make sure the code is running at the same level or higher for access. I ran into this also.
Not sure why but all of a sudden ReadProcessMemory isn't reading the amount of bytes I'm asking it to.
EDIT: Just so you know, ReadProcessMemory is returning false and GetLastError returns 0.Code:byte[] ReadBytes(uint address, int len) // (0x0D000000, 0x08000000) is what I pass through this { int buffer = 0; byte[] output = new byte[len]; ReadProcessMemory(HO_Process, (IntPtr)address, output, len, out buffer); // this makes buffers value 0x0031E000 return output; }
Last edited by Joshe343; 03-31-2015 at 12:13 AM.
make sure the code is running at the same level or higher for access. I ran into this also.
You should implement some sort of error checking. ReadProcessMemory returns 0 if it fails. Combine it with GetLastError() to get an error code you can look up on google. I had trouble with a remote thread, got the error code, was able to find it and see that I didn't have sufficient permissions.
Code:if (ReadProcessMemory(HO_Process, (IntPtr)address, output, len, out buffer) ==0) { MessageBox.Show(NULL, "Error Reading Memory" +GetLastError(), "Error", MB_OK); }
You're reading from 0x0 to 0x08000000, and it's extremely unlikely that the target process actually has all of that allocated...you're trying to read an address (many) that hasn't been allocated yet.Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.
The function fails if the requested read operation crosses into an area of the process that is inaccessible.
Use VirtualQueryEx() if you want to find all allocated memory regions.
edit: nvm, apparently it works. ? Not sure how, but ok.
Last edited by abuckau907; 04-14-2015 at 11:16 AM.
'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
--