https://git.reactos.org/?p=reactos.git;a=commitdiff;h=01c73317cc106f6cf5456…
commit 01c73317cc106f6cf545687327c83273d4294f33
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Sep 2 11:48:16 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Sep 2 11:50:23 2018 +0200
[KMTESTS:CC] Add tests showing our CcMapData/CcPinRead raise invalid status
---
modules/rostests/kmtests/ntos_cc/CcMapData_drv.c | 43 +++++++++++++++++++++++
modules/rostests/kmtests/ntos_cc/CcMapData_user.c | 3 +-
modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c | 43 +++++++++++++++++++++++
modules/rostests/kmtests/ntos_cc/CcPinRead_user.c | 3 +-
4 files changed, 90 insertions(+), 2 deletions(-)
diff --git a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
index 516d55fe22..3e86a3a55c 100644
--- a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
+++ b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c
@@ -326,6 +326,49 @@ PerformTest(
ExFreePool(TestContext);
}
}
+ else if (TestId == 4)
+ {
+ /* Map after EOF */
+ Ret = FALSE;
+ Offset.QuadPart = FileSizes.FileSize.QuadPart + 0x1000;
+
+ KmtStartSeh();
+ Ret = CcMapData(TestFileObject, &Offset, 0x1000, 0, &Bcb,
(PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+
+ if (!skip(Ret == TRUE, "CcMapData failed\n"))
+ {
+ CcUnpinData(Bcb);
+ }
+
+ /* Map a VACB after EOF */
+ Ret = FALSE;
+ Offset.QuadPart = FileSizes.FileSize.QuadPart + 0x1000 +
VACB_MAPPING_GRANULARITY;
+
+ KmtStartSeh();
+ Ret = CcMapData(TestFileObject, &Offset, 0x1000, 0, &Bcb,
(PVOID *)&Buffer);
+ KmtEndSeh(STATUS_ACCESS_VIOLATION);
+ ok(Ret == FALSE, "CcMapData succeed\n");
+
+ if (Ret)
+ {
+ CcUnpinData(Bcb);
+ }
+
+ /* Map more than a VACB */
+ Ret = FALSE;
+ Offset.QuadPart = 0x0;
+
+ KmtStartSeh();
+ Ret = CcMapData(TestFileObject, &Offset, 0x1000 +
VACB_MAPPING_GRANULARITY, 0, &Bcb, (PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+ ok(Ret == FALSE, "CcMapData succeed\n");
+
+ if (Ret)
+ {
+ CcUnpinData(Bcb);
+ }
+ }
}
}
}
diff --git a/modules/rostests/kmtests/ntos_cc/CcMapData_user.c
b/modules/rostests/kmtests/ntos_cc/CcMapData_user.c
index b1d2685f76..dee2a93d5e 100644
--- a/modules/rostests/kmtests/ntos_cc/CcMapData_user.c
+++ b/modules/rostests/kmtests/ntos_cc/CcMapData_user.c
@@ -20,8 +20,9 @@ START_TEST(CcMapData)
/* 3 tests for offset
* 1 test for BCB
+ * 1 test for length/offset
*/
- for (TestId = 0; TestId < 4; ++TestId)
+ for (TestId = 0; TestId < 5; ++TestId)
{
Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId);
ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);
diff --git a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
index 58f8808fcd..9c338fe785 100644
--- a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
+++ b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c
@@ -477,6 +477,49 @@ PerformTest(
CcUnpinData(Bcb);
}
}
+ else if (TestId == 5)
+ {
+ /* Pin after EOF */
+ Ret = FALSE;
+ Offset.QuadPart = FileSizes.FileSize.QuadPart + 0x1000;
+
+ KmtStartSeh();
+ Ret = CcPinRead(TestFileObject, &Offset, 0x1000, 0, &Bcb,
(PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+
+ if (!skip(Ret == TRUE, "CcPinRead failed\n"))
+ {
+ CcUnpinData(Bcb);
+ }
+
+ /* Pin a VACB after EOF */
+ Ret = FALSE;
+ Offset.QuadPart = FileSizes.FileSize.QuadPart + 0x1000 +
VACB_MAPPING_GRANULARITY;
+
+ KmtStartSeh();
+ Ret = CcPinRead(TestFileObject, &Offset, 0x1000, 0, &Bcb,
(PVOID *)&Buffer);
+ KmtEndSeh(STATUS_ACCESS_VIOLATION);
+ ok(Ret == FALSE, "CcPinRead succeed\n");
+
+ if (Ret)
+ {
+ CcUnpinData(Bcb);
+ }
+
+ /* Pin more than a VACB */
+ Ret = FALSE;
+ Offset.QuadPart = 0x0;
+
+ KmtStartSeh();
+ Ret = CcPinRead(TestFileObject, &Offset, 0x1000 +
VACB_MAPPING_GRANULARITY, 0, &Bcb, (PVOID *)&Buffer);
+ KmtEndSeh(STATUS_SUCCESS);
+ ok(Ret == FALSE, "CcPinRead succeed\n");
+
+ if (Ret)
+ {
+ CcUnpinData(Bcb);
+ }
+ }
}
}
}
diff --git a/modules/rostests/kmtests/ntos_cc/CcPinRead_user.c
b/modules/rostests/kmtests/ntos_cc/CcPinRead_user.c
index 78818164e8..e8e78cbc44 100644
--- a/modules/rostests/kmtests/ntos_cc/CcPinRead_user.c
+++ b/modules/rostests/kmtests/ntos_cc/CcPinRead_user.c
@@ -21,8 +21,9 @@ START_TEST(CcPinRead)
/* 3 tests for offset
* 1 test for BCB
* 1 test for pinning access
+ * 1 test for length/offset
*/
- for (TestId = 0; TestId < 5; ++TestId)
+ for (TestId = 0; TestId < 6; ++TestId)
{
Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId);
ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);