advapi32: Initialize more fields in LsaQueryInformationPolicy(PolicyDnsDomainInformation).

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-01 16:25:52 +08:00 committed by Alexandre Julliard
parent 652090f598
commit 09cd27871b
2 changed files with 32 additions and 11 deletions

View File

@ -160,9 +160,8 @@ static void test_sysinfo(void)
ok(hr == S_OK, "got %#x\n", hr);
IDispatch_Release(dispatch);
hr = IADsADSystemInfo_get_UserName(sysinfo, &bstr);
todo_wine
ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NONE_MAPPED), "got %#x\n", hr);
hr = IADsADSystemInfo_get_ComputerName(sysinfo, &bstr);
ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_CANT_ACCESS_DOMAIN_INFO), "got %#x\n", hr);
if (hr != S_OK)
{
skip("Computer is not part of a domain, skipping the tests\n");
@ -171,7 +170,7 @@ todo_wine
}
SysFreeString(bstr);
hr = IADsADSystemInfo_get_ComputerName(sysinfo, &bstr);
hr = IADsADSystemInfo_get_UserName(sysinfo, &bstr);
ok(hr == S_OK, "got %#x\n", hr);
if (hr == S_OK) SysFreeString(bstr);

View File

@ -763,16 +763,38 @@ NTSTATUS WINAPI LsaQueryInformationPolicy(
break;
case PolicyDnsDomainInformation: /* 12 (0xc) */
{
/* Only the domain name is valid for the local computer.
* All other fields are zero.
*/
PPOLICY_DNS_DOMAIN_INFO pinfo;
struct di
{
POLICY_DNS_DOMAIN_INFO info;
SID sid;
WCHAR domain_name[MAX_COMPUTERNAME_LENGTH + 1];
WCHAR dns_domain_name[MAX_COMPUTERNAME_LENGTH + 1];
WCHAR dns_forest_name[MAX_COMPUTERNAME_LENGTH + 1];
};
DWORD dwSize;
struct di *xdi;
pinfo = ADVAPI_GetDomainName(sizeof(*pinfo), offsetof(POLICY_DNS_DOMAIN_INFO, Name));
xdi = heap_alloc_zero(sizeof(*xdi));
if (!xdi) return STATUS_NO_MEMORY;
TRACE("setting domain to %s\n", debugstr_w(pinfo->Name.Buffer));
dwSize = MAX_COMPUTERNAME_LENGTH + 1;
if (GetComputerNameW(xdi->domain_name, &dwSize))
{
xdi->info.Name.Buffer = xdi->domain_name;
xdi->info.Name.Length = dwSize * sizeof(WCHAR);
xdi->info.Name.MaximumLength = (dwSize + 1) * sizeof(WCHAR);
TRACE("setting Name to %s\n", debugstr_w(xdi->info.Name.Buffer));
}
*Buffer = pinfo;
/* FIXME: also set DnsDomainName and DnsForestName */
if (ADVAPI_GetComputerSid(&xdi->sid))
{
xdi->info.Sid = &xdi->sid;
TRACE("setting SID to %s\n", debugstr_sid(&xdi->sid));
}
*Buffer = xdi;
}
break;
case PolicyAuditLogInformation: