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 


Converting 4 Bytes Value to text

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

Joined: 16 Nov 2015
Posts: 14

PostPosted: Fri Nov 20, 2015 3:03 pm    Post subject: Converting 4 Bytes Value to text Reply with quote

I was wondering how I would go about Converting the 4 bytes value that I get using the code Below to a text value

Code:

   HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS,FALSE, procID);



   DWORD address = (DWORD)(guidll);
   DWORD offset0 = 0x00049774;
   DWORD offset1 = 0x19C;
   DWORD offset2 = 0x748;
   DWORD offset3 = 0x18;
   DWORD offset4 = 0x40C;
   DWORD offset5 = 0x23C;

   int old_value;
   DWORD oldadd;


   DWORD dll = (DWORD) (address + offset0);
   ReadProcessMemory(hProc,(void*)dll,&old_value,sizeof(old_value),0);
   oldadd = (DWORD) (old_value + offset1);
   ReadProcessMemory(hProc,(void*)oldadd,&old_value,sizeof(old_value),0);
   oldadd = (DWORD) (old_value + offset2);
   ReadProcessMemory(hProc,(void*)oldadd,&old_value,sizeof(old_value),0);
   oldadd = (DWORD) (old_value + offset3);
   ReadProcessMemory(hProc,(void*)oldadd,&old_value,sizeof(old_value),0);
   oldadd = (DWORD) (old_value + offset4);
   ReadProcessMemory(hProc,(void*)oldadd,&old_value,sizeof(old_value),0);
   oldadd = (DWORD) (old_value + offset5);
   ReadProcessMemory(hProc,(void*)oldadd,&old_value,sizeof(old_value),0);


In the case of this function, the ouput is 1919184449 which should convert to Andrewrog but I'm not too sure how to convert from the 4 bytes to text
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Nov 20, 2015 3:08 pm    Post subject: Reply with quote

1919184449 is not the right value you are looking for. You may need to read into that address to get the string but '1919184449' does not equal Andrewrog in any manner.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Murded
Newbie cheater
Reputation: 0

Joined: 16 Nov 2015
Posts: 14

PostPosted: Fri Nov 20, 2015 3:25 pm    Post subject: Reply with quote

atom0s wrote:
1919184449 is not the right value you are looking for. You may need to read into that address to get the string but '1919184449' does not equal Andrewrog in any manner.


Please take a look at this gif

gyazo. com/ 0490a423750193dc0d4e7877b2ec6848

You will need to remove the spaces
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Fri Nov 20, 2015 4:24 pm    Post subject: Reply with quote

You should simply be able to change your DWORD into a char* and read each byte as a character instead.
Back to top
View user's profile Send private message
Murded
Newbie cheater
Reputation: 0

Joined: 16 Nov 2015
Posts: 14

PostPosted: Fri Nov 20, 2015 4:55 pm    Post subject: Reply with quote

Zanzer wrote:
You should simply be able to change your DWORD into a char* and read each byte as a character instead.


I'm not quite sure if I understand what you mean? could you maybe give an example?

Edit: okay so I have added this bit of code but it doesn't make a difference.

Code:

DWORD NewADD;

ReadProcessMemory(hProc,(void*)oldadd,&NewADD,sizeof(NewADD),0);


char test[100];

sprintf_s(test, "%d", GetName(ID, AWESOMIUMEDLLBASE));

NOTE: If i use %d it prints out the byte value however if I use %s it gives an error, I assume this is because I need to somehow split it up or something?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Fri Nov 20, 2015 8:16 pm    Post subject: Reply with quote

Murded wrote:
atom0s wrote:
1919184449 is not the right value you are looking for. You may need to read into that address to get the string but '1919184449' does not equal Andrewrog in any manner.


Please take a look at this gif

gyazo. com/ 0490a423750193dc0d4e7877b2ec6848

You will need to remove the spaces


You need to read the last address as a char array then and not as a DWORD.

If you know the size limit of the array you can easily setup the last read based on that.

Code:
char name[25] = {0};
ReadProcessMemory(hProc,(void*)oldadd,&name,sizeof(name),0);


Then name will hold the data you want.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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