Two Step DLL Inection (How to get thread handle?)
So I want two create a 2 step DLL injection process, the first level is a very unobtrusive global DLL:
SetWindowsHookEx -> parameter 4 = 0 -> Global injection.
this dll then observes which process it attaches to:
Code:
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
if ( GetModuleHandle( _T("Process.exe") ) != NULL )
// inject 2nd dll ONLY into this thread
:
so basically after I verify that the object currently being attached is of a specific type I want to attach my 2nd hook, but only into this process. Using SetWindowsHookEx(), i need the DWORD threadID for this process, but I'm not sure how to get it from the HMODULE given in the DLLMain, any suggestions?