{
PLSAP_LOGON_SESSION Session;
- TRACE("LsapSetLogonSessionData()\n");
+ TRACE("LsapSetLogonSessionData(%p)\n", LogonId);
Session = LsapGetLogonSession(LogonId);
if (Session == NULL)
LsapCreateLogonSession(IN PLUID LogonId)
{
PLSAP_LOGON_SESSION Session;
+ NTSTATUS Status;
- TRACE("()\n");
+ TRACE("LsapCreateLogonSession(%p)\n", LogonId);
/* Fail, if a session already exists */
if (LsapGetLogonSession(LogonId) != NULL)
/* 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++;
{
PLSAP_LOGON_SESSION Session;
- TRACE("()\n");
+ TRACE("LsapDeleteLogonSession(%p)\n", LogonId);
/* Fail, if the session does not exist */
Session = LsapGetLogonSession(LogonId);
#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 *****************************************************************/
HANDLE SeLsaCommandPort;
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;
+}
--- /dev/null
+#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_ */
\ No newline at end of file