https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a4dc3c49636ff97af1661…
commit a4dc3c49636ff97af166184544dbe081c465ff60
Author:     Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Sep 1 12:29:09 2018 +0200
Commit:     Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Sep 1 12:41:01 2018 +0200
    [KMTESTS:CC] Add tests for PIN_IF_BCB flag
---
 modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
diff --git a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
index b2aac2fdf7..34ceb13696 100644
--- a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
+++ b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
@@ -178,6 +178,18 @@ PinInAnotherThread(IN PVOID Context)
         CcUnpinData(Bcb);
     }
+    KmtStartSeh();
+    Ret = CcPinRead(TestFileObject, &Offset, TestContext->Length, PIN_WAIT |
PIN_IF_BCB, &Bcb, (PVOID *)&Buffer);
+    KmtEndSeh(STATUS_SUCCESS);
+
+    if (!skip(Ret == TRUE, "CcPinRead failed\n"))
+    {
+        ok_eq_pointer(Bcb, TestContext->Bcb);
+        ok_eq_pointer(Buffer, TestContext->Buffer);
+
+        CcUnpinData(Bcb);
+    }
+
     return;
 }
@@ -242,6 +254,17 @@ PerformTest(
                     {
                         Ret = FALSE;
                         Offset.QuadPart = 0x1000;
+
+                        /* Try enforce BCB first */
+                        KmtStartSeh();
+                        Ret = CcPinRead(TestFileObject, &Offset,
FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_WAIT | PIN_IF_BCB, &Bcb, (PVOID
*)&Buffer);
+                        KmtEndSeh(STATUS_SUCCESS);
+                        ok(Ret == FALSE, "CcPinRead succeed\n");
+                        if (Ret)
+                        {
+                            CcUnpinData(Bcb);
+                        }
+
                         KmtStartSeh();
                         Ret = CcPinRead(TestFileObject, &Offset,
FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_WAIT, &TestContext->Bcb,
&TestContext->Buffer);
                         KmtEndSeh(STATUS_SUCCESS);