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 


help me pls pointer.

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

Joined: 11 Mar 2018
Posts: 1

PostPosted: Sun Mar 11, 2018 5:00 pm    Post subject: help me pls pointer. Reply with quote

hi bro.
Code:

  game = Process.GetProcessesByName("popcapgame1")[0];
  hProcress = OpenProcess(0x1F0FF, false, game.Id);
   byte[] buffer = new byte[sizeof(int)];
            int read;
            ReadProcessMemory(hProcress, (uint)game.Modules[0].BaseAddress+ 0x763B0+0x284+0x5578, buffer, buffer.Length, out read);




what worng ?
Help me Crying or Very sad



sssss.png
 Description:
 Filesize:  8.28 KB
 Viewed:  3106 Time(s)

sssss.png


Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sun Mar 11, 2018 7:14 pm    Post subject: Reply with quote

(uint)game.Modules[0].BaseAddress+ 0x763B0+0x284+0x5578

You don't just add the offsets together for pointers, otherwise you could just have one offset.

You have to read first read the base address (and offset if it has one) as an address, then read the next offset as an address, ..., and then read the last offset as the type you want (4 bytes in this case)

so assuming this is an x86/32 bit game addresses are 4 bytes (x64 is 8 bytes) you'd have something like, I mostly know C/C++ so this will likely be slightly wrong but close enough for you to figure out if you know the language you're writing in

Code:
void* address = game.Modules[0].BaseAddress
int offsets = [0x763B0, 0x284, 0x5578] // if base address had no offset make sure to insert a 0 at the start.
int offsetCount = 3;
int read;
// read all but the last offset and dereference as pointer/address
for (int i =0; i < offsetCount-1; i++) {
  ReadProcessMemory(hProcress, address+offsets[i], address, sizeof(address), out read);
  if read != sizeof(address) ERROR;
}
// get final address
address += offsets[offsetCount-1];
// could have a "readPointerPath" utility function that does the above

// read final value
int value;
ReadProcessMemory(hProcress, address, value, sizeof(value), out read);
if read != sizeof(value) ERROR;

_________________
https://github.com/FreeER/ has a few CE related repos
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