View Full Version : Question regarding pointers
Hello.
So I thought I had retrieved the account and password successfully, after I was told it will be stored as a pointer if it exceeds x letters. I tried this out and it showed to be true.
Base + 0x553A68 is the address for password. This is true when password is less than 16 characters (I have in mind), although when it isn't I would need a pointer to "Base + 0x553A68". The problem is that I don't know how to use the pointers in C#... I'd greatly appreciate any help received!
Blood
10-17-2013, 04:03 PM
Your problem is with memory reading or pointer reading ?
Because to read a pointer just do it:
String strValue = ReadString( ReadInt( POINTER ) + OFFSET_IF_EXIST);
It worked, thanks.
As stated, this pointer is null if the acc length is actually not over 16. So this was my solution:
string pass = ReadString(Tibia.Handle, ReadInt32(Tibia.Handle, base_address + password));
if (pass.Length == 0)
{
pass = ReadString(Tibia.Handle, base_address + password);
}
Does it make sense that you'd need such an approach or am I missing something? Should you really need to check both a pointer and normal address?
ottizy
10-17-2013, 04:53 PM
It's stored as a std::string. If the length of the string exceeds 16 characters it will be stored in a different location in the memory, giving you a pointer instead.
The way to determine if it has been stored in a different location is to read the length value of the string which is located +0x14 bytes from the main pointer.
string pass = "";
if (ReadInt32(Tibia.Handle, base_address + password + 0x14) <= 15)
{
pass = ReadString(Tibia.Handle, base_address + password);
}
else
{
pass = ReadString(ReadInt32(Tibia.Handle, base_address + password));
}
XtrmJash
10-17-2013, 05:15 PM
I've gotta ask, of all the values you could've read, why did you choose password and account name first?
I am working on something requiring it. Also it was the easiest of those values that I need. I also need character name and the character list. I have retrieved character name only through client title, so I guess I'm fine. But list still no success :(
@ottizy Yeah that worked, are you sure this is a safe replacement of my code though?
ottizy
10-17-2013, 05:48 PM
I am working on something requiring it. Also it was the easiest of those values that I need. I also need character name and the character list. I have retrieved character name only through client title, so I guess I'm fine. But list still no success :(
@ottizy Yeah that worked, are you sure this is a safe replacement of my code though?
Quite sure yes
Alright, thanks. I'll rely on it :) I don't need this approach on account name though right? I mean account can't exceed 16 chars?
ottizy
10-17-2013, 06:19 PM
Yes you will need this approach. I tested just to make sure and made a account with a 31 character account name :p
Alright thanks a bunch for your effort! :D
if (ReadInt32(Tibia.Handle, base_address + password + 0x14) <= 15)
What replacement should it be for account? 0x? <= ?
Farsa
10-18-2013, 11:44 AM
same thing
Should this approach of checking for pointers:
if (ReadInt32(Handle, Address + 0x14) <= 15)
Be used at all times? Can I do it when looping through Character List, to know if it's a pointer value?
Farsa
10-18-2013, 12:14 PM
yes, each string in the character list is a std::string that uses the so called "short string optimization" http://stackoverflow.com/questions/1466073/how-is-stdstring-implemented
ottizy
10-18-2013, 03:21 PM
Some of the strings that can be found are declared as const char* I believe ( = You don't have to use the std::string approach). Like names in battlelist.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.