Author: pschweitzer
Date: Wed Aug 10 07:39:20 2016
New Revision: 72182

URL: http://svn.reactos.org/svn/reactos?rev=72182&view=rev
Log:
[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

Modified:
    trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c
    trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c

Modified: trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c?rev=72182&r1=72181&r2=72182&view=diff
==============================================================================
--- trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c     [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_cc/CcCopyRead_drv.c     [iso-8859-1] Wed Aug 10 
07:39:20 2016
@@ -194,6 +194,13 @@
             Fcb->Header.AllocationSize.QuadPart = 1004;
             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
         {
@@ -262,7 +269,7 @@
         }
         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");

Modified: trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c?rev=72182&r1=72181&r2=72182&view=diff
==============================================================================
--- trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c    [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_cc/CcCopyRead_user.c    [iso-8859-1] Wed Aug 10 
07:39:20 2016
@@ -17,6 +17,7 @@
     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 @@
 
     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();


Reply via email to