title: Interfere Win32 message loop with injected DLL code (SetWindowsHookEx)
body: <p><strong>Hello everybody!</strong></p>
  
  <p>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 <a href="http://pastebin.com/jre4Mbft" rel="nofollow">it's content you find here</a>. As you will notice, there is a very problematic part in it:</p>
  
  <pre><code>  MSG msg;
   BOOL bRet;
  
   while( (bRet = GetMessage( &amp;msg, NULL, 0, 0 )) != 0)
   { 
    if (bRet == -1)
    {
     return FALSE;
    }
    else
    {
     TranslateMessage(&amp;msg); 
     DispatchMessage(&amp;msg); 
    }
   }
  </code></pre>
  
  <p>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.</p>
  
  <p><em>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?</em></p>
  
  <p>Sincerely yours,
  Nefarius</p>