https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6929451500abaa7fadbb1c58de102a792e7ae27e
commit 6929451500abaa7fadbb1c58de102a792e7ae27e Author: Jérôme Gardou <jerome.gar...@reactos.org> AuthorDate: Mon Nov 9 10:37:10 2020 +0100 Commit: Jérôme Gardou <jerome.gar...@reactos.org> CommitDate: Tue Dec 22 11:35:30 2020 +0100 [KMTEST] Test what happens when CcSetFileSizes is called with data still mapped at the tail od the file --- .../rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c | 23 ++++++++++++++++++++-- .../rostests/kmtests/ntos_cc/CcSetFileSizes_user.c | 3 ++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c b/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c index 3d23ab54bec..241312c12c5 100644 --- a/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c +++ b/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_drv.c @@ -178,7 +178,7 @@ PerformTest( Fcb->Header.FileSize.QuadPart = VACB_MAPPING_GRANULARITY - PAGE_SIZE; Fcb->Header.ValidDataLength.QuadPart = VACB_MAPPING_GRANULARITY - PAGE_SIZE; - if ((TestId > 1 && TestId < 4) || TestId == 5) + if ((TestId > 1 && TestId < 4) || TestId >= 5) { Fcb->Header.AllocationSize.QuadPart = VACB_MAPPING_GRANULARITY - PAGE_SIZE; } @@ -315,6 +315,25 @@ PerformTest( } } } + else if (TestId == 6) + { + Offset.QuadPart = 0; + KmtStartSeh(); + Ret = CcMapData(TestFileObject, &Offset, VACB_MAPPING_GRANULARITY - PAGE_SIZE, MAP_WAIT, &Bcb, (PVOID *)&Buffer); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == TRUE, "CcMapData failed\n")) + { + ok_eq_ulong(Buffer[(VACB_MAPPING_GRANULARITY - PAGE_SIZE - sizeof(ULONG)) / sizeof(ULONG)], 0xBABABABA); + } + + KmtStartSeh(); + CcSetFileSizes(TestFileObject, &NewFileSizes); + KmtEndSeh(STATUS_SUCCESS); + + if (Ret == TRUE) + CcUnpinData(Bcb); + } } } } @@ -379,7 +398,7 @@ TestMessageHandler( ok_eq_ulong((ULONG)InLength, sizeof(ULONG)); PerformTest(*(PULONG)Buffer, DeviceObject); break; - + case IOCTL_FINISH_TEST: ok_eq_ulong((ULONG)InLength, sizeof(ULONG)); CleanupTest(*(PULONG)Buffer, DeviceObject); diff --git a/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_user.c b/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_user.c index d472c5ecc98..67bcc1df89e 100644 --- a/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_user.c +++ b/modules/rostests/kmtests/ntos_cc/CcSetFileSizes_user.c @@ -24,8 +24,9 @@ START_TEST(CcSetFileSizes) * 3: copy read - FS & AS * 4: dirty VACB - only FS * 5: dirty VACB - FS & AS + * 6: CcSetFileSizes with mapped data at tail of file */ - for (TestId = 0; TestId < 6; ++TestId) + for (TestId = 0; TestId < 7; ++TestId) { Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId); ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);