. <Runtime.InteropServices.DllImport("kernel32.dll")> Private Shared Function WriteProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As UIntPtr, ByRef lpNumberOfBytesWritten As UInteger) As Boolean
End Function
<Runtime.InteropServices.DllImport("kernel32.dll")> Private Shared Function ReadProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As UIntPtr, ByRef lpNumberOfBytesWritten As UInteger) As Boolean
End Function
<Runtime.InteropServices.DllImport("kernel32.dll")> Private Shared Function OpenProcess(ByVal dwDesiredAccess As UInt32, ByVal bInheritHandle As [Boolean], ByVal dwProcessId As UInt32) As IntPtr
End Function
Public Property myVar() As Single
Get
Dim bytes(3) As Byte
ReadProcessMemory(OpenProcess(&H1F0FFF, False, Process.GetProcessesByName("MW3")(0).Id), &H1B82BF0, bytes, 4, 0)
Return BitConverter.ToSingle(bytes, 0)
End Get
Set(ByVal value As Single)
Dim bytes() As Byte = BitConverter.GetBytes(value)
WriteProcessMemory(OpenProcess(&H1F0FFF, False, Process.GetProcessesByName("MW3")(0).Id), &H1B82BF0, bytes, 4, 4)
End Set
End Property
'Beispiel: Verwendung
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Button1.Text = myVar.ToString() 'Lesen
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
myVar = 555.0F 'Schreiben
End Sub
|