The capture function Im in the external process through their shift in function. This works well for the functions that I have hooked so far - however, I found the function debugLog (char ...) ", which still exists in binary but does not print at all - it looks like this
debugMessage proc near ; xor eax, eax ; Logical Exclusive OR retn ; Return Near from Procedure debugMessage endp
he is called like that
push offset debugString ; "This is a debug message"... call debugMessage ; Call Procedure
Now the debug message was obviously disabled, I wanted to connect to it, because I was able to just connect to a similar function (char ..) in an existing binary format.
This is the code:
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); }
A similar approach works for all other functions that are still connected to this binary. I also made sure that debugMessage is even called using the debugger.
Any ideas why this hook doesn't work at all? Maybe because a function can have var args? I already tried with const char *, ...).
Steve source share