[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
This commit is contained in:
Pierre Schweitzer 2016-08-10 07:39:20 +00:00
parent 831a53f80f
commit f27ecf0960
2 changed files with 20 additions and 1 deletions

View file

@ -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");

View file

@ -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();