Reloaded-Project / Reloaded.Hooks

Advanced native function hooks for x86, x64. Welcome to the next level!
GNU Lesser General Public License v3.0
216 stars 33 forks source link

How to call function on other processes ? #15

Open MohamedAlaaJameel opened 2 years ago

MohamedAlaaJameel commented 2 years ago

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 .

Sewer56 commented 2 years ago

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

MohamedAlaaJameel commented 2 years ago

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)}
}
Sewer56 commented 2 years ago

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.

MohamedAlaaJameel commented 2 years ago

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);
Sewer56 commented 2 years ago

Sure that would work.