I've tried to include an external compressed file into the compiled pe file as a resource; and then uncompress it and write it back to disk... but my problem is I don't know how to get the offset of the included resource data from within the code..
I solved it by using a dummy string as the data, then compiling the file and then hexediting (HIEWing actually) it and replacing all pointers to the dummy data with pointers to the resource file.
But that's not very professional, does anyone now a more convenient way to do this?? Thanx in advance..
Posted on 2001-07-31 09:41:32 by Unregistered
invoke FindResource, NULL, ADDR MyResource, RT_RCDATA
invoke LoadResouce, NULL, eax

The value returned from "LoadResource" is an HGLOBAL, but it is fixed, and is therefore the actual pointer to the memory.

I used this method when I wrote a (very) simple e-book for someone. I can send you the whole source if you want, but the two functions are all you really need.


*** Oops! I meant RT_RCDATA :o
Posted on 2001-07-31 09:52:23 by Mirno
how about LockResource? i've seen that in other programs, but i don't understand what i need it for...

Posted on 2001-08-01 07:44:04 by NOP-erator
Ok, technically you should also use LockResource too!
I didn't and it still worked... But maybe I was just lucky...

So you need to:

invoke FindResource, NULL, ADDR MyResource, RT_RCDATA
invoke LoadResource, NULL, eax
invoke LockResource, eax

;now eax is a pointer to the resource!

Posted on 2001-08-01 07:54:28 by Mirno