Access Violation in MadRes

delphi package - madRes, madTools, madStrings, ...
Post Reply
mimar
Posts: 13
Joined: Sat Jul 16, 2005 2:57 pm

Access Violation in MadRes

Post by mimar »

I have the following code, which raises an access violation in the EndUpdateResourceW function. I am injecting a 500 megabyte cab file into the executable that I am updating. Please let me know if this might be a bug in MadRes, or I am doing something wrong?

Code: Select all

      hSrc := CreateFile(PChar(Temp + ExtractFileNameOnly(FileName) + '.cab'),
        GENERIC_READ, FILE_SHARE_READ, nil, OPEN_EXISTING, 0, 0);
      c := GetFileSize(hSrc, nil);
      GetMem(ptr, c);
      ReadFile(hSrc, ptr^, c, cX, nil);
      CloseHandle(hSrc);
      hSrc := BeginUpdateResourceW(PWideChar(WideString(FileName)), false);
      UpdateResourceW(hSrc, PWideChar(RT_RCDATA), 'CABINET', w, ptr, c);
      EndUpdateResourceW(hSrc, false);
      FreeMem(ptr);
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Wow, 500MB!

Can you please compile your exe with madExcept and then post the AV bug report here?

Thanks...

P.S: Please copy "madRes.pas" and "mad.inc" to your project folder and in the "mad.inc" file please change "{$D-}{$L-}" to "{$D+}{$L+}". This will make sure that the bug report contains line numbers for madRes.
mimar
Posts: 13
Joined: Sat Jul 16, 2005 2:57 pm

Post by mimar »

I actually haven't installed the MadExcept package, because I do not want custom exception handling. Is there any other way I can get you the information you need?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Well, you could debug the program and find me the line number in which it crashes. That would help.
Post Reply