|
-
Jun 20th, 2005, 11:55 AM
#1
Thread Starter
Addicted Member
Read/Write ProcessMemory
Hello,
How can i read or write a address with a value that has length more then 4?
Seams like ReadProcessMem only gets the first 4 of the value.
Im trying to get the whole value from a word that has length 17 in memory.
Code:
dim value as byte
GetWindowThreadProcessId hwnd, pid
phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
ReadProcessMem phandle, address, value, 1, 0&
CloseHandle hProcess
Thanks,
Naitsabes
Last edited by naitsabes85; Jun 21st, 2005 at 03:11 AM.
-
Jun 20th, 2005, 03:30 PM
#2
Retired VBF Adm1nistrator
Re: Read/Write ProcessMemory
I assume you are referring to ReadProcessMemory()?
It's declaration is as follows;
VB Code:
Public Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
So the 2nd last parameter is the amount of data to read. By the way, the last parameter is passed ByRef, so you should be passing in a variable of type Long to test if the correct amount of data was read.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Jun 21st, 2005, 03:11 AM
#3
Thread Starter
Addicted Member
Re: Read/Write ProcessMemory
Something like this?
Code:
Dim valbuffer As Long
ReadProcessMemory phandle, &H5EB988, valbuffer, 17, 0&
Text1 = valbuffer
Thanks,
naitsabes
Last edited by naitsabes85; Jun 21st, 2005 at 03:26 AM.
-
Jun 21st, 2005, 06:41 AM
#4
Re: Read/Write ProcessMemory
More like this
VB Code:
Public Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" _
(ByVal hProcess As Long, _
ByRef lpBaseAddress As Any, _
ByRef lpBuffer As Any, _
ByVal nSize As Long, _
ByRef lpNumberOfBytesRead As Long) _
As Long
Dim lngBytesRead As Long
Dim bufReadBuffer(16) As Byte
ReadProcessMemory phandle, _
ByVal &H5EB988&, _
ByVal VarPtr(bufReadBuffer(0)), _
ByVal 17&, _
lngBytesRead
Last edited by penagate; Jun 21st, 2005 at 06:47 AM.
-
Jun 21st, 2005, 09:08 AM
#5
Thread Starter
Addicted Member
Re: Read/Write ProcessMemory
 Originally Posted by penagate
More like this
VB Code:
Public Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" _
(ByVal hProcess As Long, _
ByRef lpBaseAddress As Any, _
ByRef lpBuffer As Any, _
ByVal nSize As Long, _
ByRef lpNumberOfBytesRead As Long) _
As Long
Dim lngBytesRead As Long
Dim bufReadBuffer(16) As Byte
ReadProcessMemory phandle, _
ByVal &H5EB988&, _
ByVal VarPtr(bufReadBuffer(0)), _
ByVal 17&, _
lngBytesRead
Thanks ill try that!
naitsabes
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|