MADCHOOK_DllMain and MinGW

c++ / delphi package - dll injection and api hooking
Post Reply
Tuxford
Posts: 8
Joined: Thu Sep 10, 2015 11:01 am

MADCHOOK_DllMain and MinGW

Post by Tuxford »

I see there is no record for MADCHOOK_DllMain in madCHook.def
So when I converted *.lib to .a by dlltool, this function was not in destination. As result this simple code below can't be built.

Code: Select all

BOOL WINAPI DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
{
	if (fdwReason == DLL_PROCESS_ATTACH)
	{
		CreateFileW()
		InitializeMadCHook();
	}
	
	return 0;
}
When I added it to def and got lib*.a it was built success.

So... What's solution is correct?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: MADCHOOK_DllMain and MinGW

Post by madshi »

I've never tried to build a MinGW project with madCodeHook, so it's hard for me to say how to make it work. But adding MADCHOOK_DllMain to madCHook.def sounds reasonable enough.

As a double check, what happens if you add MADCHOOK_DllMain2 instead, and change the header file accordingly? I suppose it should not work that way, right? That would confirm that what you've done seems to be alright.

Just for my peace of mind: That ".a" file is fully linked into your dll/exe files, right? You're not creating some sort of madCHook.dll, right?
Post Reply