mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 21:44:31 +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;
|
NTSTATUS Status;
|
||||||
PMSV1_0_INTERACTIVE_LOGON LogonInfo;
|
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 ServerHandle = NULL;
|
||||||
SAMPR_HANDLE DomainHandle = NULL;
|
SAMPR_HANDLE DomainHandle = NULL;
|
||||||
SAMPR_HANDLE UserHandle = NULL;
|
SAMPR_HANDLE UserHandle = NULL;
|
||||||
|
@ -1214,6 +1215,15 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
|
||||||
*AccountName = NULL;
|
*AccountName = NULL;
|
||||||
*AuthenticatingAuthority = 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 */
|
/* Parameters validation */
|
||||||
if (LogonType == Interactive ||
|
if (LogonType == Interactive ||
|
||||||
LogonType == Batch ||
|
LogonType == Batch ||
|
||||||
|
@ -1330,10 +1340,6 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
|
||||||
/* Get the logon time */
|
/* Get the logon time */
|
||||||
NtQuerySystemTime(&LogonTime);
|
NtQuerySystemTime(&LogonTime);
|
||||||
|
|
||||||
/* Get the computer name */
|
|
||||||
ComputerNameSize = ARRAYSIZE(ComputerName);
|
|
||||||
GetComputerNameW(ComputerName, &ComputerNameSize);
|
|
||||||
|
|
||||||
/* Check for special accounts */
|
/* Check for special accounts */
|
||||||
// FIXME: Windows does not do this that way!! (msv1_0 does not contain these hardcoded values)
|
// FIXME: Windows does not do this that way!! (msv1_0 does not contain these hardcoded values)
|
||||||
if (RtlEqualUnicodeString(&LogonInfo->LogonDomainName, &NtAuthorityU, TRUE))
|
if (RtlEqualUnicodeString(&LogonInfo->LogonDomainName, &NtAuthorityU, TRUE))
|
||||||
|
@ -1546,7 +1552,7 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check workstations */
|
/* Check workstations */
|
||||||
if (!MsvpCheckWorkstations(&UserInfo->All.WorkStations, ComputerName))
|
if (!MsvpCheckWorkstations(&UserInfo->All.WorkStations, ComputerNameData))
|
||||||
{
|
{
|
||||||
ERR("Invalid workstation!\n");
|
ERR("Invalid workstation!\n");
|
||||||
*SubStatus = STATUS_INVALID_WORKSTATION;
|
*SubStatus = STATUS_INVALID_WORKSTATION;
|
||||||
|
@ -1579,7 +1585,7 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest,
|
||||||
/* Build and fill the interactive profile buffer */
|
/* Build and fill the interactive profile buffer */
|
||||||
Status = BuildInteractiveProfileBuffer(ClientRequest,
|
Status = BuildInteractiveProfileBuffer(ClientRequest,
|
||||||
UserInfo,
|
UserInfo,
|
||||||
ComputerName,
|
ComputerNameData,
|
||||||
(PMSV1_0_INTERACTIVE_PROFILE*)ProfileBuffer,
|
(PMSV1_0_INTERACTIVE_PROFILE*)ProfileBuffer,
|
||||||
ProfileBufferSize);
|
ProfileBufferSize);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -1659,12 +1665,12 @@ done:
|
||||||
*MachineName = DispatchTable.AllocateLsaHeap(sizeof(UNICODE_STRING));
|
*MachineName = DispatchTable.AllocateLsaHeap(sizeof(UNICODE_STRING));
|
||||||
if (*MachineName != NULL)
|
if (*MachineName != NULL)
|
||||||
{
|
{
|
||||||
(*MachineName)->Buffer = DispatchTable.AllocateLsaHeap((ComputerNameSize + 1) * sizeof(WCHAR));
|
(*MachineName)->Buffer = DispatchTable.AllocateLsaHeap(ComputerName.MaximumLength);
|
||||||
if ((*MachineName)->Buffer != NULL)
|
if ((*MachineName)->Buffer != NULL)
|
||||||
{
|
{
|
||||||
(*MachineName)->MaximumLength = (ComputerNameSize + 1) * sizeof(WCHAR);
|
(*MachineName)->MaximumLength = ComputerName.MaximumLength;
|
||||||
(*MachineName)->Length = ComputerNameSize * sizeof(WCHAR);
|
(*MachineName)->Length = ComputerName.Length;
|
||||||
RtlCopyMemory((*MachineName)->Buffer, ComputerName, (*MachineName)->MaximumLength);
|
RtlCopyMemory((*MachineName)->Buffer, ComputerName.Buffer, ComputerName.MaximumLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue