[MetaHook] Event Hook

 #include <metahook.h>

 struct event_hook_t
{
event_hook_t *next;
char *name;
void (*pfnEvent)(event_args_s *args);
}; #define HOOKEVENT_SIG "\x8D\x44\x24\x08\x56\x8D\x4C\x24\x08\x50\x51\xFF\x15\x2A\x2A\x2A\x2A\x8B\x44\x24\x10\x83\xC4\x08\x85\xC0\x74\x2A\x80\x38\x00" event_hook_t *g_pEventHooks = NULL; void EV_Init(void)
{
DWORD base = (DWORD)g_pMetaHookAPI->SearchPattern((void *)g_dwEngineBase, g_dwEngineSize, HOOKEVENT_SIG, sizeof(HOOKEVENT_SIG) - ); if (base)
{
g_pEventHooks = (event_hook_t *)(*(DWORD *)(base + 0x72));
}
} event_hook_t *EV_FindHook(const char *name)
{
if (!g_pEventHooks)
{
return NULL;
} event_hook_t *ev = g_pEventHooks; while (ev)
{
if (ev->name && !stricmp(name, ev->name))
{
return ev;
} ev = ev->next;
} return NULL;
}
上一篇:jquery的ajax提交form表单方式总结


下一篇:Perl 随机数和随机密码的产生