diff --git a/dll/win32/ifmon/ip.c b/dll/win32/ifmon/ip.c index 21d92d6a7d5..7b49a914c51 100644 --- a/dll/win32/ifmon/ip.c +++ b/dll/win32/ifmon/ip.c @@ -242,7 +242,7 @@ IpShowAdapters( WCHAR szFriendlyName[80]; DWORD dwFriendlyNameSize; PTCPIP_PROPERTIES pProperties = NULL; - PWSTR pBuffer; + PWSTR pBuffer, pStart, pEnd; dwError = NhpAllocateAndGetInterfaceInfoFromStack(&pTable, &dwCount, @@ -291,58 +291,79 @@ IpShowAdapters( { PrintMessageFromModule(hDllInstance, (pProperties->dwDhcp) ? IDS_DHCP_ON : IDS_DHCP_OFF); - if (*pProperties->pszIpAddress == UNICODE_NULL) + if (pProperties->dwDhcp == 0) { - PrintMessageFromModule(hDllInstance, IDS_NOIPADDRESS); - } - else - { - PrintMessageFromModule(hDllInstance, IDS_IPADDRESS, pProperties->pszIpAddress); - } + if (*pProperties->pszIpAddress == UNICODE_NULL) + { + PrintMessageFromModule(hDllInstance, IDS_NOIPADDRESS); + } + else + { + PrintMessageFromModule(hDllInstance, IDS_IPADDRESS, pProperties->pszIpAddress); + } - if (*pProperties->pszSubnetMask == UNICODE_NULL) - { - PrintMessageFromModule(hDllInstance, IDS_NOSUBNETMASK); - } - else - { - PrintMessageFromModule(hDllInstance, IDS_SUBNETMASK, pProperties->pszSubnetMask); - } + if (*pProperties->pszSubnetMask == UNICODE_NULL) + { + PrintMessageFromModule(hDllInstance, IDS_NOSUBNETMASK); + } + else + { + PrintMessageFromModule(hDllInstance, IDS_SUBNETMASK, pProperties->pszSubnetMask); + } - pBuffer = ExtractParameterValue(pProperties->pszParameters, L"DefGw"); - if (pBuffer) - { - PrintMessage(L" Default Gateway: %s\n", pBuffer); - HeapFree(GetProcessHeap(), 0, pBuffer); - } + pBuffer = ExtractParameterValue(pProperties->pszParameters, L"DefGw"); + if (pBuffer) + { + PrintMessageFromModule(hDllInstance, IDS_DEFAULTGATEWAY, pBuffer); + HeapFree(GetProcessHeap(), 0, pBuffer); + } - pBuffer = ExtractParameterValue(pProperties->pszParameters, L"GwMetric"); - if (pBuffer) - { - PrintMessage(L" Gateway Metric: %s\n", pBuffer); - HeapFree(GetProcessHeap(), 0, pBuffer); + pBuffer = ExtractParameterValue(pProperties->pszParameters, L"GwMetric"); + if (pBuffer) + { + PrintMessageFromModule(hDllInstance, IDS_GATEWAYMETRIC, pBuffer); + HeapFree(GetProcessHeap(), 0, pBuffer); + } } pBuffer = ExtractParameterValue(pProperties->pszParameters, L"IfMetric"); if (pBuffer) { - PrintMessage(L" Interface Metric: %s\n", pBuffer); + PrintMessageFromModule(hDllInstance, IDS_INTERFACEMETRIC, pBuffer); HeapFree(GetProcessHeap(), 0, pBuffer); } } if (DisplayFlags & DISPLAY_DNS) { - - pBuffer = ExtractParameterValue(pProperties->pszParameters, L"DNS"); - if (pBuffer) + if (pProperties->dwDhcp == 0) { - PrintMessage(L" Statically configured DNS Servers: %s\n", pBuffer); - HeapFree(GetProcessHeap(), 0, pBuffer); + pBuffer = ExtractParameterValue(pProperties->pszParameters, L"DNS"); + if (pBuffer) + { + pEnd = wcschr(pBuffer, L','); + if (pEnd == NULL) + { + PrintMessageFromModule(hDllInstance, IDS_STATICNAMESERVER, pBuffer); + } + else + { + pStart = pBuffer; + *pEnd = UNICODE_NULL; + PrintMessageFromModule(hDllInstance, IDS_STATICNAMESERVER, pBuffer); + for (;;) + { + pStart = pEnd + 1; + pEnd = wcschr(pStart, L','); + if (pEnd == NULL) + break; + *pEnd = UNICODE_NULL; + PrintMessageFromModule(hDllInstance, IDS_EMPTYLINE, pBuffer); + } + } + HeapFree(GetProcessHeap(), 0, pBuffer); + } } - -// PrintMessage(L" DNS servers configured through DHCP: %s\n", IpBuffer); -// PrintMessage(L" %s\n", IpBuffer); } CoTaskMemFree(pProperties); @@ -461,7 +482,7 @@ IpDumpFn( } PrintMessageFromModule(hDllInstance, IDS_DUMP_HEADERLINE); - PrintMessage(L"# Interface IP Configuration\n"); + PrintMessageFromModule(hDllInstance, IDS_DUMP_IP_HEADER); PrintMessageFromModule(hDllInstance, IDS_DUMP_HEADERLINE); PrintMessage(L"pushd interface ip\n"); PrintMessageFromModule(hDllInstance, IDS_DUMP_NEWLINE); @@ -486,7 +507,7 @@ IpDumpFn( 0); PrintMessageFromModule(hDllInstance, IDS_DUMP_NEWLINE); - PrintMessageFromModule(hDllInstance, IDS_DUMP_IP_HEADER, szFriendlyName); + PrintMessageFromModule(hDllInstance, IDS_DUMP_IP_INTERFACE, szFriendlyName); PrintMessageFromModule(hDllInstance, IDS_DUMP_NEWLINE); GetInterfaceProperties(&pTable[i].DeviceGuid, &pProperties); @@ -532,7 +553,7 @@ IpDumpFn( PrintMessageFromModule(hDllInstance, IDS_DUMP_NEWLINE); PrintMessage(L"popd\n"); - PrintMessage(L"# End of Interface IP Configuration\n"); + PrintMessageFromModule(hDllInstance, IDS_DUMP_IP_FOOTER); PrintMessageFromModule(hDllInstance, IDS_DUMP_NEWLINE); if (pTable) diff --git a/dll/win32/ifmon/lang/en-US.rc b/dll/win32/ifmon/lang/en-US.rc index 4d57811154d..d594cf0f3e4 100644 --- a/dll/win32/ifmon/lang/en-US.rc +++ b/dll/win32/ifmon/lang/en-US.rc @@ -50,15 +50,18 @@ Parameters:\n\n\ IDS_NOSUBNETMASK " Subnet Mask: None\n" IDS_SUBNETMASK " Subnet Mask: %s\n" IDS_SUBNETMASKS " Subnet Masks: %s\n" - + IDS_DEFAULTGATEWAY " Default Gateway: %s\n" + IDS_GATEWAYMETRIC " Gateway Metric: %s\n" + IDS_INTERFACEMETRIC " Interface Metric: %s\n" + IDS_STATICNAMESERVER " Statically configured DNS Servers: %s\n" + IDS_DHCPNAMESERVER " DNS servers configured through DHCP: %s\n" IDS_EMPTYLINE " %s\n" - - IDS_DUMP_NEWLINE "\n" IDS_DUMP_HEADERLINE "# ----------------------------------\n" - IDS_DUMP_IP_HEADER "# Interface IP Configuration for ""%s""\n" - + IDS_DUMP_IP_HEADER "# Interface IP Configuration\n" + IDS_DUMP_IP_INTERFACE "# Interface IP Configuration for ""%s""\n" + IDS_DUMP_IP_FOOTER "# End of Interface IP Configuration\n" END diff --git a/dll/win32/ifmon/resource.h b/dll/win32/ifmon/resource.h index faac684df9a..d9862b006fa 100644 --- a/dll/win32/ifmon/resource.h +++ b/dll/win32/ifmon/resource.h @@ -26,11 +26,18 @@ #define IDS_NOSUBNETMASK 306 #define IDS_SUBNETMASK 307 #define IDS_SUBNETMASKS 308 +#define IDS_DEFAULTGATEWAY 309 +#define IDS_GATEWAYMETRIC 310 +#define IDS_INTERFACEMETRIC 311 +#define IDS_STATICNAMESERVER 312 +#define IDS_DHCPNAMESERVER 313 #define IDS_EMPTYLINE 400 -#define IDS_DUMP_NEWLINE 800 -#define IDS_DUMP_HEADERLINE 801 -#define IDS_DUMP_IP_HEADER 802 +#define IDS_DUMP_NEWLINE 800 +#define IDS_DUMP_HEADERLINE 801 +#define IDS_DUMP_IP_HEADER 802 +#define IDS_DUMP_IP_INTERFACE 803 +#define IDS_DUMP_IP_FOOTER 804