• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

I need some help with visual basic writeProcessMemory

Delirium

OTLand veteran
Staff member
Global Moderator
Joined
May 28, 2007
Messages
3,365
Solutions
1
Reaction score
289
Location
Athens, Greece
Could someone tell me how this shit is used,what parameters it has and give me an example plx? (I want it to create an IP changer)

Thanks.
 
First try to read the memory. This is an example created by Praetox to get your hp.
Code:
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub Form_load()
    Me.Caption = ReadMemory(&H6059CC)
End Sub

Private Function tHvnd() As Long
    tHvnd = FindWindow("tibiaclient", vbNullString)
End Function

Private Function ReadMemory(Address As Long) As Long
    Dim ProcessID As Long, processHandle As Long
    If tHvnd = 0 Then Exit Function
    GetWindowThreadProcessId tHvnd, ProcessID
    processHandle = OpenProcess(&H10, False, ProcessID)
    If processHandle = 0 Then Exit Function
    ReadProcessMemory processHandle, Address, ReadMemory, 4, 0&
    CloseHandle processHandle
End Function

Now you got an example of reading the memory. Writing is almost the same.

btw this is VB6 I don't know what version you need.
 
First try to read the memory. This is an example created by Praetox to get your hp.
Code:
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Private Sub Form_load()
    Me.Caption = ReadMemory(&H6059CC)
End Sub

Private Function tHvnd() As Long
    tHvnd = FindWindow("tibiaclient", vbNullString)
End Function

Private Function ReadMemory(Address As Long) As Long
    Dim ProcessID As Long, processHandle As Long
    If tHvnd = 0 Then Exit Function
    GetWindowThreadProcessId tHvnd, ProcessID
    processHandle = OpenProcess(&H10, False, ProcessID)
    If processHandle = 0 Then Exit Function
    ReadProcessMemory processHandle, Address, ReadMemory, 4, 0&
    CloseHandle processHandle
End Function

Now you got an example of reading the memory. Writing is almost the same.

btw this is VB6 I don't know what version you need.

What parameters does writeProcessMemory have?
 
The parameters are:

hProcess A handle to the process memory to be modified. The handle must have PROCESS_VM_WRITE and PROCESS_VM_OPERATION access to the process.

lpBaseAddress A pointer to the base address in the specified process to which data is written. Before data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for write access, and if it is not accessible, the function fails.

lpBuffer A pointer to the buffer that contains data to be written in the address space of the specified process.

nSize The number of bytes to be written to the specified process.

lpNumberOfBytesWritten A pointer to a variable that receives the number of bytes transferred into the specified process. This parameter is optional. If lpNumberOfBytesWritten is NULL, the parameter is ignored.

i Searched for this, all i did is type in google and the first link told me the parameters.

Its as easy as that.
 
Back
Top