[NTOSKRNL] Dereference page file objects in MM shutdown phase 1
authorPierre Schweitzer <pierre@reactos.org>
Mon, 13 Aug 2018 06:23:44 +0000 (08:23 +0200)
committerPierre Schweitzer <pierre@reactos.org>
Mon, 13 Aug 2018 06:30:17 +0000 (08:30 +0200)
Hack the call the MM shutdown phase  1

ntoskrnl/mm/shutdown.c
ntoskrnl/po/poshtdwn.c

index 50522dd..d409301 100644 (file)
@@ -39,8 +39,21 @@ MmShutdownSystem(IN ULONG Phase)
     {
         MiShutdownSystem();
     }
     {
         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
     {
     else
     {
+        ASSERT(Phase == 2);
+
         UNIMPLEMENTED;
     }
 }
         UNIMPLEMENTED;
     }
 }
index 070cf67..8a33157 100644 (file)
@@ -294,6 +294,11 @@ PopGracefulShutdown(IN PVOID Context)
     IoShutdownSystem(1);
     CcWaitForCurrentLazyWriterActivity();
 
     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 */
     /* Note that here, we should broadcast the power IRP to devices */
 
     /* In this step, the HAL disables any wake timers */