https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9ab21d67aef7db1f7621c…
commit 9ab21d67aef7db1f7621c22aade1a2ed4c5babcb
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Sep 1 21:52:39 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Sep 1 21:52:39 2018 +0200
[KMTESTS:CC] Add tests for BCB extension
---
modules/rostests/kmtests/ntos_cc/CcMapData_drv.c | 15 +++++
modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c | 74 ++++++++++++++++++++++++
2 files changed, 89 insertions(+)
diff --git a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
index 0d84f21c31..516d55fe22 100644
--- a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
+++ b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
@@ -212,6 +212,21 @@ MapInAnotherThread(IN PVOID Context)
CcUnpinData(Bcb);
}
+ Offset.QuadPart = 0x1500;
+ TestContext->Length -= 0x500;
+
+ KmtStartSeh();
+ Ret = CcMapData(TestFileObject, &Offset, TestContext->Length, MAP_WAIT,
&Bcb, (PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+
+ if (!skip(Ret == TRUE, "CcMapData failed\n"))
+ {
+ ok_eq_pointer(Bcb, TestContext->Bcb);
+ ok_eq_pointer(Buffer, (PVOID)((ULONG_PTR)TestContext->Buffer + 0x500));
+
+ CcUnpinData(Bcb);
+ }
+
return;
}
diff --git a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
index 68e666c1b3..58f8808fcd 100644
--- a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
+++ b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
@@ -214,6 +214,45 @@ PinInAnotherThread(IN PVOID Context)
CcUnpinData(Bcb);
}
+ Offset.QuadPart = 0x1500;
+ TestContext->Length -= 0x500;
+
+ 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, (PVOID)((ULONG_PTR)TestContext->Buffer + 0x500));
+
+ CcUnpinData(Bcb);
+ }
+
+ KmtStartSeh();
+ Ret = CcPinRead(TestFileObject, &Offset, TestContext->Length, PIN_WAIT,
&Bcb, (PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+
+ if (!skip(Ret == TRUE, "CcPinRead failed\n"))
+ {
+ ok_eq_pointer(Bcb, TestContext->Bcb);
+ ok_eq_pointer(Buffer, (PVOID)((ULONG_PTR)TestContext->Buffer + 0x500));
+
+ CcUnpinData(Bcb);
+ }
+
+ KmtStartSeh();
+ Ret = CcPinRead(TestFileObject, &Offset, TestContext->Length, PIN_EXCLUSIVE,
&Bcb, (PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+
+ if (!skip(Ret == TRUE, "CcPinRead failed\n"))
+ {
+ ok_eq_pointer(Bcb, TestContext->Bcb);
+ ok_eq_pointer(Buffer, (PVOID)((ULONG_PTR)TestContext->Buffer + 0x500));
+
+ CcUnpinData(Bcb);
+ }
+
return;
}
@@ -261,6 +300,41 @@ PinInAnotherThreadExclusive(IN PVOID Context)
CcUnpinData(Bcb);
}
+ Offset.QuadPart = 0x1500;
+ TestContext->Length -= 0x500;
+
+ KmtStartSeh();
+ Ret = CcPinRead(TestFileObject, &Offset, TestContext->Length, PIN_IF_BCB,
&Bcb, (PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+ ok(Ret == FALSE, "CcPinRead succeed\n");
+
+ if (Ret)
+ {
+ CcUnpinData(Bcb);
+ }
+
+ KmtStartSeh();
+ Ret = CcPinRead(TestFileObject, &Offset, TestContext->Length, 0, &Bcb,
(PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+ ok(Ret == FALSE, "CcPinRead succeed\n");
+
+ if (Ret)
+ {
+ CcUnpinData(Bcb);
+ }
+
+ KmtStartSeh();
+ Ret = CcMapData(TestFileObject, &Offset, TestContext->Length, 0, &Bcb,
(PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+
+ if (!skip(Ret == TRUE, "CcMapData failed\n"))
+ {
+ ok(Bcb != TestContext->Bcb, "Returned same BCB!\n");
+ ok_eq_pointer(Buffer, (PVOID)((ULONG_PTR)TestContext->Buffer + 0x500));
+
+ CcUnpinData(Bcb);
+ }
+
return;
}