Im通过它们的函数偏移钩住外部进程中的函数。行之有效的功能IM挂钩迄今为止 - 但我已经找到了“DEBUGLOG(字符...)”功能,仍然存在于二进制,但没有做任何印刷 - 它看起来像这样Detours在外部进程中钩住“空”功能不起作用
debugMessage proc near ;
xor eax, eax ; Logical Exclusive OR
retn ; Return Near from Procedure
debugMessage endp
它被称为像这样
push offset debugString ; "This is a debug message"...
call debugMessage ; Call Procedure
现在调试消息显然已经被禁用,我想挂接到这个,因为我是能够简单地钩到类似的FUNC(炭..)二进制了。
这是代码:
typedef void (__stdcall* DebugLog)(const char*);
DebugLog Real_DebugLog = (DebugLog)(0xCAFEBABE);
extern "C"
{
static void __stdcall Hook_DebugLog(const char*);
}
void __stdcall Hook_DebugLog(const char* text) {
MessageBox(NULL, text, "MyDebugLog", MB_OK);
return Real_DebugLog(text);
}
// in dll main attach..
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)Real_DebugLog, (PVOID)Hook_DebugLog);
类似的方法适用于所有其他功能我至今钩到这个二进制文件。我也确保debugMessage甚至可以用调试器调用。
任何想法,为什么这个钩子根本不工作?也许是因为函数可能有var参数?我已经尝试过使用const char *,...)。
谢谢 - 有没有另一种解决方案? – Steve
只有另一种方式是绕行所有的通话站点 – paulm