From 5539ca8d7e7d7f7cf7f52bd4d108a26495c20f0c Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 20 Sep 2019 09:24:49 +0200 Subject: [PATCH] [IPCONFIG] Improve the 'Autoconfiguration Enabled' information - Show 'Autoconfiguration Enabled' only if DHCP is enabled for the adapter. - Retrieve and display the autoconfiguration state. --- base/applications/network/ipconfig/ipconfig.c | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/base/applications/network/ipconfig/ipconfig.c b/base/applications/network/ipconfig/ipconfig.c index d85dd313cb8..af8b1467a9a 100644 --- a/base/applications/network/ipconfig/ipconfig.c +++ b/base/applications/network/ipconfig/ipconfig.c @@ -407,6 +407,8 @@ VOID ShowInfo(BOOL bAll) ULONG adaptOutBufLen = 0; PFIXED_INFO pFixedInfo = NULL; ULONG netOutBufLen = 0; + PIP_PER_ADAPTER_INFO pPerAdapterInfo = NULL; + ULONG ulPerAdapterInfoLength = 0; ULONG ret = 0; /* call GetAdaptersInfo to obtain the adapter info */ @@ -495,6 +497,15 @@ VOID ShowInfo(BOOL bAll) if (myConType != NULL) HeapFree(ProcessHeap, 0, myConType); + if (GetPerAdapterInfo(pAdapter->Index, pPerAdapterInfo, &ulPerAdapterInfoLength) == ERROR_BUFFER_OVERFLOW) + { + pPerAdapterInfo = (PIP_PER_ADAPTER_INFO)HeapAlloc(ProcessHeap, 0, ulPerAdapterInfoLength); + if (pPerAdapterInfo != NULL) + { + GetPerAdapterInfo(pAdapter->Index, pPerAdapterInfo, &ulPerAdapterInfoLength); + } + } + /* check if the adapter is connected to the media */ if (mibEntry.dwOperStatus != MIB_IF_OPER_STATUS_CONNECTED && mibEntry.dwOperStatus != MIB_IF_OPER_STATUS_OPERATIONAL) { @@ -515,10 +526,20 @@ VOID ShowInfo(BOOL bAll) if (bConnected) { if (pAdapter->DhcpEnabled) + { _tprintf(_T("\tDHCP Enabled. . . . . . . . . . . : Yes\n")); + if (pPerAdapterInfo != NULL) + { + if (pPerAdapterInfo->AutoconfigEnabled) + _tprintf(_T("\tAutoconfiguration Enabled . . . . : Yes\n")); + else + _tprintf(_T("\tAutoconfiguration Enabled . . . . : No\n")); + } + } else + { _tprintf(_T("\tDHCP Enabled. . . . . . . . . . . : No\n")); - _tprintf(_T("\tAutoconfiguration Enabled . . . . : \n")); + } } } @@ -565,8 +586,10 @@ VOID ShowInfo(BOOL bAll) } _tprintf(_T("\n")); - pAdapter = pAdapter->Next; + HeapFree(ProcessHeap, 0, pPerAdapterInfo); + pPerAdapterInfo = NULL; + pAdapter = pAdapter->Next; } HeapFree(ProcessHeap, 0, pFixedInfo); -- 2.17.1