https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5539ca8d7e7d7f7cf7f52b...
commit 5539ca8d7e7d7f7cf7f52bd4d108a26495c20f0c Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Fri Sep 20 09:24:49 2019 +0200 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Fri Sep 20 09:25:49 2019 +0200
[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);