Page 1 of 1

madRes - UpdateResourceW (AV)

PostPosted: Thu Feb 09, 2006 10:47 pm
by Hybris
I'd like to add an XP MANIFEST to some executables using MadRes:

Code: Select all
  upd := BeginUpdateResourceW(PWideChar(WideString(f)), false);
  if upd <> 0 then
        if UpdateResourceW(upd,  MAKEINTRESOURCEW(24), MAKEINTRESOURCEW(1), 0, Res.Memory, Res.Size) then
          Items[i].SubItems[0] := XP else Items[i].SubItems[0] := ERR;
        EndUpdateResource(upd, false);

but I step into an Access Violation in UpdateResourceW:

Code: Select all
 if update <> 0 then
      with TPResourceHandle(update)^ do begin
        ppr1 := FindDir(tree, type_); <--- ERROR!
        if ppr1^ <> nil then begin

Is it a fault of mine?! :-x

Thank you in advance

PostPosted: Fri Feb 10, 2006 9:53 am
by madshi
Make sure you're using the madRes APIs and not the Windows APIs. You can do so by adding a "madRes." before the API names. Does that help?

PostPosted: Fri Feb 10, 2006 7:22 pm
by Hybris
I already had madRes before the API names, so it doesn't help. :sorry: Anyway I solved my problem switching to Resource Utilities (

Thank you!

PostPosted: Fri Feb 10, 2006 9:46 pm
by madshi
I'm glad you got the problem solved with Colin's stuff. Still I'd like to find out why madRes failed for you. Would you mind sending me a little demo project which reproduces the problem? Or would you at least send me one of the exes you tried to modified together with the manifest you tried to add?


PostPosted: Sun Feb 19, 2006 9:02 pm
by Hybris
Would you mind sending me a little demo project which reproduces the problem?

I'm really sorry but I deleted my MadRes project, I kept only the working one. :sorry: Anyway I tried with a standard Manifest (it works smoothly using Colin's units) and my code is showed by the original post.

PostPosted: Thu Feb 23, 2006 2:27 pm
by madshi
Just tried to reproduce it, but I can't. It works just fine for me. The exception location very strongly indicates that the "upd" handle you gave into UpdateResourceW was not what madRes expected. I can only understand that if for whatever reason you used Windows.BeginUpdateResourceW together with madRes.UpdateResourceW.

Anyway, don't worry, just forget it. I simply wanted to put a last message into this thread in case somebody runs into a similar problem.