Created
October 24, 2017 23:17
-
-
Save Ginden/b5c53d4770635e504305777ddde45c97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "patcher_x86.hpp" | |
Patcher* _P; | |
PatcherInstance* _PI; | |
static _bool_ plugin_On = 0; | |
int __stdcall testHook(LoHook* h, HookContext* c) | |
{ | |
c->eax *= 2; | |
return EXEC_DEFAULT; | |
} | |
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) | |
{ | |
switch ( ul_reason_for_call ) | |
{ | |
case DLL_PROCESS_ATTACH: | |
if ( !plugin_On ) | |
{ | |
plugin_On = 1; | |
_P = GetPatcher(); | |
_PI = _P->CreateInstance("HD.Plugin.TestPlugin"); | |
_PI->WriteLoHook(0x44467E, testHook); | |
} | |
case DLL_THREAD_ATTACH: | |
case DLL_THREAD_DETACH: | |
case DLL_PROCESS_DETACH: | |
break; | |
} | |
return TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment