injecting a DLL
injecting a DLL
when you inject a dll and dllmain gets called, how does your full dll code get executed? where does dllmain return to?
Re: injecting a DLL
Dllmain is just for initialization and such. The rest of the library can be called into by the application.
What does this have to do with osdev?
What does this have to do with osdev?
Re: injecting a DLL
You load up a DLL with LoadLibrary which loads it into your process' address space and calls DllMain and then returns to the code which called LoadLibrary. To actually call functions in the DLL, you need to get their addresses with GetProcAddress and call the returned function pointer.
Calling FreeLibrary will also call DllMain, before unloading the DLL, but this time will pass a different value as the fdwReason parameter to DllMain (for a list of these, see here).
Regards,
John.
Calling FreeLibrary will also call DllMain, before unloading the DLL, but this time will pass a different value as the fdwReason parameter to DllMain (for a list of these, see here).
Regards,
John.