Click to See Complete Forum and Search --> : dll injection


dave2k
June 7th, 2006, 03:34 AM
i have a dll i want to inject into another process. it conatains a function which overides an api function

i was wondering what the nijection code should look like? something like HMODULE hinstDLL = LoadLibrary((LPCTSTR)"dll.dll");
HOOKPROC hkprcSysMsg = (HOOKPROC)GetProcAddress(hinstDLL, "CallWndProc");


// Set the hook
DWORD ThreadIdCntrl = GetWindowThreadProcessId(windowHandle, 0);
::SetWindowsHookEx(WH_CALLWNDPROC, hkprcSysMsg, hinstDLL, ThreadIdCntrl);?

Krishnaa
June 8th, 2006, 07:07 AM
Syntactically correct, but I am not sure if should work to inject the dll into another process.

Does that work ?

Viorel
June 8th, 2006, 07:27 AM
Actually, instead of (LPCTSTR)"dll.dll" you should use _T("dll.dll"). Otherwise it will not work in Unicode mode.