 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Astaroth4256 Advanced Cheater
Reputation: 0
Joined: 25 May 2014 Posts: 59
|
Posted: Tue Aug 02, 2016 1:01 pm Post subject: ReadProcessMemory and strings |
|
|
A while ago I found this issue with string pointers, the one where short strings change their location if they expand to more than 15 characters; I solved it by checking if the string is valid and if not then adding the 0 pointer to the pointer path, but unfortunately I can't have my application run flawlessly for long with this simple solution. A clear example about the pointers:
string pointer: 0, 55, 8C, 200
If the string becomes longer than 15 characters:
string pointer: 0, 55, 8C, 200, 0
Now the issue is that sometimes if the string I'm looking for becomes longer then the 0, 55, 8C, 200 will still be "valid" though it becomes a random bunch of characters, for example "item name 99" turns into "dghs" and the code reads "dghs" instead of going one pointer deeper.
Is there any solution for this that will work in the long run?
|
|
| Back to top |
|
 |
Astaroth4256 Advanced Cheater
Reputation: 0
Joined: 25 May 2014 Posts: 59
|
Posted: Wed Aug 03, 2016 8:12 am Post subject: |
|
|
| Could really use an anwser, had the application stuck for two hours after it ran fine for 4, it tried to interact with something that didn't exist because the name pointer wasn't read correctly.
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4708
|
Posted: Wed Aug 03, 2016 9:32 am Post subject: |
|
|
You could get it more consistent if you always try to dereference it, but it won't be perfect.
Look around that memory region and see if you can find something that determines string length (could be a boolean indicating if it's larger than 15 characters). If that fails, look at how the game is accessing the address of that string. The game must have some way of determining if it's larger than 15 characters; if you find it, you can copy it.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
Astaroth4256 Advanced Cheater
Reputation: 0
Joined: 25 May 2014 Posts: 59
|
Posted: Sun Oct 23, 2016 8:07 am Post subject: |
|
|
| Still nothing, I tried looking around the string address but there's nothing that says if it's longer than 15 or not. "show what accesses this address" shows an instruction "move if greater or equal" and that's all I got. Still can't read the strings perfectly, the address which is supposed to be the string sometimes turns into a pointer which points to the string.
|
|
| Back to top |
|
 |
H4x0rBattie Advanced Cheater
Reputation: 0
Joined: 10 Nov 2016 Posts: 58
|
Posted: Wed Nov 23, 2016 3:28 am Post subject: |
|
|
| Astaroth4256 wrote: | | Still nothing, I tried looking around the string address but there's nothing that says if it's longer than 15 or not. "show what accesses this address" shows an instruction "move if greater or equal" and that's all I got. Still can't read the strings perfectly, the address which is supposed to be the string sometimes turns into a pointer which points to the string. |
It depends are you reading a raw string from an arbitrary location or from a location that is known to have a valid string.
Methods are totally different between the two. I know because I wrote a string scanner
_________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Nov 23, 2016 12:54 pm Post subject: Re: ReadProcessMemory and strings |
|
|
| Astaroth4256 wrote: | A while ago I found this issue with string pointers, the one where short strings change their location if they expand to more than 15 characters; I solved it by checking if the string is valid and if not then adding the 0 pointer to the pointer path, but unfortunately I can't have my application run flawlessly for long with this simple solution. A clear example about the pointers:
string pointer: 0, 55, 8C, 200
If the string becomes longer than 15 characters:
string pointer: 0, 55, 8C, 200, 0
Now the issue is that sometimes if the string I'm looking for becomes longer then the 0, 55, 8C, 200 will still be "valid" though it becomes a random bunch of characters, for example "item name 99" turns into "dghs" and the code reads "dghs" instead of going one pointer deeper.
Is there any solution for this that will work in the long run? |
Judging by how this sounds, this sounds like you are dealing with an 'std::string' object or something implemented in a similar manner.
std::string has two forms of string containment based on the size of the string. If the size is under 16 chars, it will be stored in a static buffer. Otherwise when it is larger, memory will be allocated and used instead. Other languages implement things similar but most notiable for this is std::string within C++.
If it is a std::string object, you should be able to find two more variables near the buffer that hold the allocated size / length of the string to determine if the pointer is being used or if the static buffer is being used.
_________________
- Retired. |
|
| Back to top |
|
 |
|
|
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
|
|