[2/2] iphlpapi: Set MIB_IPADDR_PRIMARY as wType for GetIpAddrTable entries
Bruno Jesus
00cpxxx at gmail.com
Wed May 13 20:02:24 CDT 2015
Thanks to Riccardo.
Fixes https://bugs.winehq.org/show_bug.cgi?id=38569
-------------- next part --------------
---
dlls/iphlpapi/ifenum.c | 6 +++++-
dlls/iphlpapi/tests/iphlpapi.c | 9 +++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c
index a12450e..3070ae5 100644
--- a/dlls/iphlpapi/ifenum.c
+++ b/dlls/iphlpapi/ifenum.c
@@ -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;
}
diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c
index 58fb843..2c31732 100644
--- a/dlls/iphlpapi/tests/iphlpapi.c
+++ b/dlls/iphlpapi/tests/iphlpapi.c
@@ -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");
+ 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);
}
}
--
2.1.4
More information about the wine-patches
mailing list