https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5aaadf39db0108057d5c3a...
commit 5aaadf39db0108057d5c3aaf983233e567715a27 Author: Pierre Schweitzer pierre@reactos.org AuthorDate: Mon Aug 13 08:23:44 2018 +0200 Commit: Pierre Schweitzer pierre@reactos.org CommitDate: Mon Aug 13 08:30:17 2018 +0200
[NTOSKRNL] Dereference page file objects in MM shutdown phase 1
Hack the call the MM shutdown phase 1 --- ntoskrnl/mm/shutdown.c | 13 +++++++++++++ ntoskrnl/po/poshtdwn.c | 5 +++++ 2 files changed, 18 insertions(+)
diff --git a/ntoskrnl/mm/shutdown.c b/ntoskrnl/mm/shutdown.c index 50522dd4e8..d4093015ff 100644 --- a/ntoskrnl/mm/shutdown.c +++ b/ntoskrnl/mm/shutdown.c @@ -39,8 +39,21 @@ MmShutdownSystem(IN ULONG Phase) { MiShutdownSystem(); } + else if (Phase == 1) + { + ULONG i; + + /* Loop through all the paging files */ + for (i = 0; i < MmNumberOfPagingFiles; i++) + { + /* And dereference them */ + ObDereferenceObject(MmPagingFile[i]->FileObject); + } + } else { + ASSERT(Phase == 2); + UNIMPLEMENTED; } } diff --git a/ntoskrnl/po/poshtdwn.c b/ntoskrnl/po/poshtdwn.c index 070cf67e54..8a33157fd0 100644 --- a/ntoskrnl/po/poshtdwn.c +++ b/ntoskrnl/po/poshtdwn.c @@ -294,6 +294,11 @@ PopGracefulShutdown(IN PVOID Context) IoShutdownSystem(1); CcWaitForCurrentLazyWriterActivity();
+ /* FIXME: Calling Mm shutdown phase 1 here to get page file dereference + * but it shouldn't be called here. Only phase 2 should be called. + */ + MmShutdownSystem(1); + /* Note that here, we should broadcast the power IRP to devices */
/* In this step, the HAL disables any wake timers */