HelpDLL Not Attaching?

Posts 1–3 of 3 · Page 1 of 1
DLL Not Attaching?
Hello, so I'm just making a really basic function to produce a popup when the DLL attaches. The problem is DllMain never seems to run.
My code:
Code:
#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
#include <Psapi.h>
#include <d3d9.h>

BOOL _stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved){
	DisableThreadLibraryCalls(hinstDLL);
	MessageBox(NULL, "Go for it", "", MB_OK);
	return false;
}
I just want the popup to appear so the process is "paused" and then I can attach OllyDBG.

Any help or clarification about the issue would be appreciated. Thanks.
Code:
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
            DisableThreadLibraryCalls(hModule);
            MessageBox(NULL, "Go for it", "", MB_OK);
            break;
        }
	return TRUE;
}
you need to wait for the process to call DLL_PROCESS_ATTATCH, and you also need to return TRUE, or 1 otherwise it wont work
Thanks. I ended up switching it over to:
Code:
int __stdcall DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
{
	DisableThreadLibraryCalls(hinstDLL);
    switch( dwReason )
    {
		case 1:
			MessageBox(NULL, "Get to dbgin", "stopped!",  MB_OK);
        break;
    }
    return 1;
}
and using a different injector. That seemed to do the trick.
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us