|
-
Jul 5th, 2007, 10:24 PM
#1
Thread Starter
Junior Member
[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!
-
Jul 6th, 2007, 01:58 AM
#2
Re: [2.0] a few read/writeprocessmemory questions
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
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
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
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Jul 6th, 2007, 08:55 AM
#3
Thread Starter
Junior Member
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
Last edited by gamesguru; Jul 6th, 2007 at 09:48 AM.
-
Jul 6th, 2007, 09:47 AM
#4
Thread Starter
Junior Member
Re: [2.0] a few read/writeprocessmemory questions
Step 1 and 2 have been resolved! Only 3 remains!
Last edited by gamesguru; Jul 7th, 2007 at 09:36 AM.
-
Jul 7th, 2007, 03:49 PM
#5
Thread Starter
Junior Member
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!
-
Jul 7th, 2007, 04:31 PM
#6
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;
I don't live here any more.
-
Jul 7th, 2007, 07:01 PM
#7
Thread Starter
Junior Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|