Page 1 of 1

AV in EXE after creating binary resource

Posted: Fri Dec 11, 2009 7:46 pm
by Mego

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));
I can send you an EXE file if you need.
Thanks a lot!

Posted: Fri Dec 11, 2009 7:48 pm
by Mego
sorry for a mistake in the code:

Code: Select all

if rh <> 0 then begin .....
of course...

Posted: Mon Dec 14, 2009 8:34 am
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?

Posted: Mon Dec 14, 2009 5:07 pm
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

Posted: Mon Dec 14, 2009 5:37 pm
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.