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++] How to change value of pointer on different app

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Negima
I post too much
Reputation: 6

Joined: 22 May 2007
Posts: 2221

PostPosted: Sat Jul 26, 2008 11:35 pm    Post subject: [C++] How to change value of pointer on different app Reply with quote

Can someone link me the APIs I must use in order to do this and attach onto a process?
Back to top
View user's profile Send private message Visit poster's website
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Sun Jul 27, 2008 12:58 am    Post subject: Reply with quote

http://msdn.microsoft.com/en-us/default.aspx

- OpenProcess
- WriteProcessMemory
- ReadProcessMemory (If needed.)
- VirtualProtectEx
- VirtualQueryEx (If needed.)
- CloseHandle

And for obtaining the process id for OpenProcess to work:

- CreateToolhelp32Snapshot
- Process32First
- Process32Next

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Tue Jul 29, 2008 12:17 pm    Post subject: Reply with quote

For a pointer, you have to read the value at the address of the base, then add the offset to that value, and read from there.

Edit: Whoops, I thought it was reading a pointer

Code:

BOOL bSetPointer( DWORD dwAddress, DWORD dwOffset, DWORD dwPtrValue )
{
  DWORD dwNewAddress = 0;
  SIZE_T nBytesRead = 0;
  //get base
  if( !ReadProcessMemory( hProcess, dwAddress, &dwNewAddress, 4, &nBytesRead ) || (nBytesRead != 4) ) return FALSE;

  //add the offset
  dwAddress += dwOffset;

  //set the pointer
  if( !WriteProcessMemory( hProcess, dwAddress, &dwPtrValue, 4, &nBytesRead ) || (nBytesRead != 4) ) return FALSE;

  return TRUE;
}

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
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