Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > .NET Languages
You last visited: Today at 19:36

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

Advertisement



C# ReadMemoryProcess

Discussion on C# ReadMemoryProcess within the .NET Languages forum part of the Coders Den category.

Reply
 
Old   #1
 
RiddiS's Avatar
 
elite*gold: 0
Join Date: Feb 2009
Posts: 31
Received Thanks: 0
C# ReadMemoryProcess

Ok, so i've written a class to read the memory address of a process and then convert it to a string so it's readable as a normal value.
It works fine, but for some reason if I read an address wich holds a value that has more then 3 numbers (for example 1000> ) it starts giving the wrong values.
Does anyone know why?


here's my piece of code(class not included becouse I'm sure everything is fine with that):
Code:
readmem.ReadProcess = myProcesses[0];

            readmem.OpenProcess();

            int bytesReaded;
            int Value;
            int Address = 0x00C33EDC;
            byte[] memory;

            memory = readmem.ReadProcessMemory((IntPtr)Address, 1, out bytesReaded);
            Value = memory[0];
            label1.Text = "Value: " + Value.ToString();
thank you
RiddiS is offline  
Old 10/09/2009, 00:34   #2




 
bloodx's Avatar
 
elite*gold: 55
Join Date: Mar 2006
Posts: 4,582
Received Thanks: 1,539
maybe cuz of byte?
bloodx is offline  
Old 10/09/2009, 00:37   #3
 
link's Avatar
 
elite*gold: 1
Join Date: Jul 2005
Posts: 553
Received Thanks: 454
Code:
            memory = readmem.ReadProcessMemory((IntPtr)Address, 1, out bytesReaded);
            Value = memory[0];
            label1.Text = "Value: " + Value.ToString();
Substitute the '1' with the size of an array (> 1).
Also this 'Value = memory[0]' does only take the first byte of 'memory', so either try 'memory.ToString()' or take its values repetitive.
link is offline  
Old 10/09/2009, 15:32   #4

 
saweet's Avatar
 
elite*gold: 20
Join Date: Sep 2007
Posts: 1,406
Received Thanks: 2,092
Do you know the size allocated to the memory address you're reading? Is it null (\0) terminated?
saweet is offline  
Old 10/09/2009, 20:33   #5
 
RiddiS's Avatar
 
elite*gold: 0
Join Date: Feb 2009
Posts: 31
Received Thanks: 0
Quote:
Originally Posted by link View Post
Code:
            memory = readmem.ReadProcessMemory((IntPtr)Address, 1, out bytesReaded);
            Value = memory[0];
            label1.Text = "Value: " + Value.ToString();
Substitute the '1' with the size of an array (> 1).
Also this 'Value = memory[0]' does only take the first byte of 'memory', so either try 'memory.ToString()' or take its values repetitive.
memory.ToString(); would just give me "Value: System.Byte[], also replacing the 1 with the size of the array doesn't make a difference.

Quote:
Originally Posted by saweet View Post
Do you know the size allocated to the memory address you're reading? Is it null (\0) terminated?
No, I don't :\]

thank you for helping
RiddiS is offline  
Old 10/09/2009, 22:13   #6
 
Shadowz75's Avatar
 
elite*gold: 0
Join Date: Mar 2009
Posts: 443
Received Thanks: 597
Quote:
Originally Posted by RiddiS View Post
memory.ToString(); would just give me "Value: System.Byte[], also replacing the 1 with the size of the array doesn't make a difference.



No, I don't :\]

thank you for helping
Code:
label1.Text = "Value: " + Encoding.ASCII.GetString(memory);
pseudocode
Shadowz75 is offline  
Reply




All times are GMT +1. The time now is 19:38.


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.