From 2f370af82657aa7e7fe79bd8dc3652df681c80e1 Mon Sep 17 00:00:00 2001 From: Andrew Munger Date: Sun, 25 Sep 2005 04:55:16 +0000 Subject: [PATCH] Fix getInterfaceInfoSet so GetInterfaceInfo returns only non-loopback adapters, however, we still return some incorrect info. Silenced a DPRINT. svn path=/trunk/; revision=18041 --- reactos/lib/iphlpapi/ifenum_reactos.c | 3 ++- reactos/lib/iphlpapi/iphlpapi_main.c | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/reactos/lib/iphlpapi/ifenum_reactos.c b/reactos/lib/iphlpapi/ifenum_reactos.c index 0dc95ba9e0c..91dd58ab309 100644 --- a/reactos/lib/iphlpapi/ifenum_reactos.c +++ b/reactos/lib/iphlpapi/ifenum_reactos.c @@ -363,6 +363,7 @@ static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile, if( infoSetInt ) { for( i = 0; i < numEntities; i++ ) { if( isInterface( &entIDSet[i] ) ) { + infoSetInt[curInterf].entity_id = entIDSet[i]; status = tdiGetMibForIfEntity ( tcpFile, &entIDSet[i], @@ -769,7 +770,7 @@ DWORD getInterfaceEntryByName(const char *name, PMIB_IFROW entry) sizeof(info.if_info) ); } - DPRINT1("entry->bDescr = %s\n", entry->bDescr); + DPRINT("entry->bDescr = %s\n", entry->bDescr); closeTcpFile( tcpFile ); } diff --git a/reactos/lib/iphlpapi/iphlpapi_main.c b/reactos/lib/iphlpapi/iphlpapi_main.c index 3baddf6074d..7c6a20f3683 100644 --- a/reactos/lib/iphlpapi/iphlpapi_main.c +++ b/reactos/lib/iphlpapi/iphlpapi_main.c @@ -935,8 +935,9 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen) if (!dwOutBufLen) ret = ERROR_INVALID_PARAMETER; else { - DWORD numInterfaces = getNumInterfaces(); - ULONG size = sizeof(IP_INTERFACE_INFO) + (numInterfaces - 1) * + DWORD numNonLoopbackInterfaces = getNumNonLoopbackInterfaces(); + DPRINT("numNonLoopbackInterfaces == 0x%x\n", numNonLoopbackInterfaces); + ULONG size = sizeof(IP_INTERFACE_INFO) + (numNonLoopbackInterfaces) * sizeof(IP_ADAPTER_INDEX_MAP); if (!pIfTable || *dwOutBufLen < size) { @@ -944,10 +945,11 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen) ret = ERROR_INSUFFICIENT_BUFFER; } else { - InterfaceIndexTable *table = getInterfaceIndexTable(); + InterfaceIndexTable *table = getNonLoopbackInterfaceIndexTable(); + DPRINT("table->numIndexes == 0x%x\n", table->numIndexes); if (table) { - size = sizeof(IP_INTERFACE_INFO) + (table->numIndexes - 1) * + size = sizeof(IP_INTERFACE_INFO) + (table->numIndexes) * sizeof(IP_ADAPTER_INDEX_MAP); if (*dwOutBufLen < size) { *dwOutBufLen = size;