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 


Help VB.Net pointer Read

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

Joined: 24 Apr 2012
Posts: 11

PostPosted: Sat May 19, 2012 12:05 am    Post subject: Help VB.Net pointer Read Reply with quote

my read pointer module is
Code:
Public Function PointerRead(ByVal MemoryAddress As IntPtr, ByVal bytesToRead As UInteger, ByVal Offset As Integer(), ByRef bytesRead As Integer) As Byte()
            Dim iPointerCount As Integer = Offset.Length - 1
            Dim ptrBytesRead As IntPtr
            bytesRead = 0
            Dim buffer As Byte() = New Byte(3) {}
            'DWORD to hold an Address
            Dim tempAddress As Integer = 0

            If iPointerCount = 0 Then


                ReadProcessMemory(m_hProcess, MemoryAddress, buffer, 4, ptrBytesRead)
                tempAddress = ToDec(Make(buffer)) + Offset(0)
                'Final Address
                buffer = New Byte(bytesToRead - 1) {}
                ReadProcessMemory(m_hProcess, CType(tempAddress, IntPtr), buffer, bytesToRead, ptrBytesRead)

                bytesRead = ptrBytesRead.ToInt32()

                'MessageBox.Show(bytesRead.ToString());



                Return buffer
            End If

            For i As Integer = 0 To iPointerCount
                If i = iPointerCount Then
                    ReadProcessMemory(m_hProcess, CType(tempAddress, IntPtr), buffer, 4, ptrBytesRead)
                    tempAddress = ToDec(Make(buffer)) + Offset(i)
                    'Final Address
                    buffer = New Byte(bytesToRead - 1) {}
                    ReadProcessMemory(m_hProcess, CType(tempAddress, IntPtr), buffer, bytesToRead, ptrBytesRead)

                    bytesRead = ptrBytesRead.ToInt32()
                    Return buffer
                ElseIf i = 0 Then
                    ReadProcessMemory(m_hProcess, MemoryAddress, buffer, 4, ptrBytesRead)
                    tempAddress = ToDec(Make(buffer)) + Offset(1)
                Else
                    ReadProcessMemory(m_hProcess, CType(tempAddress, IntPtr), buffer, 4, ptrBytesRead)
                    tempAddress = ToDec(Make(buffer)) + Offset(i)
                End If
            Next

            Return buffer
        End Function


if i write like this
Code:
Label1.Text = myMemory.PointerRead(CType(HexToDec("2239EFD"), IntPtr), 4, {&H328F4, &H6EDC0}, bytesRead).ToString


my label1.text = System.Byte[]

thats are my value is unkown??
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Sat May 19, 2012 3:41 am    Post subject: Reply with quote

Thats because your function returns a byte array.
Use BitConverter to convert the array to an integer.
Code:
Dim _Array As Byte() = myMemory.PointerRead(CType(HexToDec("2239EFD"), IntPtr), 4, {&H328F4, &H6EDC0}, bytesRead)
Label1.Text = BitConverter.ToInt32(_Array, 0).ToString("X")

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

Joined: 24 Apr 2012
Posts: 11

PostPosted: Sat May 19, 2012 7:29 pm    Post subject: Reply with quote

if i use this

Code:
Dim _Array As Byte() = myMemory.PointerRead(CType(HexToDec("2239EFD"), IntPtr), 4, {&H328F4, &H6EDC0}, bytesRead)
Label1.Text = BitConverter.ToInt32(_Array, 0).ToString("X")


my label1.text still 0
thats not read pointer Sad
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Sun May 20, 2012 3:04 am    Post subject: Reply with quote

Your pointer function is wrong if it returns the wrong address, keep trying.
Iv looked at your code, i cant really understand it.

_________________
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