Sorry to keep plaguing you with this, but....
Here's my source for hooking the function. All this is supposed to do is intercept the function, do nothing, and return the original function.
Code:
#include "stdafx.h"
#include "HookTest3.h"
#include <windows.h>
#include "detours.h";
#pragma comment(lib, "detours.lib")
//The original function prototype for this was:
//static qboolean SV_ClientCommand( client_t *cl, msg_t *msg )
int (__stdcall* SV_ClientCommand)(void *cl, void *msg);
static int MySV_ClientCommand( void *cl, void *msg )
{
return SV_ClientCommand(cl, msg); //Call the
original function
}
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
SV_ClientCommand = (int (__stdcall*)(void*, void*))DetourFunction((PBYTE)0x0abcdef, (PBYTE)MySV_ClientCommand);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
DetourRemove((PBYTE)0x0abcdef, (PBYTE)SV_ClientCommand);
break;
}
return TRUE;
}
When I inject this DLL, and the function is called, I get this:
I'm assuming I have the function definition for the function wrong, but I'm not sure what it should be.