ReadProcessMemory - Read 8 byte [solved]
I need to read from an address as 8 byte. I am using a slightly modified function from PheNix'es Undetected Module Maker.
[highlight=VB.net]SomeString = (ReadLong(&HAddress, 8))[/highlight]
The function works as long as the bytes are 4 or below, But if I use 8 or above it will read it as 4 byte.
[highlight=VB.net]Private Declare Function KGCDGTJAWN Lib "kernel32" Alias "OpenProcess" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private Declare Function EFJKPZAUQL Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Integer) As Integer
Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Dim GWXUSXTOUE As Long
'ReadLong
Public Function ReadLong(ByVal Address As Integer, ByVal Bytes As Integer)
Dim BlackOpsLookUp As Process() = Process.GetProcessesByName("BlackOps")
If BlackOpsLookUp.Length = 0 Then
Return Nothing
Exit Function
End If
Dim processHandle As IntPtr = KGCDGTJAWN(&H1F0FFF, 0, BlackOpsLookUp(0).Id)
ReadProcessMemory(processHandle, Address, GWXUSXTOUE, Bytes, Nothing)
Return GWXUSXTOUE
EFJKPZAUQL(processHandle)
End Function[/highlight]
Resume:
If I try to read a type above 4 byte, then it will ignore what byte I wrote and return it as 4 byte.
[highlight=VB.net]SomeString = (ReadLong(&HAddress, 8))[/highlight]
The function works as long as the bytes are 4 or below, But if I use 8 or above it will read it as 4 byte.
[highlight=VB.net]Private Declare Function KGCDGTJAWN Lib "kernel32" Alias "OpenProcess" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer, ByVal dwProcessId As Integer) As Integer
Private Declare Function EFJKPZAUQL Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Integer) As Integer
Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Dim GWXUSXTOUE As Long
'ReadLong
Public Function ReadLong(ByVal Address As Integer, ByVal Bytes As Integer)
Dim BlackOpsLookUp As Process() = Process.GetProcessesByName("BlackOps")
If BlackOpsLookUp.Length = 0 Then
Return Nothing
Exit Function
End If
Dim processHandle As IntPtr = KGCDGTJAWN(&H1F0FFF, 0, BlackOpsLookUp(0).Id)
ReadProcessMemory(processHandle, Address, GWXUSXTOUE, Bytes, Nothing)
Return GWXUSXTOUE
EFJKPZAUQL(processHandle)
End Function[/highlight]
Resume:
If I try to read a type above 4 byte, then it will ignore what byte I wrote and return it as 4 byte.

