Skip to content

Instantly share code, notes, and snippets.

@Ginden
Created October 24, 2017 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ginden/b5c53d4770635e504305777ddde45c97 to your computer and use it in GitHub Desktop.
Save Ginden/b5c53d4770635e504305777ddde45c97 to your computer and use it in GitHub Desktop.
#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