https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d7ad37a16574a9af72e43…
commit d7ad37a16574a9af72e43c0cd05bee53fffb468d
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sat Mar 17 16:04:28 2018 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sat Mar 17 16:39:23 2018 +0100
[KMTESTS:CC] Truncate file cache on uninitialize to avoid leaking a reference.
ROSTESTS-264 ROSTESTS-300
---
modules/rostests/kmtests/ntos_cc/CcCopyRead_drv.c | 3 ++-
modules/rostests/kmtests/ntos_cc/CcMapData_drv.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/rostests/kmtests/ntos_cc/CcCopyRead_drv.c
b/modules/rostests/kmtests/ntos_cc/CcCopyRead_drv.c
index d0ba58c6ff..142e996548 100644
--- a/modules/rostests/kmtests/ntos_cc/CcCopyRead_drv.c
+++ b/modules/rostests/kmtests/ntos_cc/CcCopyRead_drv.c
@@ -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');
diff --git a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
index 8fd6f6bd89..b4e632ec32 100644
--- a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
+++ b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
@@ -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);
}