[KMTESTS:CC] Add tests for CcCopyRead that reproduce CORE-15067

CORE-15067
This commit is contained in:
Pierre Schweitzer 2018-09-21 08:35:38 +02:00
parent 15a3ca08b0
commit 351ae6b2b4
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
2 changed files with 29 additions and 2 deletions

View file

@ -18,6 +18,7 @@ START_TEST(CcCopyRead)
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");
UNICODE_STRING FileBig = RTL_CONSTANT_STRING(L"\\Device\\Kmtest-CcCopyRead\\FileBig");
KmtLoadDriver(L"CcCopyRead", FALSE);
KmtOpenDriver();
@ -89,6 +90,17 @@ START_TEST(CcCopyRead)
NtClose(Handle);
InitializeObjectAttributes(&ObjectAttributes, &FileBig, 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 = 0;
Status = NtReadFile(Handle, NULL, NULL, NULL, &IoStatusBlock, Buffer, 1024, &ByteOffset, NULL);
ok_eq_hex(Status, STATUS_SUCCESS);
ok_eq_hex(((USHORT *)Buffer)[0], 0xBABA);
NtClose(Handle);
RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
KmtCloseDriver();
KmtUnloadDriver();