Merged MmReleaseMemoryArea into MmReleaseMmInfo.
We can only release the address space look if we are calling
MmUnmapViewOfSection.
Modified: trunk/reactos/ntoskrnl/mm/mm.c
_____
Modified: trunk/reactos/ntoskrnl/mm/mm.c
--- trunk/reactos/ntoskrnl/mm/mm.c 2005-10-29 14:10:35 UTC (rev
18849)
+++ trunk/reactos/ntoskrnl/mm/mm.c 2005-10-29 14:12:20 UTC (rev
18850)
@@ -28,59 +28,51 @@
/* FUNCTIONS
****************************************************************/
-NTSTATUS MmReleaseMemoryArea(PEPROCESS Process, PMEMORY_AREA Marea)
+NTSTATUS
+NTAPI
+MmReleaseMmInfo(PEPROCESS Process)
{
- NTSTATUS Status;
+ PVOID Address;
+ PMEMORY_AREA MemoryArea;
- DPRINT("MmReleaseMemoryArea(Process %x, Marea %x)\n",Process,Marea);
+ DPRINT("MmReleaseMmInfo(Process %x (%s))\n", Process,
+ Process->ImageFileName);
- DPRINT("Releasing %x between %x %x (type %d)\n",
- Marea, Marea->StartingAddress, Marea->EndingAddress,
- Marea->Type);
+ MmLockAddressSpace(&Process->AddressSpace);
- switch (Marea->Type)
+ while ((MemoryArea = Process->AddressSpace.MemoryAreaRoot) != NULL)
{
- case MEMORY_AREA_SECTION_VIEW:
- Status = MmUnmapViewOfSection(Process,
(PVOID)Marea->StartingAddress);
- ASSERT(Status == STATUS_SUCCESS);
- return(STATUS_SUCCESS);
+ switch (MemoryArea->Type)
+ {
+ case MEMORY_AREA_SECTION_VIEW:
+ Address = (PVOID)MemoryArea->StartingAddress;
+ MmUnlockAddressSpace(&Process->AddressSpace);
+ MmUnmapViewOfSection(Process, Address);
+ MmLockAddressSpace(&Process->AddressSpace);
+ break;
- case MEMORY_AREA_VIRTUAL_MEMORY:
- case MEMORY_AREA_PEB_OR_TEB:
- MmFreeVirtualMemory(Process, Marea);
- break;
+ case MEMORY_AREA_VIRTUAL_MEMORY:
+ case MEMORY_AREA_PEB_OR_TEB:
+ MmFreeVirtualMemory(Process, MemoryArea);
+ break;
- case MEMORY_AREA_SHARED_DATA:
- case MEMORY_AREA_NO_ACCESS:
- Status = MmFreeMemoryArea(&Process->AddressSpace,
- Marea,
- NULL,
- NULL);
- break;
+ case MEMORY_AREA_SHARED_DATA:
+ case MEMORY_AREA_NO_ACCESS:
+ MmFreeMemoryArea(&Process->AddressSpace,
+ MemoryArea,
+ NULL,
+ NULL);
+ break;
- case MEMORY_AREA_MDL_MAPPING:
- KEBUGCHECK(PROCESS_HAS_LOCKED_PAGES);
- break;
+ case MEMORY_AREA_MDL_MAPPING:
+ KEBUGCHECK(PROCESS_HAS_LOCKED_PAGES);
+ break;
- default:
- KEBUGCHECK(0);
+ default:
+ KEBUGCHECK(0);
+ }
}
- return(STATUS_SUCCESS);
-}
-
-NTSTATUS
-NTAPI
-MmReleaseMmInfo(PEPROCESS Process)
-{
- DPRINT("MmReleaseMmInfo(Process %x (%s))\n", Process,
- Process->ImageFileName);
-
- MmLockAddressSpace(&Process->AddressSpace);
-
- while (Process->AddressSpace.MemoryAreaRoot != NULL)
- MmReleaseMemoryArea(Process,
Process->AddressSpace.MemoryAreaRoot);
-
Mmi386ReleaseMmInfo(Process);
MmUnlockAddressSpace(&Process->AddressSpace);
Show replies by date