mirror of
https://github.com/reactos/reactos.git
synced 2025-06-13 02:08:29 +00:00
[SYSSETUP]
Set the account domain name. svn path=/trunk/; revision=53794
This commit is contained in:
parent
a694d0b795
commit
f0df809eb7
1 changed files with 44 additions and 0 deletions
|
@ -520,6 +520,47 @@ OwnerPageDlgProc(HWND hwndDlg,
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
NTSTATUS
|
||||||
|
SetAccountDomain(LPWSTR DomainName)
|
||||||
|
{
|
||||||
|
POLICY_ACCOUNT_DOMAIN_INFO Info;
|
||||||
|
LSA_OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
|
LSA_HANDLE PolicyHandle;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
memset(&ObjectAttributes, 0, sizeof(LSA_OBJECT_ATTRIBUTES));
|
||||||
|
ObjectAttributes.Length = sizeof(LSA_OBJECT_ATTRIBUTES);
|
||||||
|
|
||||||
|
Status = LsaOpenPolicy(NULL,
|
||||||
|
&ObjectAttributes,
|
||||||
|
POLICY_TRUST_ADMIN,
|
||||||
|
&PolicyHandle);
|
||||||
|
if (Status != STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
DPRINT("LsaOpenPolicy failed (Status: 0x%08lx)\n", Status);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info.DomainName.Buffer = DomainName;
|
||||||
|
Info.DomainName.Length = wcslen(DomainName) * sizeof(WCHAR);
|
||||||
|
Info.DomainName.MaximumLength = Info.DomainName.Length + sizeof(WCHAR);
|
||||||
|
Info.DomainSid = NULL;
|
||||||
|
|
||||||
|
Status = LsaSetInformationPolicy(PolicyHandle,
|
||||||
|
PolicyAccountDomainInformation,
|
||||||
|
(PVOID)&Info);
|
||||||
|
if (Status != STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
DPRINT("LsaSetInformationPolicy failed (Status: 0x%08lx)\n", Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
LsaClose(PolicyHandle);
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
BOOL
|
BOOL
|
||||||
WriteComputerSettings(WCHAR * ComputerName, HWND hwndDlg)
|
WriteComputerSettings(WCHAR * ComputerName, HWND hwndDlg)
|
||||||
|
@ -545,6 +586,9 @@ WriteComputerSettings(WCHAR * ComputerName, HWND hwndDlg)
|
||||||
/* Try to also set DNS hostname */
|
/* Try to also set DNS hostname */
|
||||||
SetComputerNameExW(ComputerNamePhysicalDnsHostname, ComputerName);
|
SetComputerNameExW(ComputerNamePhysicalDnsHostname, ComputerName);
|
||||||
|
|
||||||
|
/* Set the account domain name */
|
||||||
|
SetAccountDomain(ComputerName);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue