Doubts about Pointer + Offset / Handle :(
I have a doubt that I have not found the solution I seek.
seen several tutorials Read / WriteProcessMemory
and I could not find a way to use a pointer that way.
[QUOTE] P4Bytes (&H782A794, &H1A, 8415) [/ QUOTE]
Module
another module
Does not work too;/
It did not work;/
My Pointer:
[QUOTE] "main.exe" +0782 A794 [/ QUOTE]
offset:
[QUOTE] 1A [/ QUOTE]
value:
[QUOTE] 8415 [/ QUOTE]
If anyone can help me with this I thank you.
I have a basic knowledge of VB
And Sorry for my English, I speak Portuguese! "

seen several tutorials Read / WriteProcessMemory
and I could not find a way to use a pointer that way.
[QUOTE] P4Bytes (&H782A794, &H1A, 8415) [/ QUOTE]
Module
Spoiler
Module ReadWritingMemory
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private Declare Function WriteProcessMemory1 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function WriteProcessMemory2 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Single
Private Declare Function WriteProcessMemory3 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Long
Private Declare Function ReadProcessMemory1 Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function ReadProcessMemory2 Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Single
Private Declare Function ReadProcessMemory3 Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Long
Const PROCESS_ALL_ACCESS = &H1F0FF
Public Function WriteDMAInteger(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Integer, ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Boolean
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadInteger(Process, lvl, nsize) + Offsets(i - 1)
Next
WriteInteger(Process, lvl, Value, nsize)
Return True
Catch ex As Exception
Return False
End Try
End Function
Public Function ReadDMAInteger(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Integer
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadInteger(Process, lvl, nsize) + Offsets(i - 1)
Next
Dim vBuffer As Integer
vBuffer = ReadInteger(Process, lvl, nsize)
Return vBuffer
Catch ex As Exception
End Try
End Function
Public Function WriteDMAFloat(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Single, ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Boolean
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadFloat(Process, lvl, nsize) + Offsets(i - 1)
Next
WriteFloat(Process, lvl, Value, nsize)
Return True
Catch ex As Exception
Return False
End Try
End Function
Public Function ReadDMAFloat(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Single
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadFloat(Process, lvl, nsize) + Offsets(i - 1)
Next
Dim vBuffer As Single
vBuffer = ReadFloat(Process, lvl, nsize)
Return vBuffer
Catch ex As Exception
End Try
End Function
Public Function WriteDMALong(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Long, ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Boolean
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadLong(Process, lvl, nsize) + Offsets(i - 1)
Next
WriteLong(Process, lvl, Value, nsize)
Return True
Catch ex As Exception
Return False
End Try
End Function
Public Function ReadDMALong(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Long
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadLong(Process, lvl, nsize) + Offsets(i - 1)
Next
Dim vBuffer As Long
vBuffer = ReadLong(Process, lvl, nsize)
Return vBuffer
Catch ex As Exception
End Try
End Function
Public Sub WriteNOPs(ByVal ProcessName As String, ByVal Address As Long, ByVal NOPNum As Integer)
Dim C As Integer
Dim B As Integer
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
B = 0
For C = 1 To NOPNum
Call WriteProcessMemory1(hProcess, Address + B, &H90, 1, 0&)
B = B + 1
Next C
End Sub
Public Sub WriteXBytes(ByVal ProcessName As String, ByVal Address As Long, ByVal Value As String)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
Dim C As Integer
Dim B As Integer
Dim D As Integer
Dim V As Byte
B = 0
D = 1
For C = 1 To Math****und((Len(Value) / 2))
V = Val("&H" & Mid$(Value, D, 2))
Call WriteProcessMemory1(hProcess, Address + B, V, 1, 0&)
B = B + 1
D = D + 2
Next C
End Sub
Public Sub WriteInteger(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Integer, Optional ByVal nsize As Integer = 4)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
Dim hAddress, vBuffer As Integer
hAddress = Address
vBuffer = Value
WriteProcessMemory1(hProcess, hAddress, CInt(vBuffer), nsize, 0)
End Sub
Public Sub WriteFloat(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Single, Optional ByVal nsize As Integer = 4)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
Dim hAddress As Integer
Dim vBuffer As Single
hAddress = Address
vBuffer = Value
WriteProcessMemory2(hProcess, hAddress, vBuffer, nsize, 0)
End Sub
Public Sub WriteLong(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Long, Optional ByVal nsize As Integer = 4)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
Dim hAddress As Integer
Dim vBuffer As Long
hAddress = Address
vBuffer = Value
WriteProcessMemory3(hProcess, hAddress, vBuffer, nsize, 0)
End Sub
Public Function ReadInteger(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Integer
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Function
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Function
End If
Dim hAddress, vBuffer As Integer
hAddress = Address
ReadProcessMemory1(hProcess, hAddress, vBuffer, nsize, 0)
Return vBuffer
End Function
Public Function ReadFloat(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Single
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Function
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Function
End If
Dim hAddress As Integer
Dim vBuffer As Single
hAddress = Address
ReadProcessMemory2(hProcess, hAddress, vBuffer, nsize, 0)
Return vBuffer
End Function
Public Function ReadLong(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Long
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Function
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Function
End If
Dim hAddress As Integer
Dim vBuffer As Long
hAddress = Address
ReadProcessMemory3(hProcess, hAddress, vBuffer, nsize, 0)
Return vBuffer
End Function
End Module
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private Declare Function WriteProcessMemory1 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function WriteProcessMemory2 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Single
Private Declare Function WriteProcessMemory3 Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Long
Private Declare Function ReadProcessMemory1 Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function ReadProcessMemory2 Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Single
Private Declare Function ReadProcessMemory3 Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Long
Const PROCESS_ALL_ACCESS = &H1F0FF
Public Function WriteDMAInteger(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Integer, ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Boolean
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadInteger(Process, lvl, nsize) + Offsets(i - 1)
Next
WriteInteger(Process, lvl, Value, nsize)
Return True
Catch ex As Exception
Return False
End Try
End Function
Public Function ReadDMAInteger(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Integer
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadInteger(Process, lvl, nsize) + Offsets(i - 1)
Next
Dim vBuffer As Integer
vBuffer = ReadInteger(Process, lvl, nsize)
Return vBuffer
Catch ex As Exception
End Try
End Function
Public Function WriteDMAFloat(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Single, ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Boolean
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadFloat(Process, lvl, nsize) + Offsets(i - 1)
Next
WriteFloat(Process, lvl, Value, nsize)
Return True
Catch ex As Exception
Return False
End Try
End Function
Public Function ReadDMAFloat(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Single
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadFloat(Process, lvl, nsize) + Offsets(i - 1)
Next
Dim vBuffer As Single
vBuffer = ReadFloat(Process, lvl, nsize)
Return vBuffer
Catch ex As Exception
End Try
End Function
Public Function WriteDMALong(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Value As Long, ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Boolean
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadLong(Process, lvl, nsize) + Offsets(i - 1)
Next
WriteLong(Process, lvl, Value, nsize)
Return True
Catch ex As Exception
Return False
End Try
End Function
Public Function ReadDMALong(ByVal Process As String, ByVal Address As Integer, ByVal Offsets As Integer(), ByVal Level As Integer, Optional ByVal nsize As Integer = 4) As Long
Try
Dim lvl As Integer = Address
For i As Integer = 1 To Level
lvl = ReadLong(Process, lvl, nsize) + Offsets(i - 1)
Next
Dim vBuffer As Long
vBuffer = ReadLong(Process, lvl, nsize)
Return vBuffer
Catch ex As Exception
End Try
End Function
Public Sub WriteNOPs(ByVal ProcessName As String, ByVal Address As Long, ByVal NOPNum As Integer)
Dim C As Integer
Dim B As Integer
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
B = 0
For C = 1 To NOPNum
Call WriteProcessMemory1(hProcess, Address + B, &H90, 1, 0&)
B = B + 1
Next C
End Sub
Public Sub WriteXBytes(ByVal ProcessName As String, ByVal Address As Long, ByVal Value As String)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
Dim C As Integer
Dim B As Integer
Dim D As Integer
Dim V As Byte
B = 0
D = 1
For C = 1 To Math****und((Len(Value) / 2))
V = Val("&H" & Mid$(Value, D, 2))
Call WriteProcessMemory1(hProcess, Address + B, V, 1, 0&)
B = B + 1
D = D + 2
Next C
End Sub
Public Sub WriteInteger(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Integer, Optional ByVal nsize As Integer = 4)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
Dim hAddress, vBuffer As Integer
hAddress = Address
vBuffer = Value
WriteProcessMemory1(hProcess, hAddress, CInt(vBuffer), nsize, 0)
End Sub
Public Sub WriteFloat(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Single, Optional ByVal nsize As Integer = 4)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
Dim hAddress As Integer
Dim vBuffer As Single
hAddress = Address
vBuffer = Value
WriteProcessMemory2(hProcess, hAddress, vBuffer, nsize, 0)
End Sub
Public Sub WriteLong(ByVal ProcessName As String, ByVal Address As Integer, ByVal Value As Long, Optional ByVal nsize As Integer = 4)
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Sub
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Sub
End If
Dim hAddress As Integer
Dim vBuffer As Long
hAddress = Address
vBuffer = Value
WriteProcessMemory3(hProcess, hAddress, vBuffer, nsize, 0)
End Sub
Public Function ReadInteger(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Integer
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Function
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Function
End If
Dim hAddress, vBuffer As Integer
hAddress = Address
ReadProcessMemory1(hProcess, hAddress, vBuffer, nsize, 0)
Return vBuffer
End Function
Public Function ReadFloat(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Single
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Function
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Function
End If
Dim hAddress As Integer
Dim vBuffer As Single
hAddress = Address
ReadProcessMemory2(hProcess, hAddress, vBuffer, nsize, 0)
Return vBuffer
End Function
Public Function ReadLong(ByVal ProcessName As String, ByVal Address As Integer, Optional ByVal nsize As Integer = 4) As Long
If ProcessName.EndsWith(".exe") Then
ProcessName = ProcessName.Replace(".exe", "")
End If
Dim MyP As Process() = Process.GetProcessesByName(ProcessName)
If MyP.Length = 0 Then
MessageBox.Show(ProcessName & " isn't open!")
Exit Function
End If
Dim hProcess As IntPtr = OpenProcess(PROCESS_ALL_ACCESS, 0, MyP(0).Id)
If hProcess = IntPtr.Zero Then
MessageBox.Show("Failed to open " & ProcessName & "!")
Exit Function
End If
Dim hAddress As Integer
Dim vBuffer As Long
hAddress = Address
ReadProcessMemory3(hProcess, hAddress, vBuffer, nsize, 0)
Return vBuffer
End Function
End Module
another module
Spoiler
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As ULong, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function WriteFloatMemory Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function ReadFloat Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByRef buffer As Single, ByVal size As Int32, ByRef lpNumberOfBytesRead As Int32) As Boolean
Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function SetBkMode Lib "gdi32" (ByVal hDC As Long, ByVal nBkMode As Long) As Long
Public Declare Function SetTextColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
Public Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Public Declare Function SetBkColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
Public Declare Function UpdateWindow Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Public Const TRANSPARENT = 1
Public Const OPAQUE = 2
Public RBuff As Long
Public RBuff2 As Single
Public RBuff3 As Integer
'Poke Addresses'
Public Function W1Byte(ByVal Address As Integer, ByVal Value As Byte)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, 1, Nothing)
CloseHandle(processHandle)
End Function
Public Function W2Bytes(ByVal Address As Integer, ByVal Value As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, 2, Nothing)
CloseHandle(processHandle)
End Function
Public Function W4Bytes(ByVal Address As Integer, ByVal Value As Long)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, 4, Nothing)
CloseHandle(processHandle)
End Function
Public Function W8Bytes(ByVal Address As Integer, ByVal Value As ULong)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, 8, Nothing)
CloseHandle(processHandle)
End Function
Public Function WFloat(ByVal Address As Integer, ByVal Value As Single, ByVal Bytes As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, Bytes, Nothing)
CloseHandle(processHandle)
End Function
Public Function WDouble(ByVal Address As Integer, ByVal Value As Double, ByVal Bytes As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, Bytes, Nothing)
CloseHandle(processHandle)
End Function
'Read Addresses'
Public Function ReadAddress(ByVal Address As Integer, ByVal Bytes As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Address, RBuff, 4, Nothing)
CloseHandle(processHandle)
Return RBuff
End Function
'Read Addresses ( Pointers )'
Public Function ReadFloatPointer(ByVal Base As Integer, ByVal Offset As Short)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)
fullAddress = RBuff + Offset
ReadFloat(processHandle, fullAddress, RBuff2, 4, Nothing)
Return RBuff2
CloseHandle(processHandle)
End Function
Public Function Read4BytesPointer(ByVal Base As Integer, ByVal Offset As Short, ByVal Bytes As Integer)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)
fullAddress = RBuff + Offset
ReadProcessMemory(processHandle, fullAddress, RBuff3, Bytes, Nothing)
Return RBuff3
CloseHandle(processHandle)
End Function
'Poke Addresses ( Pointers )'
Public Function P1Byte(ByVal Base As Integer, ByVal Offset As Short, ByVal Value As Byte)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 1, Nothing)
fullAddress = RBuff + Offset
WriteProcessMemory(processHandle, fullAddress, Value, 1, Nothing)
CloseHandle(processHandle)
End Function
Public Function P2Bytes(ByVal Base As Integer, ByVal Offset As Short, ByVal Value As Integer)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 2, Nothing)
fullAddress = RBuff + Offset
WriteProcessMemory(processHandle, fullAddress, Value, 2, Nothing)
CloseHandle(processHandle)
End Function
Public Function P4Bytes(ByVal Base As Integer, ByVal Offset As Short, ByVal Value As Long)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)
fullAddress = RBuff + Offset
WriteProcessMemory(processHandle, fullAddress, Value, 4, Nothing)
CloseHandle(processHandle)
End Function
'NOP'
Public Function NOP(ByVal Address As Integer, ByVal Bytes As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, &H90, 1, Nothing)
CloseHandle(processHandle)
End Function
'Draw Text'
Public Sub DrawText(ByVal hWnd As Long, ByVal X As Long, ByVal Y As Long, ByVal textBuf As String)
Dim hDC, nCount As Long
hDC = GetDC(hWnd)
nCount = Len(textBuf)
SetBkColor(hDC, RGB(255, 255, 255))
SetBkMode(hDC, TRANSPARENT)
SetTextColor(hDC, RGB(0, 0, 0))
TextOut(hDC, X + 1, Y + 1, textBuf, nCount)
TextOut(hDC, X + 2, Y + 2, textBuf, nCount)
SetTextColor(hDC, RGB(255, 0, 0))
TextOut(hDC, X, Y, textBuf, nCount)
UpdateWindow(hWnd)
ReleaseDC(hWnd, hDC)
End Sub
End Module
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As ULong, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function WriteFloatMemory Lib "kernel32" Alias "WriteProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function ReadFloat Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByRef buffer As Single, ByVal size As Int32, ByRef lpNumberOfBytesRead As Int32) As Boolean
Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Integer) As Integer
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function SetBkMode Lib "gdi32" (ByVal hDC As Long, ByVal nBkMode As Long) As Long
Public Declare Function SetTextColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
Public Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Public Declare Function SetBkColor Lib "gdi32" (ByVal hDC As Long, ByVal crColor As Long) As Long
Public Declare Function UpdateWindow Lib "user32" (ByVal hWnd As Long) As Long
Public Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDC As Long) As Long
Public Const TRANSPARENT = 1
Public Const OPAQUE = 2
Public RBuff As Long
Public RBuff2 As Single
Public RBuff3 As Integer
'Poke Addresses'
Public Function W1Byte(ByVal Address As Integer, ByVal Value As Byte)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, 1, Nothing)
CloseHandle(processHandle)
End Function
Public Function W2Bytes(ByVal Address As Integer, ByVal Value As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, 2, Nothing)
CloseHandle(processHandle)
End Function
Public Function W4Bytes(ByVal Address As Integer, ByVal Value As Long)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, 4, Nothing)
CloseHandle(processHandle)
End Function
Public Function W8Bytes(ByVal Address As Integer, ByVal Value As ULong)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, 8, Nothing)
CloseHandle(processHandle)
End Function
Public Function WFloat(ByVal Address As Integer, ByVal Value As Single, ByVal Bytes As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, Bytes, Nothing)
CloseHandle(processHandle)
End Function
Public Function WDouble(ByVal Address As Integer, ByVal Value As Double, ByVal Bytes As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, Value, Bytes, Nothing)
CloseHandle(processHandle)
End Function
'Read Addresses'
Public Function ReadAddress(ByVal Address As Integer, ByVal Bytes As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Address, RBuff, 4, Nothing)
CloseHandle(processHandle)
Return RBuff
End Function
'Read Addresses ( Pointers )'
Public Function ReadFloatPointer(ByVal Base As Integer, ByVal Offset As Short)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)
fullAddress = RBuff + Offset
ReadFloat(processHandle, fullAddress, RBuff2, 4, Nothing)
Return RBuff2
CloseHandle(processHandle)
End Function
Public Function Read4BytesPointer(ByVal Base As Integer, ByVal Offset As Short, ByVal Bytes As Integer)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)
fullAddress = RBuff + Offset
ReadProcessMemory(processHandle, fullAddress, RBuff3, Bytes, Nothing)
Return RBuff3
CloseHandle(processHandle)
End Function
'Poke Addresses ( Pointers )'
Public Function P1Byte(ByVal Base As Integer, ByVal Offset As Short, ByVal Value As Byte)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 1, Nothing)
fullAddress = RBuff + Offset
WriteProcessMemory(processHandle, fullAddress, Value, 1, Nothing)
CloseHandle(processHandle)
End Function
Public Function P2Bytes(ByVal Base As Integer, ByVal Offset As Short, ByVal Value As Integer)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 2, Nothing)
fullAddress = RBuff + Offset
WriteProcessMemory(processHandle, fullAddress, Value, 2, Nothing)
CloseHandle(processHandle)
End Function
Public Function P4Bytes(ByVal Base As Integer, ByVal Offset As Short, ByVal Value As Long)
Dim fullAddress As Long
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
ReadProcessMemory(processHandle, Base, RBuff, 4, Nothing)
fullAddress = RBuff + Offset
WriteProcessMemory(processHandle, fullAddress, Value, 4, Nothing)
CloseHandle(processHandle)
End Function
'NOP'
Public Function NOP(ByVal Address As Integer, ByVal Bytes As Integer)
Dim LookUp As Process() = Process.GetProcessesByName("main")
If LookUp.Length = 0 Then
End
End If
Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, LookUp(0).Id)
WriteProcessMemory(processHandle, Address, &H90, 1, Nothing)
CloseHandle(processHandle)
End Function
'Draw Text'
Public Sub DrawText(ByVal hWnd As Long, ByVal X As Long, ByVal Y As Long, ByVal textBuf As String)
Dim hDC, nCount As Long
hDC = GetDC(hWnd)
nCount = Len(textBuf)
SetBkColor(hDC, RGB(255, 255, 255))
SetBkMode(hDC, TRANSPARENT)
SetTextColor(hDC, RGB(0, 0, 0))
TextOut(hDC, X + 1, Y + 1, textBuf, nCount)
TextOut(hDC, X + 2, Y + 2, textBuf, nCount)
SetTextColor(hDC, RGB(255, 0, 0))
TextOut(hDC, X, Y, textBuf, nCount)
UpdateWindow(hWnd)
ReleaseDC(hWnd, hDC)
End Sub
End Module
WriteDMAInteger("main", &H782A794, Offsets:={&H1A}, Value:=8415, Level:=1, nsize:=4)
It did not work;/
My Pointer:
[QUOTE] "main.exe" +0782 A794 [/ QUOTE]
offset:
[QUOTE] 1A [/ QUOTE]
value:
[QUOTE] 8415 [/ QUOTE]
If anyone can help me with this I thank you.
I have a basic knowledge of VB
And Sorry for my English, I speak Portuguese! "
