Hello. I'm trying to hook function pfnMessageBegin with
chooker by Arkshine:
PHP Code:
void MessageBegin(int msg_dest, int msg_type, const float *pOrigin, edict_t *ed) {
printf(__FUNCTION__"\n");
if (g_messageBeginHook->Restore()) {
g_messageBeginOriginalHandle(msg_dest, msg_type, pOrigin, ed);
g_messageBeginHook->Patch();
}
}
bool hook_func(void) {
#ifdef WIN32
g_messageBeginOriginalHandle = g_hooker->MemorySearch<Func_MessageBegin>((char *)&g_engfuncs.pfnMessageBegin, (void *)gpGlobals, FALSE);
#else
void *sym_ptr = (void *)&g_engfuncs.pfnMessageBegin;
while (*(unsigned short *)sym_ptr == 0x25ff) {
sym_ptr = **(void ***)((char *)sym_ptr + 2);
}
g_messageBeginOriginalHandle = (Func_MessageBegin)sym_ptr;
#endif
g_messageBeginHook = g_hooker->CreateHook(g_messageBeginOriginalHandle, (void *)MessageBegin, TRUE);
return g_messageBeginHook ? true : false;
}
But the handler is not called, but the hook is happening. What am I doing wrong?