2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/mm/procsup.c
5 * PURPOSE: Memory functions related to Processes
7 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
10 /* INCLUDES *****************************************************************/
16 /* FUNCTIONS *****************************************************************/
20 MmDeleteProcessAddressSpace(PEPROCESS Process
)
23 PMEMORY_AREA MemoryArea
;
25 DPRINT("MmDeleteProcessAddressSpace(Process %x (%s))\n", Process
,
26 Process
->ImageFileName
);
28 MmLockAddressSpace(&Process
->Vm
);
30 while ((MemoryArea
= (PMEMORY_AREA
)Process
->Vm
.WorkingSetExpansionLinks
.Flink
) != NULL
)
32 switch (MemoryArea
->Type
)
34 case MEMORY_AREA_SECTION_VIEW
:
35 Address
= (PVOID
)MemoryArea
->StartingAddress
;
36 MmUnlockAddressSpace(&Process
->Vm
);
37 MmUnmapViewOfSection(Process
, Address
);
38 MmLockAddressSpace(&Process
->Vm
);
41 case MEMORY_AREA_VIRTUAL_MEMORY
:
42 MmFreeVirtualMemory(Process
, MemoryArea
);
45 case MEMORY_AREA_OWNED_BY_ARM3
:
46 MmFreeMemoryArea(&Process
->Vm
,
53 KeBugCheck(MEMORY_MANAGEMENT
);
57 MmUnlockAddressSpace(&Process
->Vm
);
59 DPRINT("Finished MmReleaseMmInfo()\n");
60 return(STATUS_SUCCESS
);