Solved How to call game functions in C# ?

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

starswper

Newbie
Full Member
Aug 13, 2016
13
254
0
I saw an example with C++ and was working good, but I'm more confortable with C#

In C++ is something like this... in a thread :-?
C++:
typedef void (__thiscall * SendAttack_t)(void * client, unsigned int  attackmsg, unsigned int mobid, int param2, int param3, float param4);
C++:
pSendAttack((void*)idk, attackmsg, mobid, param2, param3, param4);
I didn't found game function call's models made in C# and I don't know how to convert.. but I think it's possible with create remote thread or something.
 

Teuvin

now I am become Death
Dank Tier VIP
Trump Tier Donator
Dec 8, 2016
403
10,388
65
Last edited:

wolf22j

Coder
Full Member
Nobleman
Mar 19, 2014
133
1,778
20
Not as easy with C#, if you want to do stuff like calling game functions you really should do it with C++ internally with an injected dll.

That being said, you can use CreateRemoteThreadEx, and use the function's address as lpStartAddress and lpParameter if there is a parameter. Not a very efficient way, and I'm not sure you'd be able to use multiple parameters if the function requires it. This can be negated by allocating unmanaged code into the process and then having it call the function for you, but again, you may as well just go internal with C++ & dll injection to make your life easier.
 

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
Not a very efficient way, and I'm not sure you'd be able to use multiple parameters if the function requires it.
You can, lpParameter is just a pointer to a block of memory at the end of the day.
As long as the different parameters are laid out in memory how they're supposed to be :)
 

wolf22j

Coder
Full Member
Nobleman
Mar 19, 2014
133
1,778
20
You can, lpParameter is just a pointer to a block of memory at the end of the day.
As long as the different parameters are laid out in memory how they're supposed to be :)
I was thinking in terms of the calling convention, wasn't sure if Windows always handles it correctly :p
 

Traxin

Escobar Tier VIP
Dank Tier Donator
Aug 3, 2015
1,041
25,378
154
I was thinking in terms of the calling convention, wasn't sure if Windows always handles it correctly :p
Ah, yeah.. pretty sure shit might blow up trying to call a member function with CRT lol
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods