mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 12:29:56 +00:00
[LSALIB/LSASRV]
- Add the LSA_CONNECTION_INFO struct to the LSA_API_MSG in order to handle the connection info in an easy way. - Let the connection handler return OperationalMode and Status values. This obsoletes a separate register call to lsasrv.dll, thus remove the register call code entirely. - Add dispatcher code and stubs for the remaining client calls. - Add experimental implementation of LsaCallAuthenticationPackage and LsaLogonUser. svn path=/trunk/; revision=58304
This commit is contained in:
parent
9cdf574f39
commit
eded15cab8
3 changed files with 198 additions and 170 deletions
|
@ -20,9 +20,40 @@ static HANDLE AuthPortHandle = NULL;
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
LsapCallAuthenticationPackage(PLSA_API_MSG RequestMsg)
|
||||||
|
{
|
||||||
|
TRACE("(%p)\n", RequestMsg);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
LsapDeregisterLogonProcess(PLSA_API_MSG RequestMsg)
|
||||||
|
{
|
||||||
|
TRACE("(%p)\n", RequestMsg);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
LsapLogonUser(PLSA_API_MSG RequestMsg)
|
||||||
|
{
|
||||||
|
TRACE("(%p)\n", RequestMsg);
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
LsapLookupAuthenticationPackage(PLSA_API_MSG RequestMsg)
|
LsapLookupAuthenticationPackage(PLSA_API_MSG RequestMsg)
|
||||||
{
|
{
|
||||||
|
TRACE("(%p)\n", RequestMsg);
|
||||||
|
|
||||||
|
TRACE("PackageName: %s\n", RequestMsg->LookupAuthenticationPackage.Request.PackageName);
|
||||||
|
|
||||||
RequestMsg->LookupAuthenticationPackage.Reply.Package = 0x12345678;
|
RequestMsg->LookupAuthenticationPackage.Reply.Package = 0x12345678;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -66,6 +97,11 @@ AuthPortThreadRoutine(PVOID Param)
|
||||||
|
|
||||||
RemotePortView.Length = sizeof(REMOTE_PORT_VIEW);
|
RemotePortView.Length = sizeof(REMOTE_PORT_VIEW);
|
||||||
|
|
||||||
|
TRACE("Logon Process Name: %s\n", RequestMsg.ConnectInfo.LogonProcessNameBuffer);
|
||||||
|
|
||||||
|
RequestMsg.ConnectInfo.OperationalMode = 0x43218765;
|
||||||
|
RequestMsg.ConnectInfo.Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
Accept = TRUE;
|
Accept = TRUE;
|
||||||
Status = NtAcceptConnectPort(&ConnectionHandle,
|
Status = NtAcceptConnectPort(&ConnectionHandle,
|
||||||
&Context,
|
&Context,
|
||||||
|
@ -102,12 +138,28 @@ AuthPortThreadRoutine(PVOID Param)
|
||||||
default:
|
default:
|
||||||
TRACE("Received request (ApiNumber: %lu)\n", RequestMsg.ApiNumber);
|
TRACE("Received request (ApiNumber: %lu)\n", RequestMsg.ApiNumber);
|
||||||
|
|
||||||
if (RequestMsg.ApiNumber == LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE)
|
switch (RequestMsg.ApiNumber)
|
||||||
{
|
{
|
||||||
|
case LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE:
|
||||||
|
RequestMsg.Status = LsapCallAuthenticationPackage(&RequestMsg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LSASS_REQUEST_DEREGISTER_LOGON_PROCESS:
|
||||||
|
RequestMsg.Status = LsapDeregisterLogonProcess(&RequestMsg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LSASS_REQUEST_LOGON_USER:
|
||||||
|
RequestMsg.Status = LsapLogonUser(&RequestMsg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE:
|
||||||
RequestMsg.Status = LsapLookupAuthenticationPackage(&RequestMsg);
|
RequestMsg.Status = LsapLookupAuthenticationPackage(&RequestMsg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
RequestMsg.Status = STATUS_SUCCESS; /* FIXME */
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
RequestMsg.Status = STATUS_SUCCESS;
|
|
||||||
|
|
||||||
ReplyMsg = &RequestMsg;
|
ReplyMsg = &RequestMsg;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
typedef enum _LSA_API_NUMBER
|
typedef enum _LSA_API_NUMBER
|
||||||
{
|
{
|
||||||
LSASS_REQUEST_REGISTER_LOGON_PROCESS,
|
|
||||||
LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE,
|
LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE,
|
||||||
LSASS_REQUEST_DEREGISTER_LOGON_PROCESS,
|
LSASS_REQUEST_DEREGISTER_LOGON_PROCESS,
|
||||||
LSASS_REQUEST_LOGON_USER,
|
LSASS_REQUEST_LOGON_USER,
|
||||||
|
@ -26,85 +25,6 @@ typedef enum _LSA_API_NUMBER
|
||||||
LSASS_REQUEST_MAXIMUM
|
LSASS_REQUEST_MAXIMUM
|
||||||
} LSA_API_NUMBER, *PLSA_API_NUMBER;
|
} LSA_API_NUMBER, *PLSA_API_NUMBER;
|
||||||
|
|
||||||
#if 0
|
|
||||||
typedef struct _LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST
|
|
||||||
{
|
|
||||||
ULONG PackageNameLength;
|
|
||||||
WCHAR PackageName[0];
|
|
||||||
} LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST,
|
|
||||||
*PLSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST;
|
|
||||||
|
|
||||||
typedef struct _LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY
|
|
||||||
{
|
|
||||||
ULONG Package;
|
|
||||||
} LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY,
|
|
||||||
*PLSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY;
|
|
||||||
|
|
||||||
typedef struct _LSASS_DEREGISTER_LOGON_PROCESS_REQUEST
|
|
||||||
{
|
|
||||||
ULONG Dummy;
|
|
||||||
} LSASS_DEREGISTER_LOGON_PROCESS_REQUEST,
|
|
||||||
*PLSASS_DEREGISTER_LOGON_PROCES_REQUEST;
|
|
||||||
|
|
||||||
typedef struct _LSASS_DEREGISTER_LOGON_PROCESS_REPLY
|
|
||||||
{
|
|
||||||
ULONG Dummy;
|
|
||||||
} LSASS_DEREGISTER_LOGON_PROCESS_REPLY,
|
|
||||||
*PLSASS_DEREGISTER_LOGON_PROCESS_REPLY;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST
|
|
||||||
{
|
|
||||||
ULONG AuthenticationPackage;
|
|
||||||
ULONG InBufferLength;
|
|
||||||
UCHAR InBuffer[0];
|
|
||||||
} LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST,
|
|
||||||
*PLSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST;
|
|
||||||
|
|
||||||
typedef struct _LSASS_CALL_AUTHENTICATION_PACKAGE_REPLY
|
|
||||||
{
|
|
||||||
ULONG OutBufferLength;
|
|
||||||
UCHAR OutBuffer[0];
|
|
||||||
} LSASS_CALL_AUTHENTICATION_PACKAGE_REPLY,
|
|
||||||
*PLSASS_CALL_AUTHENTICATION_PACKAGE_REPLY;
|
|
||||||
|
|
||||||
typedef struct _LSASS_LOGON_USER_REQUEST
|
|
||||||
{
|
|
||||||
ULONG OriginNameLength;
|
|
||||||
PWSTR OriginName;
|
|
||||||
SECURITY_LOGON_TYPE LogonType;
|
|
||||||
ULONG AuthenticationPackage;
|
|
||||||
PVOID AuthenticationInformation;
|
|
||||||
ULONG AuthenticationInformationLength;
|
|
||||||
ULONG LocalGroupsCount;
|
|
||||||
PSID_AND_ATTRIBUTES LocalGroups;
|
|
||||||
TOKEN_SOURCE SourceContext;
|
|
||||||
UCHAR Data[1];
|
|
||||||
} LSASS_LOGON_USER_REQUEST, *PLSASS_LOGON_USER_REQUEST;
|
|
||||||
|
|
||||||
typedef struct _LSASS_LOGON_USER_REPLY
|
|
||||||
{
|
|
||||||
PVOID ProfileBuffer;
|
|
||||||
ULONG ProfileBufferLength;
|
|
||||||
LUID LogonId;
|
|
||||||
HANDLE Token;
|
|
||||||
QUOTA_LIMITS Quotas;
|
|
||||||
NTSTATUS SubStatus;
|
|
||||||
UCHAR Data[1];
|
|
||||||
} LSASS_LOGON_USER_REPLY, *PLSASS_LOGON_USER_REPLY;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
typedef struct _LSASS_REGISTER_LOGON_PROCESS_REQUEST
|
|
||||||
{
|
|
||||||
ULONG Length;
|
|
||||||
WCHAR LogonProcessNameBuffer[127];
|
|
||||||
} LSASS_REGISTER_LOGON_PROCESS_REQUEST, *PLSASS_REGISTER_LOGON_PROCESS_REQUEST;
|
|
||||||
|
|
||||||
typedef struct _LSASS_REGISTER_LOGON_PROCESS_REPLY
|
|
||||||
{
|
|
||||||
LSA_OPERATIONAL_MODE OperationalMode;
|
|
||||||
} LSASS_REGISTER_LOGON_PROCESS_REPLY, *PLSASS_REGISTER_LOGON_PROCESS_REPLY;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _LSA_CONNECTION_INFO
|
typedef struct _LSA_CONNECTION_INFO
|
||||||
{
|
{
|
||||||
|
@ -114,58 +34,63 @@ typedef struct _LSA_CONNECTION_INFO
|
||||||
CHAR LogonProcessNameBuffer[LSASS_MAX_LOGON_PROCESS_NAME_LENGTH + 1];
|
CHAR LogonProcessNameBuffer[LSASS_MAX_LOGON_PROCESS_NAME_LENGTH + 1];
|
||||||
} LSA_CONNECTION_INFO, *PLSA_CONNECTION_INFO;
|
} LSA_CONNECTION_INFO, *PLSA_CONNECTION_INFO;
|
||||||
|
|
||||||
#if 0
|
|
||||||
typedef union _LSASS_REQUEST
|
|
||||||
{
|
|
||||||
PORT_MESSAGE Header;
|
|
||||||
struct {
|
|
||||||
UCHAR LpcHeader[sizeof(PORT_MESSAGE)];
|
|
||||||
ULONG Type;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
LSASS_REGISTER_LOGON_PROCESS_REQUEST RegisterLogonProcessRequest;
|
|
||||||
LSASS_LOGON_USER_REQUEST LogonUserRequest;
|
|
||||||
LSASS_CALL_AUTHENTICATION_PACKAGE_REQUEST
|
|
||||||
CallAuthenticationPackageRequest;
|
|
||||||
LSASS_DEREGISTER_LOGON_PROCESS_REPLY DeregisterLogonProcessRequest;
|
|
||||||
LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REQUEST
|
|
||||||
LookupAuthenticationPackageRequest;
|
|
||||||
} d;
|
|
||||||
};
|
|
||||||
} LSASS_REQUEST, *PLSASS_REQUEST;
|
|
||||||
|
|
||||||
typedef struct _LSASS_REPLY
|
typedef struct _LSA_LOGON_USER_MSG
|
||||||
{
|
|
||||||
PORT_MESSAGE Header;
|
|
||||||
NTSTATUS Status;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
LSASS_REGISTER_LOGON_PROCESS_REPLY RegisterLogonProcessReply;
|
|
||||||
LSASS_LOGON_USER_REPLY LogonUserReply;
|
|
||||||
LSASS_CALL_AUTHENTICATION_PACKAGE_REPLY CallAuthenticationPackageReply;
|
|
||||||
LSASS_DEREGISTER_LOGON_PROCESS_REPLY DeregisterLogonProcessReply;
|
|
||||||
LSASS_LOOKUP_AUTHENTICATION_PACKAGE_REPLY
|
|
||||||
LookupAuthenticationPackageReply;
|
|
||||||
} d;
|
|
||||||
} LSASS_REPLY, *PLSASS_REPLY;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _LSA_REGISTER_LOGON_PROCESS_MSG
|
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
ULONG Length;
|
LSA_STRING OriginName;
|
||||||
CHAR LogonProcessNameBuffer[LSASS_MAX_LOGON_PROCESS_NAME_LENGTH + 1];
|
SECURITY_LOGON_TYPE LogonType;
|
||||||
|
ULONG AuthenticationPackage;
|
||||||
|
PVOID AuthenticationInformation;
|
||||||
|
ULONG AuthenticationInformationLength;
|
||||||
|
PTOKEN_GROUPS LocalGroups;
|
||||||
|
ULONG LocalGroupsCount;
|
||||||
|
TOKEN_SOURCE SourceContext;
|
||||||
|
} Request;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
PVOID ProfileBuffer;
|
||||||
|
ULONG ProfileBufferLength;
|
||||||
|
LUID LogonId;
|
||||||
|
HANDLE Token;
|
||||||
|
QUOTA_LIMITS Quotas;
|
||||||
|
NTSTATUS SubStatus;
|
||||||
|
} Reply;
|
||||||
|
};
|
||||||
|
} LSA_LOGON_USER_MSG, *PLSA_LOGON_USER_MSG;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _LSA_CALL_AUTHENTICATION_PACKAGE_MSG
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
ULONG AuthenticationPackage;
|
||||||
|
ULONG InBufferLength;
|
||||||
|
UCHAR InBuffer[0];
|
||||||
|
#endif
|
||||||
|
ULONG AuthenticationPackage;
|
||||||
|
PVOID ProtocolSubmitBuffer;
|
||||||
|
ULONG SubmitBufferLength;
|
||||||
} Request;
|
} Request;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
LSA_OPERATIONAL_MODE OperationalMode;
|
#if 0
|
||||||
|
ULONG OutBufferLength;
|
||||||
|
UCHAR OutBuffer[0];
|
||||||
|
#endif
|
||||||
|
PVOID ProtocolReturnBuffer;
|
||||||
|
ULONG ReturnBufferLength;
|
||||||
|
NTSTATUS ProtocolStatus;
|
||||||
} Reply;
|
} Reply;
|
||||||
};
|
};
|
||||||
} LSA_REGISTER_LOGON_PROCESS_MSG, *PLSA_REGISTER_LOGON_PROCESS_MSG;
|
} LSA_CALL_AUTHENTICATION_PACKAGE_MSG, *PLSA_CALL_AUTHENTICATION_PACKAGE_MSG;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _LSA_DEREGISTER_LOGON_PROCESS_MSG
|
typedef struct _LSA_DEREGISTER_LOGON_PROCESS_MSG
|
||||||
|
@ -200,22 +125,26 @@ typedef struct _LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG
|
||||||
};
|
};
|
||||||
} LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG, *PLSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG;
|
} LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG, *PLSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _LSA_API_MSG
|
typedef struct _LSA_API_MSG
|
||||||
{
|
{
|
||||||
PORT_MESSAGE h;
|
PORT_MESSAGE h;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
LSA_CONNECTION_INFO ConnectInfo;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
LSA_API_NUMBER ApiNumber;
|
LSA_API_NUMBER ApiNumber;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
LSA_REGISTER_LOGON_PROCESS_MSG RegisterLogonProcess;
|
LSA_LOGON_USER_MSG LogonUser;
|
||||||
// LSA_LOGON_USER_MSG LogonUser;
|
LSA_CALL_AUTHENTICATION_PACKAGE_MSG CallAuthenticationPackage;
|
||||||
// LSA_CALL_AUTHENTICATION_PACKAGE_MSG CallAuthenticationPackage;
|
|
||||||
LSA_DEREGISTER_LOGON_PROCESS_MSG DeregisterLogonProcess;
|
LSA_DEREGISTER_LOGON_PROCESS_MSG DeregisterLogonProcess;
|
||||||
LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG LookupAuthenticationPackage;
|
LSA_LOOKUP_AUTHENTICATION_PACKAGE_MSG LookupAuthenticationPackage;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
} LSA_API_MSG, *PLSA_API_MSG;
|
} LSA_API_MSG, *PLSA_API_MSG;
|
||||||
|
|
||||||
#define LSA_PORT_DATA_SIZE(c) (sizeof(ULONG)+sizeof(NTSTATUS)+sizeof(c))
|
#define LSA_PORT_DATA_SIZE(c) (sizeof(ULONG)+sizeof(NTSTATUS)+sizeof(c))
|
||||||
|
|
|
@ -87,6 +87,42 @@ LsaCallAuthenticationPackage(HANDLE LsaHandle,
|
||||||
PULONG ReturnBufferLength,
|
PULONG ReturnBufferLength,
|
||||||
PNTSTATUS ProtocolStatus)
|
PNTSTATUS ProtocolStatus)
|
||||||
{
|
{
|
||||||
|
LSA_API_MSG ApiMessage;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT1("LsaCallAuthenticationPackage()\n");
|
||||||
|
|
||||||
|
ApiMessage.ApiNumber = LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE;
|
||||||
|
ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.CallAuthenticationPackage.Request);
|
||||||
|
ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE;
|
||||||
|
ApiMessage.h.u2.ZeroInit = 0;
|
||||||
|
|
||||||
|
ApiMessage.CallAuthenticationPackage.Request.AuthenticationPackage = AuthenticationPackage;
|
||||||
|
ApiMessage.CallAuthenticationPackage.Request.ProtocolSubmitBuffer = ProtocolSubmitBuffer;
|
||||||
|
ApiMessage.CallAuthenticationPackage.Request.SubmitBufferLength = SubmitBufferLength;
|
||||||
|
|
||||||
|
Status = ZwRequestWaitReplyPort(LsaHandle,
|
||||||
|
(PPORT_MESSAGE)&ApiMessage,
|
||||||
|
(PPORT_MESSAGE)&ApiMessage);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
DPRINT1("ZwRequestWaitReplyPort() failed (Status 0x%08lx)\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(ApiMessage.Status))
|
||||||
|
{
|
||||||
|
DPRINT1("ZwRequestWaitReplyPort() failed (ApiMessage.Status 0x%08lx)\n", ApiMessage.Status);
|
||||||
|
return ApiMessage.Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ProtocolReturnBuffer = ApiMessage.CallAuthenticationPackage.Reply.ProtocolReturnBuffer;
|
||||||
|
*ReturnBufferLength = ApiMessage.CallAuthenticationPackage.Reply.ReturnBufferLength;
|
||||||
|
*ProtocolStatus = ApiMessage.CallAuthenticationPackage.Reply.ProtocolStatus;
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
PLSASS_REQUEST Request;
|
PLSASS_REQUEST Request;
|
||||||
PLSASS_REPLY Reply;
|
PLSASS_REPLY Reply;
|
||||||
|
@ -135,8 +171,6 @@ LsaCallAuthenticationPackage(HANDLE LsaHandle,
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,6 +250,48 @@ LsaLogonUser(HANDLE LsaHandle,
|
||||||
PQUOTA_LIMITS Quotas,
|
PQUOTA_LIMITS Quotas,
|
||||||
PNTSTATUS SubStatus)
|
PNTSTATUS SubStatus)
|
||||||
{
|
{
|
||||||
|
LSA_API_MSG ApiMessage;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
ApiMessage.ApiNumber = LSASS_REQUEST_LOGON_USER;
|
||||||
|
ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.LogonUser.Request);
|
||||||
|
ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE;
|
||||||
|
ApiMessage.h.u2.ZeroInit = 0;
|
||||||
|
|
||||||
|
ApiMessage.LogonUser.Request.OriginName = *OriginName;
|
||||||
|
ApiMessage.LogonUser.Request.LogonType = LogonType;
|
||||||
|
ApiMessage.LogonUser.Request.AuthenticationPackage = AuthenticationPackage;
|
||||||
|
ApiMessage.LogonUser.Request.AuthenticationInformation = AuthenticationInformation;
|
||||||
|
ApiMessage.LogonUser.Request.AuthenticationInformationLength = AuthenticationInformationLength;
|
||||||
|
ApiMessage.LogonUser.Request.LocalGroups = LocalGroups;
|
||||||
|
if (LocalGroups != NULL)
|
||||||
|
ApiMessage.LogonUser.Request.LocalGroupsCount = LocalGroups->GroupCount;
|
||||||
|
else
|
||||||
|
ApiMessage.LogonUser.Request.LocalGroups = 0;
|
||||||
|
ApiMessage.LogonUser.Request.SourceContext = *SourceContext;
|
||||||
|
|
||||||
|
Status = ZwRequestWaitReplyPort(LsaHandle,
|
||||||
|
(PPORT_MESSAGE)&ApiMessage,
|
||||||
|
(PPORT_MESSAGE)&ApiMessage);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(ApiMessage.Status))
|
||||||
|
{
|
||||||
|
return ApiMessage.Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ProfileBuffer = ApiMessage.LogonUser.Reply.ProfileBuffer;
|
||||||
|
*ProfileBufferLength = ApiMessage.LogonUser.Reply.ProfileBufferLength;
|
||||||
|
*LogonId = ApiMessage.LogonUser.Reply.LogonId;
|
||||||
|
*Token = ApiMessage.LogonUser.Reply.Token;
|
||||||
|
*Quotas = ApiMessage.LogonUser.Reply.Quotas;
|
||||||
|
*SubStatus = ApiMessage.LogonUser.Reply.SubStatus;
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
ULONG RequestLength;
|
ULONG RequestLength;
|
||||||
ULONG CurrentLength;
|
ULONG CurrentLength;
|
||||||
|
@ -300,7 +376,6 @@ LsaLogonUser(HANDLE LsaHandle,
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -316,8 +391,6 @@ LsaRegisterLogonProcess(PLSA_STRING LsaLogonProcessName,
|
||||||
SECURITY_QUALITY_OF_SERVICE SecurityQos;
|
SECURITY_QUALITY_OF_SERVICE SecurityQos;
|
||||||
LSA_CONNECTION_INFO ConnectInfo;
|
LSA_CONNECTION_INFO ConnectInfo;
|
||||||
ULONG ConnectInfoLength = sizeof(ConnectInfo);
|
ULONG ConnectInfoLength = sizeof(ConnectInfo);
|
||||||
LSA_API_MSG ApiMessage;
|
|
||||||
HANDLE PortHandle = NULL;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT1("LsaRegisterLogonProcess()\n");
|
DPRINT1("LsaRegisterLogonProcess()\n");
|
||||||
|
@ -326,8 +399,6 @@ LsaRegisterLogonProcess(PLSA_STRING LsaLogonProcessName,
|
||||||
if (LsaLogonProcessName->Length > LSASS_MAX_LOGON_PROCESS_NAME_LENGTH)
|
if (LsaLogonProcessName->Length > LSASS_MAX_LOGON_PROCESS_NAME_LENGTH)
|
||||||
return STATUS_NAME_TOO_LONG;
|
return STATUS_NAME_TOO_LONG;
|
||||||
|
|
||||||
*Handle = NULL;
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&PortName,
|
RtlInitUnicodeString(&PortName,
|
||||||
L"\\LsaAuthenticationPort");
|
L"\\LsaAuthenticationPort");
|
||||||
|
|
||||||
|
@ -342,7 +413,7 @@ LsaRegisterLogonProcess(PLSA_STRING LsaLogonProcessName,
|
||||||
ConnectInfo.Length = LsaLogonProcessName->Length;
|
ConnectInfo.Length = LsaLogonProcessName->Length;
|
||||||
ConnectInfo.LogonProcessNameBuffer[ConnectInfo.Length] = '\0';
|
ConnectInfo.LogonProcessNameBuffer[ConnectInfo.Length] = '\0';
|
||||||
|
|
||||||
Status = ZwConnectPort(&PortHandle,
|
Status = ZwConnectPort(Handle,
|
||||||
&PortName,
|
&PortName,
|
||||||
&SecurityQos,
|
&SecurityQos,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -356,39 +427,15 @@ LsaRegisterLogonProcess(PLSA_STRING LsaLogonProcessName,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiMessage.ApiNumber = LSASS_REQUEST_REGISTER_LOGON_PROCESS;
|
DPRINT("ConnectInfo.OperationalMode: 0x%08lx\n", ConnectInfo.OperationalMode);
|
||||||
ApiMessage.h.u1.s1.DataLength = LSA_PORT_DATA_SIZE(ApiMessage.RegisterLogonProcess.Request);
|
*OperationalMode = ConnectInfo.OperationalMode;
|
||||||
ApiMessage.h.u1.s1.TotalLength = LSA_PORT_MESSAGE_SIZE;
|
|
||||||
ApiMessage.h.u2.ZeroInit = 0;
|
|
||||||
|
|
||||||
ApiMessage.RegisterLogonProcess.Request.Length = LsaLogonProcessName->Length;
|
|
||||||
memcpy(ApiMessage.RegisterLogonProcess.Request.LogonProcessNameBuffer,
|
|
||||||
LsaLogonProcessName->Buffer,
|
|
||||||
ApiMessage.RegisterLogonProcess.Request.Length);
|
|
||||||
|
|
||||||
Status = ZwRequestWaitReplyPort(PortHandle,
|
|
||||||
(PPORT_MESSAGE)&ApiMessage,
|
|
||||||
(PPORT_MESSAGE)&ApiMessage);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("ZwRequestWaitReplyPort failed (Status 0x%08lx)\n", Status);
|
DPRINT1("ConnectInfo.Status: 0x%08lx\n", ConnectInfo.Status);
|
||||||
NtClose(PortHandle);
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS(ApiMessage.Status))
|
return ConnectInfo.Status;
|
||||||
{
|
|
||||||
DPRINT1("ZwRequestWaitReplyPort failed (ApiMessage.Status 0x%08lx)\n", ApiMessage.Status);
|
|
||||||
NtClose(PortHandle);
|
|
||||||
return ApiMessage.Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
*Handle = PortHandle;
|
|
||||||
*OperationalMode = ApiMessage.RegisterLogonProcess.Reply.OperationalMode;
|
|
||||||
|
|
||||||
DPRINT1("LsaRegisterLogonProcess() done (Status 0x%08lx)\n", Status);
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue