@@ -242,7 +242,7 @@ IpShowAdapters(
242242 WCHAR szFriendlyName [80 ];
243243 DWORD dwFriendlyNameSize ;
244244 PTCPIP_PROPERTIES pProperties = NULL ;
245- PWSTR pBuffer ;
245+ PWSTR pBuffer , pStart , pEnd ;
246246
247247 dwError = NhpAllocateAndGetInterfaceInfoFromStack (& pTable ,
248248 & dwCount ,
@@ -291,58 +291,79 @@ IpShowAdapters(
291291 {
292292 PrintMessageFromModule (hDllInstance , (pProperties -> dwDhcp ) ? IDS_DHCP_ON : IDS_DHCP_OFF );
293293
294- if (* pProperties -> pszIpAddress == UNICODE_NULL )
295- {
296- PrintMessageFromModule (hDllInstance , IDS_NOIPADDRESS );
297- }
298- else
299- {
300- PrintMessageFromModule (hDllInstance , IDS_IPADDRESS , pProperties -> pszIpAddress );
301- }
302-
303- if (* pProperties -> pszSubnetMask == UNICODE_NULL )
304- {
305- PrintMessageFromModule (hDllInstance , IDS_NOSUBNETMASK );
306- }
307- else
308- {
309- PrintMessageFromModule (hDllInstance , IDS_SUBNETMASK , pProperties -> pszSubnetMask );
310- }
311-
312- pBuffer = ExtractParameterValue (pProperties -> pszParameters , L"DefGw" );
313- if (pBuffer )
294+ if (pProperties -> dwDhcp == 0 )
314295 {
315- PrintMessage (L" Default Gateway: %s\n" , pBuffer );
316- HeapFree (GetProcessHeap (), 0 , pBuffer );
317- }
318-
319- pBuffer = ExtractParameterValue (pProperties -> pszParameters , L"GwMetric" );
320- if (pBuffer )
321- {
322- PrintMessage (L" Gateway Metric: %s\n" , pBuffer );
323- HeapFree (GetProcessHeap (), 0 , pBuffer );
296+ if (* pProperties -> pszIpAddress == UNICODE_NULL )
297+ {
298+ PrintMessageFromModule (hDllInstance , IDS_NOIPADDRESS );
299+ }
300+ else
301+ {
302+ PrintMessageFromModule (hDllInstance , IDS_IPADDRESS , pProperties -> pszIpAddress );
303+ }
304+
305+ if (* pProperties -> pszSubnetMask == UNICODE_NULL )
306+ {
307+ PrintMessageFromModule (hDllInstance , IDS_NOSUBNETMASK );
308+ }
309+ else
310+ {
311+ PrintMessageFromModule (hDllInstance , IDS_SUBNETMASK , pProperties -> pszSubnetMask );
312+ }
313+
314+ pBuffer = ExtractParameterValue (pProperties -> pszParameters , L"DefGw" );
315+ if (pBuffer )
316+ {
317+ PrintMessageFromModule (hDllInstance , IDS_DEFAULTGATEWAY , pBuffer );
318+ HeapFree (GetProcessHeap (), 0 , pBuffer );
319+ }
320+
321+ pBuffer = ExtractParameterValue (pProperties -> pszParameters , L"GwMetric" );
322+ if (pBuffer )
323+ {
324+ PrintMessageFromModule (hDllInstance , IDS_GATEWAYMETRIC , pBuffer );
325+ HeapFree (GetProcessHeap (), 0 , pBuffer );
326+ }
324327 }
325328
326329 pBuffer = ExtractParameterValue (pProperties -> pszParameters , L"IfMetric" );
327330 if (pBuffer )
328331 {
329- PrintMessage ( L" Interface Metric: %s\n" , pBuffer );
332+ PrintMessageFromModule ( hDllInstance , IDS_INTERFACEMETRIC , pBuffer );
330333 HeapFree (GetProcessHeap (), 0 , pBuffer );
331334 }
332335 }
333336
334337 if (DisplayFlags & DISPLAY_DNS )
335338 {
336-
337- pBuffer = ExtractParameterValue (pProperties -> pszParameters , L"DNS" );
338- if (pBuffer )
339+ if (pProperties -> dwDhcp == 0 )
339340 {
340- PrintMessage (L" Statically configured DNS Servers: %s\n" , pBuffer );
341- HeapFree (GetProcessHeap (), 0 , pBuffer );
341+ pBuffer = ExtractParameterValue (pProperties -> pszParameters , L"DNS" );
342+ if (pBuffer )
343+ {
344+ pEnd = wcschr (pBuffer , L',' );
345+ if (pEnd == NULL )
346+ {
347+ PrintMessageFromModule (hDllInstance , IDS_STATICNAMESERVER , pBuffer );
348+ }
349+ else
350+ {
351+ pStart = pBuffer ;
352+ * pEnd = UNICODE_NULL ;
353+ PrintMessageFromModule (hDllInstance , IDS_STATICNAMESERVER , pBuffer );
354+ for (;;)
355+ {
356+ pStart = pEnd + 1 ;
357+ pEnd = wcschr (pStart , L',' );
358+ if (pEnd == NULL )
359+ break ;
360+ * pEnd = UNICODE_NULL ;
361+ PrintMessageFromModule (hDllInstance , IDS_EMPTYLINE , pBuffer );
362+ }
363+ }
364+ HeapFree (GetProcessHeap (), 0 , pBuffer );
365+ }
342366 }
343-
344- // PrintMessage(L" DNS servers configured through DHCP: %s\n", IpBuffer);
345- // PrintMessage(L" %s\n", IpBuffer);
346367 }
347368
348369 CoTaskMemFree (pProperties );
@@ -461,7 +482,7 @@ IpDumpFn(
461482 }
462483
463484 PrintMessageFromModule (hDllInstance , IDS_DUMP_HEADERLINE );
464- PrintMessage ( L"# Interface IP Configuration\n" );
485+ PrintMessageFromModule ( hDllInstance , IDS_DUMP_IP_HEADER );
465486 PrintMessageFromModule (hDllInstance , IDS_DUMP_HEADERLINE );
466487 PrintMessage (L"pushd interface ip\n" );
467488 PrintMessageFromModule (hDllInstance , IDS_DUMP_NEWLINE );
@@ -486,7 +507,7 @@ IpDumpFn(
486507 0 );
487508
488509 PrintMessageFromModule (hDllInstance , IDS_DUMP_NEWLINE );
489- PrintMessageFromModule (hDllInstance , IDS_DUMP_IP_HEADER , szFriendlyName );
510+ PrintMessageFromModule (hDllInstance , IDS_DUMP_IP_INTERFACE , szFriendlyName );
490511 PrintMessageFromModule (hDllInstance , IDS_DUMP_NEWLINE );
491512
492513 GetInterfaceProperties (& pTable [i ].DeviceGuid , & pProperties );
@@ -532,7 +553,7 @@ IpDumpFn(
532553
533554 PrintMessageFromModule (hDllInstance , IDS_DUMP_NEWLINE );
534555 PrintMessage (L"popd\n" );
535- PrintMessage ( L"# End of Interface IP Configuration\n" );
556+ PrintMessageFromModule ( hDllInstance , IDS_DUMP_IP_FOOTER );
536557 PrintMessageFromModule (hDllInstance , IDS_DUMP_NEWLINE );
537558
538559 if (pTable )
0 commit comments