View previous topic :: View next topic |
Author |
Message |
MultiTasking How do I cheat? Reputation: 0
Joined: 09 Jan 2019 Posts: 3
|
Posted: Wed Jan 09, 2019 1:30 pm Post subject: How to get String from DWORD (Pointer+Offset) [C++] |
|
|
Good day,
I'm trying to get a String from a Pointer as pointed out in this video:
https: //ww w.youtube. com/watch?v=oC2-yjTli7g
But I have problems in getting the pointer and offset correctly:
http s://i.imgur. com/hqCB2Hx.png
Code: | DWORD Pointer2 = 0x1D8530;
DWORD Offset3 = 0x3C;
char* Text = (char*)(*(DWORD*)Pointer2 + Offset3); //1 Offset
large_img = std::string(Text); |
Can anyone help me with this?
Regards
Description: |
|
Filesize: |
36.62 KB |
Viewed: |
3899 Time(s) |
|
|
|
Back to top |
|
|
OldCheatEngineUser Whateven rank Reputation: 20
Joined: 01 Feb 2016 Posts: 1586
|
Posted: Wed Jan 09, 2019 3:45 pm Post subject: |
|
|
010D8530 is not the static address, the static address is "nro.exe"+002588D8.
where nro.exe is equal to image base address, and 002588D8 is the offset from image base to some address that holds 010D8530.
also you have a typo there:
Code: | DWORD Pointer2 = 0x1D8530 // it should be 010D8530 |
assuming image base address is equal to 00400000, then add 002588D8 to it and it should be 006588D8.
so 006588D8 holds the address 010D8530, and 010D8530+3C equal to 010D856C.
010D856C holds the string 1@infi, so you have to adjust things in order to read string properly.
also keep in-mind, if the image base is not fixed (i.e. relocatable image base) then you have to find another way to get your static address.
_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote: | i am a sweetheart. |
|
|
Back to top |
|
|
MultiTasking How do I cheat? Reputation: 0
Joined: 09 Jan 2019 Posts: 3
|
Posted: Wed Jan 09, 2019 4:37 pm Post subject: |
|
|
Quote: | also you have a typo there: |
If I put:
instead of the compiler (MSVS2017) throw me the follow error:
Code: | invalid literal suffix 'D8530'; literal operator or literal operator template 'operator ""D8530' not found |
I'm not really skillful programming but I based me in other Address that I get:
Code: | AString = "Value " + std::to_string(*reinterpret_cast<int*>(0x010D93D8)); |
Address: 010D93D8=4012
And indeed "AString" is equal to "Value: 4012"
Can you explain me this?
Why 0x010D93D8 is equal to 010D93D8?
And thank you for your reply!
|
|
Back to top |
|
|
OldCheatEngineUser Whateven rank Reputation: 20
Joined: 01 Feb 2016 Posts: 1586
|
Posted: Wed Jan 09, 2019 5:01 pm Post subject: |
|
|
MultiTasking wrote: | If I put:
instead of the compiler (MSVS2017) throw me the follow error:
Code: | invalid literal suffix 'D8530'; literal operator or literal operator template 'operator ""D8530' not found |
|
i did not say to remove the 0x? prefix, 1D8 is not the same as 10D8.
and im not sure what you are doing here, or where you got 010D93D8 from.
_________________
About Me;
I Use CE Since Version 1.X, And Still Learning How To Use It Well!
Jul 26, 2020
STN wrote: | i am a sweetheart. |
|
|
Back to top |
|
|
MultiTasking How do I cheat? Reputation: 0
Joined: 09 Jan 2019 Posts: 3
|
Posted: Wed Jan 09, 2019 6:00 pm Post subject: |
|
|
Quote: | i did not say to remove the 0x? prefix, 1D8 is not the same as 10D8. |
Oh my bad!
Quote: | and im not sure what you are doing here, or where you got 010D93D8 from. |
With 010D93D8 I wanted read the int value and pass it to string (as you can see here):
Code: | std::string AString = "Value " + std::to_string(*reinterpret_cast<int*>(0x010D93D8)); |
It worked!
And now I want to do the same with 010D856C but in this case isn't a int value, is a text (or string)
I tried doing the following:
Code: | std::string AString = "String Name " + std::to_string(*reinterpret_cast<char*>(0x010D856C)); |
Expecting a result equal to "String Name 1@infi"
But the result is "String Name 109"
|
|
Back to top |
|
|
|