- NDK 0.98, now with versionned headers. Too many changes to list, see the TinyKRNL...
[reactos.git] / reactos / ntoskrnl / mm / anonmem.c
index ffb1257..548ff4a 100644 (file)
@@ -22,7 +22,6 @@
  * PURPOSE:         Implementing anonymous memory.
  *
  * PROGRAMMERS:     David Welch
- *                  Hartmut Birr
  *                  Casper Hornstrup
  *                  KJK::Hyperion
  *                  Ge van Geldorp
@@ -137,7 +136,7 @@ MmPageOutVirtualMemory(PMADDRESS_SPACE AddressSpace,
                        PMM_PAGEOP PageOp)
 {
    PFN_TYPE Page;
-   BOOL WasDirty;
+   BOOLEAN WasDirty;
    SWAPENTRY SwapEntry;
    NTSTATUS Status;
 
@@ -545,7 +544,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
  * RETURNS: Status
  */
 {
-   PEPROCESS Process;
+   PROS_EPROCESS Process;
    MEMORY_AREA* MemoryArea;
    ULONG_PTR MemoryAreaLength;
    ULONG Type;
@@ -727,15 +726,14 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
       }
    }
 
-   Status = MmCreateMemoryArea(Process,
-                               AddressSpace,
+   Status = MmCreateMemoryArea(AddressSpace,
                                MEMORY_AREA_VIRTUAL_MEMORY,
                                &BaseAddress,
                                RegionSize,
                                Protect,
                                &MemoryArea,
                                PBaseAddress != 0,
-                               (AllocationType & MEM_TOP_DOWN) == MEM_TOP_DOWN,
+                               AllocationType & MEM_TOP_DOWN,
                                BoundaryAddressMultiple);
    if (!NT_SUCCESS(Status))
    {
@@ -748,7 +746,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
    MemoryAreaLength = (ULONG_PTR)MemoryArea->EndingAddress -
                       (ULONG_PTR)MemoryArea->StartingAddress;
 
-   MmInitialiseRegion(&MemoryArea->Data.VirtualMemoryData.RegionListHead,
+   MmInitializeRegion(&MemoryArea->Data.VirtualMemoryData.RegionListHead,
                       MemoryAreaLength, Type, Protect);
 
    if ((AllocationType & MEM_COMMIT) &&
@@ -786,7 +784,7 @@ MmFreeVirtualMemoryPage(PVOID Context,
          MmFreeSwapPage(SavedSwapEntry);
          MmSetSavedSwapEntryPage(Page, 0);
       }
-      MmDeleteRmap(Page, Process, Address);
+      MmDeleteRmap(Page, (PROS_EPROCESS)Process, Address);
       MmReleasePageMemoryConsumer(MC_USER, Page);
    }
    else if (SwapEntry != 0)
@@ -797,7 +795,7 @@ MmFreeVirtualMemoryPage(PVOID Context,
 
 VOID
 NTAPI
-MmFreeVirtualMemory(PEPROCESS Process,
+MmFreeVirtualMemory(PROS_EPROCESS Process,
                     PMEMORY_AREA MemoryArea)
 {
    PLIST_ENTRY current_entry;
@@ -891,7 +889,7 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
 {
    MEMORY_AREA* MemoryArea;
    NTSTATUS Status;
-   PEPROCESS Process;
+   PROS_EPROCESS Process;
    PMADDRESS_SPACE AddressSpace;
    PVOID BaseAddress;
    ULONG RegionSize;
@@ -991,7 +989,7 @@ MmQueryAnonMem(PMEMORY_AREA MemoryArea,
                PULONG ResultLength)
 {
    PMM_REGION Region;
-   PVOID RegionBase;
+   PVOID RegionBase = NULL;
 
    Info->BaseAddress = (PVOID)PAGE_ROUND_DOWN(Address);
 
@@ -1000,7 +998,7 @@ MmQueryAnonMem(PMEMORY_AREA MemoryArea,
                          Address, &RegionBase);
    Info->BaseAddress = RegionBase;
    Info->AllocationBase = MemoryArea->StartingAddress;
-   Info->AllocationProtect = MemoryArea->Attributes;
+   Info->AllocationProtect = MemoryArea->Protect;
    Info->RegionSize = Region->Length;
    Info->State = Region->Type;
    Info->Protect = Region->Protect;