From: Pierre Schweitzer Date: Wed, 10 Aug 2016 07:39:20 +0000 (+0000) Subject: [KMTESTS:CC] X-Git-Tag: backups/sndblst@72664~427 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=f27ecf09604e23a4701c37be6356e0356a862792 [KMTESTS:CC] New test case which is matching the MS FastFAT CcCopyRead (minus the offset) and shows clearly the issue in our Cc. It also shows that my hack is utterly broken :-). CORE-11003 CORE-11819 svn path=/trunk/; revision=72182 --- diff --git a/rostests/kmtests/ntos_cc/CcCopyRead_drv.c b/rostests/kmtests/ntos_cc/CcCopyRead_drv.c index a94dfbf9991..98b4d87e101 100644 --- a/rostests/kmtests/ntos_cc/CcCopyRead_drv.c +++ b/rostests/kmtests/ntos_cc/CcCopyRead_drv.c @@ -195,6 +195,13 @@ TestIrpHandler( Fcb->Header.FileSize.QuadPart = 1004; Fcb->Header.ValidDataLength.QuadPart = 1004; } + else if (IoStack->FileObject->FileName.Length >= 2 * sizeof(WCHAR) && + IoStack->FileObject->FileName.Buffer[1] == 'R') + { + Fcb->Header.AllocationSize.QuadPart = 62; + Fcb->Header.FileSize.QuadPart = 62; + Fcb->Header.ValidDataLength.QuadPart = 62; + } else { Fcb->Header.AllocationSize.QuadPart = 512; @@ -262,7 +269,7 @@ TestIrpHandler( } else { - ok(Offset.QuadPart % PAGE_SIZE == 0, "Offset is not aligned: %I64i\n", Offset.QuadPart); + ok((Offset.QuadPart % PAGE_SIZE == 0 || Offset.QuadPart == 0), "Offset is not aligned: %I64i\n", Offset.QuadPart); ok(Length % PAGE_SIZE == 0, "Length is not aligned: %I64i\n", Length); ok(Irp->AssociatedIrp.SystemBuffer == NULL, "A SystemBuffer was allocated!\n"); diff --git a/rostests/kmtests/ntos_cc/CcCopyRead_user.c b/rostests/kmtests/ntos_cc/CcCopyRead_user.c index fbcbae5e577..1dbc08a5ce4 100644 --- a/rostests/kmtests/ntos_cc/CcCopyRead_user.c +++ b/rostests/kmtests/ntos_cc/CcCopyRead_user.c @@ -17,6 +17,7 @@ START_TEST(CcCopyRead) PVOID Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, 1024); UNICODE_STRING BigAlignmentTest = RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\BigAlignmentTest"); UNICODE_STRING SmallAlignmentTest = RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\SmallAlignmentTest"); + UNICODE_STRING ReallySmallAlignmentTest = RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\ReallySmallAlignmentTest"); KmtLoadDriver(L"CcCopyRead", FALSE); KmtOpenDriver(); @@ -77,6 +78,17 @@ START_TEST(CcCopyRead) NtClose(Handle); + InitializeObjectAttributes(&ObjectAttributes, &ReallySmallAlignmentTest, OBJ_CASE_INSENSITIVE, NULL, NULL); + Status = NtOpenFile(&Handle, FILE_ALL_ACCESS, &ObjectAttributes, &IoStatusBlock, 0, FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT); + ok_eq_hex(Status, STATUS_SUCCESS); + + ByteOffset.QuadPart = 1; + Status = NtReadFile(Handle, NULL, NULL, NULL, &IoStatusBlock, Buffer, 61, &ByteOffset, NULL); + ok_eq_hex(Status, STATUS_SUCCESS); + ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA); + + NtClose(Handle); + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); KmtCloseDriver(); KmtUnloadDriver();