=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: iphlpapi: Add partial implementation of GetIfTable2Ex.
Alexandre Julliard
julliard at winehq.org
Tue May 30 16:05:13 CDT 2017
Module: wine
Branch: master
Commit: ebf5b23ccb2be6a1d44de7c35e7c1df662136a8f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ebf5b23ccb2be6a1d44de7c35e7c1df662136a8f
Author: André Hentschel <nerv at dawncrow.de>
Date: Thu May 25 16:15:21 2017 +0200
iphlpapi: Add partial implementation of GetIfTable2Ex.
Signed-off-by: André Hentschel <nerv at dawncrow.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/iphlpapi/iphlpapi.spec | 2 +-
dlls/iphlpapi/iphlpapi_main.c | 21 +++++++++++++++++----
dlls/iphlpapi/tests/iphlpapi.c | 33 +++++++++++++++++++++++++++++++++
include/netioapi.h | 6 ++++++
4 files changed, 57 insertions(+), 5 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi.spec b/dlls/iphlpapi/iphlpapi.spec
index 4e5970c..fee9960 100644
--- a/dlls/iphlpapi/iphlpapi.spec
+++ b/dlls/iphlpapi/iphlpapi.spec
@@ -92,7 +92,7 @@
#@ stub GetIfStackTable
@ stdcall GetIfTable( ptr ptr long )
@ stdcall GetIfTable2( ptr )
-#@ stub GetIfTable2Ex
+@ stdcall GetIfTable2Ex( long ptr )
@ stub GetIfTableFromStack
@ stub GetIgmpList
@ stdcall GetInterfaceInfo( ptr ptr )
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index c592a90..d0e13e4 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -1852,17 +1852,21 @@ DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder)
}
/******************************************************************
- * GetIfTable2 (IPHLPAPI.@)
+ * GetIfTable2Ex (IPHLPAPI.@)
*/
-DWORD WINAPI GetIfTable2( MIB_IF_TABLE2 **table )
+DWORD WINAPI GetIfTable2Ex( MIB_IF_TABLE_LEVEL level, MIB_IF_TABLE2 **table )
{
DWORD i, nb_interfaces, size = sizeof(MIB_IF_TABLE2);
InterfaceIndexTable *index_table;
MIB_IF_TABLE2 *ret;
- TRACE( "table %p\n", table );
+ TRACE( "level %u, table %p\n", level, table );
- if (!table) return ERROR_INVALID_PARAMETER;
+ if (!table || level > MibIfTableRaw)
+ return ERROR_INVALID_PARAMETER;
+
+ if (level != MibIfTableNormal)
+ FIXME("level %u not fully supported\n", level);
if ((nb_interfaces = get_interface_indices( FALSE, NULL )) > 1)
size += (nb_interfaces - 1) * sizeof(MIB_IF_ROW2);
@@ -1890,6 +1894,15 @@ DWORD WINAPI GetIfTable2( MIB_IF_TABLE2 **table )
}
/******************************************************************
+ * GetIfTable2 (IPHLPAPI.@)
+ */
+DWORD WINAPI GetIfTable2( MIB_IF_TABLE2 **table )
+{
+ TRACE( "table %p\n", table );
+ return GetIfTable2Ex(MibIfTableNormal, table);
+}
+
+/******************************************************************
* GetInterfaceInfo (IPHLPAPI.@)
*
* Get a list of network interface adapters.
diff --git a/dlls/iphlpapi/tests/iphlpapi.c b/dlls/iphlpapi/tests/iphlpapi.c
index 3369f78..d8c319e 100644
--- a/dlls/iphlpapi/tests/iphlpapi.c
+++ b/dlls/iphlpapi/tests/iphlpapi.c
@@ -58,6 +58,7 @@ static DWORD (WINAPI *pGetIfEntry2)(PMIB_IF_ROW2);
static DWORD (WINAPI *pGetFriendlyIfIndex)(DWORD);
static DWORD (WINAPI *pGetIfTable)(PMIB_IFTABLE,PULONG,BOOL);
static DWORD (WINAPI *pGetIfTable2)(PMIB_IF_TABLE2*);
+static DWORD (WINAPI *pGetIfTable2Ex)(MIB_IF_TABLE_LEVEL,PMIB_IF_TABLE2*);
static DWORD (WINAPI *pGetIpForwardTable)(PMIB_IPFORWARDTABLE,PULONG,BOOL);
static DWORD (WINAPI *pGetIpNetTable)(PMIB_IPNETTABLE,PULONG,BOOL);
static DWORD (WINAPI *pGetInterfaceInfo)(PIP_INTERFACE_INFO,PULONG);
@@ -110,6 +111,7 @@ static void loadIPHlpApi(void)
pGetFriendlyIfIndex = (void *)GetProcAddress(hLibrary, "GetFriendlyIfIndex");
pGetIfTable = (void *)GetProcAddress(hLibrary, "GetIfTable");
pGetIfTable2 = (void *)GetProcAddress(hLibrary, "GetIfTable2");
+ pGetIfTable2Ex = (void *)GetProcAddress(hLibrary, "GetIfTable2Ex");
pGetIpForwardTable = (void *)GetProcAddress(hLibrary, "GetIpForwardTable");
pGetIpNetTable = (void *)GetProcAddress(hLibrary, "GetIpNetTable");
pGetInterfaceInfo = (void *)GetProcAddress(hLibrary, "GetInterfaceInfo");
@@ -2023,6 +2025,36 @@ static void test_GetIfTable2(void)
pFreeMibTable( table );
}
+static void test_GetIfTable2Ex(void)
+{
+ DWORD ret;
+ MIB_IF_TABLE2 *table;
+
+ if (!pGetIfTable2Ex)
+ {
+ win_skip( "GetIfTable2Ex not available\n" );
+ return;
+ }
+
+ table = NULL;
+ ret = pGetIfTable2Ex( MibIfTableNormal, &table );
+ ok( ret == NO_ERROR, "got %u\n", ret );
+ ok( table != NULL, "table not set\n" );
+ pFreeMibTable( table );
+
+ table = NULL;
+ ret = pGetIfTable2Ex( MibIfTableRaw, &table );
+ ok( ret == NO_ERROR, "got %u\n", ret );
+ ok( table != NULL, "table not set\n" );
+ pFreeMibTable( table );
+
+ table = NULL;
+ ret = pGetIfTable2Ex( 2, &table );
+ ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
+ ok( !table, "table should not be set\n" );
+ pFreeMibTable( table );
+}
+
static void test_GetUnicastIpAddressEntry(void)
{
IP_ADAPTER_ADDRESSES *aa, *ptr;
@@ -2208,6 +2240,7 @@ START_TEST(iphlpapi)
test_interface_identifier_conversion();
test_GetIfEntry2();
test_GetIfTable2();
+ test_GetIfTable2Ex();
test_GetUnicastIpAddressEntry();
test_GetUnicastIpAddressTable();
freeIPHlpApi();
diff --git a/include/netioapi.h b/include/netioapi.h
index cabfe9e..4f5f671 100644
--- a/include/netioapi.h
+++ b/include/netioapi.h
@@ -21,6 +21,12 @@
#include <ntddndis.h>
+typedef enum _MIB_IF_TABLE_LEVEL
+{
+ MibIfTableNormal,
+ MibIfTableRaw
+} MIB_IF_TABLE_LEVEL, *PMIB_IF_TABLE_LEVEL;
+
typedef enum _MIB_NOTIFICATION_TYPE
{
MibParameterNotification,
More information about the wine-cvs
mailing list