[KMTESTS:CC] Add more tests for CcPinMappedData()
authorPierre Schweitzer <pierre@reactos.org>
Sat, 13 Oct 2018 17:15:48 +0000 (19:15 +0200)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 13 Oct 2018 17:15:48 +0000 (19:15 +0200)
modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c
modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c

index 89b348f..1a41bf1 100644 (file)
@@ -353,6 +353,36 @@ PerformTest(
                         ExFreePool(TestContext);
                     }
                 }
+                else if (TestId == 3)
+                {
+                    Ret = FALSE;
+                    Offset.QuadPart = 0;
+                    KmtStartSeh();
+                    Ret = CcMapData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, MAP_WAIT, &Bcb, (PVOID *)&Buffer);
+                    KmtEndSeh(STATUS_SUCCESS);
+
+                    if (!skip(Ret == TRUE, "CcMapData failed\n"))
+                    {
+                        Ret = FALSE;
+                        PinBcb = Bcb;
+                        ok_eq_ulong(Buffer[0x3000 / sizeof(ULONG)], 0xDEADBABE);
+
+                        KmtStartSeh();
+                        Ret = CcPinMappedData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_IF_BCB, &PinBcb);
+                        KmtEndSeh(STATUS_SUCCESS);
+
+                        if (!skip(Ret == FALSE, "CcPinMappedData succeed\n"))
+                        {
+                            ok_eq_pointer(Bcb, PinBcb);
+                        }
+                        else
+                        {
+                            Bcb = PinBcb;
+                        }
+
+                        CcUnpinData(Bcb);
+                    }
+                }
             }
         }
     }
index 14bc2aa..21fe904 100644 (file)
@@ -19,7 +19,7 @@ START_TEST(CcPinMappedData)
     KmtOpenDriver();
 
     /* 1 basic test */
-    for (TestId = 0; TestId < 3; ++TestId)
+    for (TestId = 0; TestId < 4; ++TestId)
     {
         Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId);
         ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);