[KMTESTS:SE] Implement initial logon session tests
authorGeorge Bișoc <george.bisoc@reactos.org>
Thu, 17 Jun 2021 16:12:12 +0000 (18:12 +0200)
committerGeorge Bișoc <george.bisoc@reactos.org>
Thu, 15 Jul 2021 17:31:46 +0000 (19:31 +0200)
This implements tests for SeMarkLogonSessionForTerminationNotification exported routine so far.

modules/rostests/kmtests/CMakeLists.txt
modules/rostests/kmtests/kmtest_drv/testlist.c
modules/rostests/kmtests/ntos_se/SeLogonSession.c [new file with mode: 0644]

index 9e3528c..3898b37 100644 (file)
@@ -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
index 99743a2..d486c2e 100644 (file)
@@ -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 (file)
index 0000000..726267d
--- /dev/null
@@ -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@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();
+}