From: Gé van Geldorp Date: Thu, 5 Jan 2006 23:11:51 +0000 (+0000) Subject: Don't keep overwriting the first address entry, give the others a chance too. X-Git-Tag: backups/expat-rbuild@40467~556 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=fe015e66020093620ff51558eb6ab41a0f4fd27d;hp=594534a9f8faa46106537535856e7d5f00e17d0f Don't keep overwriting the first address entry, give the others a chance too. Fixes IP address display in ipconfig. svn path=/trunk/; revision=20597 --- diff --git a/reactos/drivers/net/tcpip/tcpip/ninfo.c b/reactos/drivers/net/tcpip/tcpip/ninfo.c index 9602d3ca4d6..8f81565d75d 100644 --- a/reactos/drivers/net/tcpip/tcpip/ninfo.c +++ b/reactos/drivers/net/tcpip/tcpip/ninfo.c @@ -19,7 +19,7 @@ TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer, IF_LIST_ITER(CurrentIF); TDI_STATUS Status = TDI_INVALID_REQUEST; KIRQL OldIrql; - UINT Count = 1; /* Start adapter indices at 1 */ + UINT Count = 0; UINT IfCount = CountInterfaces(); PIPADDR_ENTRY IpAddress = ExAllocatePool( NonPagedPool, sizeof( IPADDR_ENTRY ) * IfCount ); @@ -38,20 +38,21 @@ TDI_STATUS InfoTdiQueryGetAddrTable( PNDIS_BUFFER Buffer, /* Locate the diffrent addresses and put them the right place */ GetInterfaceIPv4Address( CurrentIF, ADE_UNICAST, - &IpAddress->Addr ); + &IpCurrent->Addr ); GetInterfaceIPv4Address( CurrentIF, ADE_BROADCAST, - &IpAddress->BcastAddr ); + &IpCurrent->BcastAddr ); GetInterfaceIPv4Address( CurrentIF, ADE_ADDRMASK, - &IpAddress->Mask ); + &IpCurrent->Mask ); IpCurrent++; Count++; } EndFor(CurrentIF); + ASSERT( Count == IfCount ); TcpipReleaseSpinLock(&InterfaceListLock, OldIrql); - Status = InfoCopyOut( (PCHAR)IpAddress, sizeof(*IpAddress) * Count, + Status = InfoCopyOut( (PCHAR)IpAddress, sizeof(*IpAddress) * IfCount, Buffer, BufferSize ); ExFreePool( IpAddress );