[KMTESTS:CC] Truncate file cache on uninitialize to avoid leaking a reference. ROSTESTS-264 ROSTESTS-300

This commit is contained in:
Thomas Faber 2018-03-17 16:04:28 +01:00
parent c100ec6e7b
commit d7ad37a165
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
2 changed files with 4 additions and 2 deletions

View 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);
}