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 


String Address moves due to reallocation

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
LostForever
Cheater
Reputation: 0

Joined: 06 Oct 2006
Posts: 46

PostPosted: Tue Jun 27, 2017 8:17 am    Post subject: String Address moves due to reallocation Reply with quote

Title pretty much says it all, I'm trying to find a dynamic string. This isn't a game but an application that I'd like to stop filling out every single time I start it.

It has an input box for your username and various other fields.

1. I find the String using a text scan, pretty simple stuff no problem.
2. I find a pointer to the value using a pointer scan.
3. I restart and change the value pointed to by the saved pointer, it works!
4. Unfortunately however when the string exceeds 23 characters (as mine does) the string is reallocated elsewhere meaning that my pointer doesn't work for my username. The side-effect of this is that my username is not actually entered correctly (I simply tell the C++ application to enter the keys).

i.e. I attempt to type TheUsernameIWantToEnterIsThis but it only gets as far as TheUsernameIwantToEnte (I assume it's 22 characters and the null terminator)

The pointer is then no longer valid, changing it does nothing but doing a new scan finds a new address that writes to a larger empty block of memory (which I confirmed in the memory browser, I want to say it's ~40 or 50). This pattern repeats all the way up to 80 characters.

Any advice would be hugely appreciated, I know this is the Gamehacking section but I figure it's still the most accurate place for it, if I'm wrong I'm happy to repost it or have it moved.

Thanks in advance.

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 199

Joined: 25 Jan 2006
Posts: 8518
Location: 127.0.0.1

PostPosted: Tue Jun 27, 2017 1:25 pm    Post subject: Reply with quote

Based on how you described this, it sounds like a string type similar to C++'s std::string. By default, the first chunk of characters are stored in a small char[] array. After that array hits its max size used, it instead converts the string to an allocated buffer (ie. char*) and resizes as needed as the string grows.

For this type of string, if it is the case for your application, the pointer is usually stored near the char[] array. Find the first small string of the user name like you have before then open it in the memory view of Cheat Engine. Start filling in the name more until the point it changes the address and see if there is a value near the old buffer that is then used to handle the new strings pointer.

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

Joined: 06 Oct 2006
Posts: 46

PostPosted: Tue Jun 27, 2017 7:44 pm    Post subject: Reply with quote

That was incredibly insightful I didn't realize that's how std::string worked, I'll give it a shot as soon as I finish work.

Thanks for the help I hope it pays off.

_________________
Back to top
View user's profile Send private message
LostForever
Cheater
Reputation: 0

Joined: 06 Oct 2006
Posts: 46

PostPosted: Sat Jul 01, 2017 9:22 am    Post subject: Reply with quote

Just a quick update: I haven't forgotten about this but the application has a lot of anti-debug features I'm currently trying to contend with.
_________________
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 Gamehacking 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