Hello everybody!
After hours of penetrating Google I ended up here. I'll come straight to the point: I'm about to "refresh" my C/C++ skills and gain experience with the unmanaged world again. As a "basic" task I developed a little key logger (which are just a few lines with the Windows API) but now I want to extend it with a "stealth" feature. Therefor I threw the code into a Win32 DLL it's content you find here. As you will notice, there is a very problematic part in it:
MSG msg;
BOOL bRet;
while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
if (bRet == -1)
{
return FALSE;
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
Yes, it's an ordinary message loop - which causes trouble in my case. I inject this DLL into a "victim" executable (e.g. VLC media player) to fool AV/Application firewalls and it works so far, the injection itself passes flawlessly. Now comes the big BUT: of course the endless while-loop now freezes the whole target application (without it, my hook callback never gets executed) which wasn't really planed... After diving through half of the MSDN library and trying a lot of "solutions" Google gave me; I give up.
Is it even possible to evaluate the message loop of the "victim" process without blocking it's own business but providing my keyboard hook callback to work?
Sincerely yours, Nefarius