Commit b276bda5 authored by Alexandre Julliard's avatar Alexandre Julliard

kernelbase: Remove trailing dot in GetComputerNameExW() when domain name is empty.

parent d96331d8
......@@ -3146,13 +3146,15 @@ BOOL WINAPI GetComputerNameExW( COMPUTER_NAME_FORMAT type, WCHAR *name, DWORD *l
case ComputerNameDnsFullyQualified:
case ComputerNamePhysicalDnsFullyQualified:
{
WCHAR buffer[256];
DWORD size = ARRAY_SIZE(buffer);
WCHAR *domain, buffer[256];
DWORD size = ARRAY_SIZE(buffer) - 1;
if (!GetComputerNameExW( ComputerNameDnsHostname, buffer, &size )) return FALSE;
lstrcatW( buffer, L"." );
size = ARRAY_SIZE(buffer) - lstrlenW(buffer);
if (!GetComputerNameExW( ComputerNameDnsDomain, buffer + lstrlenW(buffer), &size )) return FALSE;
domain = buffer + lstrlenW(buffer);
*domain++ = '.';
size = ARRAY_SIZE(buffer) - (domain - buffer);
if (!GetComputerNameExW( ComputerNameDnsDomain, domain, &size )) return FALSE;
if (!*domain) domain[-1] = 0;
size = lstrlenW(buffer);
if (name && size < *len)
{
......
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