Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] Writing to process memory, calling a function

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
boris semashko
How do I cheat?
Reputation: 0

Joined: 28 Aug 2009
Posts: 7

PostPosted: Fri Aug 28, 2009 3:02 pm    Post subject: [C++] Writing to process memory, calling a function Reply with quote

Hello.
1. How can I write to process memory with C++ (of course I know adress) code?
In past I tried to do similiar thing with winapi, but I was able to only read process memory..

2. How can I find out a function address from running game and call it from C++ code? I already used "GetProcAddress" to get function from dll but its totally diffrent. For example I'd like to call game function that send message from external app, so I have to know how to transfer function arguments, etc... and of course how to get pointer to it.

Well, enough for start. Thanks for *any* replies.
Back to top
View user's profile Send private message
Slugsnack
Grandmaster Cheater Supreme
Reputation: 71

Joined: 24 Jan 2007
Posts: 1857

PostPosted: Fri Aug 28, 2009 3:55 pm    Post subject: Reply with quote

writeprocessmemory or if you're straight in there you can use * to dereference a pointer and write to that

for 2, if the function is not exported by the dll then you will have to do your own debugging to find out the function arguments, etc. and for address the best way is probably by AOB scanning
Back to top
View user's profile Send private message
&Vage
Grandmaster Cheater Supreme
Reputation: 0

Joined: 25 Jul 2008
Posts: 1053

PostPosted: Fri Aug 28, 2009 7:01 pm    Post subject: Reply with quote

GetProcAddress is only for exports. If you want to find out the arguments, you can breakpoint on the prologue and check the stack. Slugsnack is right, searching for bytes is the best way, if the function you want to call isn't an export.
Back to top
View user's profile Send private message
tombana
Master Cheater
Reputation: 2

Joined: 14 Jun 2007
Posts: 456
Location: The Netherlands

PostPosted: Sat Aug 29, 2009 5:13 am    Post subject: Reply with quote

And then for calling the external function: if it has zero or one arguments, you can use CreateRemoteThread. Otherwise you'll have to use WriteProcessMemory to write a little stub of code that will call the desired function for you, and then call CreateRemoteThread on that stub.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites