Page 2 of 2

Re:Loading a DLL without LoadLibrary

Posted: Mon Apr 19, 2004 9:52 am
by Kensho
I never said the return type was the problem... I mentioned two things: The memory alignment, and the imports table, but not the return type... Now I have another theory, the memory protection... my guess, i'm trying to access a part of a memory that I haven't allocated correctly... it exists, but it should be alocated somewhere else that where it stands... Maybe VirtualAlloc isn't the solution... You said you have ported the code into win32... How did you allocate the memory??

Re:Loading a DLL without LoadLibrary

Posted: Mon Apr 19, 2004 1:38 pm
by Tim
I used VirtualAlloc. Specify full read/write access in the initial call, write what you need to into the memory, then call VirtualProtect to apply the appropriate protection required by the section attributes.

You could even install your own page fault handler using structured exception handling, with a __try/__except wrapper around main.