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 


Convert 4bytes to text

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

Joined: 23 Nov 2009
Posts: 11

PostPosted: Fri Mar 18, 2011 9:19 am    Post subject: Convert 4bytes to text Reply with quote

Hello, i am from argentina, sorry for my bad english!
I have a question, i work with vb6...
I can use readprocessmemory perfect...
But i can't convert a 4bytes value to TEXT (string) like cheatengine.. Someone can help me please?

edit:
For example:
the 4bytes value is: "791687217" in decimal and "2F303031" in hexadecimal.
And when i put it TYPE of cheatengine "TEXT", the value in text is: "100/100"

How i convert this but in vb6?

Sorry for my english!
Thanks!
Back to top
View user's profile Send private message
Krähne
Expert Cheater
Reputation: 0

Joined: 06 Jun 2010
Posts: 108
Location: Inside of my Kernel

PostPosted: Fri Mar 18, 2011 9:46 pm    Post subject: Reply with quote

Bueno, en vista que hablas español, en ese idioma te respondo.

Para leer 4 bytes en memoria, y luego convertirlos a texto, sigue el ejemplo que te dejo en éste enlace. Ojo, el ejemplo lo realicé en Visual Basic .NET, pero creo que no te será difícil convertirlo a Visual Basic 6... De hecho te debería ser más fácil.

Bien, cuando estés usando el ejemplo, ten cuidado con el UTF8Encoding(), te cito las palabras de Wiccan:

Wiccaan wrote:
Keep in mind you may need to not write in Unicode for some processes. So be careful when using:
Code:
Dim encoding As New System.Text.UTF8Encoding()

You may need to use Ascii encoding instead.


Claro, Wiccan solo habló en ese momento acerca de modificar la memoria, pero sigue el consejo al momento de leerla. Wink

Para finalizar te dejo una prueba del ejemplo en ejecución:



Espero te sirva de algo, ¡Saludos!.

PD: El ejemplo puesto, corre con .NET Framework 3.5, Si no lo tienes instalado, aquí te dejo el código en texto plano, no sé si lo entiendas sin el GUI a mano.

_________________
Excuse me if you don't understand what I just said, but "english" isn't my native language.
Back to top
View user's profile Send private message MSN Messenger
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Sat Mar 19, 2011 4:33 am    Post subject: Reply with quote

791687217 is 4 bytes, 100/100 is 7 bytes. So you need to read more anyway.
I dont use vb6 but im sure you can adapt this. Heres two simple functions i just made using ReadProcessMemory

Code:
        public string Get_Unicode(int Address, byte Text_Length)
        {
            byte[] buffer = new byte[Text_Length];
            ReadProcessMemory(Process_Handle, Address, buffer, Text_Length, 0);
            return System.Text.Encoding.Unicode.GetString(buffer);
        }

Code:
        public string Get_ASCII(int Address, byte Text_Length)
        {
            byte[] buffer = new byte[Text_Length];
            ReadProcessMemory(Process_Handle, Address, buffer, Text_Length, 0);
            return System.Text.Encoding.ASCII.GetString(buffer);
        }

Replace Process_Handle with yours.
Say 00400000 is your address with value 791687217
Get_Unicode(0x400000, 7);//For Unicode
Get_ASCII(0x400000, 7);//For Ascii

You read the byte value then convert it to string using getstring.
I use something similar to this in my mem reader but these will only return the string from a static address. If you need to do dynamic and Dll's, alittle more is needed.
You should be fine once you convert this code though.

_________________
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: Sat Mar 19, 2011 10:55 am    Post subject: Reply with quote

Check out my old project for VB6:
http://home.comcast.net/~wiccaan/downloads/VB6_Trainer_Toolkit.zip

I don't (and haven't for a while) code in VB6 anymore though so I can't give any support if things are broken. I wrote this a while back so expect to have some issues but the main jist is there.

I also suggest you upgrade to a newer language, VB6 is outdated and unsupported. You should look into VB.NET (or C# cause it better lolol) since it's newer and supported.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
mhortiz1
How do I cheat?
Reputation: 0

Joined: 12 Nov 2015
Posts: 1

PostPosted: Thu Nov 12, 2015 4:22 am    Post subject: 4bytes to text C# Reply with quote

Sorry for resurrect this post, i have same problem , anyone can explain me , how to parse 4bytes to text?

4-Bytes = 790638903

Text = 71 / 150

Therefore , i need 4bytes this value at text in c#.
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 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