Metin2 Hook Socket Send Function Err

05/08/2014 23:55 TheTompa#1
Ich brauche die Hilfe dieser Codes funktionieren nicht :(


Code:
#include "stdafx.h"
#include <stdio.h>
#include <Winsock2.h>
#include <windows.h>
 
#include <iostream>
#include <fstream>
#include <string>
 
#pragma comment(lib,"detours.lib")
#include "detours.h"
#pragma comment(lib, "ws2_32.lib")



static int(WINAPI *orig_send)(SOCKET s,const char*buf,int len,int flags)=send;



int WINAPI my_send(SOCKET s,const char*buf,int len,int flags)
{
        printf("Paket gesendet..\n");
        return orig_send(s, buf,len, flags);
}
 
int WINAPI konsol()
{
	AllocConsole();
	AttachConsole(GetCurrentProcessId());
	freopen("con","w",stdout);
	return 0;
}




BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
				MessageBoxA(0,"Haken Injected",0,0);
				konsol();
				DetourTransactionBegin();
                DetourUpdateThread(GetCurrentThread());
                DetourAttach(&(PVOID&)orig_send, my_send);
                DetourTransactionCommit();

	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
05/09/2014 00:07 Mi4uric3#2
1. Was funktioniert nicht?
2. Was hat das mit Metin2 zu tun?
3. Mit Copy&Paste kommst du nicht weit. Lern Programmieren.

#Moverequest -> Coders Den -> C++
05/09/2014 15:12 OsamaFlow#3
Gehört nicht in den Metin2 Main Bereich.

#report

PS: falls das was mit p servern zu tun hat, dann schreibs da rein.