<?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[Hilfe bei winsock hook]]></title><description><![CDATA[<p>Hi,<br />
ich möchte die Pakete eines Programms empfangen und modifizieren können. Das möchte ich machen, indem ich recv und send hooke.<br />
Ich habe mir schon Tutorials durchgelesen, komme allerdings nicht weiter. Kann man einen winsock hook mit der Funktion SetWindowsHookEx() machen? Wenn ja wie?</p>
<p>Danke schonmal im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/230779/hilfe-bei-winsock-hook</link><generator>RSS for Node</generator><lastBuildDate>Thu, 09 Apr 2026 22:00:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/230779.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 01 Jan 2009 22:17:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hilfe bei winsock hook on Thu, 01 Jan 2009 22:17:25 GMT]]></title><description><![CDATA[<p>Hi,<br />
ich möchte die Pakete eines Programms empfangen und modifizieren können. Das möchte ich machen, indem ich recv und send hooke.<br />
Ich habe mir schon Tutorials durchgelesen, komme allerdings nicht weiter. Kann man einen winsock hook mit der Funktion SetWindowsHookEx() machen? Wenn ja wie?</p>
<p>Danke schonmal im voraus!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638154</guid><dc:creator><![CDATA[terra]]></dc:creator><pubDate>Thu, 01 Jan 2009 22:17:25 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei winsock hook on Fri, 02 Jan 2009 00:00:19 GMT]]></title><description><![CDATA[<p>wie hast du es denn versucht und wo kommst du nicht weiter?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638176</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638176</guid><dc:creator><![CDATA[RamboZamboTanztTango]]></dc:creator><pubDate>Fri, 02 Jan 2009 00:00:19 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei winsock hook on Fri, 02 Jan 2009 11:17:01 GMT]]></title><description><![CDATA[<p>Ich habe mich zunächst an diesem Tutorial orientiert:<br />
<a href="http://elearning.tutorials.de/flashpaper/c_c++/c-Mouse-Systemhook.swf" rel="nofollow">http://elearning.tutorials.de/flashpaper/c_c++/c-Mouse-Systemhook.swf</a><br />
Meine Probleme treten dann darin auf, dass ich nicht weiß welche Parameter ich der SetWindosHookEx()-Funktion übergeben muss, in der msdn habe ich schon nach geschaut aber nichts gefunden, was etwas mit winsock zu tun hat.</p>
<pre><code class="language-cpp">DLLIMPORT BOOL InstallHook() 
{ 
if(g_hMouseHook != NULL) 
return TRUE; 
g_hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseProc, g_hInst, 0); 
if(g_hMouseHook == NULL) 
return FALSE; 
return TRUE; 
}
</code></pre>
<p>In diesem Fall wird für einen Mouse Hook &quot;WH_MOUSE&quot; übergeben, was muss ich bei einem Winsock Hook übergeben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638284</guid><dc:creator><![CDATA[terra]]></dc:creator><pubDate>Fri, 02 Jan 2009 11:17:01 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei winsock hook on Fri, 02 Jan 2009 11:37:44 GMT]]></title><description><![CDATA[<p>das ist ein anderer hook und hat nix mit function hooking zu tun. such ma nach detours.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638293</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638293</guid><dc:creator><![CDATA[RamboZamboTanztTango]]></dc:creator><pubDate>Fri, 02 Jan 2009 11:37:44 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei winsock hook on Fri, 02 Jan 2009 16:05:38 GMT]]></title><description><![CDATA[<p>Ok, ich habe mir jetz detours einmal angeschaut. Allerdings habe ich Probleme beim kompilieren. Ich bekomme Fehler in der detours.h:</p>
<pre><code>In file included from detours.cpp:18:
detours.h: In function `LONG InterlockedCompareExchange(LONG*, LONG, LONG)':
detours.h:369: error: `LONG InterlockedCompareExchange(LONG*, LONG, LONG)' was declared `extern' and later `static'
C:/Cpp/Dev-Cpp/include/winbase.h:1603: error: previous declaration of `LONG InterlockedCompareExchange(long int*, LONG, LONG)'
detours.h: In function `LONG InterlockedCompareExchange(LONG*, LONG, LONG)':
detours.h:370: error: cannot convert `void**' to `LONG*' for argument `1' to `LONG InterlockedCompareExchange(LONG*, LONG, LONG)'
</code></pre>
<p>Das ist nur ein kleiner Teil der Errors, alle zu posten wäre zu viel.</p>
<p>Auf <a href="http://codeproject.com" rel="nofollow">codeproject.com</a> habe ich einen Artikel gefunden und daraus diesen Quellcode entnommen:</p>
<pre><code class="language-cpp">#include &quot;dll.h&quot;
#include &lt;windows.h&gt;
#include &quot;detours.h&quot;

int (WINAPI *pSend)(SOCKET s, const char* buf, int len, int flags) = send;
int WINAPI MySend(SOCKET s, const char* buf, int len, int flags);
int (WINAPI *pRecv)(SOCKET s, char* buf, int len, int flags) = recv;
int WINAPI MyRecv(SOCKET s, char* buf, int len, int flags);

INT APIENTRY DllMain(HMODULE hDLL, DWORD Reason, LPVOID Reserved)
{
    switch(Reason)
    {
        case DLL_PROCESS_ATTACH:
            DisableThreadLibraryCalls(hDLL);
            DetourTransactionBegin();
            DetourUpdateThread(GetCurrentThread());
            DetourAttach((PVOID*)pSend, (void*)MySend);
            if(DetourTransactionCommit() == NO_ERROR)
                OutputDebugString(&quot;send() detoured successfully&quot;);
            DetourTransactionBegin();
            DetourUpdateThread(GetCurrentThread());
            DetourAttach((PVOID*)pRecv, (void*)MyRecv);
            if(DetourTransactionCommit() == NO_ERROR)
                OutputDebugString(&quot;recv() detoured successfully&quot;);
            break;
    };
}

int WINAPI MySend(SOCKET s, const char* buf, int len, int flags)
{

    return pSend(s, buf, len, flags);
}

int WINAPI MyRecv(SOCKET s, char* buf, int len, int flags)
{

    return pRecv(s, buf, len, flags);
}
</code></pre>
<p>Ich benutze wxDev-Cpp!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638428</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638428</guid><dc:creator><![CDATA[terra]]></dc:creator><pubDate>Fri, 02 Jan 2009 16:05:38 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei winsock hook on Sat, 03 Jan 2009 12:25:58 GMT]]></title><description><![CDATA[<p>Es ist nicht unwahrscheinlich, daß Detours sich nicht ohne größere Schwierigkeiten mit dem GCC übersetzen läßt. Schon <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-217656.html" rel="nofollow">für den BCC</a> waren einige Änderungen notwendig, und für den GCC dürfte es eher schlimmer werden.</p>
<p>Der einfachste Weg wäre, MSVC oder BCC zu benutzen; beide sind kostenlos erhältlich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638740</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638740</guid><dc:creator><![CDATA[audacia]]></dc:creator><pubDate>Sat, 03 Jan 2009 12:25:58 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei winsock hook on Sat, 03 Jan 2009 13:12:46 GMT]]></title><description><![CDATA[<p>audacia schrieb:</p>
<blockquote>
<p>Es ist nicht unwahrscheinlich, daß Detours sich nicht ohne größere Schwierigkeiten mit dem GCC übersetzen läßt. Schon <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-217656.html" rel="nofollow">für den BCC</a> waren einige Änderungen notwendig, und für den GCC dürfte es eher schlimmer werden.</p>
<p>Der einfachste Weg wäre, MSVC oder BCC zu benutzen; beide sind kostenlos erhältlich.</p>
</blockquote>
<p>Gut, das habe ich mir schon gedacht, habe mir MSVC runtergeladen und werde es installieren. Man kann bei wxDev-Cpp den MSVC als compiler auswählen, mal schauen ob es dann funktioniert.<br />
Danke für die Hilfe!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1638766</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638766</guid><dc:creator><![CDATA[terra]]></dc:creator><pubDate>Sat, 03 Jan 2009 13:12:46 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe bei winsock hook on Sat, 03 Jan 2009 15:49:38 GMT]]></title><description><![CDATA[<p>Ich habe jetz soweit alles hingekreigt.<br />
Ich bekomme allerdings bei dem oben genannten Quellcode Kompilierungsfehler:</p>
<pre><code>Kompilieren...
dllmain.cpp
Verknüpfen...
detours.lib(detoured.obj) : error LNK2005: _DllMain@12 ist bereits in dllmain.obj definiert.
C:\Dokumente und Einstellungen\Tim\Eigene Dateien\Visual Studio 2008\Projects\WinsockHookDLL7\Debug\WinsockHookDLL7.dll : fatal error LNK1169: Mindestens ein mehrfach definiertes Symbol gefunden.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1638853</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1638853</guid><dc:creator><![CDATA[terra]]></dc:creator><pubDate>Sat, 03 Jan 2009 15:49:38 GMT</pubDate></item></channel></rss>