Sendcommandtoconsole crashes the game
i've made a dll to inject into black ops. heres what i got:
as you can see, im trying to get the dll to send an arbitrary command to the console, when i press f5. However, after injecting the dll, pressing f5 will crash the game. any ideas on how to fix this?
im not sure if this matters, but im using patch 1, SKIDROW version.
edit:
the offset is wrong, updated the offset using the signatures provided by another forum member. but its still broken
edit2:
i tried another way of sending command to console:
and i called the function like this:
still crashes
Code:
#include <windows.h>
void SendCommandToConsole(char * dCmd)
{
DWORD dwCall = 0x0044de80;//address for sendcommandtoconsole function
__asm
{
PUSH dCmd;
PUSH 0;
PUSH 0;
CALL dwCall;
ADD ESP, 0x0C;
}
}
DWORD WINAPI LoopFunction(LPVOID lpvoid) {
while (true) {
if (GetAsyncKeyState(VK_F5) & 1) {
SendCommandToConsole("test command?");
}
}
Sleep(100);
return 0;
}
BOOL WINAPI DllMain(HMODULE hmodule, DWORD reason, LPVOID lpvoid) {
if (reason == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hmodule);
CreateThread(0, 0, LoopFunction, 0, 0, 0);
}
return TRUE;
}
im not sure if this matters, but im using patch 1, SKIDROW version.
edit:
the offset is wrong, updated the offset using the signatures provided by another forum member. but its still broken

edit2:
i tried another way of sending command to console:
Code:
void (*CG_SendConsoleCommand)(int a1,int a2,char *cvar) = (void (__cdecl *)(int,int,char *))0x5F01A0;//current offset
Code:
CG_SendConsoleCommand(0,0,"test command");


