Ok, thanks for your version of the Detours library, with that one I could build the DLL.
However, injection/hooking does not work properly, yet.
This is basically what my loader looks like:
Code:
// Get debug privilege
EnableDebugPrivilege();
// Create process
result = CreateProcess(NULL, &ExePathAndCmdLineVec[0], NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, &WorkingDirVec[0], &si, &pi);
if(!result)
{
return -1;
}
// Inject DLL
bInjectLibrary(pi.hThread, DllPath.c_str());
// Resume process execution
ResumeThread(pi.hThread);
Are you sure this kind of injection works for .NET applications?
I attached a sample executable... It is not the target, but it works just like the target. I couldn't manage to manipulate the "ProcessorId"-Entry using your DLL...