Loading a DLL without LoadLibrary

Programming, for all ages and all languages.
Kensho

Re:Loading a DLL without LoadLibrary

Post 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??
Tim

Re:Loading a DLL without LoadLibrary

Post 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.
Post Reply