madRes - UpdateResourceW (AV)

delphi package - madRes, madTools, madStrings, ...

madRes - UpdateResourceW (AV)

Postby Hybris » Thu Feb 09, 2006 10:47 pm

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
       begin
        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);
       end;


but I step into an Access Violation in UpdateResourceW:

Code: Select all
 if update <> 0 then
    try
      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
Hybris
 
Posts: 3
Joined: Thu Feb 09, 2006 4:30 pm

Postby madshi » Fri Feb 10, 2006 9:53 am

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?
madshi
Site Admin
 
Posts: 9273
Joined: Sun Mar 21, 2004 5:25 pm

Postby Hybris » Fri Feb 10, 2006 7:22 pm

I already had madRes before the API names, so it doesn't help. :sorry: Anyway I solved my problem switching to Resource Utilities (http://www.wilsonc.demon.co.uk/d10resourceutils.htm).

Thank you!
Hybris
 
Posts: 3
Joined: Thu Feb 09, 2006 4:30 pm

Postby madshi » Fri Feb 10, 2006 9:46 pm

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?

Thanks!
madshi
Site Admin
 
Posts: 9273
Joined: Sun Mar 21, 2004 5:25 pm

Postby Hybris » Sun Feb 19, 2006 9:02 pm

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.
Hybris
 
Posts: 3
Joined: Thu Feb 09, 2006 4:30 pm

Postby madshi » Thu Feb 23, 2006 2:27 pm

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.
madshi
Site Admin
 
Posts: 9273
Joined: Sun Mar 21, 2004 5:25 pm


Return to madBasic

Who is online

Users browsing this forum: No registered users and 2 guests