Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to call function on other processes ? #15

Open
MohamedAlaaJameel opened this issue Jul 17, 2022 · 5 comments
Open

How to call function on other processes ? #15

MohamedAlaaJameel opened this issue Jul 17, 2022 · 5 comments

Comments

@MohamedAlaaJameel
Copy link

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
Copy link
Member

Sewer56 commented Jul 17, 2022

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
Copy link
Author

MohamedAlaaJameel commented Jul 19, 2022

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
Copy link
Member

Sewer56 commented Jul 19, 2022

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
Copy link
Author

MohamedAlaaJameel commented Jul 20, 2022

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
Copy link
Member

Sewer56 commented Jul 20, 2022

Sure that would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants