[2.0] a few read/writeprocessmemory questions
thanks to all who help...
1)How do i read a 2 byte, 4 byte, or 8 byte value? I know how to read a one byte, but that only goes up to 255...
2)If any of you are familiar assembly, i need know now how to change (write) to an addresses hex dump, also known as Array of Byte (in most memory editing engines).
3) Reading/writing to a pointer I.E (0x1009624, offset: 0xb14), or any other pointer...
thanks in advanced, and positive rating to all who help!:bigyello:
Re: [2.0] a few read/writeprocessmemory questions
Quote:
1)How do i read a 2 byte, 4 byte, or 8 byte value? I know how to read a one byte, but that only goes up to 255...
Read 2 bytes and concatenate them in a Short
Quote:
2)If any of you are familiar assembly, i need know now how to change (write) to an addresses hex dump, also known as Array of Byte (in most memory editing engines).
We have a forum for Assembly
Quote:
Reading/writing to a pointer I.E (0x1009624, offset: 0xb14), or any other pointer...
Unless you're working in assembly you'll keep getting AddressViolationException If that memory location is reserved for the system or another app
Re: [2.0] a few read/writeprocessmemory questions
Thanks, for trying...but I may have mis-communicated, let me clarify:
1)
Code:
ProcessMemoryReaderLib.ProcessMemoryReader memedit
= new ProcessMemoryReaderLib.ProcessMemoryReader();
memedit.ReadProcess = myprocess[0];
memedit.OpenProcess();
int bytesread; //needed
int byteswritten; //needed
int address = 0x1009624; //address
int value; //value of address
short value2=444; //for writing 2 byte, 444 for the value
byte[] memory; //for reading byte
reading
memory = memedit.ReadProcessMemory((IntPtr)address, 1, out bytesread);
//starts out as a byte array...i'm wondering how to get around this...
value = memory[0];
MessageBox.Show(value.ToString());
//writing
memory = BitConverter.GetBytes(value2);
memedit.WriteProcessMemory((IntPtr)address, memory, out byteswritten);
Code:
Resolution:
byteone = BitConverter.GetBytes(intone);
inttwo = BitConverter.ToInt32(byteone, 0);
MessageBox.Show(inttwo.ToString());
As you can see, when you read an address...the value is assigned to a byte array, how do I get around this? Like if I want to read a 4-byte value.
2)
Code:
I understand that you have an assembly forum, I need this to be done in c#...should just
be another variation of writing 2 byte, 4 byte, 8 byte, ect...
should be easy...
3)
Code:
Don't say this can only be done in assembly...I've seen it done in C++, and in Delphi...
and I'm pretty sure it can be done in C#...
again...should be easy
Re: [2.0] a few read/writeprocessmemory questions
Step 1 and 2 have been resolved! Only 3 remains!
Re: [2.0] a few read/writeprocessmemory questions
Can anyone tell me how to read the value of pointers?! Let me give a better explanation of what I want...
Pointers are 4 byte values that hold the the address of a memorylocation instead of a normal value.
That address is used by the game to find out where to store and look for it's data. E.g: 10 bytes after the pointer to the start of the player data is health, 14 bytes after the start of the player data is armor, 18 bytes after the player is ammo etc....
Here's a picture...I hope someone understands, and knows what to do!
http://www.heijnen1.demon.nl/pointers.GIF
Re: [2.0] a few read/writeprocessmemory questions
Read up on the following C# topics:
- unsafe code
- fixed()
- pointers
You can use pointers in C# just as you can in C/C++. To read the value at a pointer's address just dereference the pointer...
int fred = 0;
fred = *myPointer;
to set the value at the pointers address...
*myPointer = 12345;
Re: [2.0] a few read/writeprocessmemory questions
Sorry for the mis-communication, but I need to read/write from and to a process's memory (pointers that is), not my application's memory. I've seen it done in Delphi and C++ but never in C#...and I'd like to know how.