Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 02:42

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

Advertisement



Read Memory String/Char(?)

Discussion on Read Memory String/Char(?) within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2015
Posts: 375
Received Thanks: 2,520
Read Memory String/Char(?)

Solved.
Xonivion is offline  
Thanks
1 User
Old 07/29/2015, 13:52   #2
 
elite*gold: 0
Join Date: Feb 2009
Posts: 1,137
Received Thanks: 573
I guess you mean ReadProcessMemory right?
The problem is that String isn't an ordinal type like int, bool, etc. The second problem is that the string can have different Encodings. I wrote you an example to read an C/C++ PChar in UTF8 encoding from the adress of the first char:
Code:
String ReadUTF8String(IntPtr Address, IntPtr ProcHandle) {
	int i = 0;
	Byte buff = 255;
	Byte[] Str;
	int BytesRead;
	
	for (i = 0; buff!=0; i++) // Counting till 0 (String Terminating Byte)
		if (!ReadProcessMemory(ProcHandle, Adress+i, buff, 1, ref BytesRead))
		  break;
	Str = new Byte[i]; // Create Array with the Size of the String
	if (!ReadProcessMemory(ProcHandle, Adress, Str, Str.Length, ref BytesRead)) //Read the Buffer
            return null;
	return Encoding.UTF8.GetString(Str); // Return the Buffer as String
}
Well i am not a C# Developer and haven't tested it, so i have no guarantee that this code will work without changes
warfley is offline  
Old 07/29/2015, 22:03   #3



 
Shawak's Avatar
 
elite*gold: 0
The Black Market: 259/0/0
Join Date: Apr 2010
Posts: 10,289
Received Thanks: 3,613
You may use my lib for this:

Code:
var mem = new Memory(123123) // process id
var value = mem.Read<string>(0x2342342);
Shawak is offline  
Reply


Similar Threads Similar Threads
VB.Net: Read string from memory?
09/10/2012 - .NET Languages - 8 Replies
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?
[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....
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 02:44.


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.