Index: dll/win32/iphlpapi/iphlpapi_main.c =================================================================== --- dll/win32/iphlpapi/iphlpapi_main.c (revision 72796) +++ dll/win32/iphlpapi/iphlpapi_main.c (working copy) @@ -1404,7 +1404,7 @@ */ DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen) { - DWORD ret, size; + DWORD ret, size, type; LONG regReturn; HKEY hKey; PIPHLP_RES_INFO resInfo; @@ -1426,11 +1426,60 @@ } memset(pFixedInfo, 0, size); - size = sizeof(pFixedInfo->HostName); - GetComputerNameExA(ComputerNameDnsHostname, pFixedInfo->HostName, &size); - size = sizeof(pFixedInfo->DomainName); - GetComputerNameExA(ComputerNameDnsDomain, pFixedInfo->DomainName, &size); + /* Check for DhcpHostname and DhcpDomain first */ + regReturn = RegOpenKeyExA(HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + 0, + KEY_READ, + &hKey); + if (regReturn == ERROR_SUCCESS) { + /* Windows doesn't honor DHCP option 12 even if RFC requires it if it is returned by DHCP server! */ +#if 0 + type = REG_SZ; + size = sizeof(pFixedInfo->HostName); + regReturn = RegQueryValueExA(hKey, + "DhcpHostname", + NULL, + &type, + (LPBYTE)pFixedInfo->HostName, + &size); + if (regReturn == ERROR_FILE_NOT_FOUND || (regReturn == ERROR_SUCCESS && size < 1)) + { +#endif + type = REG_SZ; + size = sizeof(pFixedInfo->HostName); + regReturn = RegQueryValueExA(hKey, + "Hostname", + NULL, + &type, + (LPBYTE)pFixedInfo->HostName, + &size); +#if 0 + } +#endif + type = REG_SZ; + size = sizeof(pFixedInfo->DomainName); + regReturn = RegQueryValueExA(hKey, + "DhcpDomain", + NULL, + &type, + (LPBYTE)pFixedInfo->DomainName, + &size); + if (regReturn == ERROR_FILE_NOT_FOUND || (regReturn == ERROR_SUCCESS && size < 1)) + { + type = REG_SZ; + size = sizeof(pFixedInfo->DomainName); + regReturn = RegQueryValueExA(hKey, + "Domain", + NULL, + &type, + (LPBYTE)pFixedInfo->DomainName, + &size); + } + RegCloseKey(hKey); + } + TRACE("GetComputerNameExA: %s\n", pFixedInfo->DomainName); if (resInfo->riCount > 0)