[NTOS] Improve MmCleanProcessAddressSpace

This commit is contained in:
Timo Kreuzer 2022-08-14 23:33:18 +03:00
parent 9fc56bfc9d
commit 10fbefdeb0

View file

@ -1270,12 +1270,17 @@ MmCleanProcessAddressSpace(IN PEPROCESS Process)
PMM_AVL_TABLE VadTree;
PETHREAD Thread = PsGetCurrentThread();
/* Only support this */
ASSERT(Process->AddressSpaceInitialized == 2);
/* Remove from the session */
MiSessionRemoveProcess();
/* Abort early, when the address space wasn't fully initialized */
if (Process->AddressSpaceInitialized < 2)
{
DPRINT1("Incomplete address space for Process %p. Might leak resources.\n",
Process);
return;
}
/* Lock the process address space from changes */
MmLockAddressSpace(&Process->Vm);
MiLockProcessWorkingSetUnsafe(Process, Thread);