Bruno Jesus : iphlpapi: Set MIB_IPADDR_PRIMARY as wType for GetIpAddrTable entries.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu May 14 06:22:36 CDT 2015
Module: wine
Branch: master
Commit: 084bcaa76b4e8c02b5dbc2f9f400d25271067874
URL: http://source.winehq.org/git/wine.git/?a=commit;h=084bcaa76b4e8c02b5dbc2f9f400d25271067874
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Wed May 13 22:02:24 2015 -0300
iphlpapi: Set MIB_IPADDR_PRIMARY as wType for GetIpAddrTable entries.
---
dlls/iphlpapi/ifenum.c | 6 +++++-
dlls/iphlpapi/tests/iphlpapi.c | 9 +++++++++
include/ipmib.h | 7 +++++++
3 files changed, 21 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..847ba49 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", 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);
}
}
diff --git a/include/ipmib.h b/include/ipmib.h
index 65576be..d85ee5a 100644
--- a/include/ipmib.h
+++ b/include/ipmib.h
@@ -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 */
More information about the wine-cvs
mailing list