advapi32: Return correct short domain name.

Also remove suffix and uppercase the returned name as Windows does.

Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Dmitry Timoshkov 2018-03-02 18:45:00 +08:00 committed by Alexandre Julliard
parent a3bcaca48d
commit eb077e9fac
1 changed files with 8 additions and 3 deletions

View File

@ -786,11 +786,16 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
if (!xdi) return STATUS_NO_MEMORY; if (!xdi) return STATUS_NO_MEMORY;
dwSize = MAX_COMPUTERNAME_LENGTH + 1; dwSize = MAX_COMPUTERNAME_LENGTH + 1;
if (GetComputerNameW(xdi->domain_name, &dwSize)) if (GetComputerNameExW(ComputerNamePhysicalDnsDomain, xdi->domain_name, &dwSize))
{ {
WCHAR *dot;
dot = strrchrW(xdi->domain_name, '.');
if (dot) *dot = 0;
struprW(xdi->domain_name);
xdi->info.Name.Buffer = xdi->domain_name; xdi->info.Name.Buffer = xdi->domain_name;
xdi->info.Name.Length = dwSize * sizeof(WCHAR); xdi->info.Name.Length = strlenW(xdi->domain_name) * sizeof(WCHAR);
xdi->info.Name.MaximumLength = (dwSize + 1) * sizeof(WCHAR); xdi->info.Name.MaximumLength = xdi->info.Name.Length + sizeof(WCHAR);
TRACE("setting Name to %s\n", debugstr_w(xdi->info.Name.Buffer)); TRACE("setting Name to %s\n", debugstr_w(xdi->info.Name.Buffer));
} }