-
Notifications
You must be signed in to change notification settings - Fork 12
Description
I havent worked with hooks for a while, I remember doing it with microsoft detours library.
It was super simple because you just called it like hook(theirfunc, myfunc);
I am having trouble understanding what is nextInstructionOffset. Where am I supposed to be finding this information from? Inside IDA inside the actual function or at the place where the function is called?
I dont want to accidently overwrite any code and what if the function changes later? then I would have to keep rechecking these bytes in IDA every time?
I looked at the usage of this lib in GW2 as reference, I am having trouble understanding why hook(hl::CpuContext *ctx) is better than a standard hook like detours lib?
Also this:
void __fastcall hkGameThread(uintptr_t pInst, int, int frame_time)
{
auto pCore = g_initObj.getMain();
static auto orgFunc = ((void(__thiscall*)(uintptr_t, int))pCore->m_hkAlertCtx->getLocation());
orgFunc(pInst, frame_time);
}
Why is the params have an extra int and the orgfunc does not? I remember doing something similar for a different calling declaration but not sure if it was __fastcall or __thiscall, sorry been so long since I messed around with it.
Would really appreciate an explanation, love the lib btw, the pattern scanning stuff is super good. It would be cool to be able to search for a function that has two string refs within it, because sometimes the function list in ida returns too many references and it would be cool to narrow it down to a single function easily.