aeree Cheater
Reputation: 3
Joined: 23 Jan 2010 Posts: 42 Location: Germany
|
Posted: Thu Oct 10, 2013 8:32 am Post subject: [SOLVED] Make a process call a function |
|
|
I'm trying to make Counter-Strike Source call the Msg() function which displays text in the console.
Is it possible for an external hack to make the game call this function?
If not are there any alternatives?
EDIT: Ok I figured it out myself. It is a dll tho..
| Code: |
#include <Windows.h>
DWORD Msg = NULL;
void MsgA(char* foo)
{
_asm{
pushad
pushfd
push foo
call Msg
pop eax
popfd
popad
}
}
DWORD WINAPI Thread(LPVOID nothing)
{
MessageBoxA(0,"Injected","Yay",0);
Msg = (DWORD)GetModuleHandle("tier0.dll") + 0x3200;
while(1)
{
if(GetAsyncKeyState('X'))
{
MsgA("test\n");
}
}
}
void Message()
{
MessageBoxA(0,"Quit game","done",0);
}
BOOL WINAPI DllMain(HINSTANCE Hinst, DWORD Reason, LPVOID Somethingelse)
{
switch(Reason)
{
case DLL_PROCESS_ATTACH:
CreateThread(0,0,Thread,0,0,0);
case DLL_PROCESS_DETACH:
Message();
}
return 1;
}
|
I got the address of the module containing the function + the offset to the function. after that i simply created MsgA using inline assembly to call the function.
It works very well
_________________
1 + 1 = |
|