mirror of
https://github.com/reactos/reactos.git
synced 2024-06-17 01:51:49 +00:00
[MSV1_0] Improve GetComputerNameW call (1/5)
This is a part of the Partial Network Login Implementation PR.
This commit is contained in:
parent
2be9ea9c3b
commit
5a67ed775f
|
@ -1183,7 +1183,8 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
|
|||
|
||||
NTSTATUS Status;
|
||||
PMSV1_0_INTERACTIVE_LOGON LogonInfo;
|
||||
WCHAR ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
UNICODE_STRING ComputerName;
|
||||
WCHAR ComputerNameData[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
SAMPR_HANDLE ServerHandle = NULL;
|
||||
SAMPR_HANDLE DomainHandle = NULL;
|
||||
SAMPR_HANDLE UserHandle = NULL;
|
||||
|
@ -1214,6 +1215,15 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
|
|||
*AccountName = NULL;
|
||||
*AuthenticatingAuthority = NULL;
|
||||
|
||||
/* Get the computer name */
|
||||
ComputerNameSize = ARRAYSIZE(ComputerNameData);
|
||||
if (!GetComputerNameW(ComputerNameData, &ComputerNameSize))
|
||||
{
|
||||
ERR("Failed to get Computername.\n");
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
RtlInitUnicodeString(&ComputerName, ComputerNameData);
|
||||
|
||||
/* Parameters validation */
|
||||
if (LogonType == Interactive ||
|
||||
LogonType == Batch ||
|
||||
|
@ -1330,10 +1340,6 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
|
|||
/* Get the logon time */
|
||||
NtQuerySystemTime(&LogonTime);
|
||||
|
||||
/* Get the computer name */
|
||||
ComputerNameSize = ARRAYSIZE(ComputerName);
|
||||
GetComputerNameW(ComputerName, &ComputerNameSize);
|
||||
|
||||
/* Check for special accounts */
|
||||
// FIXME: Windows does not do this that way!! (msv1_0 does not contain these hardcoded values)
|
||||
if (RtlEqualUnicodeString(&LogonInfo->LogonDomainName, &NtAuthorityU, TRUE))
|
||||
|
@ -1546,7 +1552,7 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
|
|||
}
|
||||
|
||||
/* Check workstations */
|
||||
if (!MsvpCheckWorkstations(&UserInfo->All.WorkStations, ComputerName))
|
||||
if (!MsvpCheckWorkstations(&UserInfo->All.WorkStations, ComputerNameData))
|
||||
{
|
||||
ERR("Invalid workstation!\n");
|
||||
*SubStatus = STATUS_INVALID_WORKSTATION;
|
||||
|
@ -1579,7 +1585,7 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
|
|||
/* Build and fill the interactive profile buffer */
|
||||
Status = BuildInteractiveProfileBuffer(ClientRequest,
|
||||
UserInfo,
|
||||
ComputerName,
|
||||
ComputerNameData,
|
||||
(PMSV1_0_INTERACTIVE_PROFILE*)ProfileBuffer,
|
||||
ProfileBufferSize);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -1659,12 +1665,12 @@ done:
|
|||
*MachineName = DispatchTable.AllocateLsaHeap(sizeof(UNICODE_STRING));
|
||||
if (*MachineName != NULL)
|
||||
{
|
||||
(*MachineName)->Buffer = DispatchTable.AllocateLsaHeap((ComputerNameSize + 1) * sizeof(WCHAR));
|
||||
(*MachineName)->Buffer = DispatchTable.AllocateLsaHeap(ComputerName.MaximumLength);
|
||||
if ((*MachineName)->Buffer != NULL)
|
||||
{
|
||||
(*MachineName)->MaximumLength = (ComputerNameSize + 1) * sizeof(WCHAR);
|
||||
(*MachineName)->Length = ComputerNameSize * sizeof(WCHAR);
|
||||
RtlCopyMemory((*MachineName)->Buffer, ComputerName, (*MachineName)->MaximumLength);
|
||||
(*MachineName)->MaximumLength = ComputerName.MaximumLength;
|
||||
(*MachineName)->Length = ComputerName.Length;
|
||||
RtlCopyMemory((*MachineName)->Buffer, ComputerName.Buffer, ComputerName.MaximumLength);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue