Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22248

DllMain() not called when injecting but called with LoadLibrary()

$
0
0

Dll Code:

#include <windows.h>BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved){    MessageBoxW(NULL, L"Hello world!", L"Test DLL", MB_OK);    return TRUE;}

LoadLibrary Code:

#include <windows.h>int main(){    LoadLibrary("dll.dll");    return 0;}

When I load the dll with the above code the message box pops up as expected.

When I instead try to inject the dll with any injector I was able to find, DllMain never gets called.

The target process and dll architecture is both x64. The target process has the required library for MessageBoxW() already loaded.If needed, this is how I compile the dll (mingw): gcc.exe main.cpp -shared -fPIC -o dll.dll

Maybe I'm unlucky with my 5 injector's I already tried, any recommendation?

What else could cause the message box to not pop up?


Viewing all articles
Browse latest Browse all 22248

Trending Articles