This is my memory editing snippet. Just place this code inside a module and use it in your programs if you wish
Unfortunatly, i had coded this module in vb6, so not every command will work with vb.net. You may translate if you wish, i just ask that you re-post for others to use.
~~~~~Declarations~~~~~
[highlight=vbnet] Public Const PROCESS_ALL_ACCESS = &H1F0FFF
Dim f1holder As Integer
Dim timer_pos As Long
Dim hProcess As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal SomeValueIsStoredHere As Long, ByVal lpdwProcessId As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Object, ByVal lpBuffer As Object, ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
Public Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Object, ByRef lpBuffer As Object, ByVal nSize As Long, ByVal lpNumberOfBytesWritten As Long) As Long[/highlight]
~~~~~Module~~~~~
[highlight=vbnet] Public Function WriteALong(ByVal TheGame As String, ByVal TheAddress As Long, ByVal ThisIsTheValue As Long)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId(SomeValueIsStoredHere, SomeValueIsStoredHereToo)
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
WriteProcessMemory(SomeValue, TheAddress, ThisIsTheValue, 4, 0&)
CloseHandle(hProcess)
End Function[/highlight]
[highlight=vbnet] Public Function ReadALong(ByVal TheGame As String, ByVal TheAddress As Long, ByVal TheValue As Long)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId(SomeValueIsStoredHere, SomeValueIsStoredHereToo)
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
ReadProcessMem(SomeValue, TheAddress, TheValue, 4, 0&)
CloseHandle(hProcess)
End Function[/highlight]
[highlight=vbnet] Public Function ReadAFloat(ByVal TheGame As String, ByVal TheAddress As Long, ByVal TheValue As Single)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId(SomeValueIsStoredHere, SomeValueIsStoredHereToo)
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
ReadProcessMem(SomeValue, TheAddress, TheValue, 4, 0&)
CloseHandle(hProcess)
End Function[/highlight]
[highlight=vbnet] Public Function WriteAFloat(ByVal TheGame As String, ByVal TheAddress As Long, ByVal ThisIsTheValue As Single)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId(SomeValueIsStoredHere, SomeValueIsStoredHereToo)
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
WriteProcessMemory(SomeValue, TheAddress, ThisIsTheValue, 4, 0&)
CloseHandle(hProcess)
End Function[/highlight]
~~~~~Instructions~~~~~
Alright. In order for this to work, im gonna show you a quick example using that cheezy little Pinball game that comes with Windows XP.
lets say we turned the game on and made a button that we set the button command to this: [highlight=vbnet]
Private Sub Command1_Click()
Call WriteALong("3D Pinball for Windows, Space Cadet", &HA12EF4, 999999)
Call WriteALong("3D Pinball for Windows, Space Cadet", &HB8AEBA, 999999)
End Sub
[/highlight]
Basically what the code means, is that i Called the function "WriteALong" from the module that is just above. "3D Pinball for Windows, Space Cadet" is the window title, &HB8AEBA is the address. "999999" is the value you set that specific address to.
*Note: Add &H instead of the 2 00 (two zero's), Here's an example: Your address is 00L1FD4. You need to replace the 00 (two zero's) with an &H , then you would get this: &HL1FD4. If there is only 1 0 at the beginning then just replace it with an &. If there are no zero's at the beginning then this rule does not apply.
And thats it!
oh and p.s. This is basically how people use VB and make trainers for games and such.