问题
So, I wrote a program which is able to successfully read memory from most of processes using VirtualQueryEx
. However, I've come across a process for which this function fails. It's not a system process, just a game process. Without Debug privileges I couldn't even open the process's handle. With them I am able to get the process's handle but still get access denied for VirtualQueryEx
.
I'm not sure but maybe the process is private? If that's the case, what should I do to successfully use VirtualQueryEx
function?
I've also read somewhere that I might have to suspend whole process's threads before running VirtualQueryEx
, but so far I didn't need that... And when I used function Thread32First
to get the first thread it gave me an error: ERROR_BAD_LENGTH
...
I would be very grateful for any help in this matter!
回答1:
How are you opening the process handle? From the doc:
The handle must have been opened with the
PROCESS_QUERY_INFORMATION
access right, which enables using the handle to read information from the process object.
Another possibility is that the target process and your process are different bitness (32 vs 64). In that case you either need to use MEMORY_BASIC_INFORMATION32
or something like VirtualQueryEx64
from wow64ext library.
来源:https://stackoverflow.com/questions/18769151/access-denied-error-when-using-virtualqueryex