iphlpapi: Set MIB_IPADDR_PRIMARY as wType for GetIpAddrTable entries.

This commit is contained in:
Bruno Jesus 2015-05-13 22:02:24 -03:00 committed by Alexandre Julliard
parent e0fa7ff465
commit 084bcaa76b
3 changed files with 21 additions and 1 deletions

View File

@ -807,7 +807,11 @@ static DWORD getIPAddrRowByName(PMIB_IPADDRROW ipAddrRow, const char *ifName,
/* FIXME: hardcoded reasm size, not sure where to get it */
ipAddrRow->dwReasmSize = 65535;
ipAddrRow->unused1 = 0;
ipAddrRow->wType = 0;
/* wType is a bit field composed of MIB_IPADDR_* flags. Windows <= XP seems
* to like returning undocumented values 0x20 + 0x02 but for our current
* needs returning MIB_IPADDR_PRIMARY is enough.
*/
ipAddrRow->wType = MIB_IPADDR_PRIMARY;
return ret;
}

View File

@ -226,7 +226,16 @@ static void testGetIpAddrTable(void)
"GetIpAddrTable(buf, &dwSize, FALSE) returned %d, expected NO_ERROR\n",
apiReturn);
if (apiReturn == NO_ERROR && buf->dwNumEntries)
{
int i;
testGetIfEntry(buf->table[0].dwIndex);
for (i = 0; i < buf->dwNumEntries; i++)
{
ok (buf->table[i].wType != 0, "Test[%d]: expected wType > 0\n", i);
trace("Entry[%d]: addr %s, dwIndex %u, wType 0x%x\n", i,
ntoa(buf->table[i].dwAddr), buf->table[i].dwIndex, buf->table[i].wType);
}
}
HeapFree(GetProcessHeap(), 0, buf);
}
}

View File

@ -21,6 +21,13 @@
#include <ifmib.h>
#include <nldef.h>
/* Flags used in the wType field from MIB_IPADDRROW */
#define MIB_IPADDR_PRIMARY 0x0001
#define MIB_IPADDR_DYNAMIC 0x0004
#define MIB_IPADDR_DISCONNECTED 0x0008
#define MIB_IPADDR_DELETED 0x0040
#define MIB_IPADDR_TRANSIENT 0x0080
/* IPADDR table */