The code goes something like this:
hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pidOfNKdotEXE);
if (hProc)
{
rc = VirtualQueryEx(hProc, 0xd0000000, &mbi, sizeof(mbi))
if (!rc)
{
print GetLastError();
}
CloseHandle(hProc);
}
The address is valid in the address space of the kernel but GetLastError
returns 0x80070057 (E_INVALIDARG). Is this by design or a bug? Is there a
workaround for user mode process to do this? Barring that, will
VirtualQuery(0xd0000000) work if called within a kernel-mode driver?
Thanks in advance!
--
Luca Calligaris (MVP-Windows Embedded)
l.calliga...@eurotech.it.nospam
www.eurotech.it
"Windows Programmer" <win...@programmer.com> ha scritto nel messaggio
news:OHfYONwb...@TK2MSFTNGP04.phx.gbl...
Good point. But, OpenProcess is returning a process handle. I don't doubt
it could be a security issue and maybe that's what VirtualQueryEx is
actually complaining about rather than the address. Just looking for some
confirmation as well as a suitable workaround (like doing it in kernel mode
driver - would it work there?).
Regards
"Luca Calligaris [eMVP]" <luca.callig...@eurotech.com.nospam> wrote
in message news:ejdqqbzb...@TK2MSFTNGP05.phx.gbl...
// validate the ptr is a valid user ptr
if (fUMode && !IsValidUsrPtr ((LPCVOID)pArgs[idx],
pSizeArgs[idx], dwCurSig & ARG_O_BIT)) {
DEBUGMSG (1, (L"ValidateArgs: Arg %u invalid pointer
0x%08x\r\n", idx, pArgs[idx]));
return ERROR_INVALID_PARAMETER;
}
The definition of IsValidUsrPtr is in public\common\oak\inc\vmlayout.h, so
it is obviously any User Mode pointer that above 2G (0x80000000) will
definitely be NO NO to kernel. And back to your question, a kernel mode DLL
should be fine with pointer above 2GB.
"Windows Programmer" <win...@programmer.com> wrote in message
news:u$X8Ea2bK...@TK2MSFTNGP02.phx.gbl...
Thanks for your research. Looks pretty conclusive!
"KMOS" <kmos_i...@rocketmail.com> wrote in message
news:#IZxMwFc...@TK2MSFTNGP05.phx.gbl...
"Windows Programmer" <win...@programmer.com> wrote in message
news:eTQwjHMc...@TK2MSFTNGP04.phx.gbl...