Fix getInterfaceInfoSet so GetInterfaceInfo returns only non-loopback adapters, however, we still return some incorrect info.

Silenced a DPRINT.

svn path=/trunk/; revision=18041
This commit is contained in:
Andrew Munger 2005-09-25 04:55:16 +00:00
parent 6e7b2b5af4
commit 2f370af826
2 changed files with 8 additions and 5 deletions

View file

@ -363,6 +363,7 @@ static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile,
if( infoSetInt ) { if( infoSetInt ) {
for( i = 0; i < numEntities; i++ ) { for( i = 0; i < numEntities; i++ ) {
if( isInterface( &entIDSet[i] ) ) { if( isInterface( &entIDSet[i] ) ) {
infoSetInt[curInterf].entity_id = entIDSet[i];
status = tdiGetMibForIfEntity status = tdiGetMibForIfEntity
( tcpFile, ( tcpFile,
&entIDSet[i], &entIDSet[i],
@ -769,7 +770,7 @@ DWORD getInterfaceEntryByName(const char *name, PMIB_IFROW entry)
sizeof(info.if_info) ); sizeof(info.if_info) );
} }
DPRINT1("entry->bDescr = %s\n", entry->bDescr); DPRINT("entry->bDescr = %s\n", entry->bDescr);
closeTcpFile( tcpFile ); closeTcpFile( tcpFile );
} }

View file

@ -935,8 +935,9 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
if (!dwOutBufLen) if (!dwOutBufLen)
ret = ERROR_INVALID_PARAMETER; ret = ERROR_INVALID_PARAMETER;
else { else {
DWORD numInterfaces = getNumInterfaces(); DWORD numNonLoopbackInterfaces = getNumNonLoopbackInterfaces();
ULONG size = sizeof(IP_INTERFACE_INFO) + (numInterfaces - 1) * DPRINT("numNonLoopbackInterfaces == 0x%x\n", numNonLoopbackInterfaces);
ULONG size = sizeof(IP_INTERFACE_INFO) + (numNonLoopbackInterfaces) *
sizeof(IP_ADAPTER_INDEX_MAP); sizeof(IP_ADAPTER_INDEX_MAP);
if (!pIfTable || *dwOutBufLen < size) { if (!pIfTable || *dwOutBufLen < size) {
@ -944,10 +945,11 @@ DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
ret = ERROR_INSUFFICIENT_BUFFER; ret = ERROR_INSUFFICIENT_BUFFER;
} }
else { else {
InterfaceIndexTable *table = getInterfaceIndexTable(); InterfaceIndexTable *table = getNonLoopbackInterfaceIndexTable();
DPRINT("table->numIndexes == 0x%x\n", table->numIndexes);
if (table) { if (table) {
size = sizeof(IP_INTERFACE_INFO) + (table->numIndexes - 1) * size = sizeof(IP_INTERFACE_INFO) + (table->numIndexes) *
sizeof(IP_ADAPTER_INDEX_MAP); sizeof(IP_ADAPTER_INDEX_MAP);
if (*dwOutBufLen < size) { if (*dwOutBufLen < size) {
*dwOutBufLen = size; *dwOutBufLen = size;