I want to hook a game function and inject my code in it's cave code, but when I try to send the value of my variables with the addresses I want to jump and return, it mess it up.
Example:
DWORD returnAddress = 0x12345678; //the static address in game that I have to return after my function
_declspec(naked) void asmfunc()
{
__asm
{
...
jmp returnAddress //I already tried [returnAddress] with same result
}
}
As you know, it sends the address of returnAddress
in my process to the jmp instruction that will be converted in the target process address whose value has, obviously, nothing to do with mine. I want to do a jmp to the game address 0x12345678 but if I do jmp 0x12345678
the compiler accuses syntax error.
Of course it works fine with dll injection, but I want to do it with simple code injection. Is there a way to achieve it?