https://git.reactos.org/?p=reactos.git;a=commitdiff;h=991db73e375af22102151…
commit 991db73e375af22102151a585974652b4061d798
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sat Oct 13 18:53:08 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sat Oct 13 18:53:08 2018 +0200
[KMTESTS:CC] Add more tests for CcPinMappedData()
---
.../rostests/kmtests/ntos_cc/CcPinMappedData_drv.c | 48 +++++++++++++++++++++-
.../kmtests/ntos_cc/CcPinMappedData_user.c | 2 +-
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c
b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c
index 5f52301cce..06cbc95987 100644
--- a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c
+++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c
@@ -150,7 +150,7 @@ PerformTest(
ULONG TestId,
PDEVICE_OBJECT DeviceObject)
{
- PVOID Bcb, PinBcb;
+ PVOID Bcb, PinBcb, NewBcb;
BOOLEAN Ret;
PULONG Buffer;
PTEST_FCB Fcb;
@@ -184,7 +184,7 @@ PerformTest(
if (TestId == 0)
{
Ret = FALSE;
- Offset.QuadPart = TestId * 0x1000;
+ Offset.QuadPart = 0;
KmtStartSeh();
Ret = CcMapData(TestFileObject, &Offset,
FileSizes.FileSize.QuadPart - Offset.QuadPart, MAP_WAIT, &Bcb, (PVOID *)&Buffer);
KmtEndSeh(STATUS_SUCCESS);
@@ -211,6 +211,50 @@ PerformTest(
CcUnpinData(Bcb);
}
}
+ else if (TestId == 1)
+ {
+ Ret = FALSE;
+ Offset.QuadPart = 0;
+ KmtStartSeh();
+ Ret = CcPinRead(TestFileObject, &Offset,
FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_WAIT, &PinBcb, (PVOID
*)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+
+ if (!skip(Ret == TRUE, "CcPinRead failed\n"))
+ {
+ ok(*(PUSHORT)PinBcb == 0x2FD, "Not a BCB: %x\n",
*(PUSHORT)PinBcb);
+ ok_eq_ulong(Buffer[0x3000 / sizeof(ULONG)], 0xDEADBABE);
+
+ Ret = FALSE;
+ 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"))
+ {
+ ok(Bcb != PinBcb, "Returned same BCB!\n");
+
+ Ret = FALSE;
+ NewBcb = Bcb;
+ KmtStartSeh();
+ Ret = CcPinMappedData(TestFileObject, &Offset,
FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_WAIT, &NewBcb);
+ KmtEndSeh(STATUS_SUCCESS);
+
+ if (!skip(Ret == TRUE, "CcPinMappedData
failed\n"))
+ {
+ ok(Bcb != NewBcb, "Returned same BCB!\n");
+ ok_eq_pointer(NewBcb, PinBcb);
+ ok(*(PUSHORT)NewBcb == 0x2FD, "Not a BCB:
%x\n", *(PUSHORT)NewBcb);
+
+ /* Previous BCB isn't valid anymore! */
+ Bcb = NewBcb;
+ }
+
+ CcUnpinData(Bcb);
+ }
+
+ CcUnpinData(PinBcb);
+ }
+ }
}
}
}
diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c
b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c
index df3cc320a2..095d55ed1d 100644
--- a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c
+++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c
@@ -19,7 +19,7 @@ START_TEST(CcPinMappedData)
KmtOpenDriver();
/* 1 basic test */
- for (TestId = 0; TestId < 1; ++TestId)
+ for (TestId = 0; TestId < 2; ++TestId)
{
Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId);
ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);