Merged MmReleaseMemoryArea into MmReleaseMmInfo.

We can only release the address space look if we are calling MmUnmapViewOfSection.

svn path=/trunk/; revision=18850
This commit is contained in:
Hartmut Birr 2005-10-29 14:12:20 +00:00
parent 5e158693d9
commit f4d5030a94

View file

@ -28,32 +28,38 @@ MM_STATS MmStats;
/* FUNCTIONS ****************************************************************/ /* 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", MmLockAddressSpace(&Process->AddressSpace);
Marea, Marea->StartingAddress, Marea->EndingAddress,
Marea->Type);
switch (Marea->Type) while ((MemoryArea = Process->AddressSpace.MemoryAreaRoot) != NULL)
{
switch (MemoryArea->Type)
{ {
case MEMORY_AREA_SECTION_VIEW: case MEMORY_AREA_SECTION_VIEW:
Status = MmUnmapViewOfSection(Process, (PVOID)Marea->StartingAddress); Address = (PVOID)MemoryArea->StartingAddress;
ASSERT(Status == STATUS_SUCCESS); MmUnlockAddressSpace(&Process->AddressSpace);
return(STATUS_SUCCESS); MmUnmapViewOfSection(Process, Address);
MmLockAddressSpace(&Process->AddressSpace);
break;
case MEMORY_AREA_VIRTUAL_MEMORY: case MEMORY_AREA_VIRTUAL_MEMORY:
case MEMORY_AREA_PEB_OR_TEB: case MEMORY_AREA_PEB_OR_TEB:
MmFreeVirtualMemory(Process, Marea); MmFreeVirtualMemory(Process, MemoryArea);
break; break;
case MEMORY_AREA_SHARED_DATA: case MEMORY_AREA_SHARED_DATA:
case MEMORY_AREA_NO_ACCESS: case MEMORY_AREA_NO_ACCESS:
Status = MmFreeMemoryArea(&Process->AddressSpace, MmFreeMemoryArea(&Process->AddressSpace,
Marea, MemoryArea,
NULL, NULL,
NULL); NULL);
break; break;
@ -65,21 +71,7 @@ NTSTATUS MmReleaseMemoryArea(PEPROCESS Process, PMEMORY_AREA Marea)
default: default:
KEBUGCHECK(0); 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); Mmi386ReleaseMmInfo(Process);