Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Long
- Private Declare Auto Function ReadProcessMemory Lib "kernel32" (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 VirtualProtectEx Lib "kernel32" (ByVal hProcess As Long, ByRef lpAddress As Object, ByVal dwSize As Long, ByVal flNewProtect As Long, ByRef lpflOldProtect As Long) As Long
- Public Function GetValue(ByVal ProcessHandle As IntPtr, ByVal Address As Integer)
- Dim Buffer As Long
- Dim convert As Long
- Dim byte_array0 As Byte()
- Try
- ReadProcessMemory(ProcessHandle, Address, Buffer, 4, 0)
- Catch ex As Exception
- MsgBox(ex.Message, MsgBoxStyle.Critical, "Error!")
- Return False
- End Try
- byte_array0 = BitConverter.GetBytes(Buffer)
- convert = BitConverter.ToInt64(byte_array0, 0)
- Return convert
- End Function
- Public Function WriteValue(ByVal ProcessHandle As IntPtr, ByVal Address As Integer, ByVal Value As Long)
- Try
- VirtualProtectEx(ProcessHandle, Address, 4, &H4&, 0)
- WriteProcessMemory(ProcessHandle, Address, Value, 4, 0)
- Catch ex As Exception
- MsgBox(ex.Message, MsgBoxStyle.Critical, "Error!")
- Return False
- End Try
- Return True
- End Function
- Dim Buffer As object '''<<<correction
- Dim convert As Long
- Dim byte_array0 As Byte()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement