That code is alittle hard to read, so it'l be easier to do alittle spoon feeding.
Your read string returns a unicode string type (2 bytes per char) Maybe you need to be looking at ascii.
You dont need to loop the readprocessmemory or bitconvertor.
95% of the time you dont need to use Openprocess, rare cases you do.
You dont need Closehandle, system.diagnostics will close it for you.
Try this
Imports
Code:
Imports System.Runtime.InteropServices
Imports System.Text.Encoding
API
Code:
<DllImport("kernel32.dll")> _
Public Shared Function ReadProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As Integer, ByVal buffer As Byte(), ByVal size As Integer, ByVal lpNumberOfBytesRead As Integer) As Boolean
End Function
And a piece of code i just put together. May need tweaking, i dont code in this language
Code:
Private Function ReadString(ByVal Address As Integer, ByVal UnicodeType As Boolean, ByVal ProcessName As String) As String
Dim Proc = Process.GetProcessesByName(ProcessName)
If Proc.Length = 0 Then
Return String.Empty 'Return blank string if process isnt open
End If
Dim buff(0 To 120) As Byte
If ReadProcessMemory(Proc(0).Handle, Address, buff, buff.Length, 0) Then 'if read, contintue
Dim tmp = If(UnicodeType, Unicode.GetString(buff), ASCII.GetString(buff))
If (tmp <> String.Empty) Then
Dim LastChar As Integer = tmp.IndexOf(" ", StringComparison.Ordinal)
Return If(LastChar = -1, tmp, tmp.Substring(0, LastChar)) 'returns the cut string
End If
End If
Return String.Empty
End Function
Try these one at a time. Just replace it with your processname
Code:
TextBox1.Text = ReadString(&H26FFA8, False, "Processname")
TextBox1.Text = ReadString(&H26FFA8, True, "Processname")
The first one with False will return Ascii, the other with True will return unicode.
If these dont work, maybe you have the wrong address.