Author: ekohl
Date: Mon Oct 26 21:03:40 2015
New Revision: 69714
URL:
http://svn.reactos.org/svn/reactos?rev=69714&view=rev
Log:
[NTOSKRNL][LSASRV]
- Move the message typedefs into a shared header file.
- Implement LsapRmCreateLogonSession and LsapRmDeleteLogonSession. Call
LsapRmCreateLogonSession in LsapCreateLogonSession.
Added:
trunk/reactos/include/reactos/srmp.h (with props)
Modified:
trunk/reactos/dll/win32/lsasrv/lsasrv.h
trunk/reactos/dll/win32/lsasrv/session.c
trunk/reactos/dll/win32/lsasrv/srm.c
trunk/reactos/ntoskrnl/include/ntoskrnl.h
trunk/reactos/ntoskrnl/se/srm.c
Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Mon Oct 26 21:03:40 2015
@@ -32,6 +32,8 @@
#include <ntsam.h>
#include <ntlsa.h>
#include <sddl.h>
+
+#include <srmp.h>
#include <lsass.h>
#include <lsa_s.h>
@@ -425,6 +427,14 @@
NTSTATUS
LsapRmInitializeServer(VOID);
+NTSTATUS
+LsapRmCreateLogonSession(
+ PLUID LogonId);
+
+NTSTATUS
+LsapRmDeleteLogonSession(
+ PLUID LogonId);
+
/* utils.c */
INT
LsapLoadString(HINSTANCE hInstance,
Modified: trunk/reactos/dll/win32/lsasrv/session.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/session.c…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/session.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/session.c [iso-8859-1] Mon Oct 26 21:03:40 2015
@@ -68,7 +68,7 @@
{
PLSAP_LOGON_SESSION Session;
- TRACE("LsapSetLogonSessionData()\n");
+ TRACE("LsapSetLogonSessionData(%p)\n", LogonId);
Session = LsapGetLogonSession(LogonId);
if (Session == NULL)
@@ -84,8 +84,9 @@
LsapCreateLogonSession(IN PLUID LogonId)
{
PLSAP_LOGON_SESSION Session;
-
- TRACE("()\n");
+ NTSTATUS Status;
+
+ TRACE("LsapCreateLogonSession(%p)\n", LogonId);
/* Fail, if a session already exists */
if (LsapGetLogonSession(LogonId) != NULL)
@@ -101,6 +102,16 @@
/* Initialize the session entry */
RtlCopyLuid(&Session->LogonId, LogonId);
+ TRACE("LsapCreateLogonSession(<0x%lx,0x%lx>)\n",
+ LogonId->HighPart, LogonId->LowPart);
+
+ Status = LsapRmCreateLogonSession(LogonId);
+ if (!NT_SUCCESS(Status))
+ {
+ RtlFreeHeap(RtlGetProcessHeap(), 0, Session);
+ return Status;
+ }
+
/* Insert the new session into the session list */
InsertHeadList(&SessionListHead, &Session->Entry);
SessionCount++;
@@ -115,7 +126,7 @@
{
PLSAP_LOGON_SESSION Session;
- TRACE("()\n");
+ TRACE("LsapDeleteLogonSession(%p)\n", LogonId);
/* Fail, if the session does not exist */
Session = LsapGetLogonSession(LogonId);
Modified: trunk/reactos/dll/win32/lsasrv/srm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/srm.c?rev…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/srm.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/srm.c [iso-8859-1] Mon Oct 26 21:03:40 2015
@@ -11,28 +11,6 @@
#include "lsasrv.h"
#include <ndk/ntndk.h>
-
-typedef struct _LSAP_RM_API_MESSAGE
-{
- PORT_MESSAGE Header;
- ULONG ApiNumber;
- union
- {
- UCHAR Fill[PORT_MAXIMUM_MESSAGE_LENGTH - sizeof(PORT_MESSAGE)];
- struct
- {
- ULONG Info1;
- } WriteLog;
-
- } u;
-} LSAP_RM_API_MESSAGE, *PLSAP_RM_API_MESSAGE;
-
-enum _LSAP_API_NUMBER
-{
- LsapAdtWriteLogApi = 1,
- LsapComponentTestApi,
- LsapAsyncApi
-};
/* GLOBALS *****************************************************************/
@@ -262,3 +240,83 @@
return STATUS_SUCCESS;
}
+
+NTSTATUS
+LsapRmCreateLogonSession(
+ PLUID LogonId)
+{
+ SEP_RM_API_MESSAGE RequestMessage;
+ SEP_RM_API_MESSAGE ReplyMessage;
+ NTSTATUS Status;
+
+ TRACE("LsapRmCreateLogonSession(%p)\n", LogonId);
+
+ RequestMessage.Header.u2.ZeroInit = 0;
+ RequestMessage.Header.u1.s1.TotalLength =
+ (CSHORT)(sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(LUID));
+ RequestMessage.Header.u1.s1.DataLength =
+ RequestMessage.Header.u1.s1.TotalLength -
+ (CSHORT)sizeof(PORT_MESSAGE);
+
+ RequestMessage.ApiNumber = (ULONG)RmCreateLogonSession;
+ RtlCopyLuid(&RequestMessage.u.LogonLuid, LogonId);
+
+ ReplyMessage.Header.u2.ZeroInit = 0;
+ ReplyMessage.Header.u1.s1.TotalLength =
+ (CSHORT)(sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS));
+ ReplyMessage.Header.u1.s1.DataLength =
+ ReplyMessage.Header.u1.s1.TotalLength -
+ (CSHORT)sizeof(PORT_MESSAGE);
+
+ ReplyMessage.u.ResultStatus = STATUS_SUCCESS;
+
+ Status = NtRequestWaitReplyPort(SeRmCommandPort,
+ (PPORT_MESSAGE)&RequestMessage,
+ (PPORT_MESSAGE)&ReplyMessage);
+ if (NT_SUCCESS(Status))
+ {
+ Status = ReplyMessage.u.ResultStatus;
+ }
+
+ return Status;
+}
+
+NTSTATUS
+LsapRmDeleteLogonSession(
+ PLUID LogonId)
+{
+ SEP_RM_API_MESSAGE RequestMessage;
+ SEP_RM_API_MESSAGE ReplyMessage;
+ NTSTATUS Status;
+
+ TRACE("LsapRmDeleteLogonSession(%p)\n", LogonId);
+
+ RequestMessage.Header.u2.ZeroInit = 0;
+ RequestMessage.Header.u1.s1.TotalLength =
+ (CSHORT)(sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(LUID));
+ RequestMessage.Header.u1.s1.DataLength =
+ RequestMessage.Header.u1.s1.TotalLength -
+ (CSHORT)sizeof(PORT_MESSAGE);
+
+ RequestMessage.ApiNumber = (ULONG)RmDeleteLogonSession;
+ RtlCopyLuid(&RequestMessage.u.LogonLuid, LogonId);
+
+ ReplyMessage.Header.u2.ZeroInit = 0;
+ ReplyMessage.Header.u1.s1.TotalLength =
+ (CSHORT)(sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS));
+ ReplyMessage.Header.u1.s1.DataLength =
+ ReplyMessage.Header.u1.s1.TotalLength -
+ (CSHORT)sizeof(PORT_MESSAGE);
+
+ ReplyMessage.u.ResultStatus = STATUS_SUCCESS;
+
+ Status = NtRequestWaitReplyPort(SeRmCommandPort,
+ (PPORT_MESSAGE)&RequestMessage,
+ (PPORT_MESSAGE)&ReplyMessage);
+ if (NT_SUCCESS(Status))
+ {
+ Status = ReplyMessage.u.ResultStatus;
+ }
+
+ return Status;
+}
Added: trunk/reactos/include/reactos/srmp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/srmp.h?rev…
==============================================================================
--- trunk/reactos/include/reactos/srmp.h (added)
+++ trunk/reactos/include/reactos/srmp.h [iso-8859-1] Mon Oct 26 21:03:40 2015
@@ -0,0 +1,51 @@
+#ifndef _SRMP_
+#define _SRMP_
+
+typedef enum _RM_API_NUMBER
+{
+ RmAuditSetCommand = 1,
+ RmCreateLogonSession = 2,
+ RmDeleteLogonSession = 3
+} RM_API_NUMBER;
+
+typedef struct _SEP_RM_API_MESSAGE
+{
+ PORT_MESSAGE Header;
+ ULONG ApiNumber;
+ union
+ {
+ UCHAR Fill[PORT_MAXIMUM_MESSAGE_LENGTH - sizeof(PORT_MESSAGE)];
+ NTSTATUS ResultStatus;
+ struct
+ {
+ BOOLEAN Enabled;
+ ULONG Flags[9];
+ } SetAuditEvent;
+ LUID LogonLuid;
+ } u;
+} SEP_RM_API_MESSAGE, *PSEP_RM_API_MESSAGE;
+
+
+typedef enum _LSAP_API_NUMBER
+{
+ LsapAdtWriteLogApi = 1,
+ LsapComponentTestApi,
+ LsapAsyncApi
+} LSAP_API_NUMBER;
+
+typedef struct _LSAP_RM_API_MESSAGE
+{
+ PORT_MESSAGE Header;
+ ULONG ApiNumber;
+ union
+ {
+ UCHAR Fill[PORT_MAXIMUM_MESSAGE_LENGTH - sizeof(PORT_MESSAGE)];
+ struct
+ {
+ ULONG Info1;
+ } WriteLog;
+
+ } u;
+} LSAP_RM_API_MESSAGE, *PLSAP_RM_API_MESSAGE;
+
+#endif /* _SRMP_ */
Propchange: trunk/reactos/include/reactos/srmp.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/ntoskrnl.…
==============================================================================
--- trunk/reactos/ntoskrnl/include/ntoskrnl.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/ntoskrnl.h [iso-8859-1] Mon Oct 26 21:03:40 2015
@@ -88,6 +88,9 @@
/* PNP GUIDs */
#include <umpnpmgr/sysguid.h>
+/* SRM header */
+#include <srmp.h>
+
#define ExRaiseStatus RtlRaiseStatus
//
Modified: trunk/reactos/ntoskrnl/se/srm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/se/srm.c?rev=6971…
==============================================================================
--- trunk/reactos/ntoskrnl/se/srm.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/se/srm.c [iso-8859-1] Mon Oct 26 21:03:40 2015
@@ -19,30 +19,6 @@
/* PRIVATE DEFINITIONS ********************************************************/
#define SEP_LOGON_SESSION_TAG 'sLeS'
-
-enum _RM_API_NUMBER
-{
- RmAuditSetCommand = 1,
- RmCreateLogonSession = 2,
- RmDeleteLogonSession = 3
-};
-
-typedef struct _SEP_RM_API_MESSAGE
-{
- PORT_MESSAGE Header;
- ULONG ApiNumber;
- union
- {
- UCHAR Fill[PORT_MAXIMUM_MESSAGE_LENGTH - sizeof(PORT_MESSAGE)];
- NTSTATUS ResultStatus;
- struct
- {
- BOOLEAN Enabled;
- ULONG Flags[9];
- } SetAuditEvent;
- LUID LogonLuid;
- } u;
-} SEP_RM_API_MESSAGE, *PSEP_RM_API_MESSAGE;
typedef struct _SEP_LOGON_SESSION_REFERENCES
{