diff --git a/reactos/ntoskrnl/cc/view.c b/reactos/ntoskrnl/cc/view.c index 72e70c99f4e..fcdefc4d032 100644 --- a/reactos/ntoskrnl/cc/view.c +++ b/reactos/ntoskrnl/cc/view.c @@ -189,6 +189,7 @@ CcRosFlushDirtyPages(ULONG Target, PULONG Count) (*Count) = 0; + KeEnterCriticalRegion(); KeAcquireGuardedMutex(&ViewLock); WriteCount[0] = WriteCount[1]; @@ -278,6 +279,7 @@ CcRosFlushDirtyPages(ULONG Target, PULONG Count) } KeReleaseGuardedMutex(&ViewLock); + KeLeaveCriticalRegion(); DPRINT("CcRosFlushDirtyPages() finished\n"); return(STATUS_SUCCESS); diff --git a/reactos/ntoskrnl/po/power.c b/reactos/ntoskrnl/po/power.c index 971691fa765..a163b98bc48 100644 --- a/reactos/ntoskrnl/po/power.c +++ b/reactos/ntoskrnl/po/power.c @@ -659,6 +659,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) || @@ -742,9 +743,12 @@ NtSetSystemPowerState(IN POWER_ACTION SystemAction, /* Check if we're still in an invalid status */ if (!NT_SUCCESS(Status)) break; + + /* Flush dirty cache pages */ + CcRosFlushDirtyPages(-1, &Dummy); /* 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 */