I may have missed a key step in injecting a DLL into a process using unmanaged C++. I have a test program that works fine with the Detours library but I'm having trouble translating it to EasyHook.
I have built a dll that has a simple hooking of the MessageBoxA call:
extern "C" __declspec(dllexport)
void __stdcall NativeInjectionEntryPoint(REMOTE_ENTRY_INFO* InRemoteInfo)
hHook= new HOOK_TRACE_INFO();
_Print("waking up the process\n");
_Print("leaving native injection entry point\n");
Real_MessageBoxA and Mine_MessageBoxA are taken from the Detours traceapi sample. My DLL links to user32.lib, in the Detours style, so that it will have the address of MessageBoxA.
And I'm calling it from a modified UnmanagedHook project. The dll loading and injection seems to be working from the point of view of NativeInjectionEntryPoint outputting all of the debugging prints. However, none of my hooked functions seem
to be called, which I've checked by looking for output in the log file, breakpoints in the debugger (attached to the target process), and popping up MessageBoxA()'s from my hook functions. The target process continues to run as if it has not been hooked.
(I've even tried returning error conditions from the hooked functions but to no effect.)
I read in the managed API that we are supposed to set ACL's and other stuff. Is this true for the Unmanaged C++ interface?
Is there a simple working example of a DLL and C++ host process? Suggestions?