- Implemented MEMORY_AREA_PEB_OR_TEB and MEMORY_AREA_PAGED_POOL for MiQueryVirtualMemory.

- Fixed the range check in ProbeForRead and ProbeForWrite.

svn path=/trunk/; revision=17307
This commit is contained in:
Hartmut Birr 2005-08-11 20:35:00 +00:00
parent b4315630d7
commit 20731f1883

View file

@ -175,6 +175,7 @@ MiQueryVirtualMemory (IN HANDLE ProcessHandle,
switch(MemoryArea->Type)
{
case MEMORY_AREA_VIRTUAL_MEMORY:
case MEMORY_AREA_PEB_OR_TEB:
Status = MmQueryAnonMem(MemoryArea, Address, Info,
ResultLength);
break;
@ -230,6 +231,18 @@ MiQueryVirtualMemory (IN HANDLE ProcessHandle,
Status = STATUS_SUCCESS;
*ResultLength = sizeof(MEMORY_BASIC_INFORMATION);
break;
case MEMORY_AREA_PAGED_POOL:
Info->Type = 0;
Info->State = MEM_COMMIT;
Info->Protect = MemoryArea->Attributes;
Info->AllocationProtect = MemoryArea->Attributes;
Info->BaseAddress = MemoryArea->StartingAddress;
Info->AllocationBase = MemoryArea->StartingAddress;
Info->RegionSize = (ULONG_PTR)MemoryArea->EndingAddress -
(ULONG_PTR)MemoryArea->StartingAddress;
Status = STATUS_SUCCESS;
*ResultLength = sizeof(MEMORY_BASIC_INFORMATION);
break;
default:
DPRINT1("unhandled memory area type: 0x%x\n", MemoryArea->Type);
Status = STATUS_UNSUCCESSFUL;
@ -1001,7 +1014,7 @@ ProbeForRead (IN CONST VOID *Address,
ExRaiseStatus (STATUS_DATATYPE_MISALIGNMENT);
}
else if ((ULONG_PTR)Address + Length - 1 < (ULONG_PTR)Address ||
(ULONG_PTR)Address + Length - 1 > (ULONG_PTR)MmUserProbeAddress)
(ULONG_PTR)Address + Length - 1 >= (ULONG_PTR)MmUserProbeAddress)
{
ExRaiseStatus (STATUS_ACCESS_VIOLATION);
}
@ -1031,7 +1044,7 @@ ProbeForWrite (IN CONST VOID *Address,
Last = (PCHAR)((ULONG_PTR)Address + Length - 1);
if ((ULONG_PTR)Last < (ULONG_PTR)Address ||
(ULONG_PTR)Last > (ULONG_PTR)MmUserProbeAddress)
(ULONG_PTR)Last >= (ULONG_PTR)MmUserProbeAddress)
{
ExRaiseStatus (STATUS_ACCESS_VIOLATION);
}