Author: tfaber
Date: Sun Aug 31 11:47:41 2014
New Revision: 64006
URL: 
http://svn.reactos.org/svn/reactos?rev=64006&view=rev
Log:
[NTOS:CC]
- Actually flush the whole file in CcFlushCache if FileOffset is NULL instead of just the
first 4GB
Modified:
    trunk/reactos/ntoskrnl/cc/view.c
Modified: trunk/reactos/ntoskrnl/cc/view.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cc/view.c?rev=640…
==============================================================================
--- trunk/reactos/ntoskrnl/cc/view.c    [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cc/view.c    [iso-8859-1] Sun Aug 31 11:47:41 2014
@@ -865,6 +865,7 @@
 {
     PROS_SHARED_CACHE_MAP SharedCacheMap;
     LARGE_INTEGER Offset;
+    LONGLONG RemainingLength;
     PROS_VACB current;
     NTSTATUS Status;
     KIRQL oldIrql;
@@ -879,11 +880,12 @@
         if (FileOffset)
         {
             Offset = *FileOffset;
+            RemainingLength = Length;
         }
         else
         {
-            Offset.QuadPart = (LONGLONG)0;
-            Length = SharedCacheMap->FileSize.u.LowPart;
+            Offset.QuadPart = 0;
+            RemainingLength = SharedCacheMap->FileSize.QuadPart;
         }
         if (IoStatus)
@@ -892,7 +894,7 @@
             IoStatus->Information = 0;
         }
-        while (Length > 0)
+        while (RemainingLength > 0)
         {
             current = CcRosLookupVacb(SharedCacheMap, Offset.u.LowPart);
             if (current != NULL)
@@ -915,14 +917,7 @@
             }
             Offset.QuadPart += VACB_MAPPING_GRANULARITY;
-            if (Length > VACB_MAPPING_GRANULARITY)
-            {
-                Length -= VACB_MAPPING_GRANULARITY;
-            }
-            else
-            {
-                Length = 0;
-            }
+            RemainingLength -= min(RemainingLength, VACB_MAPPING_GRANULARITY);
         }
     }
     else