- Implemented MEMORY_AREA_PEB_OR_TEB and MEMORY_AREA_PAGED_POOL for MiQueryVirtualMemory.  
- Fixed the range check in ProbeForRead and ProbeForWrite.
Modified: trunk/reactos/ntoskrnl/mm/virtual.c

Modified: trunk/reactos/ntoskrnl/mm/virtual.c
--- trunk/reactos/ntoskrnl/mm/virtual.c	2005-08-11 20:29:08 UTC (rev 17306)
+++ trunk/reactos/ntoskrnl/mm/virtual.c	2005-08-11 20:35:00 UTC (rev 17307)
@@ -175,6 +175,7 @@
 	       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 @@
                      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 @@
       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 @@
 
    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);
    }