|Consider the following two programs. One is the console application with this code:
char *p = new char;
I run this program in Debug configuration and break on return 0 line. I the Watch window I see p variable value. The second program:
HANDLE hProcess = OpenProcess( PROCESS_VM_READ, FALSE ,
if ( hProcess == NULL ) return;
address, p, 100,
ReadProcessMemory is successful both in 32 and 64 bit (both program are compiled in Win32 or x64 configuration). Environment: Windows 7 64 bit, Visual Studio 2010. It also works in previous Windows versions.
Now I try the same in Windows 10 64 bit. Both programs in 32 bit - OK. 64 bit: ReadProcessMemory returns FALSE with last error 299: Only part of a ReadProcessMemory request was completed.
1. To replace PROCESS_VM_READ with PROCESS_ALL_ACCESS
2. To run the second program as administrator
3. To use different Visual Studio versions (2010, 2015).
Still doesn't help. ReadProcessMemory fails in Windows 10 for 64 bit processes.
Edit: I tried to write this code from scratch, and it is working. So, the problem is somewhere in the original project, I don't know the solution yet, but API is working.
modified 25-Aug-15 6:24am.