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 


how to get the hexadecimal value

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

Joined: 30 Dec 2015
Posts: 11

PostPosted: Sat May 21, 2016 9:25 am    Post subject: how to get the hexadecimal value Reply with quote

Hello,

I want to know how to get the hex value?
here is my code to get a decimal value:
Code:
Public Function ReadInteger(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Integer
        Dim hProcess As IntPtr = OpenProcess(&H1F0FF, 0, p(0).Id)
        If hProcess = IntPtr.Zero Then
            MessageBox.Show("Impossible d'ouvrir " & ProcessName & "!")
            Return False
        End If
        Dim hAddress, vBuffer As Integer
        hAddress = Address
        ReadProcessMemory1(hProcess, hAddress, vBuffer, nsize, 4)
        CloseHandle(hProcess)
        Return vBuffer
    End Function


Can you help me how to get a hexadecimal value relative offset?
Thank you for your reply,



decimal.jpg
 Description:
my projet
 Filesize:  64.09 KB
 Viewed:  14865 Time(s)

decimal.jpg


Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Sat May 21, 2016 12:55 pm    Post subject: Reply with quote

https://www.google.com/#q=visual+basic+decimal+to+hex
Back to top
View user's profile Send private message
thedebutent
Newbie cheater
Reputation: 0

Joined: 30 Dec 2015
Posts: 11

PostPosted: Sat May 21, 2016 2:23 pm    Post subject: Reply with quote

Good evening,

I found the solution to my problem .
my code :
Code:
Public Function ReadHex(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Integer
        Dim hProcess As IntPtr = OpenProcess(&H1F0FF, 0, p(0).Id)
        If hProcess = IntPtr.Zero Then
            MessageBox.Show("Impossible d'ouvrir " & ProcessName & "!")
            Return False
        End If
        Dim hAddress, vBuffer As Integer
        hAddress = Address
        ReadProcessMemory1(hProcess, hAddress, vBuffer, nsize, 0)
        CloseHandle(hProcess)
        Return conversion.hex(vBuffer)
    End Function



teste.jpg
 Description:
 Filesize:  10.43 KB
 Viewed:  14826 Time(s)

teste.jpg


Back to top
View user's profile Send private message
thedebutent
Newbie cheater
Reputation: 0

Joined: 30 Dec 2015
Posts: 11

PostPosted: Sun May 22, 2016 7:06 am    Post subject: Reply with quote

hello,

reading problem compared to hexadecimal:
my code change :
Code:
Private Function ReadHex(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As String
        Dim hProcess As IntPtr = OpenProcess(&H1F0FF, 0, p(0).Id)
        If hProcess = IntPtr.Zero Then
            MessageBox.Show("Impossible d'ouvrir " & ProcessName & "!")
            Return False
        End If
        Dim hAddress, vBuffer As Integer
        hAddress = Address
        ReadProcessMemory1(hProcess, hAddress, vBuffer, nsize, 0)
        CloseHandle(hProcess)
        Dim hexChar As String = Conversion.Hex(vBuffer)
        Dim Hex As String = Strings.StrReverse(hexChar)
        Return Hex
    End Function

how do you get the same hexadecimal value in the blue square?



1.jpg
 Description:
the hexadecimal value I want in the blue square
 Filesize:  110.69 KB
 Viewed:  14722 Time(s)

1.jpg



hex.jpg
 Description:
hexadecimal reading
 Filesize:  2.65 KB
 Viewed:  14722 Time(s)

hex.jpg


Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4709

PostPosted: Sun May 22, 2016 9:37 am    Post subject: Reply with quote

Any number that takes up multiple bytes is usually stored with the bytes in reverse order such that the least significant byte is stored first. Look up "little-endian" for more information.

A couple examples:
Code:
     dec          hex         AoB
1,999,388,785 = 772C4071 = 71 40 2C 77
   19,658,094 = 012BF56E = 6E F5 2B 01

_________________
I don't know where I'm going, but I'll figure it out when I get there.
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