Author: cgutman
Date: Tue Jul 14 22:14:32 2009
New Revision: 41959
URL:
http://svn.reactos.org/svn/reactos?rev=41959&view=rev
Log:
- Release all adapter IP addresses when using /release
Modified:
trunk/reactos/base/applications/network/ipconfig/ipconfig.c
Modified: trunk/reactos/base/applications/network/ipconfig/ipconfig.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
==============================================================================
--- trunk/reactos/base/applications/network/ipconfig/ipconfig.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/network/ipconfig/ipconfig.c [iso-8859-1] Tue Jul 14
22:14:32 2009
@@ -515,6 +515,7 @@
{
IP_ADAPTER_INDEX_MAP AdapterInfo;
DWORD ret;
+ DWORD i;
/* if interface is not given, query GetInterfaceInfo */
if (Index == NULL)
@@ -530,8 +531,19 @@
if (GetInterfaceInfo(pInfo, &ulOutBufLen) == NO_ERROR )
{
- CopyMemory(&AdapterInfo, &pInfo->Adapter[0],
sizeof(IP_ADAPTER_INDEX_MAP));
- _tprintf(_T("name - %S\n"), pInfo->Adapter[0].Name);
+ for (i = 0; i < pInfo->NumAdapters; i++)
+ {
+ CopyMemory(&AdapterInfo, &pInfo->Adapter[i],
sizeof(IP_ADAPTER_INDEX_MAP));
+ _tprintf(_T("name - %S\n"), pInfo->Adapter[i].Name);
+
+ /* Call IpReleaseAddress to release the IP address on the specified
adapter. */
+ if ((ret = IpReleaseAddress(&AdapterInfo)) != NO_ERROR)
+ {
+ _tprintf(_T("\nAn error occured while releasing interface
%S : \n"), AdapterInfo.Name);
+ DoFormatMessage(ret);
+ }
+ }
+
HeapFree(ProcessHeap, 0, pInfo);
}
else
@@ -556,15 +568,6 @@
* ipconfig /release *con* will release all cards with 'con' in
their name
*/
}
-
-
- /* Call IpReleaseAddress to release the IP address on the specified adapter. */
- if ((ret = IpReleaseAddress(&AdapterInfo)) != NO_ERROR)
- {
- _tprintf(_T("\nAn error occured while releasing interface %S : \n"),
AdapterInfo.Name);
- DoFormatMessage(ret);
- }
-
}