[KMTESTS:CC] Add a test for pinning without access

This commit is contained in:
Pierre Schweitzer 2018-09-01 12:40:24 +02:00
parent f96f1224a7
commit 38487d63d8
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
2 changed files with 20 additions and 2 deletions

View file

@ -217,6 +217,8 @@ PerformTest(
Fcb = ExAllocatePool(NonPagedPool, sizeof(TEST_FCB));
if (!skip(Fcb != NULL, "ExAllocatePool failed\n"))
{
BOOLEAN PinAccess = (TestId != 4);
RtlZeroMemory(Fcb, sizeof(TEST_FCB));
ExInitializeFastMutex(&Fcb->HeaderMutex);
FsRtlSetupAdvancedHeader(&Fcb->Header, &Fcb->HeaderMutex);
@ -225,7 +227,7 @@ PerformTest(
TestFileObject->SectionObjectPointer = &Fcb->SectionObjectPointers;
KmtStartSeh();
CcInitializeCacheMap(TestFileObject, &FileSizes, TRUE, &Callbacks, NULL);
CcInitializeCacheMap(TestFileObject, &FileSizes, PinAccess, &Callbacks, NULL);
KmtEndSeh(STATUS_SUCCESS);
if (!skip(CcIsFileCached(TestFileObject) == TRUE, "CcInitializeCacheMap failed\n"))
@ -300,6 +302,21 @@ PerformTest(
ExFreePool(TestContext);
}
}
else if (TestId == 4)
{
Ret = FALSE;
Offset.QuadPart = 0x1000;
KmtStartSeh();
Ret = CcPinRead(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_WAIT, &Bcb, (PVOID *)&Buffer);
KmtEndSeh(STATUS_SUCCESS);
if (!skip(Ret == TRUE, "CcPinRead failed\n"))
{
ok_eq_ulong(Buffer[0x2000 / sizeof(ULONG)], 0);
CcUnpinData(Bcb);
}
}
}
}
}

View file

@ -20,8 +20,9 @@ START_TEST(CcPinRead)
/* 3 tests for offset
* 1 test for BCB
* 1 test for pinning access
*/
for (TestId = 0; TestId < 4; ++TestId)
for (TestId = 0; TestId < 5; ++TestId)
{
Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId);
ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);