nog_lorp Grandmaster Cheater
Reputation: 0
Joined: 26 Feb 2006 Posts: 743
|
Posted: Sat Aug 18, 2007 12:29 pm Post subject: |
|
|
oib, explain what you are trying to do.
All the information you should need is:
A) the info on the MSDN page.
B) basic C syntax knowledge.
Do you want to read memory of the process you are injecting the DLL into? If that is what you want to do, you do not need ReadProcessMemory.
As for the "loop" comment:
Do you want to read a big piece of memory? ReadProcessMemory reads a specified number of bytes (4th argument).
Do you want to read a bunch of different (non-adjacent) pieces of memory? Then you can do them all in a row or use a loop with a bunch of arrays storing the arguments. Either way, it is entirely non-specific to ReadProcessMemory. Just to be nice though, here is an example:
| Code: |
HANDLE hProcess = OpenProcess(...);
void* lpBaseAddress[] = 0x004000,0x004010,0x004020;
int nSize[] = 5,6,7;
void* lpBuffer[] = malloc(nSize[0]),malloc(nSize[1]),malloc(nSize[2]);
for(int i = 0; i<2; i++)
{
ReadProcessMemory(
hProcess,
lpBaseAddress[i],
lpBuffer[i],
nSize[i],
NULL
);
}
|
This should read 3 pieces of memory located at 0x004000, 0x004010, and 0x004020 respectively, with sizes 5, 6, and 7 bytes.
To access them, dereference the pointer to where they are stored like so: ((char*)lpBuffer[1]+i)*, where i is which byte to read.
~nog_lorp
_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish |
|