[C++]Metin2 How to Hook Game Function(Basic)

08/27/2013 20:41 LoveCpp#1
Here is a video :


Source :

Code:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include <detours.h>

// int sub_56E1B0(const char*)

typedef int(*tHook)(const char*) ;
tHook oHook; // our original function

int hHook(const char* a)
{
	return oHook("Hooked when original function called!");
}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		oHook = (tHook) DetourFunction((PBYTE) 0x0056E1B0, (PBYTE) hHook);
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
That offset for revision 26070 , you have to update it.
Its basic dont write silly comments.
08/27/2013 23:52 Metin2 Team#2
Thanks man :) you rock !! :)
08/28/2013 00:41 [The]Domco#3
Yea nice :-) but some more explanation for some functions will be good :P
08/28/2013 00:47 LoveCpp#4
which function that you wanna explanation?
08/28/2013 09:05 Mi4uric3#5
This is basic C++ and has nothing to do with Metin2.
#moverequest
08/28/2013 14:33 LoveCpp#6
i dont think metin2 developers dont hang out with c++ section and its about metin2 lol
08/28/2013 15:15 Mi4uric3#7
Quote:
Originally Posted by LoveCpp View Post
i dont think metin2 developers dont hang out with c++ section
Well that doesn't make your threads correct in the metin2-section.
Quote:
Originally Posted by LoveCpp View Post
and its about metin2 lol
No it's not. All your tutorials are like "how to call a function in memory", "how to hook a function in memory". This is not metin2-specific.