Sync with trunk r58033.
[reactos.git] / ntoskrnl / po / poshtdwn.c
index dd5113e..e68be76 100644 (file)
@@ -9,6 +9,9 @@
 /* INCLUDES ******************************************************************/
 
 #include <ntoskrnl.h>
+#ifdef NEWCC
+#include "../cache/newcc.h"
+#endif
 #define NDEBUG
 #include <debug.h>
 
@@ -81,6 +84,7 @@ PopShutdownSystem(IN POWER_ACTION SystemAction)
 
             /* Try platform driver first, then legacy */
             //PopInvokeSystemStateHandler(PowerStateShutdownReset, NULL);
+            PopSetSystemPowerState(PowerSystemShutdown, SystemAction);
             HalReturnToFirmware(HalRebootRoutine);
             break;
 
@@ -99,7 +103,7 @@ PopShutdownSystem(IN POWER_ACTION SystemAction)
             //PopInvokeSystemStateHandler(PowerStateShutdownOff, NULL);
             
             /* ReactOS Hack */
-            PopSetSystemPowerState(PowerSystemShutdown);
+            PopSetSystemPowerState(PowerSystemShutdown, SystemAction);
             PopShutdownHandler();
 
             /* If that didn't work, call the HAL */
@@ -134,7 +138,7 @@ PopGracefulShutdown(IN PVOID Context)
         /* Get the next process */
         Process = PsGetNextProcess(Process);
     }
-    
+
     /* First, the HAL handles any "end of boot" special functionality */
     DPRINT1("HAL shutting down\n");
     HalEndOfBoot();
@@ -148,6 +152,11 @@ PopGracefulShutdown(IN PVOID Context)
     CmShutdownSystem();
     
     /* Note that modified pages should be written here (MiShutdownSystem) */
+#ifdef NEWCC
+       /* Flush all user files before we start shutting down IO */
+       /* This is where modified pages are written back by the IO manager */
+       CcShutdownSystem();
+#endif
 
     /* In this step, the I/O manager does last-chance shutdown notification */
     DPRINT1("I/O manager shutting down in phase 1\n");