-
Notifications
You must be signed in to change notification settings - Fork 14
2.3 Hook: Handle & Memory Patching
DK edited this page Mar 3, 2024
·
3 revisions
HookHandle
class is the result object of a succesful DKUtil::Hook
operation(except relocation hooks). HookHandle
is used to access the hook specific data and enable/disable the hook that created it.
HookHandle handle;
// hook control
handle->Enable();
handle->Disable();
DKUtil::Hook
supports a few ways of passing memory patches/data to the hook. Using example of mov rcx, qword ptr [rsp+0x20]
:
struct XbyakPatch : Xbyak::CodeGenerator
{
XbyakPatch
{
mov(rcx, rsp[0x20]);
}
};
DKUtil::Patch DKUPatch {
"\x48\x8B\x4C\x24\x20"; // data pointer
5, // size
};
std::array<std::uint8_t, 5> RawPatch{ 0x48, 0x8B, 0x4C, 0x24, 0x20 };
The DKUtil::Hook
functions are overloaded to accept above memory structure pointers.