Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: External Exception C0000006


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 5 - Last Post: Jan 28, 2016 12:47 AM Last Post By: Gijsbert Huijsen
Nico Callewaert

Posts: 22
Registered: 5/9/02
External Exception C0000006  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 11, 2016 1:33 AM
Hi,

After switching our project from Delphi 7 to Delphi XE5, some users encounter the following error : "External Exception C0000006". The exception appears at random times, most of the times not immediatly but after working a while/little while with the application. The application hangs and needs to be terminated with the task manager. After a restart, the user can work for some time again. Of course highly frustrating. After googling a bit, I found this link that explains the problem :

http://devzone.advantagedatabase.com/dz/Content.aspx?Key=17&RefNo=101230-2385

Long story short : the operating system is unable to load the next portion of the exe file. The SetPEFlags directive forces to load the entire exe at once in memory.

So I included the SetPEFlags line like this, in the project file, after the uses :

.........
DefectCodeData in 'DefectCodeData.pas' {dmDefectCode: TDataModule},
RepairCode in 'RepairCode.pas' {frmRepairCode},
RepairCodeData in 'RepairCodeData.pas' {dmRepairCode: TDataModule};

{$R *.TLB}

{$R *.RES}
{$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP}

begin
Application.Tag := 0;

Application.Initialize;
..........

Problem not fixed.

The exe is located on a networkshare. But that was exactly the same under D7, without problems. Nothing changed. I noticed that users who run the application in a Citrix environment also encountered the same problem. But again, this configuration was also used with D7.

The exe is large, 71 MB. I found another link on the internet that adviced to UPX the exe. After UPX, the exe is 22 MB, but the problem remains.

So, I'm getting at my wits end and I don't have any idea how to fix this.

Any help is highly appreciated.
Many thanks in advance,

Nico

Edited by: Nico Callewaert on Jan 11, 2016 1:35 AM
Roy Lambert

Posts: 1,063
Registered: 8/7/01
Re: External Exception C0000006 [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 11, 2016 4:25 AM   in response to: Nico Callewaert in response to: Nico Callewaert
Nico

I think that the way UPX works the whole program is loaded into memory and isn't amenable to Windows memory management. If that's still the case then it should prevent the error you're seeing.

Are there any dlls involved in your application?

Roy Lambert

Nico Callewaert

Posts: 22
Registered: 5/9/02
Re: External Exception C0000006 [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 11, 2016 6:39 AM   in response to: Roy Lambert in response to: Roy Lambert
Roy Lambert wrote:
Nico

I think that the way UPX works the whole program is loaded into memory and isn't amenable to Windows memory management. If that's still the case then it should prevent the error you're seeing.

Are there any dlls involved in your application?

Roy Lambert


Hi Roy,

Yes, that's what I understood from UPX: Exe is loaded as a whole in memory. Other users don't report this problem. Just the ones who are using citrix or VPN.
No dll's involved.

Thanks for the reply Roy,

regards
Roy Lambert

Posts: 1,063
Registered: 8/7/01
Re: External Exception C0000006 [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 11, 2016 11:14 PM   in response to: Nico Callewaert in response to: Nico Callewaert
Nico

Do you have something like MadExcept or EurekaLog built in?

Roy Lambert

Nico Callewaert

Posts: 2
Registered: 1/16/16
Re: External Exception C0000006 [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 19, 2016 1:40 AM   in response to: Roy Lambert in response to: Roy Lambert
Roy Lambert wrote:
Nico

Do you have something like MadExcept or EurekaLog built in?

Roy Lambert


Hi Roy,

Sorry for the late reply, I don't visit this forum daily. I don't have such a thing built in, but after a long search, I discoverd that this directive helped :

{$DEFINE IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = $8000}
{$SetPEOptFlags IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE}

Just wanted to share it, in case other users might encounter the same problem.

Thanks for your help and have a nice day.
Nico
Gijsbert Huijsen

Posts: 1
Registered: 12/3/08
Re: External Exception C0000006 [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 28, 2016 12:47 AM   in response to: Nico Callewaert in response to: Nico Callewaert
Hi Roy,

Sorry for the late reply, I don't visit this forum daily. I don't have such a thing built in, but after a long search, I discoverd that this directive helped :

{$DEFINE IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = $8000}
{$SetPEOptFlags IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE}

Just wanted to share it, in case other users might encounter the same problem.

Thanks for your help and have a nice day.
Nico

Hi Nico,

You mention the flag $8000, but you probably mean the following flag from Windows.pas:

IMAGE_FILE_NET_RUN_FROM_SWAP = $0800; { If Image is on Net, copy and run from the swap file. }

Kind regards,

Gijsbert
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02