Commit 0197f54a authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

secur32: Add support for NameFullyQualifiedDN to GetComputerObjectName.

parent 411ccfb9
......@@ -165,14 +165,15 @@ static void test_sysinfo(void)
if (hr != S_OK)
{
skip("Computer is not part of a domain, skipping the tests\n");
IADsADSystemInfo_Release(sysinfo);
return;
goto done;
}
SysFreeString(bstr);
hr = IADsADSystemInfo_get_UserName(sysinfo, &bstr);
ok(hr == S_OK, "got %#x\n", hr);
if (hr == S_OK) SysFreeString(bstr);
todo_wine
ok(hr == S_OK || hr == HRESULT_FROM_WIN32(ERROR_NONE_MAPPED), "got %#x\n", hr);
if (hr != S_OK) goto done;
SysFreeString(bstr);
hr = IADsADSystemInfo_get_SiteName(sysinfo, &bstr);
ok(hr == S_OK, "got %#x\n", hr);
......@@ -201,7 +202,7 @@ static void test_sysinfo(void)
hr = IADsADSystemInfo_GetAnyDCName(sysinfo, &bstr);
ok(hr == S_OK, "got %#x\n", hr);
if (hr == S_OK) SysFreeString(bstr);
done:
IADsADSystemInfo_Release(sysinfo);
}
......
......@@ -1021,6 +1021,56 @@ BOOLEAN WINAPI GetComputerObjectNameW(
}
break;
case NameFullyQualifiedDN:
{
static const WCHAR cnW[] = { 'C','N','=',0 };
static const WCHAR ComputersW[] = { 'C','N','=','C','o','m','p','u','t','e','r','s',0 };
static const WCHAR dcW[] = { 'D','C','=',0 };
static const WCHAR commaW[] = { ',',0 };
WCHAR name[MAX_COMPUTERNAME_LENGTH + 1];
DWORD len, size;
WCHAR *suffix;
size = sizeof(name) / sizeof(name[0]);
if (!GetComputerNameW(name, &size))
{
status = FALSE;
break;
}
len = strlenW(cnW) + size + 1 + strlenW(ComputersW) + 1 + strlenW(dcW);
suffix = strrchrW(domainInfo->DnsDomainName.Buffer, '.');
if (suffix)
{
*suffix++ = 0;
len += 1 + strlenW(dcW) + strlenW(suffix);
}
len += strlenW(domainInfo->DnsDomainName.Buffer);
if (lpNameBuffer && *nSize > len)
{
lstrcpyW(lpNameBuffer, cnW);
lstrcatW(lpNameBuffer, name);
lstrcatW(lpNameBuffer, commaW);
lstrcatW(lpNameBuffer, ComputersW);
lstrcatW(lpNameBuffer, commaW);
lstrcatW(lpNameBuffer, dcW);
lstrcatW(lpNameBuffer, domainInfo->DnsDomainName.Buffer);
if (suffix)
{
lstrcatW(lpNameBuffer, commaW);
lstrcatW(lpNameBuffer, dcW);
lstrcatW(lpNameBuffer, suffix);
}
status = TRUE;
}
else /* just requesting length required */
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
status = FALSE;
}
*nSize = len + 1;
break;
}
case NameDisplay:
case NameUniqueId:
case NameCanonical:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment