Commit ebf5b23c authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

iphlpapi: Add partial implementation of GetIfTable2Ex.

parent 52afd729
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
#@ stub GetIfStackTable #@ stub GetIfStackTable
@ stdcall GetIfTable( ptr ptr long ) @ stdcall GetIfTable( ptr ptr long )
@ stdcall GetIfTable2( ptr ) @ stdcall GetIfTable2( ptr )
#@ stub GetIfTable2Ex @ stdcall GetIfTable2Ex( long ptr )
@ stub GetIfTableFromStack @ stub GetIfTableFromStack
@ stub GetIgmpList @ stub GetIgmpList
@ stdcall GetInterfaceInfo( ptr ptr ) @ stdcall GetInterfaceInfo( ptr ptr )
......
...@@ -1852,17 +1852,21 @@ DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder) ...@@ -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); DWORD i, nb_interfaces, size = sizeof(MIB_IF_TABLE2);
InterfaceIndexTable *index_table; InterfaceIndexTable *index_table;
MIB_IF_TABLE2 *ret; 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) if ((nb_interfaces = get_interface_indices( FALSE, NULL )) > 1)
size += (nb_interfaces - 1) * sizeof(MIB_IF_ROW2); size += (nb_interfaces - 1) * sizeof(MIB_IF_ROW2);
...@@ -1890,6 +1894,15 @@ DWORD WINAPI GetIfTable2( MIB_IF_TABLE2 **table ) ...@@ -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.@) * GetInterfaceInfo (IPHLPAPI.@)
* *
* Get a list of network interface adapters. * Get a list of network interface adapters.
......
...@@ -58,6 +58,7 @@ static DWORD (WINAPI *pGetIfEntry2)(PMIB_IF_ROW2); ...@@ -58,6 +58,7 @@ static DWORD (WINAPI *pGetIfEntry2)(PMIB_IF_ROW2);
static DWORD (WINAPI *pGetFriendlyIfIndex)(DWORD); static DWORD (WINAPI *pGetFriendlyIfIndex)(DWORD);
static DWORD (WINAPI *pGetIfTable)(PMIB_IFTABLE,PULONG,BOOL); static DWORD (WINAPI *pGetIfTable)(PMIB_IFTABLE,PULONG,BOOL);
static DWORD (WINAPI *pGetIfTable2)(PMIB_IF_TABLE2*); 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 *pGetIpForwardTable)(PMIB_IPFORWARDTABLE,PULONG,BOOL);
static DWORD (WINAPI *pGetIpNetTable)(PMIB_IPNETTABLE,PULONG,BOOL); static DWORD (WINAPI *pGetIpNetTable)(PMIB_IPNETTABLE,PULONG,BOOL);
static DWORD (WINAPI *pGetInterfaceInfo)(PIP_INTERFACE_INFO,PULONG); static DWORD (WINAPI *pGetInterfaceInfo)(PIP_INTERFACE_INFO,PULONG);
...@@ -110,6 +111,7 @@ static void loadIPHlpApi(void) ...@@ -110,6 +111,7 @@ static void loadIPHlpApi(void)
pGetFriendlyIfIndex = (void *)GetProcAddress(hLibrary, "GetFriendlyIfIndex"); pGetFriendlyIfIndex = (void *)GetProcAddress(hLibrary, "GetFriendlyIfIndex");
pGetIfTable = (void *)GetProcAddress(hLibrary, "GetIfTable"); pGetIfTable = (void *)GetProcAddress(hLibrary, "GetIfTable");
pGetIfTable2 = (void *)GetProcAddress(hLibrary, "GetIfTable2"); pGetIfTable2 = (void *)GetProcAddress(hLibrary, "GetIfTable2");
pGetIfTable2Ex = (void *)GetProcAddress(hLibrary, "GetIfTable2Ex");
pGetIpForwardTable = (void *)GetProcAddress(hLibrary, "GetIpForwardTable"); pGetIpForwardTable = (void *)GetProcAddress(hLibrary, "GetIpForwardTable");
pGetIpNetTable = (void *)GetProcAddress(hLibrary, "GetIpNetTable"); pGetIpNetTable = (void *)GetProcAddress(hLibrary, "GetIpNetTable");
pGetInterfaceInfo = (void *)GetProcAddress(hLibrary, "GetInterfaceInfo"); pGetInterfaceInfo = (void *)GetProcAddress(hLibrary, "GetInterfaceInfo");
...@@ -2023,6 +2025,36 @@ static void test_GetIfTable2(void) ...@@ -2023,6 +2025,36 @@ static void test_GetIfTable2(void)
pFreeMibTable( table ); 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) static void test_GetUnicastIpAddressEntry(void)
{ {
IP_ADAPTER_ADDRESSES *aa, *ptr; IP_ADAPTER_ADDRESSES *aa, *ptr;
...@@ -2208,6 +2240,7 @@ START_TEST(iphlpapi) ...@@ -2208,6 +2240,7 @@ START_TEST(iphlpapi)
test_interface_identifier_conversion(); test_interface_identifier_conversion();
test_GetIfEntry2(); test_GetIfEntry2();
test_GetIfTable2(); test_GetIfTable2();
test_GetIfTable2Ex();
test_GetUnicastIpAddressEntry(); test_GetUnicastIpAddressEntry();
test_GetUnicastIpAddressTable(); test_GetUnicastIpAddressTable();
freeIPHlpApi(); freeIPHlpApi();
......
...@@ -21,6 +21,12 @@ ...@@ -21,6 +21,12 @@
#include <ntddndis.h> #include <ntddndis.h>
typedef enum _MIB_IF_TABLE_LEVEL
{
MibIfTableNormal,
MibIfTableRaw
} MIB_IF_TABLE_LEVEL, *PMIB_IF_TABLE_LEVEL;
typedef enum _MIB_NOTIFICATION_TYPE typedef enum _MIB_NOTIFICATION_TYPE
{ {
MibParameterNotification, MibParameterNotification,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment