Reloaded.Hooks icon indicating copy to clipboard operation
Reloaded.Hooks copied to clipboard

How to call function on other processes ?

Open MohamedAlaaJameel opened this issue 2 years ago • 5 comments

I have read the link But I dont understand how to target c++ x64 Game Process ? to execute functions or to add hooks... I've been using the Memorysharp for a long time but no support for x64 process ... for example :

sharp = new sharp(gameProcess);
sharp.execute(func,params);

I need any simple example for something like that if possible .

MohamedAlaaJameel avatar Jul 17 '22 08:07 MohamedAlaaJameel

Inject your .NET code into the target process:

or if you wanna roll your own code, this provides DLL Exports, combine with DLL Injector:

or if you want to get your hands dirty, you can load the runtime yourself in a C/C++ program and then your code from there

Sewer56 avatar Jul 17 '22 13:07 Sewer56

thank you for your answer but I don't want to inject anything to the target process , all I want to execute functions on the target process from c# winform program for 64 bit .

OnBtnClick()//this is pseudo code for 32 bit 
{
process =open(game.exe);
sharp=new memorysharp(process);
int sendAddress=0x1222541a
sharp.execute(sendAddress,thisptr, len,packet)}
}

MohamedAlaaJameel avatar Jul 19 '22 01:07 MohamedAlaaJameel

Normally this sort of use case would fall under Reloaded.Injector, specifically this function but I'd need to add an overload for calling functions by arbitrary address.

I'll probably add one next time I do maintenance.
Until then, steal the CallRemoteFunction method, allocate and write the parameter in external memory yourself using Reloaded.Memory or preferred method.

Sewer56 avatar Jul 19 '22 15:07 Sewer56

Thanks for your quick reply I got it , I will also wait for your release . to ensure that I understand :

//pseudo code : 
alloc(mem);
wirte(mem,param1.Data)//assume 12 bytes
write(mem+param1.size,param2.Data);

string[] mnemonics = new[]
{
    "mov rcx,{param1.address}",
    "mov rdx,{param2.address}",
    "mov r8,{param3.address}",
   "call {SendData.address}"
};
byte[] shellCode= asm.Assemble(mnemonics);
alloc(funcMemory)
write(funcMemory,shellCode);
var result = CallRemoteFunction (handle,funcMemory,null);

MohamedAlaaJameel avatar Jul 20 '22 07:07 MohamedAlaaJameel

Sure that would work.

Sewer56 avatar Jul 20 '22 11:07 Sewer56