https://git.reactos.org/?p=reactos.git;a=commitdiff;h=32a45ce15cb82f91d0377…
commit 32a45ce15cb82f91d0377eff714c5420703b07ff
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Thu Jun 17 18:12:12 2021 +0200
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Thu Jul 15 19:31:46 2021 +0200
[KMTESTS:SE] Implement initial logon session tests
This implements tests for SeMarkLogonSessionForTerminationNotification exported
routine so far.
---
modules/rostests/kmtests/CMakeLists.txt | 1 +
modules/rostests/kmtests/kmtest_drv/testlist.c | 2 ++
modules/rostests/kmtests/ntos_se/SeLogonSession.c | 35 +++++++++++++++++++++++
3 files changed, 38 insertions(+)
diff --git a/modules/rostests/kmtests/CMakeLists.txt
b/modules/rostests/kmtests/CMakeLists.txt
index 9e3528cdf96..3898b37a6ba 100644
--- a/modules/rostests/kmtests/CMakeLists.txt
+++ b/modules/rostests/kmtests/CMakeLists.txt
@@ -96,6 +96,7 @@ list(APPEND KMTEST_DRV_SOURCE
ntos_ps/PsNotify.c
ntos_se/SeHelpers.c
ntos_se/SeInheritance.c
+ ntos_se/SeLogonSession.c
ntos_se/SeQueryInfoToken.c
rtl/RtlIsValidOemCharacter.c
rtl/RtlRangeList.c
diff --git a/modules/rostests/kmtests/kmtest_drv/testlist.c
b/modules/rostests/kmtests/kmtest_drv/testlist.c
index 99743a26fe8..d486c2e3351 100644
--- a/modules/rostests/kmtests/kmtest_drv/testlist.c
+++ b/modules/rostests/kmtests/kmtest_drv/testlist.c
@@ -64,6 +64,7 @@ KMT_TESTFUNC Test_ObTypeNoClean;
KMT_TESTFUNC Test_ObTypes;
KMT_TESTFUNC Test_PsNotify;
KMT_TESTFUNC Test_SeInheritance;
+KMT_TESTFUNC Test_SeLogonSession;
KMT_TESTFUNC Test_SeQueryInfoToken;
KMT_TESTFUNC Test_RtlAvlTree;
KMT_TESTFUNC Test_RtlException;
@@ -152,6 +153,7 @@ const KMT_TEST TestList[] =
{ "RtlStrSafeKM", Test_RtlStrSafe },
{ "RtlUnicodeStringKM", Test_RtlUnicodeString },
{ "SeInheritance", Test_SeInheritance },
+ { "SeLogonSession", Test_SeLogonSession },
{ "SeQueryInfoToken", Test_SeQueryInfoToken },
{ "ZwAllocateVirtualMemory", Test_ZwAllocateVirtualMemory },
{ "ZwCreateSection", Test_ZwCreateSection },
diff --git a/modules/rostests/kmtests/ntos_se/SeLogonSession.c
b/modules/rostests/kmtests/ntos_se/SeLogonSession.c
new file mode 100644
index 00000000000..726267d01a2
--- /dev/null
+++ b/modules/rostests/kmtests/ntos_se/SeLogonSession.c
@@ -0,0 +1,35 @@
+/*
+ * PROJECT: ReactOS kernel-mode tests
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: Kernel mode tests for logon session manipulation API
+ * COPYRIGHT: Copyright 2021 George Bișoc <george.bisoc(a)reactos.org>
+ */
+
+#include <kmt_test.h>
+#include <ntifs.h>
+
+#define IMAGINARY_LOGON {0x001, 0}
+
+static
+VOID
+LogonMarkTermination(VOID)
+{
+ NTSTATUS Status;
+ LUID SystemLogonID = SYSTEM_LUID;
+ LUID NonExistentLogonID = IMAGINARY_LOGON;
+
+ /* Mark the system authentication logon for termination */
+ Status = SeMarkLogonSessionForTerminationNotification(&SystemLogonID);
+ ok_irql(PASSIVE_LEVEL);
+ ok_eq_hex(Status, STATUS_SUCCESS);
+
+ /* We give a non existent logon */
+ Status = SeMarkLogonSessionForTerminationNotification(&NonExistentLogonID);
+ ok_irql(PASSIVE_LEVEL);
+ ok_eq_hex(Status, STATUS_NOT_FOUND);
+}
+
+START_TEST(SeLogonSession)
+{
+ LogonMarkTermination();
+}