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 


c# read text?

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

Joined: 10 Mar 2012
Posts: 14

PostPosted: Tue Jun 05, 2012 2:13 pm    Post subject: c# read text? Reply with quote

i managed to read byte, float and byte[4] tho i cant find how to read text?
(i managed to find something in google but it only give me the 4 letters of the text :S)

can somebody help me?
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: Wed Jun 06, 2012 6:33 am    Post subject: Reply with quote

Read the memory as bytes then convert them to a string.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
mamaorha
Newbie cheater
Reputation: 0

Joined: 10 Mar 2012
Posts: 14

PostPosted: Fri Jun 08, 2012 2:16 am    Post subject: Reply with quote

well managed to figure it out but the prob is im telling him how many bytes to read (how can i know how much i need to read instead?)

IntPtr NickName = FindAddress(Base + nickPointer, nickOffset);

string nick = ReadAscii(NickName, 15);
nick = nick.Substring(0, nick.IndexOf("\0"));


public string ReadAscii(IntPtr pAddress, int pSize)
{
byte[] buffer = new byte[pSize * 2];
try
{
ReadProcessMemory(GameProcessHandle, pAddress, buffer, pSize * 2, 0);
return System.Text.Encoding.ASCII.GetString(buffer);
}
catch { return ""; }
}
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: Tue Jun 12, 2012 9:55 am    Post subject: Reply with quote

Determining the length is something you will need to look into. If the string is static, then you will know the length already. If it is dynamic, you will need to debug the application to see if there is a buffer limit that is used, or read until you find a null char '0'.
_________________
- 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 programming 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