[KMTESTS:CC] Truncate file cache on uninitialize to avoid leaking a reference. ROSTES... 435/head
authorThomas Faber <thomas.faber@reactos.org>
Sat, 17 Mar 2018 15:04:28 +0000 (16:04 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 17 Mar 2018 15:39:23 +0000 (16:39 +0100)
modules/rostests/kmtests/ntos_cc/CcCopyRead_drv.c
modules/rostests/kmtests/ntos_cc/CcMapData_drv.c

index d0ba58c..142e996 100644 (file)
@@ -156,6 +156,7 @@ TestIrpHandler(
     _In_ PIRP Irp,
     _In_ PIO_STACK_LOCATION IoStack)
 {
+    LARGE_INTEGER Zero = RTL_CONSTANT_LARGE_INTEGER(0LL);
     NTSTATUS Status;
     PTEST_FCB Fcb;
     CACHE_UNINITIALIZE_EVENT CacheUninitEvent;
@@ -307,7 +308,7 @@ TestIrpHandler(
     {
         ok_irql(PASSIVE_LEVEL);
         KeInitializeEvent(&CacheUninitEvent.Event, NotificationEvent, FALSE);
-        CcUninitializeCacheMap(IoStack->FileObject, NULL, &CacheUninitEvent);
+        CcUninitializeCacheMap(IoStack->FileObject, &Zero, &CacheUninitEvent);
         KeWaitForSingleObject(&CacheUninitEvent.Event, Executive, KernelMode, FALSE, NULL);
         Fcb = IoStack->FileObject->FsContext;
         ExFreePoolWithTag(Fcb, 'FwrI');
index 8fd6f6b..b4e632e 100644 (file)
@@ -198,6 +198,7 @@ CleanupTest(
     ULONG TestId,
     PDEVICE_OBJECT DeviceObject)
 {
+    LARGE_INTEGER Zero = RTL_CONSTANT_LARGE_INTEGER(0LL);
     CACHE_UNINITIALIZE_EVENT CacheUninitEvent;
 
     ok_eq_pointer(TestDeviceObject, DeviceObject);
@@ -208,7 +209,7 @@ CleanupTest(
         if (CcIsFileCached(TestFileObject))
         {
             KeInitializeEvent(&CacheUninitEvent.Event, NotificationEvent, FALSE);
-            CcUninitializeCacheMap(TestFileObject, NULL, &CacheUninitEvent);
+            CcUninitializeCacheMap(TestFileObject, &Zero, &CacheUninitEvent);
             KeWaitForSingleObject(&CacheUninitEvent.Event, Executive, KernelMode, FALSE, NULL);
         }