I am using these functions to read a processes memory:
Code:
Public Function GetInt64FromMemory(ByVal Address As Long, Optional ByVal Offset As Integer = 0) As Int64
Try
Return Marshal.ReadInt64(New IntPtr(Address), 0)
Catch ex As Exception
Debug.WriteLine("Exception in GetInt64FromMemory. Address: " _
& Address.ToString("x") & ". Offset: " & Offset.ToString & ". Description: " & ex.Message)
Return Nothing
End Try
End Function
Public Function GetInt32FromMemory(ByVal Address As Long, Optional ByVal Offset As Integer = 0) As Int32
Try
Return Marshal.ReadInt32(New IntPtr(Address), 0) 'GetMemory(Address, 4))
Catch ex As Exception
Debug.WriteLine("Exception in GetInt32FromMemory. Address: " _
& Address.ToString("x") & ". Offset: " & Offset.ToString & ". Description: " & ex.Message)
Return Nothing
End Try
End Function
Public Function GetInt16FromMemory(ByVal Address As Long, Optional ByVal Offset As Integer = 0) As Int16
Try
Return Marshal.ReadInt16(New IntPtr(Address), Offset)
Catch ex As Exception
Debug.WriteLine("Exception in GetInt16FromMemory. Address: " _
& Address.ToString("x") & ". Offset: " & Offset.ToString & ". Description: " & ex.Message)
Return Nothing
End Try
End Function
Friend Function GetStringFromMemory(ByVal Address As Long, ByVal nByte As Integer, Optional ByVal Offset As Integer = 0) As String
Try
Dim sBuffer(nByte - 1) As Byte
sBuffer = GetMemory(New IntPtr(Address + Offset), nByte)
Return System.Text.Encoding.ASCII.GetString(sBuffer)
Catch ex As Exception
Debug.WriteLine("Exception in GetStringFromMemory. Address: " _
& Address.ToString("x") & ". Offset: " & Offset.ToString & ". Num Bytes: " _
& nByte.ToString & ". Description: " & ex.Message)
Return Nothing
End Try
End Function
Public Function GetMemory(ByVal Address As Long, ByVal ByteCount As Long) As Object
Try
Dim _Return(ByteCount - 1) As Byte
Marshal.Copy(New IntPtr(Address), _Return, 0, ByteCount)
Return _Return
Catch ex As Exception
Debug.WriteLine("Exception occured in GetMemory. Start Address: " & Address.ToString("x") & _
" Byte Count: " & ByteCount.ToString & " Details: " & ex.Message)
Return Nothing
End Try
End Function
And to see if I am logged in, I am trying to use:
Code:
Dim ObjectOffset As Integer = GetInt32FromMemory(_BaseAddress, &H1139F80)
Debug.WriteLine("Client Connection: " & ObjectOffset)
Dim IsLoadedOffset As Integer = GetInt32FromMemory(ObjectOffset, &H113D78C)
Dim IsLoaded As Integer = GetInt32FromMemory(IsLoadedOffset, 0)
But I just can't seem to get it to work at all. I have been a "leach" on this site for like 2 weeks now trying to read everything and get a grasp on this. I believe my offsets are correct for 3.2.2. I either just get a copy of my _BaseAddress value or I get an "Access Denied" error (assuming I am reading memory out of process.)
To find my process, I am using
Code:
For Each tmpProcess As Process In Process.GetProcesses
'Debug.WriteLine(tmpProcess.ProcessName)
If tmpProcess.ProcessName.ToLower.Contains("wow") Then
tmpProcess.EnterDebugMode()
Dim _BaseAddress As Long = tmpProcess.MainModule.BaseAddress.ToInt32 'GetHeapAddress(tmpProcess.Handle)
Any help would be very appreciated.