AV in EXE after creating binary resource

delphi package - madRes, madTools, madStrings, ...
Post Reply
Mego
Posts: 3
Joined: Fri Dec 11, 2009 7:30 pm

AV in EXE after creating binary resource

Post by Mego »

Hi,

After creating (with madres) an RCDATA resource (size=10K) in an EXE builded by Centura Team Developer 1.5, my EXE can't start at all.

If a resource size 256 bytes, everything is OK
If I'm creating an RCDATA resource (size=10K) manually with Restorator 2006 - everything is OK.
If I'm creating an RCDATA resource (size=10K) with madres in some EXE builded by Delphi - everything is OK also.

Is it a bug in madres or i'm doing something illegal?

Code: Select all

  rh := madres.BeginUpdateResourceW(PChar(sFileName), False);
  if rh = 0 then begin
    Win32Check(madres.UpdateResourceW(rh, RT_RCDATA, PChar(sResName), 1049 , pData, iDataSize));
    Win32Check(madres.EndUpdateResourceW(rh, False));
  end;
I can send you an EXE file if you need.
Thanks a lot!
Mego
Posts: 3
Joined: Fri Dec 11, 2009 7:30 pm

Post by Mego »

sorry for a mistake in the code:

Code: Select all

if rh <> 0 then begin .....
of course...
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

I don't know Restorator 2006, what is that?

Generally when adding a big resource, madRes has to modify the sections of the PE file structure. Usually that works just fine. But it might make problems with certain EXE files produced by certain compilers. I'd suggest that you double check this with the freeware "Resource Hacker". Is this freeware able to add your resource without making it crash?
Mego
Posts: 3
Joined: Fri Dec 11, 2009 7:30 pm

Post by Mego »

I've added a 25K resource into my EXE with ResourceHacker 3.4.0. successfully, the EXE is still working.

With madres I can add 256 bytes resources without error on EXE start.

I've also tried Colin Wislon's Resource editor, but it made my EXE only 40K long (instead of 30M). The same behaviour is when using standard WinAPI UpdateResourceW
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Well, you can compare the EXEs produced by Resource Hacker and madRes with the freeware tool "PEBrowse Pro". That will let you check the PE file sections and their properties. Maybe you can find out in what way they differ and which difference might be responsible for the crash when using madRes. Also you could load the madRes produced EXE with Resource Hacker and check whether the resources all seem to be alright.
Post Reply