[CMAKE]
[reactos.git] / ntoskrnl / po / power.c
index d745d76..359a035 100644 (file)
@@ -52,7 +52,7 @@ PopRequestPowerIrpCompletion(IN PDEVICE_OBJECT DeviceObject,
 
     IoFreeIrp(Irp);
 
-    return STATUS_SUCCESS;
+    return STATUS_MORE_PROCESSING_REQUIRED;
 }
 
 VOID
@@ -127,6 +127,7 @@ PopSetSystemPowerState(SYSTEM_POWER_STATE PowerState)
 
 BOOLEAN
 NTAPI
+INIT_FUNCTION
 PoInitSystem(IN ULONG BootPhase)
 {
     PVOID NotificationEntry;
@@ -216,6 +217,7 @@ PopIdle0(IN PPROCESSOR_POWER_STATE PowerState)
 
 VOID
 NTAPI
+INIT_FUNCTION
 PoInitializePrcb(IN PKPRCB Prcb)
 {
     /* Initialize the Power State */
@@ -370,7 +372,6 @@ PoRequestPowerIrp(IN PDEVICE_OBJECT DeviceObject,
     PIO_STACK_LOCATION Stack;
     PIRP Irp;
     PREQUEST_POWER_ITEM RequestPowerItem;
-    NTSTATUS Status;
   
     if (MinorFunction != IRP_MN_QUERY_POWER
         && MinorFunction != IRP_MN_SET_POWER
@@ -419,7 +420,7 @@ PoRequestPowerIrp(IN PDEVICE_OBJECT DeviceObject,
         *pIrp = Irp;
   
     IoSetCompletionRoutine(Irp, PopRequestPowerIrpCompletion, RequestPowerItem, TRUE, TRUE, TRUE);
-    Status = IoCallDriver(TopDeviceObject, Irp);
+    IoCallDriver(TopDeviceObject, Irp);
   
     /* Always return STATUS_PENDING. The completion routine
      * will call CompletionFunction and complete the Irp.
@@ -660,6 +661,7 @@ NtSetSystemPowerState(IN POWER_ACTION SystemAction,
     KPROCESSOR_MODE PreviousMode = KeGetPreviousMode();
     POP_POWER_ACTION Action = {0};
     NTSTATUS Status;
+    ULONG Dummy;
 
     /* Check for invalid parameter combinations */
     if ((MinSystemState >= PowerSystemMaximum) ||
@@ -743,9 +745,14 @@ NtSetSystemPowerState(IN POWER_ACTION SystemAction,
 
         /* Check if we're still in an invalid status */
         if (!NT_SUCCESS(Status)) break;
+        
+#ifndef NEWCC
+        /* Flush dirty cache pages */
+        CcRosFlushDirtyPages(-1, &Dummy);
+#endif
 
         /* Flush all volumes and the registry */
-        DPRINT1("Flushing volumes\n");
+        DPRINT1("Flushing volumes, cache flushed %d pages\n", Dummy);
         PopFlushVolumes(PopAction.Shutdown);
 
         /* Set IRP for drivers */