• Log in or sign up for an account here: https://www.sythe.org/login

Reading/Writing Memory

Terrankiller

Ex-Administrator
Joined
May 7, 2005
Sythe Gold
1
Messages
1,286
Location
California
Reading/Writing Memory
I decided to release this because mostly everything in this forum sucks and I haven't seen anything like this posted yet. Basically, this should get you started with making actual trainers. If you do not know how to get a process handle or byte address, then you shouldn't even be using this code in the first place:

Code:
'Written by: Terrankiller
'[email protected]
'http://www.terrankiller.com

Public Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long

Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, ByVal lpNumberOfBytesWritten 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 Sub CloseHandle Lib "kernel32" (ByVal hPass As Long)

Public Const PROCESS_ALL_ACCESS As Long = &H1F0FFF

Public Const PROCESS_VM_READ = &H10&

'Read Process Memory
'ReadMemory ProcessID, &H1C4F982, VarPtr(ReadValue), LenB(ReadValue)

Public Function ReadMemory(Process As Long, ByVal Address As Long, ByVal Buffer As Long, ByVal Size As Long)

   On Error Resume Next
   
   Dim pHnd As Long, bWritten As Long
   
      pHnd = OpenProcess(PROCESS_VM_READ, False, Process)
      
      If pHnd = 0 Then Exit Function
      
      ReadProcessMemory pHnd, ByVal Address, ByVal Buffer, Size, bWritten
      
      CloseHandle pHnd

End Function

'Modify Process Memory
'WriteMemory ProcessID, &H1C4F982, VarPtr(ModifyValue), LenB(ModifyValue)

Public Function WriteMemory(Process As Long, ByVal Address As Long, ByVal Buffer As Long, ByVal Size As Long)

   On Error Resume Next
   
   Dim pHnd As Long, bWritten As Long
    
      pHnd = OpenProcess(PROCESS_ALL_ACCESS, False, Process)
      
      If pHnd = 0 Then Exit Function

      WriteProcessMemory pHnd, ByVal Address, ByVal Buffer, Size, bWritten
      
      CloseHandle pHnd

End Function
 
Reading/Writing Memory
your a legend programer with amazing programs, and im just a leecher, but maybe ude get some feedback in ur posts if u were a bit nicer :)

just a suggestion. and if u don't mind me asking, why'd you close your sight?

-colin
 
Runescape Gamblingrunescape gambling
Back
Top