Learn to code and stop copying and pasting please.
Guys, i need your help. I have no idea whats wrong, but its not working! HELP)
Cheat engine tutorial step 8. A base adress is 002903B0, offsets C, 14, 0, 18.
Code:Imports System.Runtime.InteropServices Public Class form1 'API ReadProcessMemory <DllImport("kernel32.dll", SetLastError:=True)> _ Private Shared Function ReadProcessMemory( _ ByVal hProcess As IntPtr, _ ByVal lpBaseAddress As IntPtr, _ <Out()> ByVal lpBuffer() As Byte, _ ByVal dwSize As Integer, _ ByRef lpNumberOfBytesRead As Integer) As Boolean End Function Private Function FindAddress(ByVal pHandle As IntPtr, ByVal BaseAddress As IntPtr, ByVal StaticPointer As IntPtr, ByVal Offsets() As IntPtr) As IntPtr ' Create a buffer that is 4 bytes on a 32-bit system or 8 bytes on a 64-bit system. Dim tmp(IntPtr.Size - 1) As Byte Dim Address As IntPtr = BaseAddress ' We must check for 32-bit vs 64-bit. If IntPtr.Size = 4 Then Address = New IntPtr(Address.ToInt32 + StaticPointer.ToInt32) Else Address = New IntPtr(Address.ToInt64 + StaticPointer.ToInt64) End If ' Loop through each offset to find the address For i As Integer = 0 To Offsets.Length - 1 ReadProcessMemory(pHandle, Address, tmp, IntPtr.Size, 0) If IntPtr.Size = 4 Then Address = BitConverter.ToInt32(tmp, 0) + Offsets(i).ToInt32() Else Address = BitConverter.ToInt64(tmp, 0) + Offsets(i).ToInt64() End If Next Return Address End Function Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim p As Process() = Process.GetProcessesByName("Tutorial-i386") ' I'm assuming p is a Process object that represents the game process. Dim pID As IntPtr = p(0).Handle Dim base As IntPtr = p(0).MainModule.BaseAddress ' Our static pointer... Dim sptr As IntPtr = &H2903B0 ' And our offsets... Dim offsets() As IntPtr = {&HC, &H14, &H0, &H18} Dim addr As IntPtr = FindAddress(pID, base, sptr, offsets) Dim f As String f = addr.ToString MessageBox.Show(f) End Sub End Class
Last edited by lock5126; 02-24-2013 at 08:06 AM.
Learn to code and stop copying and pasting please.
Waiting for a meaningful help.
Last edited by lock5126; 02-24-2013 at 09:06 AM.
Set the break-points, and tell us the outputs. If you want the addresses displayed in hex (which you probably do) , calling .ToString("X") on a number, will turn it into a string, in hex format.Code:For i As Integer = 0 To Offsets.Length - 1 ReadProcessMemory(pHandle, Address, tmp, IntPtr.Size, 0) If IntPtr.Size = 4 Then Address = BitConverter.ToInt32(tmp, 0) + Offsets(i).ToInt32() '' BREAK-POINT ON THIS LINE Else Address = BitConverter.ToInt64(tmp, 0) + Offsets(i).ToInt64() '' BREAK-POINT ON THIS LINE End If Next
---
Or, is it just
?Code:Dim f As String f = addr.ToString("X") '' display the number as hex MessageBox.Show(f) 'replace with MessageBox.Show(addr.ToString("X")) and get rid of 'f' : un-needed.
Last edited by abuckau907; 02-24-2013 at 10:23 AM.
'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
--
lock5126 (02-24-2013)
Thank you so much dude!
Is this it?
Last edited by lock5126; 02-24-2013 at 10:50 AM.
np. This might help (just added some msg boxes) - 1 msgbox*
-upload a screenshot to some public site, and show the results here by doing.. (not mpgh 'Attachment') : )Code:Private Function FindAddress(ByVal pHandle As IntPtr, ByVal BaseAddress As IntPtr, ByVal StaticPointer As IntPtr, ByVal Offsets() As IntPtr) As IntPtr ' Create a buffer that is 4 bytes on a 32-bit system or 8 bytes on a 64-bit system. Dim tmp(IntPtr.Size - 1) As Byte Dim _ListOfAllAddressAsHexString As New System.Text.StringBuilder '' AB -used for debugging output _ListOfAllAddressAsHexString.AppendLine("procHandle: " & pHandle.ToString) _ListOfAllAddressAsHexString.AppendLine("MainModuleBase: &H" & BaseAddress.ToString("X")) _ListOfAllAddressAsHexString.AppendLine("StaticOffset: &H" & StaticPointer.ToString("X")) Dim Address As IntPtr = BaseAddress If IntPtr.Size = 4 Then ' We must check for 32-bit vs 64-bit. Address = New IntPtr(Address.ToInt32 + StaticPointer.ToInt32) Else Address = New IntPtr(Address.ToInt64 + StaticPointer.ToInt64) End If _ListOfAllAddressAsHexString.AppendLine("MainModuleBase + staticOffset: &H" & Address.ToString("X")) _ListOfAllAddressAsHexString.AppendLine("---------------------------") ' Loop through each offset to find the address For i As Integer = 0 To Offsets.Length - 1 ReadProcessMemory(pHandle, Address, tmp, IntPtr.Size, 0) If IntPtr.Size = 4 Then Address = BitConverter.ToInt32(tmp, 0) + Offsets(i).ToInt32() Else Address = BitConverter.ToInt64(tmp, 0) + Offsets(i).ToInt64() End If _ListOfAllAddressAsHexString.AppendLine("ptr#" & i & ": &H" & Address.ToString("X")) Next ''display the msg box containing all the addr MessageBox.Show(_ListOfAllAddressAsHexString.ToArray,"debugging list -ab") Return Address End Function
[ img ] www.somesitedotcom/ your_image [ /img ] - (without spaces)
Last edited by abuckau907; 02-24-2013 at 11:01 AM. Reason: [b]
'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
--
lock5126 (02-24-2013)
MessageBox.Show(_ListOfAllAddressAsHexString.ToArr ay, "debugging list -ab"), when "ToArray" must be "ToString".
Thank you, worked! )
haha yeah I was thinking List(Of string) I guess : ) cooleo.
So there is no bug: You only needed to display the number in hex, issue resolved?
Last edited by abuckau907; 02-24-2013 at 11:13 AM.
'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
--
idk what the final addr should be
"So there is no bug: You only needed to display the number in hex, issue resolved?"
'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
--
Hope I will find a solution.
Shall immediately begin to learn English xD
..Can cancer get cancer?
'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
--