How do i use the InjectAndExecute method to call a function with __thiscall convention.
The function should take in two parameters as well. how do I pass the this pointer?
Hello iifuzz,
In fact, InjectAndExecute methods allow you to write your own assembly code and then calling it. By design, the injected code must not receive any parameter in order to work.
Maybe you'd rather want to execute existing code in the remote process ? For that, you can use the Execute methods, those allow you to specify parameters.
Best,
ZenLulz
ZenLulz
Hello iifuzz,
In fact, InjectAndExecute methods allow you to write your own assembly code and then calling it. By design, the injected code must not receive any parameter in order to work.
Maybe you'd rather want to execute existing code in the remote process ? For that, you can use the Execute methods, those allow you to specify parameters.
Best,
ZenLulz
Thanks for the response zen.
I have switched to using Execute with _thiscall, i assumed that the ecx register should be passed as the first parameter and by following along in ollydbg the parameters and ecx appear to be passed correctly. The call to the game seems to work in some cases, but I am crashing in others even though the values passed through are correct.
I know this probably isnt the right place to ask, but I have tried everything and any help would be great!
This is the game function I am calling:
var asm = new[]
{
"mov esi, " + esi, // Probably not needed...
"mov ecx, " + slot, // arg
"push ecx",
"mov ecx, " + ecx, // Set *this
"push " + bar, // arg
"call " + address, // Call function
"retn"
};
0 members, 0 guests, 0 anonymous users