Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 12:28

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



VB.Net: Read string from memory?

Discussion on VB.Net: Read string from memory? within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,974
VB.Net: Read string from memory?

Hi,

ich möchte gerne einen String aus dem Speicher lesen. Ich habe dazu die entsprechenden Offsets und in Autoit geht das auch wunderbar. Aber das ist wenig effizient und in VB kriege ich das erst gar nicht hin...

Hat da wer zufällig eine entsprechende Funktion, die er mir zur Verfügung stellen kann?
Whoknowsit is offline  
Old 09/09/2012, 17:36   #2
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
ReadProcessMemory
Kraizy​ is offline  
Old 09/09/2012, 17:37   #3


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,974
Das ist weniger das Problem

Code:
    Public Function MemReadString(ByVal PID As Integer, ByVal address As Integer, ByVal bytes As Integer) As String
        Dim str(bytes) As Byte
        ReadProcessMemory(PID, address, str, bytes, 0)
        Return System.Text.ASCIIEncoding.UTF8.GetString(str)
    End Function
Das funktioniert aber nicht Wobei ich sagen muss, dass ich nebenbei auch Integerwerte auslese und das klappt wiederum relativ problemlos.
Whoknowsit is offline  
Old 09/09/2012, 17:55   #4
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
was kommt denn als ergebnis raus
Kraizy​ is offline  
Old 09/09/2012, 18:02   #5


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,974
Nichts

Code:
ReadStr(pid, Base + &HDC92D8)
Whoknowsit is offline  
Old 09/09/2012, 18:56   #6
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,811
hast du es mal zb mit system.text.encoding.unicode.getstring(str) probiert?
Kraizy​ is offline  
Old 09/09/2012, 23:38   #7


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,974
Mittlerweile bin ich hier:

Code:
    Public Function ReadString(ByVal PID As Integer, ByVal Address As Long, ByVal CharCount As Int32) As String
        Dim ret As Byte() = Nothing
        Dim vBuffer As Long

        Dim processHandle As IntPtr = OpenProcess(PROCESS_VM_READ, 0, PID)
        Dim tStr(CharCount) As Char
        Dim retStr As String = ""
        For i As Int32 = 0 To CharCount Step 1
            ReadProcessMemory(processHandle, Address + i, vBuffer, 1, 0)
            ret = BitConverter.GetBytes(vBuffer)
            tStr(i) = System.Text.Encoding.Unicode.GetString(ret) : retStr += tStr(i)

        Next i
        Return retStr
        CloseHandle(processHandle)
    End Function
Ich erhalte nun das gewünschte Ergebnis, jedoch gibts noch Probleme mit Sonderzeichen. Hab schon sämtliche Kodierungen durch. Liegt wahrscheinlich daran, dass ich hier jeweils nur 1 Byte einlese. Aber egal was ich versuche, es funktioniert nicht
Whoknowsit is offline  
Old 09/10/2012, 00:18   #8
 
elite*gold: 0
Join Date: Sep 2012
Posts: 51
Received Thanks: 32
Sorry if I tell something stupid, I'm novice programmer.

Maybe you could use:

Code:
ReadProcessMemory(processHandle, Address, vBuffer, CharCount, 0)
then parse the whole string with
Code:
retStr = System.Text.Encoding.Unicode.GetString(vBuffer)
so the parser will handle special chars...
urgabel is offline  
Old 09/10/2012, 18:33   #9


 
Whoknowsit's Avatar
 
elite*gold: 146
Join Date: May 2009
Posts: 3,764
Received Thanks: 6,974
That doesnt make any sense But ty anyways.

Ich bin mittlerweile so weit:

Code:
    Public Function ReadString(ByVal PID As Integer, ByVal Address As Long, ByVal CharCount As Int32) As String
        Dim ret As Byte() = Nothing
        Dim vBuffer As Long

        Dim processHandle As IntPtr = OpenProcess(PROCESS_VM_READ, 0, PID)
        Dim tStr(CharCount) As Char
        Dim retStr As String = ""
        For i As Int32 = 0 To CharCount Step 1
            ReadProcessMemory(processHandle, Address + i, vBuffer, 4, 0)
            ret = BitConverter.GetBytes(vBuffer)
            tStr(i) = System.Text.Encoding.UTF8.GetString(ret) : retStr += tStr(i)

        Next i
        Return retStr
        CloseHandle(processHandle)
    End Function
jedoch nach wie vor Probleme mit dem Rückgabestring.
Whoknowsit is offline  
Reply


Similar Threads Similar Threads
[Hilfe] String aus Memory lesen
08/03/2011 - World of Warcraft - 0 Replies
Hi, ich würd gern nen String ausm Speicher lesen. Die Länge soll dabei selbstständig berechnet werden.. Sprich es soll so lange gelesen werden bis das Byte 0x00 kommt. Dazu hab ich mir folgende Schleife geschrieben: // ReadString string ReadString(UINT_PTR Offset) { int size; BYTE strbyte = {0x20}; // Hack.. musste strbyte ja mit irgendwas initiieren was nicht null ist. for (size=0;strbyte!=0;size++) // so lange lesen bis das byte 0x00 und damit das Ende des Strings gefunden wurde....
[Release] String/Memory Liste
10/23/2010 - S4 League Hacks, Bots, Cheats & Exploits - 7 Replies
Hier Hab ich mal ein Theard gemacht, für die String/Memory Adressen. Have Fun ;) Inf Sp Skill Memory Values:
C++ String aus Memory auslesen
05/08/2010 - C/C++ - 1 Replies
Hallo zusammen ;) Ich probiere mich derzeit ein wenig mit dem auslesen des Memory in C++. Hab mir da auch schon ne DLL gebastelt und injected... usw. Nun habe ich ein Problem: Ich möchte gerne den Namen meines Charakters auslesen. Mit Cheatengine klappt das ja wunderbar und wird auch richtig angezeigt, nur wenn ich mittels der DLL versuche aus der Addresse meinen Namen auszulesen bekomm ich immer nur 1 Zeichen und das stimmt nicht einmal mit dem 1. Buchstaben meines Namens überein. Hier...
[Help]C# How to convert memory value to string?
05/04/2010 - CO2 Programming - 2 Replies
How to convert value to string :confused: this is my code Is this code right or is it wrong? thanks in advance!:handsdown: note: I know that CloseHandle is missing :) using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq;
String memory addres
10/28/2005 - Lineage 2 - 0 Replies
Does anyone have any ideea how i can find a desired string in the memory address??? I am trying to make a new code but i have to come up with a way to find certain string so i can edit it. please post your ideas and progs, im sure working together is more efficient then working alone.



All times are GMT +1. The time now is 12:29.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.