Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
- int __stdcall testHook2(LoHook* h, HookContext* c)
- {
- c->esi = max(1, (c->esi) >> 2);
- return EXEC_DEFAULT;
- }
- int __stdcall testHook3(LoHook* h, HookContext* c)
- {
- c->edi = max(1, (c->edi) >> 2);
- return EXEC_DEFAULT;
- }
- int __stdcall testHook4(LoHook* h, HookContext* c)
- {
- c->ebx += (c->ebx) >> 1;
- 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);
- _PI->WriteLoHook(0x4A6C88, testHook2);
- _PI->WriteLoHook(0x4A6EE8, testHook3);
- _PI->WriteLoHook(0x4A73DC, testHook4);
- }
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement