NtQueryVirtualMemory issue/fix
med0x2e opened this issue · 3 comments
med0x2e commented
Hi,
I've been trying to get NtQueryVirtualMemory to work in a sample x64 PoC with the current generated NQVM prototype; the call to NQVM keep failing with "0xc0000005" error code.
the current generated prototype:
NTSTATUS status = NtQueryVirtualMemory(hProcess, (PVOID)p_addr, MemoryBasicInformation, &memInfo, sizeof(memInfo), &retBytes);
EXTERN_C NTSTATUS NtQueryVirtualMemory(
IN HANDLE ProcessHandle,
IN PVOID BaseAddress,
IN MEMORY_INFORMATION_CLASS MemoryInformationClass,
OUT PVOID MemoryInformation,
IN ULONG MemoryInformationLength, <====
OUT PULONG ReturnLength OPTIONAL);
I had to change the "MemoryInformationLength" type to ULONG_PTR (unsigned long long) to get it working;
NTSTATUS status = NtQueryVirtualMemory(hProcess, (PVOID)p_addr, MemoryBasicInformation, &memInfo, sizeof(memInfo), &retBytes);
EXTERN_C NTSTATUS NtQueryVirtualMemory(
IN HANDLE ProcessHandle,
IN PVOID BaseAddress,
IN MEMORY_INFORMATION_CLASS MemoryInformationClass,
OUT PVOID MemoryInformation,
IN ULONG_PTR MemoryInformationLength, <<====
OUT PULONG ReturnLength OPTIONAL);
OS: Windows 10
Build Number: 18363
jthuraisamy commented
med0x2e commented
Tested your fix & worked as well.
Thanks :)
jthuraisamy commented
Glad it worked; thanks for reporting this issue!