ReactOS 0.4.16-dev-1946-g52006dd
iphlpapi.c File Reference
#include <stdarg.h>
#include "winsock2.h"
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "ws2tcpip.h"
#include "windns.h"
#include "iphlpapi.h"
#include "icmpapi.h"
#include "iprtrmib.h"
#include "netioapi.h"
#include "wine/test.h"
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for iphlpapi.c:

Go to the source code of this file.

Macros

#define ICMP_MINLEN   8 /* copied from dlls/iphlpapi/ip_icmp.h file */
 

Functions

static DWORD (WINAPI *pAllocateAndGetTcpExTableFromStack)(void **
 
DWORD WINAPI ConvertGuidToStringA (const GUID *, char *, DWORD)
 
DWORD WINAPI ConvertGuidToStringW (const GUID *, WCHAR *, DWORD)
 
DWORD WINAPI ConvertStringToGuidW (const WCHAR *, GUID *)
 
static void loadIPHlpApi (void)
 
static void freeIPHlpApi (void)
 
static const charntoa (DWORD ip)
 
static const charntoa6 (IN6_ADDR *ip)
 
static DWORD ipv4_addr (BYTE b1, BYTE b2, BYTE b3, BYTE b4)
 
static void testWin98OnlyFunctions (void)
 
static void testGetNumberOfInterfaces (void)
 
static void testGetIfEntry (DWORD index)
 
static void testGetIpAddrTable (void)
 
static void testGetIfTable (void)
 
static void testGetIpForwardTable (void)
 
static void testGetIpNetTable (void)
 
static void testGetIcmpStatistics (void)
 
static void testGetIpStatistics (void)
 
static void testGetTcpStatistics (void)
 
static void testGetUdpStatistics (void)
 
static void testGetIcmpStatisticsEx (void)
 
static void testGetIpStatisticsEx (void)
 
static void testGetTcpStatisticsEx (void)
 
static void testGetUdpStatisticsEx (void)
 
static void testGetTcpTable (void)
 
static void testGetUdpTable (void)
 
static void testSetTcpEntry (void)
 
static void WINAPI icmp_send_echo_test_apc_xp (void *context)
 
static void WINAPI icmp_send_echo_test_apc (void *context, IO_STATUS_BLOCK *io_status, ULONG reserved)
 
static void testIcmpSendEcho (void)
 
static void testIcmpParseReplies (void)
 
static void testWinNT4Functions (void)
 
static void testGetInterfaceInfo (void)
 
static void testGetAdaptersInfo (void)
 
static void testGetNetworkParams (void)
 
static void testGetBestInterface (void)
 
static void testGetBestInterfaceEx (void)
 
static void testGetBestRoute (void)
 
static DWORD CALLBACK testWin98Functions (void *p)
 
static void testGetPerAdapterInfo (void)
 
static void testNotifyAddrChange (void)
 
static void testWin2KFunctions (void)
 
static void test_GetAdaptersAddresses (void)
 
static DWORD get_extended_tcp_table (ULONG family, TCP_TABLE_CLASS class, void **table)
 
static void test_GetExtendedTcpTable (void)
 
static void test_GetExtendedTcpTable_owner (int family)
 
static void test_AllocateAndGetTcpExTableFromStack (void)
 
static DWORD get_extended_udp_table (ULONG family, UDP_TABLE_CLASS class, void **table)
 
static void test_GetExtendedUdpTable (void)
 
static void test_GetExtendedUdpTable_owner (int family)
 
static void test_CreateSortedAddressPairs (void)
 
static IP_ADAPTER_ADDRESSES * get_adapters (ULONG flags)
 
static DWORD get_interface_index (void)
 
static void convert_luid_to_name (NET_LUID *luid, WCHAR *expect_nameW, int len)
 
static void test_interface_identifier_conversion (void)
 
static void test_interface_identifier_conversion_failure (void)
 
static void test_GetIfEntry2 (void)
 
static void test_GetIfTable2 (void)
 
static void test_GetIfTable2Ex (void)
 
static void test_GetUnicastIpAddressEntry (void)
 
static void test_GetUnicastIpAddressTable (void)
 
static void test_ConvertLengthToIpv4Mask (void)
 
static void test_GetTcp6Table (void)
 
static void test_GetUdp6Table (void)
 
static void test_ParseNetworkString (void)
 
static void WINAPI test_ipaddtess_change_callback (PVOID context, PMIB_UNICASTIPADDRESS_ROW row, MIB_NOTIFICATION_TYPE notification_type)
 
static void test_NotifyUnicastIpAddressChange (void)
 
static void test_ConvertGuidToString (void)
 
static void test_compartments (void)
 
 START_TEST (iphlpapi)
 

Variables

static HMODULE hLibrary = NULL
 
static BOOL
 
static HANDLE
 
static DWORD
 
static PDWORD
 
static MIB_UNICASTIPADDRESS_TABLE **static ULONG
 
static MIB_UNICASTIPADDRESS_TABLE **static TCP_TABLE_CLASS
 
static UDP_TABLE_CLASS
 
static const PSOCKADDR_IN6
 
static const PSOCKADDR_IN6_PAIR ULONG *static ULONG *static NET_ADDRESS_INFO USHORT BYTE *static PUNICAST_IPADDRESS_CHANGE_CALLBACK
 
static const PSOCKADDR_IN6_PAIR ULONG *static ULONG *static NET_ADDRESS_INFO USHORT BYTE *static PVOID
 
static const PSOCKADDR_IN6_PAIR ULONG *static ULONG *static NET_ADDRESS_INFO USHORT BYTE *static BOOLEAN
 
static BOOL icmp_send_echo_test_apc_expect
 

Macro Definition Documentation

◆ ICMP_MINLEN

#define ICMP_MINLEN   8 /* copied from dlls/iphlpapi/ip_icmp.h file */

Definition at line 56 of file iphlpapi.c.

Function Documentation

◆ convert_luid_to_name()

static void convert_luid_to_name ( NET_LUID luid,
WCHAR expect_nameW,
int  len 
)
static

Definition at line 2513 of file iphlpapi.c.

2514{
2515 struct
2516 {
2517 const WCHAR *prefix;
2518 DWORD type;
2519 } prefixes[] =
2520 {
2521 { L"other", IF_TYPE_OTHER },
2522 { L"ethernet", IF_TYPE_ETHERNET_CSMACD },
2523 { L"tokenring", IF_TYPE_ISO88025_TOKENRING },
2524 { L"ppp", IF_TYPE_PPP },
2525 { L"loopback", IF_TYPE_SOFTWARE_LOOPBACK },
2526 { L"atm", IF_TYPE_ATM },
2527 { L"wireless", IF_TYPE_IEEE80211 },
2528 { L"tunnel", IF_TYPE_TUNNEL },
2529 { L"ieee1394", IF_TYPE_IEEE1394 }
2530 };
2531 DWORD i;
2532 const WCHAR *prefix = NULL;
2533
2534 for (i = 0; i < ARRAY_SIZE(prefixes); i++)
2535 {
2536 if (prefixes[i].type == luid->Info.IfType)
2537 {
2538 prefix = prefixes[i].prefix;
2539 break;
2540 }
2541 }
2542#ifdef __REACTOS__
2543 if (prefix)
2544 _snwprintf( expect_nameW, len, L"%s_%d", prefix, luid->Info.NetLuidIndex );
2545 else
2546 _snwprintf( expect_nameW, len, L"iftype%d_%d", luid->Info.IfType, luid->Info.NetLuidIndex );
2547#else
2548 if (prefix)
2549 swprintf( expect_nameW, len, L"%s_%d", prefix, luid->Info.NetLuidIndex );
2550 else
2551 swprintf( expect_nameW, len, L"iftype%d_%d", luid->Info.IfType, luid->Info.NetLuidIndex );
2552#endif
2553}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define NULL
Definition: types.h:112
#define swprintf
Definition: precomp.h:40
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static int prefixes
Definition: i386-dis.c:276
#define IF_TYPE_IEEE80211
Definition: ipifcons.h:91
#define IF_TYPE_TUNNEL
Definition: ipifcons.h:151
#define IF_TYPE_ISO88025_TOKENRING
Definition: ipifcons.h:29
#define IF_TYPE_IEEE1394
Definition: ipifcons.h:164
#define IF_TYPE_SOFTWARE_LOOPBACK
Definition: ipifcons.h:44
#define IF_TYPE_ETHERNET_CSMACD
Definition: ipifcons.h:26
#define IF_TYPE_ATM
Definition: ipifcons.h:57
#define IF_TYPE_PPP
Definition: ipifcons.h:43
#define IF_TYPE_OTHER
Definition: ipifcons.h:21
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
Character const *const prefix
Definition: tempnam.cpp:195
struct _NET_LUID_LH::@3183 Info
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_interface_identifier_conversion().

◆ ConvertGuidToStringA()

DWORD WINAPI ConvertGuidToStringA ( const GUID ,
char ,
DWORD   
)

◆ ConvertGuidToStringW()

DWORD WINAPI ConvertGuidToStringW ( const GUID ,
WCHAR ,
DWORD   
)

◆ ConvertStringToGuidW()

DWORD WINAPI ConvertStringToGuidW ( const WCHAR ,
GUID  
)

◆ DWORD()

static DWORD ( WINAPI pAllocateAndGetTcpExTableFromStack)
static

◆ freeIPHlpApi()

static void freeIPHlpApi ( void  )
static

Definition at line 178 of file iphlpapi.c.

179{
181}
#define FreeLibrary(x)
Definition: compat.h:748
static HMODULE hLibrary
Definition: iphlpapi.c:58

Referenced by START_TEST().

◆ get_adapters()

static IP_ADAPTER_ADDRESSES * get_adapters ( ULONG  flags)
static

Definition at line 2475 of file iphlpapi.c.

2476{
2477 ULONG err, size = 4096;
2478 IP_ADAPTER_ADDRESSES *tmp, *ret;
2479
2480 if (!(ret = malloc( size ))) return NULL;
2481 err = GetAdaptersAddresses( AF_UNSPEC, flags, NULL, ret, &size );
2482 while (err == ERROR_BUFFER_OVERFLOW)
2483 {
2484 if (!(tmp = realloc( ret, size ))) break;
2485 ret = tmp;
2486 err = GetAdaptersAddresses( AF_UNSPEC, flags, NULL, ret, &size );
2487 }
2488 if (err == ERROR_SUCCESS) return ret;
2489 free( ret );
2490 return NULL;
2491}
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define ERROR_SUCCESS
Definition: deptool.c:10
return ret
Definition: mutex.c:146
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
#define err(...)
uint32_t ULONG
Definition: typedefs.h:59
#define ERROR_BUFFER_OVERFLOW
Definition: winerror.h:307
#define AF_UNSPEC
Definition: winsock.h:338

◆ get_extended_tcp_table()

static DWORD get_extended_tcp_table ( ULONG  family,
TCP_TABLE_CLASS  class,
void **  table 
)
static

Definition at line 2059 of file iphlpapi.c.

2060{
2061 DWORD ret, size = 0;
2062
2063 *table = NULL;
2064 ret = pGetExtendedTcpTable( NULL, &size, TRUE, family, class, 0 );
2065 if (ret != ERROR_INSUFFICIENT_BUFFER) return ret;
2066
2067 *table = malloc( size );
2068 ret = pGetExtendedTcpTable( *table, &size, TRUE, family, class, 0 );
2070 {
2071 *table = realloc( *table, size );
2072 ret = pGetExtendedTcpTable( *table, &size, TRUE, family, class, 0 );
2073 }
2074 return ret;
2075}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define TRUE
Definition: types.h:120

Referenced by test_GetExtendedTcpTable(), and test_GetExtendedTcpTable_owner().

◆ get_extended_udp_table()

static DWORD get_extended_udp_table ( ULONG  family,
UDP_TABLE_CLASS  class,
void **  table 
)
static

Definition at line 2270 of file iphlpapi.c.

2271{
2272 DWORD ret, size = 0;
2273
2274 *table = NULL;
2275 ret = pGetExtendedUdpTable( NULL, &size, TRUE, family, class, 0 );
2276 if (ret != ERROR_INSUFFICIENT_BUFFER) return ret;
2277
2278 *table = malloc( size );
2279 ret = pGetExtendedUdpTable( *table, &size, TRUE, family, class, 0 );
2281 {
2282 *table = realloc( *table, size );
2283 ret = pGetExtendedUdpTable( *table, &size, TRUE, family, class, 0 );
2284 }
2285 return ret;
2286}

Referenced by test_GetExtendedUdpTable(), and test_GetExtendedUdpTable_owner().

◆ get_interface_index()

static DWORD get_interface_index ( void  )
static

Definition at line 2493 of file iphlpapi.c.

2494{
2495 DWORD ret = 0;
2496 IP_ADAPTER_ADDRESSES *buf, *aa;
2497
2498 buf = get_adapters( 0 );
2499 if (!buf) return 0;
2500
2501 for (aa = buf; aa; aa = aa->Next)
2502 {
2503 if (aa->IfType == IF_TYPE_ETHERNET_CSMACD)
2504 {
2505 ret = aa->IfIndex;
2506 break;
2507 }
2508 }
2509 free( buf );
2510 return ret;
2511}
static IP_ADAPTER_ADDRESSES * get_adapters(void)
Definition: internet.c:2281
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

Referenced by test_GetIfEntry2(), and test_GetUnicastIpAddressEntry().

◆ icmp_send_echo_test_apc()

static void WINAPI icmp_send_echo_test_apc ( void context,
IO_STATUS_BLOCK io_status,
ULONG  reserved 
)
static

Definition at line 1069 of file iphlpapi.c.

1070{
1072 ok(io_status->Status == 0, "Got IO Status 0x%08lx\n", io_status->Status);
1073 ok(io_status->Information == sizeof(ICMP_ECHO_REPLY) + 32 /* sizeof(senddata) */,
1074 "Got IO Information %Iu\n", io_status->Information);
1075}
#define ok(value,...)
Definition: atltest.h:57
static void WINAPI icmp_send_echo_test_apc_xp(void *context)
Definition: iphlpapi.c:1062
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK io_status
Definition: comm.c:56
Definition: http.c:7252

Referenced by testIcmpSendEcho().

◆ icmp_send_echo_test_apc_xp()

static void WINAPI icmp_send_echo_test_apc_xp ( void context)
static

Definition at line 1062 of file iphlpapi.c.

1063{
1064 ok(icmp_send_echo_test_apc_expect, "Unexpected APC execution\n");
1065 ok(context == (void*)0xdeadc0de, "Wrong context: %p\n", context);
1067}
#define FALSE
Definition: types.h:117
static BOOL icmp_send_echo_test_apc_expect
Definition: iphlpapi.c:1061

Referenced by icmp_send_echo_test_apc(), and testIcmpSendEcho().

◆ ipv4_addr()

static DWORD ipv4_addr ( BYTE  b1,
BYTE  b2,
BYTE  b3,
BYTE  b4 
)
static

Definition at line 207 of file iphlpapi.c.

208{
209 return htonl( (b1 << 24) | (b2 << 16) | (b3 << 8) | b4 );
210}
#define htonl(x)
Definition: module.h:214
static CRYPT_DATA_BLOB b4
Definition: msg.c:2187
static CRYPT_DATA_BLOB b3[]
Definition: msg.c:548
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:538
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:529

Referenced by testGetIpNetTable().

◆ loadIPHlpApi()

static void loadIPHlpApi ( void  )
static

Definition at line 131 of file iphlpapi.c.

132{
133 hLibrary = LoadLibraryA("iphlpapi.dll");
134 if (hLibrary) {
135 pAllocateAndGetTcpExTableFromStack = (void *)GetProcAddress(hLibrary, "AllocateAndGetTcpExTableFromStack");
136 pGetTcp6Table = (void *)GetProcAddress(hLibrary, "GetTcp6Table");
137 pGetUdp6Table = (void *)GetProcAddress(hLibrary, "GetUdp6Table");
138 pGetUnicastIpAddressEntry = (void *)GetProcAddress(hLibrary, "GetUnicastIpAddressEntry");
139 pGetUnicastIpAddressTable = (void *)GetProcAddress(hLibrary, "GetUnicastIpAddressTable");
140 pGetExtendedTcpTable = (void *)GetProcAddress(hLibrary, "GetExtendedTcpTable");
141 pGetExtendedUdpTable = (void *)GetProcAddress(hLibrary, "GetExtendedUdpTable");
142 pCreateSortedAddressPairs = (void *)GetProcAddress(hLibrary, "CreateSortedAddressPairs");
143 pConvertLengthToIpv4Mask = (void *)GetProcAddress(hLibrary, "ConvertLengthToIpv4Mask");
144 pParseNetworkString = (void *)GetProcAddress(hLibrary, "ParseNetworkString");
145 pNotifyUnicastIpAddressChange = (void *)GetProcAddress(hLibrary, "NotifyUnicastIpAddressChange");
146 pCancelMibChangeNotify2 = (void *)GetProcAddress(hLibrary, "CancelMibChangeNotify2");
147#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
148 ConvertInterfaceAliasToLuid = (void *)GetProcAddress(hLibrary, "ConvertInterfaceAliasToLuid");
149 ConvertInterfaceLuidToAlias = (void *)GetProcAddress(hLibrary, "ConvertInterfaceLuidToAlias");
150 ConvertGuidToStringA = (void *)GetProcAddress(hLibrary, "ConvertGuidToStringA");
151 ConvertGuidToStringW = (void *)GetProcAddress(hLibrary, "ConvertGuidToStringW");
152 ConvertStringToGuidW = (void *)GetProcAddress(hLibrary, "ConvertStringToGuidW");
153 GetIfEntry2 = (void *)GetProcAddress(hLibrary, "GetIfEntry2");
154 GetIfTable2 = (void *)GetProcAddress(hLibrary, "GetIfTable2");
155 GetIfTable2Ex = (void *)GetProcAddress(hLibrary, "GetIfTable2Ex");
156 GetIpForwardTable2 = (void *)GetProcAddress(hLibrary, "GetIpForwardTable2");
157 GetIpNetTable2 = (void *)GetProcAddress(hLibrary, "GetIpNetTable2");
158 FreeMibTable = (void *)GetProcAddress(hLibrary, "FreeMibTable");
159 ConvertInterfaceGuidToLuid = (void *)GetProcAddress(hLibrary, "ConvertInterfaceGuidToLuid");
160 ConvertInterfaceIndexToLuid = (void *)GetProcAddress(hLibrary, "ConvertInterfaceIndexToLuid");
161 ConvertInterfaceLuidToGuid = (void *)GetProcAddress(hLibrary, "ConvertInterfaceLuidToGuid");
162 ConvertInterfaceLuidToIndex = (void *)GetProcAddress(hLibrary, "ConvertInterfaceLuidToIndex");
163 ConvertInterfaceLuidToNameA = (void *)GetProcAddress(hLibrary, "ConvertInterfaceLuidToNameA");
164 ConvertInterfaceLuidToNameW = (void *)GetProcAddress(hLibrary, "ConvertInterfaceLuidToNameW");
165 ConvertInterfaceNameToLuidA = (void *)GetProcAddress(hLibrary, "ConvertInterfaceNameToLuidA");
166 ConvertInterfaceNameToLuidW = (void *)GetProcAddress(hLibrary, "ConvertInterfaceNameToLuidW");
167 GetCurrentThreadCompartmentId = (void *)GetProcAddress(hLibrary, "GetCurrentThreadCompartmentId");
168 if_indextoname = (void *)GetProcAddress(hLibrary, "if_indextoname");
169 if_nametoindex = (void *)GetProcAddress(hLibrary, "if_nametoindex");
170
171 /* If we can't get FreeMibTable(), use free(). */
172 if (!FreeMibTable)
173 FreeMibTable = (void (WINAPI *)(void *))free;
174#endif
175 }
176}
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
DWORD WINAPI ConvertGuidToStringW(const GUID *, WCHAR *, DWORD)
DWORD WINAPI ConvertStringToGuidW(const WCHAR *, GUID *)
DWORD WINAPI ConvertGuidToStringA(const GUID *, char *, DWORD)
#define WINAPI
Definition: msvc.h:6
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceLuidToGuid(const NET_LUID *, GUID *)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI GetIpForwardTable2(ADDRESS_FAMILY, MIB_IPFORWARD_TABLE2 **)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceNameToLuidA(const char *, NET_LUID *)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI GetIfTable2(MIB_IF_TABLE2 **)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceLuidToIndex(const NET_LUID *, NET_IFINDEX *)
IPHLPAPI_DLL_LINKAGE void WINAPI FreeMibTable(void *)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceLuidToNameA(const NET_LUID *, char *, SIZE_T)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceLuidToNameW(const NET_LUID *, WCHAR *, SIZE_T)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceAliasToLuid(const WCHAR *, NET_LUID *)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI GetIpNetTable2(ADDRESS_FAMILY, MIB_IPNET_TABLE2 **)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceNameToLuidW(const WCHAR *, NET_LUID *)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceIndexToLuid(NET_IFINDEX, NET_LUID *)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI GetIfTable2Ex(MIB_IF_TABLE_LEVEL, MIB_IF_TABLE2 **)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceLuidToAlias(const NET_LUID *, WCHAR *, SIZE_T)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI GetIfEntry2(MIB_IF_ROW2 *)
IPHLPAPI_DLL_LINKAGE NET_IFINDEX WINAPI if_nametoindex(PCSTR)
IPHLPAPI_DLL_LINKAGE PCHAR WINAPI if_indextoname(NET_IFINDEX, PCHAR)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertInterfaceGuidToLuid(const GUID *, NET_LUID *)
IPHLPAPI_DLL_LINKAGE NET_IF_COMPARTMENT_ID WINAPI GetCurrentThreadCompartmentId(void)

Referenced by START_TEST().

◆ ntoa()

static const char * ntoa ( DWORD  ip)
static

Definition at line 184 of file iphlpapi.c.

185{
186 static char buffers[4][16];
187 static int i = -1;
188
189 ip = htonl(ip);
190 i = (i + 1) % ARRAY_SIZE(buffers);
191 sprintf( buffers[i], "%lu.%lu.%lu.%lu", (ip >> 24) & 0xff, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff );
192 return buffers[i];
193}
const GLuint * buffers
Definition: glext.h:5916
#define sprintf
Definition: sprintf.c:45
Definition: dhcpd.h:62

Referenced by test_AllocateAndGetTcpExTableFromStack(), testGetIpAddrTable(), testGetIpForwardTable(), testGetIpNetTable(), testGetTcpTable(), testGetUdpTable(), and testIcmpSendEcho().

◆ ntoa6()

static const char * ntoa6 ( IN6_ADDR ip)
static

Definition at line 195 of file iphlpapi.c.

196{
197 static char buffers[4][40];
198 static int i = -1;
199 unsigned short *p = ip->u.Word;
200
201 i = (i + 1) % ARRAY_SIZE(buffers);
202 sprintf( buffers[i], "%x:%x:%x:%x:%x:%x:%x:%x",
203 htons(p[0]), htons(p[1]), htons(p[2]), htons(p[3]), htons(p[4]), htons(p[5]), htons(p[6]), htons(p[7]) );
204 return buffers[i];
205}
GLfloat GLfloat p
Definition: glext.h:8902
#define htons(x)
Definition: module.h:215

Referenced by test_GetTcp6Table(), and test_GetUdp6Table().

◆ START_TEST()

START_TEST ( iphlpapi  )

Definition at line 3392 of file iphlpapi.c.

3393{
3394 WSADATA wsa_data;
3395 WSAStartup(MAKEWORD(2, 2), &wsa_data);
3396
3397 loadIPHlpApi();
3398 if (hLibrary) {
3399 HANDLE thread;
3400
3403
3404 /* run testGetXXXX in two threads at once to make sure we don't crash in that case */
3408
3433 freeIPHlpApi();
3434 }
3435
3436 WSACleanup();
3437}
static HANDLE thread
Definition: service.c:33
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
#define AF_INET
Definition: tcpip.h:117
#define INFINITE
Definition: serial.h:102
static void test_interface_identifier_conversion_failure(void)
Definition: iphlpapi.c:2731
static void loadIPHlpApi(void)
Definition: iphlpapi.c:131
static void test_GetExtendedTcpTable_owner(int family)
Definition: iphlpapi.c:2119
static void test_interface_identifier_conversion(void)
Definition: iphlpapi.c:2555
static DWORD CALLBACK testWin98Functions(void *p)
Definition: iphlpapi.c:1797
static void test_GetIfTable2Ex(void)
Definition: iphlpapi.c:2877
static void test_ConvertGuidToString(void)
Definition: iphlpapi.c:3345
static void test_NotifyUnicastIpAddressChange(void)
Definition: iphlpapi.c:3322
static void testWin98OnlyFunctions(void)
Definition: iphlpapi.c:216
static void test_ConvertLengthToIpv4Mask(void)
Definition: iphlpapi.c:3069
static void test_GetAdaptersAddresses(void)
Definition: iphlpapi.c:1911
static void test_GetExtendedTcpTable(void)
Definition: iphlpapi.c:2077
static void test_GetUnicastIpAddressTable(void)
Definition: iphlpapi.c:3016
static void test_GetExtendedUdpTable_owner(int family)
Definition: iphlpapi.c:2318
static void test_compartments(void)
Definition: iphlpapi.c:3378
static void test_GetIfEntry2(void)
Definition: iphlpapi.c:2827
static void test_ParseNetworkString(void)
Definition: iphlpapi.c:3185
static void test_GetTcp6Table(void)
Definition: iphlpapi.c:3102
static void test_GetExtendedUdpTable(void)
Definition: iphlpapi.c:2288
static void freeIPHlpApi(void)
Definition: iphlpapi.c:178
static void test_CreateSortedAddressPairs(void)
Definition: iphlpapi.c:2416
static void test_GetUdp6Table(void)
Definition: iphlpapi.c:3147
static void testWinNT4Functions(void)
Definition: iphlpapi.c:1541
static void test_GetUnicastIpAddressEntry(void)
Definition: iphlpapi.c:2913
static void test_AllocateAndGetTcpExTableFromStack(void)
Definition: iphlpapi.c:2221
static void testWin2KFunctions(void)
Definition: iphlpapi.c:1905
static void test_GetIfTable2(void)
Definition: iphlpapi.c:2859
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define MAKEWORD(a, b)
Definition: typedefs.h:248
int PASCAL FAR WSACleanup(void)
Definition: startup.c:60
#define AF_INET6
Definition: winsock.h:363

◆ test_AllocateAndGetTcpExTableFromStack()

static void test_AllocateAndGetTcpExTableFromStack ( void  )
static

Definition at line 2221 of file iphlpapi.c.

2222{
2223 DWORD ret;
2224 MIB_TCPTABLE_OWNER_PID *table_ex = NULL;
2225
2226 if (!pAllocateAndGetTcpExTableFromStack)
2227 {
2228 win_skip("AllocateAndGetTcpExTableFromStack not available\n");
2229 return;
2230 }
2231
2232 if (0)
2233 {
2234 /* crashes on native */
2235 ret = pAllocateAndGetTcpExTableFromStack( NULL, FALSE, INVALID_HANDLE_VALUE, 0, 0 );
2236 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2237 ret = pAllocateAndGetTcpExTableFromStack( (void **)&table_ex, FALSE, INVALID_HANDLE_VALUE, 0, AF_INET );
2238 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2239 ret = pAllocateAndGetTcpExTableFromStack( NULL, FALSE, GetProcessHeap(), 0, AF_INET );
2240 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2241 }
2242
2243 ret = pAllocateAndGetTcpExTableFromStack( (void **)&table_ex, FALSE, GetProcessHeap(), 0, 0 );
2244 ok( ret == ERROR_INVALID_PARAMETER || broken(ret == ERROR_NOT_SUPPORTED) /* win2k */, "got %lu\n", ret );
2245
2246 ret = pAllocateAndGetTcpExTableFromStack( (void **)&table_ex, FALSE, GetProcessHeap(), 0, AF_INET );
2247 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2248
2249 if (ret == NO_ERROR && winetest_debug > 1)
2250 {
2251 DWORD i;
2252 trace( "AllocateAndGetTcpExTableFromStack table: %lu entries\n", table_ex->dwNumEntries );
2253 for (i = 0; i < table_ex->dwNumEntries; i++)
2254 {
2255 char remote_ip[16];
2256
2257 strcpy(remote_ip, ntoa(table_ex->table[i].dwRemoteAddr));
2258 trace( "%lu: local %s:%u remote %s:%u state %lu pid %lu\n", i,
2259 ntoa(table_ex->table[i].dwLocalAddr), ntohs(table_ex->table[i].dwLocalPort),
2260 remote_ip, ntohs(table_ex->table[i].dwRemotePort),
2261 table_ex->table[i].dwState, table_ex->table[i].dwOwningPid );
2262 }
2263 }
2264 HeapFree(GetProcessHeap(), 0, table_ex);
2265
2266 ret = pAllocateAndGetTcpExTableFromStack( (void **)&table_ex, FALSE, GetProcessHeap(), 0, AF_INET6 );
2267 ok( ret == ERROR_NOT_SUPPORTED, "got %lu\n", ret );
2268}
#define trace
Definition: atltest.h:70
#define broken(x)
Definition: atltest.h:178
#define NO_ERROR
Definition: dderror.h:5
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define ERROR_NOT_SUPPORTED
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:735
static const char * ntoa(DWORD ip)
Definition: iphlpapi.c:184
int winetest_debug
#define win_skip
Definition: minitest.h:67
#define ntohs(x)
Definition: module.h:210
strcpy
Definition: string.h:131

Referenced by START_TEST().

◆ test_compartments()

static void test_compartments ( void  )
static

Definition at line 3378 of file iphlpapi.c.

3379{
3381
3382#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
3384 skip("Missing APIs!\n");
3385 return;
3386 }
3387#endif
3389 ok(id == NET_IF_COMPARTMENT_ID_PRIMARY, "got %u\n", id);
3390}
#define skip(...)
Definition: atltest.h:64
GLuint id
Definition: glext.h:5910
UINT32 NET_IF_COMPARTMENT_ID
Definition: ifdef.h:24
#define NET_IF_COMPARTMENT_ID_PRIMARY
Definition: ifdef.h:36

Referenced by START_TEST().

◆ test_ConvertGuidToString()

static void test_ConvertGuidToString ( void  )
static

Definition at line 3345 of file iphlpapi.c.

3346{
3347 DWORD err;
3348 char bufA[39];
3349 WCHAR bufW[39];
3350 GUID guid = { 0xa, 0xb, 0xc, { 0xd, 0, 0xe, 0xf } }, guid2;
3351
3352#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
3354 skip("Missing APIs!\n");
3355 return;
3356 }
3357#endif
3358 err = ConvertGuidToStringA( &guid, bufA, 38 );
3359 ok( err, "got %ld\n", err );
3360 err = ConvertGuidToStringA( &guid, bufA, 39 );
3361 ok( !err, "got %ld\n", err );
3362 ok( !strcmp( bufA, "{0000000A-000B-000C-0D00-0E0F00000000}" ), "got %s\n", bufA );
3363
3364 err = ConvertGuidToStringW( &guid, bufW, 38 );
3365 ok( err, "got %ld\n", err );
3366 err = ConvertGuidToStringW( &guid, bufW, 39 );
3367 ok( !err, "got %ld\n", err );
3368 ok( !wcscmp( bufW, L"{0000000A-000B-000C-0D00-0E0F00000000}" ), "got %s\n", debugstr_w( bufW ) );
3369
3370 err = ConvertStringToGuidW( bufW, &guid2 );
3371 ok( !err, "got %ld\n", err );
3372 ok( IsEqualGUID( &guid, &guid2 ), "guid mismatch\n" );
3373
3374 err = ConvertStringToGuidW( L"foo", &guid2 );
3375 ok( err == ERROR_INVALID_PARAMETER, "got %ld\n", err );
3376}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GUID guid
Definition: version.c:147
#define debugstr_w
Definition: kernel32.h:32
static GUID guid2
Definition: devinst.c:42
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by START_TEST().

◆ test_ConvertLengthToIpv4Mask()

static void test_ConvertLengthToIpv4Mask ( void  )
static

Definition at line 3069 of file iphlpapi.c.

3070{
3071 DWORD ret;
3072 DWORD n;
3073 ULONG mask;
3075
3076 if (!pConvertLengthToIpv4Mask)
3077 {
3078 win_skip( "ConvertLengthToIpv4Mask not available\n" );
3079 return;
3080 }
3081
3082 for (n = 0; n <= 32; n++)
3083 {
3084 mask = 0xdeadbeef;
3085 if (n > 0)
3086 expected = htonl( ~0u << (32 - n) );
3087 else
3088 expected = 0;
3089
3090 ret = pConvertLengthToIpv4Mask( n, &mask );
3091 ok( ret == NO_ERROR, "ConvertLengthToIpv4Mask returned 0x%08lx, expected 0x%08x\n", ret, NO_ERROR );
3092 ok( mask == expected, "ConvertLengthToIpv4Mask mask value 0x%08lx, expected 0x%08lx\n", mask, expected );
3093 }
3094
3095 /* Testing for out of range. In this case both mask and return are changed to indicate error. */
3096 mask = 0xdeadbeef;
3097 ret = pConvertLengthToIpv4Mask( 33, &mask );
3098 ok( ret == ERROR_INVALID_PARAMETER, "ConvertLengthToIpv4Mask returned 0x%08lx, expected 0x%08x\n", ret, ERROR_INVALID_PARAMETER );
3099 ok( mask == INADDR_NONE, "ConvertLengthToIpv4Mask mask value 0x%08lx, expected 0x%08x\n", mask, INADDR_NONE );
3100}
#define INADDR_NONE
Definition: tcp.c:42
GLdouble n
Definition: glext.h:7729
GLenum GLint GLuint mask
Definition: glext.h:6028
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
BOOL expected
Definition: store.c:2000

Referenced by START_TEST().

◆ test_CreateSortedAddressPairs()

static void test_CreateSortedAddressPairs ( void  )
static

Definition at line 2416 of file iphlpapi.c.

2417{
2418 SOCKADDR_IN6 dst[2];
2420 ULONG pair_count;
2421 DWORD ret;
2422
2423 if (!pCreateSortedAddressPairs)
2424 {
2425 win_skip( "CreateSortedAddressPairs not available\n" );
2426 return;
2427 }
2428
2429 memset( dst, 0, sizeof(dst) );
2430 dst[0].sin6_family = AF_INET6;
2431 dst[0].sin6_addr.u.Word[5] = 0xffff;
2432 dst[0].sin6_addr.u.Word[6] = 0x0808;
2433 dst[0].sin6_addr.u.Word[7] = 0x0808;
2434
2435 pair_count = 0xdeadbeef;
2436 ret = pCreateSortedAddressPairs( NULL, 0, dst, 1, 0, NULL, &pair_count );
2437 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2438 ok( pair_count == 0xdeadbeef, "got %lu\n", pair_count );
2439
2440 pair = (SOCKADDR_IN6_PAIR *)0xdeadbeef;
2441 pair_count = 0xdeadbeef;
2442 ret = pCreateSortedAddressPairs( NULL, 0, NULL, 1, 0, &pair, &pair_count );
2443 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2444 ok( pair == (SOCKADDR_IN6_PAIR *)0xdeadbeef, "got %p\n", pair );
2445 ok( pair_count == 0xdeadbeef, "got %lu\n", pair_count );
2446
2447 pair = NULL;
2448 pair_count = 0xdeadbeef;
2449 ret = pCreateSortedAddressPairs( NULL, 0, dst, 1, 0, &pair, &pair_count );
2450 ok( ret == NO_ERROR, "got %lu\n", ret );
2451 ok( pair != NULL, "pair not set\n" );
2452 ok( pair_count >= 1, "got %lu\n", pair_count );
2453 ok( pair[0].SourceAddress != NULL, "src address not set\n" );
2454 ok( pair[0].DestinationAddress != NULL, "dst address not set\n" );
2455 FreeMibTable( pair );
2456
2457 dst[1].sin6_family = AF_INET6;
2458 dst[1].sin6_addr.u.Word[5] = 0xffff;
2459 dst[1].sin6_addr.u.Word[6] = 0x0404;
2460 dst[1].sin6_addr.u.Word[7] = 0x0808;
2461
2462 pair = NULL;
2463 pair_count = 0xdeadbeef;
2464 ret = pCreateSortedAddressPairs( NULL, 0, dst, 2, 0, &pair, &pair_count );
2465 ok( ret == NO_ERROR, "got %lu\n", ret );
2466 ok( pair != NULL, "pair not set\n" );
2467 ok( pair_count >= 2, "got %lu\n", pair_count );
2468 ok( pair[0].SourceAddress != NULL, "src address not set\n" );
2469 ok( pair[0].DestinationAddress != NULL, "dst address not set\n" );
2470 ok( pair[1].SourceAddress != NULL, "src address not set\n" );
2471 ok( pair[1].DestinationAddress != NULL, "dst address not set\n" );
2472 FreeMibTable( pair );
2473}
GLenum GLenum dst
Definition: glext.h:6340
#define memset(x, y, z)
Definition: compat.h:39
Definition: _pair.h:47
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Out_ PPHYSICAL_ADDRESS DestinationAddress
Definition: iotypes.h:1128
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS SourceAddress
Definition: iotypes.h:1127

Referenced by START_TEST().

◆ test_GetAdaptersAddresses()

static void test_GetAdaptersAddresses ( void  )
static

Definition at line 1911 of file iphlpapi.c.

1912{
1913 BOOL dns_eligible_found = FALSE;
1914 ULONG ret, size, osize, i;
1915 IP_ADAPTER_ADDRESSES *aa, *ptr;
1916 IP_ADAPTER_UNICAST_ADDRESS *ua;
1917
1918#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
1920 skip("Missing APIs!\n");
1921#endif
1922 ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, NULL, NULL);
1923 ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %lu\n", ret);
1924
1925 /* size should be ignored and overwritten if buffer is NULL */
1926 size = 0x7fffffff;
1927 ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, NULL, &size);
1928 ok(ret == ERROR_BUFFER_OVERFLOW, "expected ERROR_BUFFER_OVERFLOW, got %lu\n", ret);
1929 if (ret != ERROR_BUFFER_OVERFLOW) return;
1930
1931 /* GAA_FLAG_SKIP_FRIENDLY_NAME is ignored */
1932 osize = 0x7fffffff;
1933 ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, NULL, &osize);
1934 ok(ret == ERROR_BUFFER_OVERFLOW, "expected ERROR_BUFFER_OVERFLOW, got %lu\n", ret);
1935#ifdef __REACTOS__
1936 if (LOBYTE(LOWORD(GetVersion())) >= 6)
1937#endif
1938 ok(osize == size, "expected %ld, got %ld\n", size, osize);
1939
1940 ptr = malloc(size);
1941 ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, ptr, &size);
1942 ok(!ret, "expected ERROR_SUCCESS got %lu\n", ret);
1943 free(ptr);
1944
1945 /* higher size must not be changed to lower size */
1946 size *= 2;
1947 osize = size;
1948 ptr = malloc(osize);
1949 ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, ptr, &osize);
1950 while (ret == ERROR_BUFFER_OVERFLOW)
1951 {
1952 size = osize * 2;
1953 osize = size;
1954 ptr = realloc(ptr, osize);
1955 ret = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_FRIENDLY_NAME, NULL, ptr, &osize);
1956 }
1957 ok(!ret, "expected ERROR_SUCCESS got %lu\n", ret);
1958 ok(osize == size, "expected %ld, got %ld\n", size, osize);
1959
1960 for (aa = ptr; !ret && aa; aa = aa->Next)
1961 {
1962 char temp[128], buf[39];
1963 IP_ADAPTER_PREFIX *prefix;
1964 DWORD status;
1965 GUID guid;
1966
1967 ok(aa->Length == sizeof(IP_ADAPTER_ADDRESSES_LH) ||
1968 aa->Length == sizeof(IP_ADAPTER_ADDRESSES_XP),
1969 "Unknown structure size of %lu bytes\n", aa->Length);
1970 ok(aa->DnsSuffix != NULL, "DnsSuffix is not a valid pointer\n");
1971 ok(aa->Description != NULL, "Description is not a valid pointer\n");
1972 ok(aa->FriendlyName != NULL, "FriendlyName is not a valid pointer\n");
1973
1974 for (i = 0; i < aa->PhysicalAddressLength; i++)
1975 sprintf(temp + i * 3, "%02X-", aa->PhysicalAddress[i]);
1976 temp[i ? i * 3 - 1 : 0] = '\0';
1977 trace("idx %lu name %s %s dns %s descr %s phys %s mtu %lu flags %08lx type %lu\n",
1978 aa->IfIndex, aa->AdapterName,
1979 wine_dbgstr_w(aa->FriendlyName), wine_dbgstr_w(aa->DnsSuffix),
1980 wine_dbgstr_w(aa->Description), temp, aa->Mtu, aa->Flags, aa->IfType );
1981 ua = aa->FirstUnicastAddress;
1982 while (ua)
1983 {
1984 ok(ua->Length == sizeof(IP_ADAPTER_UNICAST_ADDRESS_LH) ||
1985 ua->Length == sizeof(IP_ADAPTER_UNICAST_ADDRESS_XP),
1986 "Unknown structure size of %lu bytes\n", ua->Length);
1987 ok(ua->PrefixOrigin != IpPrefixOriginOther,
1988 "bad address config value %d\n", ua->PrefixOrigin);
1989 ok(ua->SuffixOrigin != IpSuffixOriginOther,
1990 "bad address config value %d\n", ua->PrefixOrigin);
1991 /* Address configured manually or from DHCP server? */
1992 if (ua->PrefixOrigin == IpPrefixOriginManual ||
1993 ua->PrefixOrigin == IpPrefixOriginDhcp)
1994 {
1995 ok(ua->ValidLifetime, "expected non-zero value\n");
1996 ok(ua->PreferredLifetime, "expected non-zero value\n");
1997 ok(ua->LeaseLifetime, "expected non-zero\n");
1998 }
1999 /* Is the address ok in the network (not duplicated)? */
2000 ok(ua->DadState != IpDadStateInvalid && ua->DadState != IpDadStateDuplicate,
2001 "bad address duplication value %d\n", ua->DadState);
2002 trace(" flags %08lx origin %u/%u state %u lifetime %lu/%lu/%lu prefix %u\n",
2003 ua->Flags, ua->PrefixOrigin, ua->SuffixOrigin, ua->DadState,
2004 ua->ValidLifetime, ua->PreferredLifetime, ua->LeaseLifetime,
2005 ua->Length < sizeof(IP_ADAPTER_UNICAST_ADDRESS_LH) ? 0 : ua->OnLinkPrefixLength);
2006
2007 if (ua->Flags & IP_ADAPTER_ADDRESS_DNS_ELIGIBLE)
2008 dns_eligible_found = TRUE;
2009
2010#ifdef __REACTOS__
2011 if (LOBYTE(LOWORD(GetVersion())) >= 6) {
2012#endif
2013 if(ua->Address.lpSockaddr->sa_family == AF_INET)
2014 ok(aa->Ipv4Enabled == TRUE, "expected Ipv4Enabled flag to be set in interface %ls\n", aa->FriendlyName);
2015 else if(ua->Address.lpSockaddr->sa_family == AF_INET6)
2016 ok(aa->Ipv6Enabled == TRUE, "expected Ipv6Enabled flag to be set in interface %ls\n", aa->FriendlyName);
2017#ifdef __REACTOS__
2018 }
2019#endif
2020
2021 ua = ua->Next;
2022 }
2023 for (i = 0, temp[0] = '\0'; i < ARRAY_SIZE(aa->ZoneIndices); i++)
2024 sprintf(temp + strlen(temp), "%ld ", aa->ZoneIndices[i]);
2025 trace("status %u index %lu zone %s\n", aa->OperStatus, aa->Ipv6IfIndex, temp );
2026 prefix = aa->FirstPrefix;
2027 while (prefix)
2028 {
2029 trace( " prefix %u/%lu flags %08lx\n", prefix->Address.iSockaddrLength,
2030 prefix->PrefixLength, prefix->Flags );
2031 prefix = prefix->Next;
2032 }
2033
2034 if (aa->Length < sizeof(IP_ADAPTER_ADDRESSES_LH)) continue;
2035 trace("speed %s/%s metrics %lu/%lu guid %s type %u/%u\n",
2036 wine_dbgstr_longlong(aa->TransmitLinkSpeed),
2037 wine_dbgstr_longlong(aa->ReceiveLinkSpeed),
2038 aa->Ipv4Metric, aa->Ipv6Metric, wine_dbgstr_guid((GUID*) &aa->NetworkGuid),
2039 aa->ConnectionType, aa->TunnelType);
2040
2041#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
2043#endif
2044 status = ConvertInterfaceLuidToGuid(&aa->Luid, &guid);
2045 ok(!status, "got %lu\n", status);
2046 sprintf(buf, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
2047 guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1],
2048 guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5],
2049 guid.Data4[6], guid.Data4[7]);
2050 ok(!strcasecmp(aa->AdapterName, buf), "expected '%s' got '%s'\n", aa->AdapterName, buf);
2051#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
2052 }
2053#endif
2054 }
2055 ok(dns_eligible_found, "Did not find any dns eligible addresses.\n");
2056 free(ptr);
2057}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
DWORD WINAPI GetVersion(void)
Definition: version.c:1458
#define strcasecmp
Definition: fake.h:9
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GAA_FLAG_SKIP_FRIENDLY_NAME
#define LOBYTE(W)
Definition: jmemdos.c:487
#define wine_dbgstr_w
Definition: kernel32.h:34
static PVOID ptr
Definition: dispmode.c:27
@ IpDadStateInvalid
Definition: nldef.h:45
@ IpDadStateDuplicate
Definition: nldef.h:47
@ IpPrefixOriginOther
Definition: nldef.h:9
@ IpPrefixOriginDhcp
Definition: nldef.h:12
@ IpPrefixOriginManual
Definition: nldef.h:10
@ IpSuffixOriginOther
Definition: nldef.h:30
#define LOWORD(l)
Definition: pedump.c:82
static calc_node_t temp
Definition: rpn_ieee.c:38
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
Definition: ps.c:97

Referenced by START_TEST().

◆ test_GetExtendedTcpTable()

static void test_GetExtendedTcpTable ( void  )
static

Definition at line 2077 of file iphlpapi.c.

2078{
2079 DWORD ret;
2081 MIB_TCPTABLE_OWNER_PID *table_pid;
2082 MIB_TCPTABLE_OWNER_MODULE *table_module;
2083
2084 if (!pGetExtendedTcpTable)
2085 {
2086 win_skip("GetExtendedTcpTable not available\n");
2087 return;
2088 }
2089 ret = pGetExtendedTcpTable( NULL, NULL, TRUE, AF_INET, TCP_TABLE_BASIC_ALL, 0 );
2090 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2091
2093 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2094 free( table );
2095
2097 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2098 free( table );
2099
2100 ret = get_extended_tcp_table( AF_INET, TCP_TABLE_OWNER_PID_ALL, (void **)&table_pid );
2101 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2102 free( table_pid );
2103
2105 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2106 free( table_pid );
2107
2108 ret = get_extended_tcp_table( AF_INET, TCP_TABLE_OWNER_MODULE_ALL, (void **)&table_module );
2109 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2110 free( table_module );
2111
2113 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2114 free( table_module );
2115}
static DWORD get_extended_tcp_table(ULONG family, TCP_TABLE_CLASS class, void **table)
Definition: iphlpapi.c:2059
@ TCP_TABLE_BASIC_LISTENER
Definition: iprtrmib.h:30
@ TCP_TABLE_OWNER_MODULE_ALL
Definition: iprtrmib.h:38
@ TCP_TABLE_OWNER_PID_LISTENER
Definition: iprtrmib.h:33
@ TCP_TABLE_BASIC_ALL
Definition: iprtrmib.h:32
@ TCP_TABLE_OWNER_PID_ALL
Definition: iprtrmib.h:35
@ TCP_TABLE_OWNER_MODULE_LISTENER
Definition: iprtrmib.h:36

Referenced by START_TEST().

◆ test_GetExtendedTcpTable_owner()

static void test_GetExtendedTcpTable_owner ( int  family)
static

Definition at line 2119 of file iphlpapi.c.

2120{
2121 SOCKET sock;
2122 int port;
2123 DWORD i, ret;
2124 void *raw_table = NULL;
2125
2126#ifdef __REACTOS__
2127 if (LOBYTE(LOWORD(GetVersion())) < 6) {
2128 skip("This test is invalid for this NT version.\n");
2129 return;
2130 }
2131#endif
2132 winetest_push_context( "%s", family == AF_INET ? "AF_INET" : "AF_INET6" );
2133
2134 sock = socket( family, SOCK_STREAM, IPPROTO_TCP );
2135 ok( sock != INVALID_SOCKET, "socket error %d\n", WSAGetLastError() );
2136
2137 if (family == AF_INET)
2138 {
2139 struct sockaddr_in addr = { 0 };
2140 int addr_len = sizeof(addr);
2141
2143 addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
2144 addr.sin_port = 0;
2145
2146 ret = bind( sock, (struct sockaddr *)&addr, addr_len );
2147 ok( !ret, "bind error %d\n", WSAGetLastError() );
2148 ret = getsockname( sock, (struct sockaddr *)&addr, &addr_len );
2149 ok( !ret, "getsockname error %d\n", WSAGetLastError() );
2150
2151 port = addr.sin_port;
2152 }
2153 else
2154 {
2155 struct sockaddr_in6 addr = { 0 };
2156 int addr_len = sizeof(addr);
2157
2159 addr.sin6_addr = in6addr_loopback;
2160 addr.sin6_port = 0;
2161
2162 ret = bind( sock, (struct sockaddr *)&addr, addr_len );
2163 ok( !ret, "bind error %d\n", WSAGetLastError() );
2164 ret = getsockname( sock, (struct sockaddr *)&addr, &addr_len );
2165 ok( !ret, "getsockname error %d\n", WSAGetLastError() );
2166
2167 port = addr.sin6_port;
2168 }
2169
2170 listen( sock, 1 );
2171
2172 ret = get_extended_tcp_table( family, TCP_TABLE_OWNER_PID_ALL, &raw_table );
2173 if (ret != ERROR_SUCCESS)
2174 {
2175 skip( "error %lu getting TCP table\n", ret );
2176 goto done;
2177 }
2178
2179 if (family == AF_INET)
2180 {
2181 MIB_TCPTABLE_OWNER_PID *table = raw_table;
2182 BOOL found_it = FALSE;
2183 for (i = 0; i < table->dwNumEntries; i++)
2184 {
2185 MIB_TCPROW_OWNER_PID *row = &table->table[i];
2186 if (row->dwLocalPort == port && row->dwLocalAddr == htonl( INADDR_LOOPBACK ))
2187 {
2188 ok( row->dwState == MIB_TCP_STATE_LISTEN, "unexpected socket state %ld\n", row->dwState );
2189 ok( row->dwOwningPid == GetCurrentProcessId(), "unexpected socket owner %04lx\n", row->dwOwningPid );
2190 found_it = TRUE;
2191 break;
2192 }
2193 }
2194 ok( found_it, "no table entry for socket\n" );
2195 }
2196 else
2197 {
2198 MIB_TCP6TABLE_OWNER_PID *table = raw_table;
2199 BOOL found_it = FALSE;
2200 for (i = 0; i < table->dwNumEntries; i++)
2201 {
2202 MIB_TCP6ROW_OWNER_PID *row = &table->table[i];
2203 if (row->dwLocalPort == port && IN6_IS_ADDR_LOOPBACK( (IN6_ADDR*)&row->ucLocalAddr ))
2204 {
2205 ok( row->dwState == MIB_TCP_STATE_LISTEN, "unexpected socket state %ld\n", row->dwState );
2206 ok( row->dwOwningPid == GetCurrentProcessId(), "unexpected socket owner %04lx\n", row->dwOwningPid );
2207 found_it = TRUE;
2208 break;
2209 }
2210 }
2211 ok( found_it, "no table entry for socket\n" );
2212 }
2213
2214done:
2215 closesocket( sock );
2216 free( raw_table );
2217
2219}
USHORT port
Definition: uri.c:228
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78
#define IPPROTO_TCP
Definition: ip.h:196
#define SOCK_STREAM
Definition: tcpip.h:118
GLenum const GLvoid * addr
Definition: glext.h:9621
#define IN6_IS_ADDR_LOOPBACK(a)
Definition: inet.h:129
#define INADDR_LOOPBACK
Definition: inet.h:78
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
#define closesocket
Definition: ncftp.h:477
@ MIB_TCP_STATE_LISTEN
Definition: tcpmib.h:16
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:213
INT WSAAPI listen(IN SOCKET s, IN INT backlog)
Definition: sockctrl.c:123
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
Definition: inet.h:67
Definition: tcpcore.h:1455
ADDRESS_FAMILY sin6_family
Definition: ws2ipdef.h:179
short sin_family
Definition: winsock.h:504
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
int PASCAL FAR WSAGetLastError(void)
Definition: dllmain.c:131
#define INVALID_SOCKET
Definition: winsock.h:326
UINT_PTR SOCKET
Definition: winsock.h:41
CONST IN6_ADDR in6addr_loopback

Referenced by START_TEST().

◆ test_GetExtendedUdpTable()

static void test_GetExtendedUdpTable ( void  )
static

Definition at line 2288 of file iphlpapi.c.

2289{
2290 DWORD ret;
2292 MIB_UDPTABLE_OWNER_PID *table_pid;
2293 MIB_UDPTABLE_OWNER_MODULE *table_module;
2294
2295 if (!pGetExtendedUdpTable)
2296 {
2297 win_skip("GetExtendedUdpTable not available\n");
2298 return;
2299 }
2300 ret = pGetExtendedUdpTable( NULL, NULL, TRUE, AF_INET, UDP_TABLE_BASIC, 0 );
2301 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2302
2304 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2305 free( table );
2306
2307 ret = get_extended_udp_table( AF_INET, UDP_TABLE_OWNER_PID, (void **)&table_pid );
2308 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2309 free( table_pid );
2310
2311 ret = get_extended_udp_table( AF_INET, UDP_TABLE_OWNER_MODULE, (void **)&table_module );
2312 ok( ret == ERROR_SUCCESS, "got %lu\n", ret );
2313 free( table_module );
2314}
static DWORD get_extended_udp_table(ULONG family, UDP_TABLE_CLASS class, void **table)
Definition: iphlpapi.c:2270
@ UDP_TABLE_BASIC
Definition: iprtrmib.h:43
@ UDP_TABLE_OWNER_MODULE
Definition: iprtrmib.h:45
@ UDP_TABLE_OWNER_PID
Definition: iprtrmib.h:44

Referenced by START_TEST().

◆ test_GetExtendedUdpTable_owner()

static void test_GetExtendedUdpTable_owner ( int  family)
static

Definition at line 2318 of file iphlpapi.c.

2319{
2320 SOCKET sock;
2321 int port;
2322 DWORD i, ret;
2323 void *raw_table = NULL;
2324
2325#ifdef __REACTOS__
2326 if (LOBYTE(LOWORD(GetVersion())) < 6) {
2327 skip("This test is invalid for this NT version.\n");
2328 return;
2329 }
2330#endif
2331 winetest_push_context( "%s", family == AF_INET ? "AF_INET" : "AF_INET6" );
2332
2333 sock = socket( family, SOCK_DGRAM, IPPROTO_UDP );
2334 ok( sock != INVALID_SOCKET, "socket error %d\n", WSAGetLastError() );
2335
2336 if (family == AF_INET)
2337 {
2338 struct sockaddr_in addr = { 0 };
2339 int addr_len = sizeof(addr);
2340
2342 addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
2343 addr.sin_port = 0;
2344
2345 ret = bind( sock, (struct sockaddr *)&addr, addr_len );
2346 ok( !ret, "bind error %d\n", WSAGetLastError() );
2347 ret = getsockname( sock, (struct sockaddr *)&addr, &addr_len );
2348 ok( !ret, "getsockname error %d\n", WSAGetLastError() );
2349
2350 port = addr.sin_port;
2351 }
2352 else
2353 {
2354 struct sockaddr_in6 addr = { 0 };
2355 int addr_len = sizeof(addr);
2356
2358 addr.sin6_addr = in6addr_loopback;
2359 addr.sin6_port = 0;
2360
2361 ret = bind( sock, (struct sockaddr *)&addr, addr_len );
2362 ok( !ret, "bind error %d\n", WSAGetLastError() );
2363 ret = getsockname( sock, (struct sockaddr *)&addr, &addr_len );
2364 ok( !ret, "getsockname error %d\n", WSAGetLastError() );
2365
2366 port = addr.sin6_port;
2367 }
2368
2369 ret = get_extended_udp_table( family, UDP_TABLE_OWNER_PID, &raw_table );
2370 if (ret != ERROR_SUCCESS)
2371 {
2372 skip( "error %lu getting UDP table\n", ret );
2373 goto done;
2374 }
2375
2376 if (family == AF_INET)
2377 {
2378 MIB_UDPTABLE_OWNER_PID *table = raw_table;
2379 BOOL found_it = FALSE;
2380 for (i = 0; i < table->dwNumEntries; i++)
2381 {
2382 MIB_UDPROW_OWNER_PID *row = &table->table[i];
2383 if (row->dwLocalPort == port && row->dwLocalAddr == htonl( INADDR_LOOPBACK ))
2384 {
2385 ok( row->dwOwningPid == GetCurrentProcessId(), "unexpected socket owner %04lx\n", row->dwOwningPid );
2386 found_it = TRUE;
2387 break;
2388 }
2389 }
2390 ok( found_it, "no table entry for socket\n" );
2391 }
2392 else
2393 {
2394 MIB_UDP6TABLE_OWNER_PID *table = raw_table;
2395 BOOL found_it = FALSE;
2396 for (i = 0; i < table->dwNumEntries; i++)
2397 {
2398 MIB_UDP6ROW_OWNER_PID *row = &table->table[i];
2399 if (row->dwLocalPort == port && IN6_IS_ADDR_LOOPBACK( (IN6_ADDR*)&row->ucLocalAddr ))
2400 {
2401 ok( row->dwOwningPid == GetCurrentProcessId(), "unexpected socket owner %04lx\n", row->dwOwningPid );
2402 found_it = TRUE;
2403 break;
2404 }
2405 }
2406 ok( found_it, "no table entry for socket\n" );
2407 }
2408
2409done:
2410 closesocket( sock );
2411 free( raw_table );
2412
2414}
#define IPPROTO_UDP
Definition: ip.h:197
#define SOCK_DGRAM
Definition: winsock.h:330

Referenced by START_TEST().

◆ test_GetIfEntry2()

static void test_GetIfEntry2 ( void  )
static

Definition at line 2827 of file iphlpapi.c.

2828{
2829 DWORD ret;
2832
2833#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
2834 if (!GetIfEntry2) {
2835 skip("Missing APIs!\n");
2836 return;
2837 }
2838#endif
2839 if (!(index = get_interface_index()))
2840 {
2841 skip( "no suitable interface found\n" );
2842 return;
2843 }
2844
2845 ret = GetIfEntry2( NULL );
2846 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2847
2848 memset( &row, 0, sizeof(row) );
2849 ret = GetIfEntry2( &row );
2850 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2851
2852 memset( &row, 0, sizeof(row) );
2853 row.InterfaceIndex = index;
2854 ret = GetIfEntry2( &row );
2855 ok( ret == NO_ERROR, "got %lu\n", ret );
2856 ok( row.InterfaceIndex == index, "got %lu\n", index );
2857}
#define index(s, c)
Definition: various.h:29
GLuint index
Definition: glext.h:6031
ULONG NET_IFINDEX
Definition: ifdef.h:26
static DWORD get_interface_index(void)
Definition: iphlpapi.c:2493

Referenced by START_TEST().

◆ test_GetIfTable2()

static void test_GetIfTable2 ( void  )
static

Definition at line 2859 of file iphlpapi.c.

2860{
2861 DWORD ret;
2863
2864#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
2865 if (!GetIfTable2) {
2866 skip("Missing APIs!\n");
2867 return;
2868 }
2869#endif
2870 table = NULL;
2871 ret = GetIfTable2( &table );
2872 ok( ret == NO_ERROR, "got %lu\n", ret );
2873 ok( table != NULL, "table not set\n" );
2875}

Referenced by START_TEST().

◆ test_GetIfTable2Ex()

static void test_GetIfTable2Ex ( void  )
static

Definition at line 2877 of file iphlpapi.c.

2878{
2879 DWORD ret;
2881
2882#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
2883 if (!GetIfTable2Ex) {
2884 skip("Missing APIs!\n");
2885 return;
2886 }
2887#endif
2888 table = NULL;
2890 ok( ret == NO_ERROR, "got %lu\n", ret );
2891 ok( table != NULL, "table not set\n" );
2893
2894 table = NULL;
2896 ok( ret == NO_ERROR, "got %lu\n", ret );
2897 ok( table != NULL, "table not set\n" );
2899
2900 table = NULL;
2902 ok( ret == NO_ERROR || broken(ret == ERROR_INVALID_PARAMETER), "got %lu\n", ret );
2903 ok( table != NULL || broken(!table), "table not set\n" );
2905
2906 table = NULL;
2907 ret = GetIfTable2Ex( 3, &table );
2908 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2909 ok( !table, "table should not be set\n" );
2911}
@ MibIfTableNormalWithoutStatistics
Definition: netioapi.h:41
@ MibIfTableNormal
Definition: netioapi.h:39
@ MibIfTableRaw
Definition: netioapi.h:40

Referenced by START_TEST().

◆ test_GetTcp6Table()

static void test_GetTcp6Table ( void  )
static

Definition at line 3102 of file iphlpapi.c.

3103{
3104 DWORD ret;
3105 ULONG size = 0;
3107
3108 if (!pGetTcp6Table)
3109 {
3110 win_skip("GetTcp6Table not available\n");
3111 return;
3112 }
3113
3114 ret = pGetTcp6Table(NULL, &size, FALSE);
3115 if (ret == ERROR_NOT_SUPPORTED)
3116 {
3117 skip("GetTcp6Table is not supported\n");
3118 return;
3119 }
3121 "GetTcp6Table(NULL, &size, FALSE) returned %ld, expected ERROR_INSUFFICIENT_BUFFER\n", ret);
3122 if (ret != ERROR_INSUFFICIENT_BUFFER) return;
3123
3124 buf = malloc(size);
3125
3126 ret = pGetTcp6Table(buf, &size, FALSE);
3127 ok(ret == NO_ERROR,
3128 "GetTcp6Table(buf, &size, FALSE) returned %ld, expected NO_ERROR\n", ret);
3129
3130 if (ret == NO_ERROR && winetest_debug > 1)
3131 {
3132 DWORD i;
3133 trace("TCP6 table: %lu entries\n", buf->dwNumEntries);
3134 for (i = 0; i < buf->dwNumEntries; i++)
3135 {
3136 trace("%lu: local %s%%%u:%u remote %s%%%u:%u state %u\n", i,
3137 ntoa6(&buf->table[i].LocalAddr), ntohs(buf->table[i].dwLocalScopeId),
3138 ntohs(buf->table[i].dwLocalPort), ntoa6(&buf->table[i].RemoteAddr),
3139 ntohs(buf->table[i].dwRemoteScopeId), ntohs(buf->table[i].dwRemotePort),
3140 buf->table[i].State);
3141 }
3142 }
3143
3144 free(buf);
3145}
static const char * ntoa6(IN6_ADDR *ip)
Definition: iphlpapi.c:195

Referenced by START_TEST().

◆ test_GetUdp6Table()

static void test_GetUdp6Table ( void  )
static

Definition at line 3147 of file iphlpapi.c.

3148{
3149 DWORD apiReturn;
3150 ULONG dwSize = 0;
3151
3152 if (!pGetUdp6Table) {
3153 win_skip("GetUdp6Table not available\n");
3154 return;
3155 }
3156
3157 apiReturn = pGetUdp6Table(NULL, &dwSize, FALSE);
3158 if (apiReturn == ERROR_NOT_SUPPORTED) {
3159 skip("GetUdp6Table is not supported\n");
3160 return;
3161 }
3162 ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
3163 "GetUdp6Table(NULL, &dwSize, FALSE) returned %ld, expected ERROR_INSUFFICIENT_BUFFER\n",
3164 apiReturn);
3165 if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
3167
3168 apiReturn = pGetUdp6Table(buf, &dwSize, FALSE);
3169 ok(apiReturn == NO_ERROR,
3170 "GetUdp6Table(buf, &dwSize, FALSE) returned %ld, expected NO_ERROR\n",
3171 apiReturn);
3172
3173 if (apiReturn == NO_ERROR && winetest_debug > 1)
3174 {
3175 DWORD i;
3176 trace( "UDP6 table: %lu entries\n", buf->dwNumEntries );
3177 for (i = 0; i < buf->dwNumEntries; i++)
3178 trace( "%lu: %s%%%u:%u\n",
3179 i, ntoa6(&buf->table[i].dwLocalAddr), ntohs(buf->table[i].dwLocalScopeId), ntohs(buf->table[i].dwLocalPort) );
3180 }
3181 free(buf);
3182 }
3183}
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

Referenced by START_TEST().

◆ test_GetUnicastIpAddressEntry()

static void test_GetUnicastIpAddressEntry ( void  )
static

Definition at line 2913 of file iphlpapi.c.

2914{
2915 IP_ADAPTER_ADDRESSES *aa, *ptr;
2917 DWORD ret;
2918
2919 if (!pGetUnicastIpAddressEntry)
2920 {
2921 win_skip( "GetUnicastIpAddressEntry not available\n" );
2922 return;
2923 }
2924
2925 ret = pGetUnicastIpAddressEntry( NULL );
2926 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2927
2928 memset( &row, 0, sizeof(row) );
2929 ret = pGetUnicastIpAddressEntry( &row );
2930 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2931
2932 memset( &row, 0, sizeof(row) );
2933 row.Address.Ipv4.sin_family = AF_INET;
2934 row.Address.Ipv4.sin_port = 0;
2935 row.Address.Ipv4.sin_addr.S_un.S_addr = 0x01020304;
2936 ret = pGetUnicastIpAddressEntry( &row );
2937 ok( ret == ERROR_FILE_NOT_FOUND, "got %lu\n", ret );
2938
2939 memset( &row, 0, sizeof(row) );
2940 row.InterfaceIndex = 123;
2941 ret = pGetUnicastIpAddressEntry( &row );
2942 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2943
2944 memset( &row, 0, sizeof(row) );
2945 row.InterfaceIndex = get_interface_index();
2946 row.Address.Ipv4.sin_family = AF_INET;
2947 row.Address.Ipv4.sin_port = 0;
2948 row.Address.Ipv4.sin_addr.S_un.S_addr = 0x01020304;
2949 ret = pGetUnicastIpAddressEntry( &row );
2950 ok( ret == ERROR_NOT_FOUND, "got %lu\n", ret );
2951
2952 memset( &row, 0, sizeof(row) );
2953 row.InterfaceIndex = 123;
2954 row.Address.Ipv4.sin_family = AF_INET;
2955 row.Address.Ipv4.sin_port = 0;
2956 row.Address.Ipv4.sin_addr.S_un.S_addr = 0x01020304;
2957 ret = pGetUnicastIpAddressEntry( &row );
2958 ok( ret == ERROR_FILE_NOT_FOUND, "got %lu\n", ret );
2959
2960 ptr = get_adapters( GAA_FLAG_INCLUDE_ALL_INTERFACES );
2961 ok(ptr != NULL, "can't get adapters\n");
2962
2963 for (aa = ptr; !ret && aa; aa = aa->Next)
2964 {
2965 IP_ADAPTER_UNICAST_ADDRESS *ua;
2966
2967 ua = aa->FirstUnicastAddress;
2968 while (ua)
2969 {
2970 /* test with luid */
2971 memset( &row, 0, sizeof(row) );
2972 memcpy(&row.InterfaceLuid, &aa->Luid, sizeof(aa->Luid));
2973 memcpy(&row.Address, ua->Address.lpSockaddr, ua->Address.iSockaddrLength);
2974 ret = pGetUnicastIpAddressEntry( &row );
2975 ok( ret == NO_ERROR, "got %lu\n", ret );
2976
2977 /* test with index */
2978 memset( &row, 0, sizeof(row) );
2979 row.InterfaceIndex = aa->IfIndex;
2980 memcpy(&row.Address, ua->Address.lpSockaddr, ua->Address.iSockaddrLength);
2981 ret = pGetUnicastIpAddressEntry( &row );
2982 ok( ret == NO_ERROR, "got %lu\n", ret );
2983 if (ret == NO_ERROR)
2984 {
2985 ok(row.InterfaceLuid.Info.Reserved == aa->Luid.Info.Reserved, "Expected %d, got %d\n",
2986 aa->Luid.Info.Reserved, row.InterfaceLuid.Info.Reserved);
2987 ok(row.InterfaceLuid.Info.NetLuidIndex == aa->Luid.Info.NetLuidIndex, "Expected %d, got %d\n",
2988 aa->Luid.Info.NetLuidIndex, row.InterfaceLuid.Info.NetLuidIndex);
2989 ok(row.InterfaceLuid.Info.IfType == aa->Luid.Info.IfType, "Expected %d, got %d\n",
2990 aa->Luid.Info.IfType, row.InterfaceLuid.Info.IfType);
2991 ok(row.InterfaceIndex == aa->IfIndex, "Expected %ld, got %ld\n",
2992 aa->IfIndex, row.InterfaceIndex);
2993 ok(row.PrefixOrigin == ua->PrefixOrigin, "Expected %d, got %d\n",
2994 ua->PrefixOrigin, row.PrefixOrigin);
2995 ok(row.SuffixOrigin == ua->SuffixOrigin, "Expected %d, got %d\n",
2996 ua->SuffixOrigin, row.SuffixOrigin);
2997 ok(row.ValidLifetime == ua->ValidLifetime, "Expected %ld, got %ld\n",
2998 ua->ValidLifetime, row.ValidLifetime);
2999 ok(row.PreferredLifetime == ua->PreferredLifetime, "Expected %ld, got %ld\n",
3000 ua->PreferredLifetime, row.PreferredLifetime);
3001 ok(row.OnLinkPrefixLength == ua->OnLinkPrefixLength, "Expected %d, got %d\n",
3002 ua->OnLinkPrefixLength, row.OnLinkPrefixLength);
3003 ok(row.SkipAsSource == 0, "Expected 0, got %d\n", row.SkipAsSource);
3004 ok(row.DadState == ua->DadState, "Expected %d, got %d\n", ua->DadState, row.DadState);
3005 if (row.Address.si_family == AF_INET6)
3006 ok(row.ScopeId.Value == row.Address.Ipv6.sin6_scope_id, "Expected %ld, got %ld\n",
3007 row.Address.Ipv6.sin6_scope_id, row.ScopeId.Value);
3008 ok(row.CreationTimeStamp.QuadPart, "CreationTimeStamp is 0\n");
3009 }
3010 ua = ua->Next;
3011 }
3012 }
3013 free(ptr);
3014}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define ERROR_NOT_FOUND
Definition: winerror.h:1014

Referenced by START_TEST().

◆ test_GetUnicastIpAddressTable()

static void test_GetUnicastIpAddressTable ( void  )
static

Definition at line 3016 of file iphlpapi.c.

3017{
3019 DWORD ret;
3020 ULONG i;
3021
3022 if (!pGetUnicastIpAddressTable)
3023 {
3024 win_skip( "GetUnicastIpAddressTable not available\n" );
3025 return;
3026 }
3027
3028 ret = pGetUnicastIpAddressTable(AF_UNSPEC, NULL);
3029 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
3030
3031 ret = pGetUnicastIpAddressTable(AF_BAN, &table);
3032 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
3033
3034 ret = pGetUnicastIpAddressTable(AF_INET, &table);
3035 ok( ret == NO_ERROR, "got %lu\n", ret );
3036 trace("GetUnicastIpAddressTable(AF_INET): NumEntries %lu\n", table->NumEntries);
3038
3039 ret = pGetUnicastIpAddressTable(AF_INET6, &table);
3040 ok( ret == NO_ERROR, "got %lu\n", ret );
3041 trace("GetUnicastIpAddressTable(AF_INET6): NumEntries %lu\n", table->NumEntries);
3043
3044 ret = pGetUnicastIpAddressTable(AF_UNSPEC, &table);
3045 ok( ret == NO_ERROR, "got %lu\n", ret );
3046 trace("GetUnicastIpAddressTable(AF_UNSPEC): NumEntries %lu\n", table->NumEntries);
3047 for (i = 0; i < table->NumEntries && winetest_debug > 1; i++)
3048 {
3049 trace("Index %lu:\n", i);
3050 trace("Address.si_family: %u\n", table->Table[i].Address.si_family);
3051 trace("InterfaceLuid.Info.Reserved: %u\n", table->Table[i].InterfaceLuid.Info.Reserved);
3052 trace("InterfaceLuid.Info.NetLuidIndex: %u\n", table->Table[i].InterfaceLuid.Info.NetLuidIndex);
3053 trace("InterfaceLuid.Info.IfType: %u\n", table->Table[i].InterfaceLuid.Info.IfType);
3054 trace("InterfaceIndex: %lu\n", table->Table[i].InterfaceIndex);
3055 trace("PrefixOrigin: %u\n", table->Table[i].PrefixOrigin);
3056 trace("SuffixOrigin: %u\n", table->Table[i].SuffixOrigin);
3057 trace("ValidLifetime: %lu seconds\n", table->Table[i].ValidLifetime);
3058 trace("PreferredLifetime: %lu seconds\n", table->Table[i].PreferredLifetime);
3059 trace("OnLinkPrefixLength: %u\n", table->Table[i].OnLinkPrefixLength);
3060 trace("SkipAsSource: %u\n", table->Table[i].SkipAsSource);
3061 trace("DadState: %u\n", table->Table[i].DadState);
3062 trace("ScopeId.Value: %lu\n", table->Table[i].ScopeId.Value);
3063 trace("CreationTimeStamp: %08lx%08lx\n", table->Table[i].CreationTimeStamp.HighPart, table->Table[i].CreationTimeStamp.LowPart);
3064 }
3065
3067}
#define AF_BAN
Definition: winsock.h:361

Referenced by START_TEST().

◆ test_interface_identifier_conversion()

static void test_interface_identifier_conversion ( void  )
static

Definition at line 2555 of file iphlpapi.c.

2556{
2557 DWORD ret, i;
2558 NET_LUID luid;
2559 GUID guid;
2560 SIZE_T len;
2563 WCHAR expect_nameW[IF_MAX_STRING_SIZE + 1];
2564 char nameA[IF_MAX_STRING_SIZE + 1], *name;
2565 char expect_nameA[IF_MAX_STRING_SIZE + 1];
2568
2569#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
2574 !pConvertInterfaceAliasToLuid || !pConvertInterfaceLuidToAlias ||
2576 skip("Missing APIs!\n");
2577 return;
2578 }
2579#endif
2580 ret = GetIfTable2( &table );
2581 ok( !ret, "got %ld\n", ret );
2582
2583 for (i = 0; i < table->NumEntries; i++)
2584 {
2585 MIB_IF_ROW2 *row = table->Table + i;
2586
2587 /* ConvertInterfaceIndexToLuid */
2588 memset( &luid, 0xff, sizeof(luid) );
2589 ret = ConvertInterfaceIndexToLuid( 0, &luid );
2590 ok( ret == ERROR_FILE_NOT_FOUND, "got %lu\n", ret );
2591 ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
2592 ok( !luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
2593 ok( !luid.Info.IfType, "got %u\n", luid.Info.IfType );
2594
2595 luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
2596 ret = ConvertInterfaceIndexToLuid( row->InterfaceIndex, &luid );
2597 ok( !ret, "got %lu\n", ret );
2598 ok( luid.Value == row->InterfaceLuid.Value, "mismatch\n" );
2599
2600 /* ConvertInterfaceLuidToIndex */
2602 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2603
2605 ok( !ret, "got %lu\n", ret );
2606 ok( index == row->InterfaceIndex, "mismatch\n" );
2607
2608 /* ConvertInterfaceLuidToGuid */
2609 memset( &guid, 0xff, sizeof(guid) );
2611 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2612 ok( guid.Data1 == 0xffffffff, "got %s\n", debugstr_guid(&guid) );
2613
2615 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2616
2617 memset( &guid, 0, sizeof(guid) );
2618 ret = ConvertInterfaceLuidToGuid( &luid, &guid );
2619 ok( !ret, "got %lu\n", ret );
2620 ok( IsEqualGUID( &guid, &row->InterfaceGuid ), "mismatch\n" );
2621
2622 /* ConvertInterfaceGuidToLuid */
2623 luid.Info.NetLuidIndex = 1;
2625 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2626 ok( luid.Info.NetLuidIndex == 1, "got %u\n", luid.Info.NetLuidIndex );
2627
2629 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2630
2631 luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
2632 ret = ConvertInterfaceGuidToLuid( &guid, &luid );
2633 ok( !ret, "got %lu\n", ret );
2634 ok( luid.Value == row->InterfaceLuid.Value ||
2635 broken( luid.Value != row->InterfaceLuid.Value), /* Win8 can have identical guids for two different ifaces */
2636 "mismatch\n" );
2637 if (luid.Value != row->InterfaceLuid.Value) continue;
2638
2639 /* ConvertInterfaceLuidToNameW */
2640 ret = ConvertInterfaceLuidToNameW( &luid, NULL, 0 );
2641 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2642
2643 ret = ConvertInterfaceLuidToNameW( &luid, nameW, 0 );
2644 ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %lu\n", ret );
2645
2646 nameW[0] = 0;
2647 len = ARRAY_SIZE(nameW);
2649 ok( !ret, "got %lu\n", ret );
2650 convert_luid_to_name( &luid, expect_nameW, len );
2651 ok( !wcscmp( nameW, expect_nameW ), "got %s vs %s\n", debugstr_w( nameW ), debugstr_w( expect_nameW ) );
2652
2653 /* ConvertInterfaceLuidToNameA */
2654 ret = ConvertInterfaceLuidToNameA( &luid, NULL, 0 );
2655 ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %lu\n", ret );
2656
2657 ret = ConvertInterfaceLuidToNameA( &luid, nameA, 0 );
2658 ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %lu\n", ret );
2659
2660 nameA[0] = 0;
2661 len = ARRAY_SIZE(nameA);
2662 ret = ConvertInterfaceLuidToNameA( &luid, nameA, len );
2663 ok( !ret, "got %lu\n", ret );
2664 ok( nameA[0], "name not set\n" );
2665
2666 /* ConvertInterfaceNameToLuidW */
2667 luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
2669 ok( ret == ERROR_INVALID_NAME, "got %lu\n", ret );
2670 ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
2671 ok( luid.Info.NetLuidIndex != 0xdead, "index not set\n" );
2672 ok( !luid.Info.IfType, "got %u\n", luid.Info.IfType );
2673
2675 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2676
2677 luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
2679 ok( !ret, "got %lu\n", ret );
2680 ok( luid.Value == row->InterfaceLuid.Value, "mismatch\n" );
2681
2682 /* ConvertInterfaceNameToLuidA */
2683 luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
2685 ok( ret == ERROR_INVALID_NAME, "got %lu\n", ret );
2686#if defined(__REACTOS__) && defined(_MSC_VER)
2687 ok( luid.Info.Reserved == 0xffdead, "reserved set\n" );
2688 ok( luid.Info.NetLuidIndex == 0xffdead, "index set\n" );
2689#else
2690 ok( luid.Info.Reserved == 0xdead, "reserved set\n" );
2691 ok( luid.Info.NetLuidIndex == 0xdead, "index set\n" );
2692#endif
2693 ok( luid.Info.IfType == 0xdead, "type set\n" );
2694
2696 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2697
2698 luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
2699 ret = ConvertInterfaceNameToLuidA( nameA, &luid );
2700 ok( !ret, "got %lu\n", ret );
2701 ok( luid.Value == row->InterfaceLuid.Value, "mismatch\n" );
2702
2703 /* ConvertInterfaceAliasToLuid */
2704 ret = ConvertInterfaceAliasToLuid( row->Alias, &luid );
2705 ok( !ret, "got %lu\n", ret );
2706 ok( luid.Value == row->InterfaceLuid.Value, "mismatch\n" );
2707
2708 /* ConvertInterfaceLuidToAlias */
2709 ret = ConvertInterfaceLuidToAlias( &row->InterfaceLuid, alias, ARRAY_SIZE(alias) );
2710 ok( !ret, "got %lu\n", ret );
2711 ok( !wcscmp( alias, row->Alias ), "got %s vs %s\n", wine_dbgstr_w( alias ), wine_dbgstr_w( row->Alias ) );
2712
2713 index = if_nametoindex( nameA );
2714 ok( index == row->InterfaceIndex, "Got index %lu for %s, expected %lu\n", index, nameA, row->InterfaceIndex );
2715 /* Wargaming.net Game Center passes a GUID-like string. */
2716 index = if_nametoindex( "{00000001-0000-0000-0000-000000000000}" );
2717 ok( !index, "Got unexpected index %lu\n", index );
2719 ok( !index, "Got unexpected index %lu for input %s\n", index, wine_dbgstr_guid( &guid ) );
2720
2721 /* if_indextoname */
2722 nameA[0] = 0;
2723 name = if_indextoname( row->InterfaceIndex, nameA );
2724 ConvertInterfaceLuidToNameA( &row->InterfaceLuid, expect_nameA, ARRAY_SIZE(expect_nameA) );
2725 ok( name == nameA, "mismatch\n" );
2726 ok( !strcmp( nameA, expect_nameA ), "mismatch\n" );
2727 }
2729}
const WCHAR * alias
Definition: main.c:67
static const WCHAR nameW[]
Definition: main.c:49
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_INVALID_NAME
Definition: compat.h:103
#define IF_MAX_STRING_SIZE
Definition: ifdef.h:66
static void convert_luid_to_name(NET_LUID *luid, WCHAR *expect_nameW, int len)
Definition: iphlpapi.c:2513
#define debugstr_guid
Definition: kernel32.h:35
Definition: name.c:39
ULONG_PTR SIZE_T
Definition: typedefs.h:80
ULONG64 Value
Definition: ifdef.h:100

Referenced by START_TEST().

◆ test_interface_identifier_conversion_failure()

static void test_interface_identifier_conversion_failure ( void  )
static

Definition at line 2731 of file iphlpapi.c.

2732{
2733 DWORD ret;
2735 char nameA[IF_MAX_STRING_SIZE + 1], *name;
2737 NET_LUID luid;
2738 GUID guid;
2739 static const GUID guid_zero;
2740 static const GUID guid_ones = { 0xffffffffUL, 0xffff, 0xffff, { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
2741
2742#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
2748 skip("Missing APIs!\n");
2749 return;
2750 }
2751#endif
2752 /* ConvertInterfaceIndexToLuid */
2754 ok( ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", ret );
2755
2756 ret = ConvertInterfaceIndexToLuid( -1, &luid );
2757 ok( ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %lu\n", ret );
2758
2759 /* ConvertInterfaceLuidToIndex */
2761 ok( ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", ret );
2762
2764 ok( ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", ret );
2765
2766 luid.Value = -1;
2767 index = -1;
2769 ok( ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %lu\n", ret );
2770 ok( index == 0, "index shall be zero (got %lu)\n", index );
2771
2772 /* ConvertInterfaceLuidToGuid */
2774 ok( ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", ret );
2775
2776 luid.Value = -1;
2777 memcpy( &guid, &guid_ones, sizeof(guid) );
2778 ret = ConvertInterfaceLuidToGuid( &luid, &guid );
2779 ok( ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %lu\n", ret );
2780 ok( memcmp( &guid, &guid_zero, sizeof(guid) ) == 0, "guid shall be nil\n" );
2781
2782 /* ConvertInterfaceGuidToLuid */
2784 ok( ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", ret );
2785
2786 /* ConvertInterfaceLuidToNameW */
2788 ok( ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", ret );
2789
2790 memset( nameW, 0, sizeof(nameW) );
2792 ok( ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %lu\n", ret );
2793 ok( !nameW[0], "nameW shall not change\n" );
2794
2795 /* ConvertInterfaceLuidToNameA */
2797 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2798
2799 memset( nameA, 0, sizeof(nameA) );
2800 ret = ConvertInterfaceLuidToNameA( NULL, nameA, 0 );
2801 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2802 ok( !nameA[0], "nameA shall not change\n" );
2803
2804 /* ConvertInterfaceNameToLuidW */
2806 ok( ret == ERROR_INVALID_PARAMETER, "got %lu\n", ret );
2807
2808 /* ConvertInterfaceNameToLuidA */
2810 ok( ret == ERROR_INVALID_NAME, "got %lu\n", ret );
2811
2812 /* if_nametoindex */
2814 ok( !index, "Got unexpected index %lu\n", index );
2815
2816 /* if_indextoname */
2817 name = if_indextoname( 0, NULL );
2818 ok( name == NULL, "expected NULL, got %s\n", name );
2819
2820 name = if_indextoname( 0, nameA );
2821 ok( name == NULL, "expected NULL, got %p\n", name );
2822
2823 name = if_indextoname( ~0u, nameA );
2824 ok( name == NULL, "expected NULL, got %p\n", name );
2825}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112

Referenced by START_TEST().

◆ test_ipaddtess_change_callback()

static void WINAPI test_ipaddtess_change_callback ( PVOID  context,
PMIB_UNICASTIPADDRESS_ROW  row,
MIB_NOTIFICATION_TYPE  notification_type 
)
static

Definition at line 3310 of file iphlpapi.c.

3312{
3313 BOOL *callback_called = context;
3314
3315 *callback_called = TRUE;
3316
3317 ok(notification_type == MibInitialNotification, "Unexpected notification_type %#x.\n",
3318 notification_type);
3319 ok(!row, "Unexpected row %p.\n", row);
3320}
@ MibInitialNotification
Definition: netioapi.h:49

Referenced by test_NotifyUnicastIpAddressChange().

◆ test_NotifyUnicastIpAddressChange()

static void test_NotifyUnicastIpAddressChange ( void  )
static

Definition at line 3322 of file iphlpapi.c.

3323{
3324 BOOL callback_called;
3325 HANDLE handle;
3326 DWORD ret;
3327
3328 if (!pNotifyUnicastIpAddressChange)
3329 {
3330 win_skip("NotifyUnicastIpAddressChange not available.\n");
3331 return;
3332 }
3333
3334 callback_called = FALSE;
3335 ret = pNotifyUnicastIpAddressChange(AF_INET, test_ipaddtess_change_callback,
3336 &callback_called, TRUE, &handle);
3337 ok(ret == NO_ERROR, "Unexpected ret %#lx.\n", ret);
3338 ok(callback_called, "Callback was not called.\n");
3339
3340 ret = pCancelMibChangeNotify2(handle);
3341 ok(ret == NO_ERROR, "Unexpected ret %#lx.\n", ret);
3342 ok(!CloseHandle(handle), "CloseHandle() succeeded.\n");
3343}
#define CloseHandle
Definition: compat.h:739
static void WINAPI test_ipaddtess_change_callback(PVOID context, PMIB_UNICASTIPADDRESS_ROW row, MIB_NOTIFICATION_TYPE notification_type)
Definition: iphlpapi.c:3310

Referenced by START_TEST().

◆ test_ParseNetworkString()

static void test_ParseNetworkString ( void  )
static

Definition at line 3185 of file iphlpapi.c.

3186{
3187 struct
3188 {
3189 char str[32];
3190 IN_ADDR addr;
3191 DWORD ret;
3192 }
3193 ipv4_address_tests[] =
3194 {
3195 {"1.2.3.4", {{{1, 2, 3, 4}}}},
3196#if defined(__REACTOS__) && defined(_MSC_VER) && _MSC_VER < 1930
3197 {"1.2.3.4a", {0}, ERROR_INVALID_PARAMETER},
3198 {"1.2.3.0x4a", {0}, ERROR_INVALID_PARAMETER},
3199 {"1.2.3", {0}, ERROR_INVALID_PARAMETER},
3200 {"a1.2.3.4", {0}, ERROR_INVALID_PARAMETER},
3201 {"0xdeadbeef", {0}, ERROR_INVALID_PARAMETER},
3202 {"1.2.3.4:22", {0}, ERROR_INVALID_PARAMETER},
3203 {"::1", {0}, ERROR_INVALID_PARAMETER},
3204 {"winehq.org", {0}, ERROR_INVALID_PARAMETER},
3205#else
3206 {"1.2.3.4a", {}, ERROR_INVALID_PARAMETER},
3207 {"1.2.3.0x4a", {}, ERROR_INVALID_PARAMETER},
3208 {"1.2.3", {}, ERROR_INVALID_PARAMETER},
3209 {"a1.2.3.4", {}, ERROR_INVALID_PARAMETER},
3210 {"0xdeadbeef", {}, ERROR_INVALID_PARAMETER},
3211 {"1.2.3.4:22", {}, ERROR_INVALID_PARAMETER},
3212 {"::1", {}, ERROR_INVALID_PARAMETER},
3213 {"winehq.org", {}, ERROR_INVALID_PARAMETER},
3214#endif
3215 };
3216 struct
3217 {
3218 char str[32];
3219 IN_ADDR addr;
3220 DWORD port;
3221 DWORD ret;
3222 }
3223 ipv4_service_tests[] =
3224 {
3225 {"1.2.3.4:22", {{{1, 2, 3, 4}}}, 22},
3226#if defined(__REACTOS__) && defined(_MSC_VER) && _MSC_VER < 1930
3227 {"winehq.org:22", {0}, 0, ERROR_INVALID_PARAMETER},
3228 {"1.2.3.4", {0}, 0, ERROR_INVALID_PARAMETER},
3229 {"1.2.3.4:0", {0}, 0, ERROR_INVALID_PARAMETER},
3230 {"1.2.3.4:65536", {0}, 0, ERROR_INVALID_PARAMETER},
3231#else
3232 {"winehq.org:22", {}, 0, ERROR_INVALID_PARAMETER},
3233 {"1.2.3.4", {}, 0, ERROR_INVALID_PARAMETER},
3234 {"1.2.3.4:0", {}, 0, ERROR_INVALID_PARAMETER},
3235 {"1.2.3.4:65536", {}, 0, ERROR_INVALID_PARAMETER},
3236#endif
3237 };
3238 WCHAR wstr[IP6_ADDRESS_STRING_BUFFER_LENGTH] = {'1','2','7','.','0','.','0','.','1',':','2','2',0};
3239 NET_ADDRESS_INFO info;
3240 USHORT port;
3241 BYTE prefix_len;
3242 DWORD ret;
3243 int i;
3244
3245 if (!pParseNetworkString)
3246 {
3247 win_skip("ParseNetworkString not available\n");
3248 return;
3249 }
3250
3251 ret = pParseNetworkString(wstr, -1, NULL, NULL, NULL);
3252 ok(ret == ERROR_SUCCESS, "expected success, got %ld\n", ret);
3253
3254 ret = pParseNetworkString(NULL, NET_STRING_IPV4_SERVICE, &info, NULL, NULL);
3255 ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", ret);
3256
3257 for (i = 0; i < ARRAY_SIZE(ipv4_address_tests); i++)
3258 {
3259 MultiByteToWideChar(CP_ACP, 0, ipv4_address_tests[i].str, sizeof(ipv4_address_tests[i].str),
3260 wstr, ARRAY_SIZE(wstr));
3261 memset(&info, 0x99, sizeof(info));
3262 port = 0x9999;
3263 prefix_len = 0x99;
3264
3265 ret = pParseNetworkString(wstr, NET_STRING_IPV4_ADDRESS, &info, &port, &prefix_len);
3266
3267 ok(ret == ipv4_address_tests[i].ret,
3268 "%s gave error %ld\n", ipv4_address_tests[i].str, ret);
3270 "%s gave format %d\n", ipv4_address_tests[i].str, info.Format);
3271 ok(info.Ipv4Address.sin_addr.S_un.S_addr == (ret ? 0x99999999 : ipv4_address_tests[i].addr.S_un.S_addr),
3272 "%s gave address %d.%d.%d.%d\n", ipv4_address_tests[i].str,
3273 info.Ipv4Address.sin_addr.S_un.S_un_b.s_b1, info.Ipv4Address.sin_addr.S_un.S_un_b.s_b2,
3274 info.Ipv4Address.sin_addr.S_un.S_un_b.s_b3, info.Ipv4Address.sin_addr.S_un.S_un_b.s_b4);
3275 ok(info.Ipv4Address.sin_port == (ret ? 0x9999 : 0),
3276 "%s gave port %d\n", ipv4_service_tests[i].str, ntohs(info.Ipv4Address.sin_port));
3277 ok(port == (ret ? 0x9999 : 0),
3278 "%s gave port %d\n", ipv4_service_tests[i].str, port);
3279 ok(prefix_len == (ret ? 0x99 : 255),
3280 "%s gave prefix length %d\n", ipv4_service_tests[i].str, prefix_len);
3281 }
3282
3283 for (i = 0; i < ARRAY_SIZE(ipv4_service_tests); i++)
3284 {
3285 MultiByteToWideChar(CP_ACP, 0, ipv4_service_tests[i].str, sizeof(ipv4_service_tests[i].str),
3286 wstr, ARRAY_SIZE(wstr));
3287 memset(&info, 0x99, sizeof(info));
3288 port = 0x9999;
3289 prefix_len = 0x99;
3290
3291 ret = pParseNetworkString(wstr, NET_STRING_IPV4_SERVICE, &info, &port, &prefix_len);
3292
3293 ok(ret == ipv4_service_tests[i].ret,
3294 "%s gave error %ld\n", ipv4_service_tests[i].str, ret);
3296 "%s gave format %d\n", ipv4_address_tests[i].str, info.Format);
3297 ok(info.Ipv4Address.sin_addr.S_un.S_addr == (ret ? 0x99999999 : ipv4_service_tests[i].addr.S_un.S_addr),
3298 "%s gave address %d.%d.%d.%d\n", ipv4_service_tests[i].str,
3299 info.Ipv4Address.sin_addr.S_un.S_un_b.s_b1, info.Ipv4Address.sin_addr.S_un.S_un_b.s_b2,
3300 info.Ipv4Address.sin_addr.S_un.S_un_b.s_b3, info.Ipv4Address.sin_addr.S_un.S_un_b.s_b4);
3301 ok(ntohs(info.Ipv4Address.sin_port) == (ret ? 0x9999 : ipv4_service_tests[i].port),
3302 "%s gave port %d\n", ipv4_service_tests[i].str, ntohs(info.Ipv4Address.sin_port));
3303 ok(port == (ret ? 0x9999 : ipv4_service_tests[i].port),
3304 "%s gave port %d\n", ipv4_service_tests[i].str, port);
3305 ok(prefix_len == (ret ? 0x99 : 255),
3306 "%s gave prefix length %d\n", ipv4_service_tests[i].str, prefix_len);
3307 }
3308}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
unsigned short USHORT
Definition: pedump.c:61
const WCHAR * str
Definition: tcpip.h:126
#define NET_STRING_IPV4_SERVICE
Definition: iphlpapi.h:40
@ NET_ADDRESS_IPV4
Definition: iphlpapi.h:142
@ NET_ADDRESS_FORMAT_UNSPECIFIED
Definition: iphlpapi.h:140
#define NET_STRING_IPV4_ADDRESS
Definition: iphlpapi.h:39
#define IP6_ADDRESS_STRING_BUFFER_LENGTH
Definition: windns.h:196
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ testGetAdaptersInfo()

static void testGetAdaptersInfo ( void  )
static

Definition at line 1606 of file iphlpapi.c.

1607{
1609 NET_LUID luid;
1610 GUID guid;
1611 char name[ARRAY_SIZE(ptr->AdapterName)];
1612 DWORD err;
1613 ULONG len = 0;
1614 MIB_IFROW row;
1615#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
1617 skip("Missing APIs!\n");
1618 return;
1619 }
1620#endif
1621
1623 ok( err == ERROR_INVALID_PARAMETER, "got %ld\n", err );
1624 err = GetAdaptersInfo( NULL, &len );
1625 ok( err == ERROR_NO_DATA || err == ERROR_BUFFER_OVERFLOW, "got %ld\n", err );
1626 if (err == ERROR_NO_DATA) return;
1627
1628 buf = malloc( len );
1629 err = GetAdaptersInfo( buf, &len );
1630 ok( !err, "got %ld\n", err );
1631 ptr = buf;
1632 while (ptr)
1633 {
1634 trace( "adapter '%s', address %s/%s gateway %s/%s\n", ptr->AdapterName,
1635 ptr->IpAddressList.IpAddress.String, ptr->IpAddressList.IpMask.String,
1636 ptr->GatewayList.IpAddress.String, ptr->GatewayList.IpMask.String );
1637 row.dwIndex = ptr->Index;
1638 GetIfEntry( &row );
1639 ConvertInterfaceIndexToLuid( ptr->Index, &luid );
1641 sprintf( name, "{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
1642 guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1],
1643 guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5],
1644 guid.Data4[6], guid.Data4[7] );
1645 ok( !strcmp( ptr->AdapterName, name ), "expected '%s' got '%s'\n", ptr->AdapterName, name );
1646 ok( !strcmp( ptr->Description, (char *)row.bDescr ), "got %s vs %s\n", ptr->Description, (char *)row.bDescr );
1647 ok( ptr->AddressLength == row.dwPhysAddrLen, "got %d vs %ld\n", ptr->AddressLength, row.dwPhysAddrLen );
1648 ok( !memcmp(ptr->Address, row.bPhysAddr, ptr->AddressLength ), "mismatch\n" );
1649 ok( ptr->Type == row.dwType, "got %d vs %ld\n", ptr->Type, row.dwType );
1650 ok( ptr->Type != MIB_IF_TYPE_LOOPBACK, "shouldn't get loopback\n" );
1651 ok( ptr->IpAddressList.IpAddress.String[0], "A valid IP address must be present\n" );
1652 ok( ptr->IpAddressList.IpMask.String[0], "A valid mask must be present\n" );
1653 ok( ptr->GatewayList.IpAddress.String[0], "A valid IP address must be present\n" );
1654 ok( ptr->GatewayList.IpMask.String[0], "A valid mask must be present\n" );
1655 ptr = ptr->Next;
1656 }
1657 free( buf );
1658}
DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
DWORD WINAPI GetAdaptersInfo(PIP_ADAPTER_INFO pAdapterInfo, PULONG pOutBufLen)
#define MIB_IF_TYPE_LOOPBACK
Definition: ipifcons.h:227
#define ERROR_NO_DATA
Definition: winerror.h:406

Referenced by testWin98Functions().

◆ testGetBestInterface()

static void testGetBestInterface ( void  )
static

Definition at line 1688 of file iphlpapi.c.

1689{
1690 DWORD apiReturn;
1691 DWORD bestIfIndex;
1692
1693 apiReturn = GetBestInterface( INADDR_ANY, &bestIfIndex );
1694 trace( "GetBestInterface([0.0.0.0], {%lu}) = %lu\n", bestIfIndex, apiReturn );
1695 if (apiReturn == ERROR_NOT_SUPPORTED)
1696 {
1697 skip( "GetBestInterface is not supported\n" );
1698 return;
1699 }
1700
1701 apiReturn = GetBestInterface( INADDR_LOOPBACK, NULL );
1702 ok( apiReturn == ERROR_INVALID_PARAMETER,
1703 "GetBestInterface([127.0.0.1], NULL) returned %lu, expected %d\n",
1704 apiReturn, ERROR_INVALID_PARAMETER );
1705
1706 apiReturn = GetBestInterface( INADDR_LOOPBACK, &bestIfIndex );
1707 ok( apiReturn == NO_ERROR,
1708 "GetBestInterface([127.0.0.1], {%lu}) returned %lu, expected %d\n",
1709 bestIfIndex, apiReturn, NO_ERROR );
1710}
DWORD WINAPI GetBestInterface(IPAddr dwDestAddr, PDWORD pdwBestIfIndex)
#define INADDR_ANY
Definition: inet.h:80

Referenced by testWin98Functions().

◆ testGetBestInterfaceEx()

static void testGetBestInterfaceEx ( void  )
static

Definition at line 1712 of file iphlpapi.c.

1713{
1714 DWORD apiReturn;
1715 DWORD bestIfIndex = 0;
1716 struct sockaddr_in destAddr;
1717
1718 memset(&destAddr, 0, sizeof(struct sockaddr_in));
1719 destAddr.sin_family = AF_INET;
1720 destAddr.sin_addr.S_un.S_addr = INADDR_ANY;
1721 apiReturn = GetBestInterfaceEx( (struct sockaddr *)&destAddr, &bestIfIndex );
1722 trace( "GetBestInterfaceEx([0.0.0.0], {%lu}) = %lu\n", bestIfIndex, apiReturn );
1723 if (apiReturn == ERROR_NOT_SUPPORTED)
1724 {
1725 skip( "GetBestInterfaceEx not supported\n" );
1726 return;
1727 }
1728
1729 apiReturn = GetBestInterfaceEx( NULL, NULL );
1730 ok( apiReturn == ERROR_INVALID_PARAMETER,
1731 "GetBestInterfaceEx(NULL, NULL) returned %lu, expected %d\n",
1732 apiReturn, ERROR_INVALID_PARAMETER );
1733
1734 apiReturn = GetBestInterfaceEx( NULL, &bestIfIndex );
1735 ok( apiReturn == ERROR_INVALID_PARAMETER,
1736 "GetBestInterfaceEx(NULL, {%lu}) returned %lu, expected %d\n",
1737 bestIfIndex, apiReturn, ERROR_INVALID_PARAMETER );
1738
1739 memset(&destAddr, 0, sizeof(struct sockaddr_in));
1740 apiReturn = GetBestInterfaceEx( (struct sockaddr *)&destAddr, NULL );
1741 ok( apiReturn == ERROR_INVALID_PARAMETER,
1742 "GetBestInterfaceEx(<AF_UNSPEC>, NULL) returned %lu, expected %d\n",
1743 apiReturn, ERROR_INVALID_PARAMETER );
1744
1745 memset(&destAddr, -1, sizeof(struct sockaddr_in));
1746 apiReturn = GetBestInterfaceEx( (struct sockaddr *)&destAddr, NULL );
1747 ok( apiReturn == ERROR_INVALID_PARAMETER,
1748 "GetBestInterfaceEx(<INVALID>, NULL) returned %lu, expected %d\n",
1749 apiReturn, ERROR_INVALID_PARAMETER );
1750
1751 memset(&destAddr, 0, sizeof(struct sockaddr_in));
1752 destAddr.sin_family = AF_INET;
1753 destAddr.sin_addr.S_un.S_addr = INADDR_LOOPBACK;
1754 apiReturn = GetBestInterfaceEx( (struct sockaddr *)&destAddr, NULL );
1755 ok( apiReturn == ERROR_INVALID_PARAMETER,
1756 "GetBestInterfaceEx([127.0.0.1], NULL) returned %lu, expected %d\n",
1757 apiReturn, ERROR_INVALID_PARAMETER );
1758
1759 memset(&destAddr, 0, sizeof(struct sockaddr_in));
1760 destAddr.sin_family = AF_INET;
1761 destAddr.sin_addr.S_un.S_addr = INADDR_LOOPBACK;
1762 apiReturn = GetBestInterfaceEx( (struct sockaddr *)&destAddr, &bestIfIndex );
1763 ok( apiReturn == NO_ERROR,
1764 "GetBestInterfaceEx([127.0.0.1], {%lu}) returned %lu, expected %d\n",
1765 bestIfIndex, apiReturn, ERROR_INVALID_PARAMETER );
1766}
DWORD WINAPI GetBestInterfaceEx(struct sockaddr *pDestAddr, PDWORD pdwBestIfIndex)

Referenced by testWin98Functions().

◆ testGetBestRoute()

static void testGetBestRoute ( void  )
static

Definition at line 1768 of file iphlpapi.c.

1769{
1770 DWORD apiReturn;
1771 MIB_IPFORWARDROW bestRoute;
1772
1773 apiReturn = GetBestRoute( INADDR_ANY, 0, &bestRoute );
1774 trace( "GetBestRoute([0.0.0.0], 0, [...]) = %lu\n", apiReturn );
1775 if (apiReturn == ERROR_NOT_SUPPORTED)
1776 {
1777 skip( "GetBestRoute is not supported\n" );
1778 return;
1779 }
1780
1781 apiReturn = GetBestRoute( INADDR_ANY, 0, NULL );
1782 ok( apiReturn == ERROR_INVALID_PARAMETER,
1783 "GetBestRoute([0.0.0.0], 0, NULL) returned %lu, expected %d\n",
1784 apiReturn, ERROR_INVALID_PARAMETER );
1785
1786 apiReturn = GetBestRoute( INADDR_LOOPBACK, 0, &bestRoute );
1787 ok( apiReturn == NO_ERROR,
1788 "GetBestRoute([127.0.0.1], 0, NULL) returned %lu, expected %d\n",
1789 apiReturn, NO_ERROR );
1790}
DWORD WINAPI GetBestRoute(DWORD dwDestAddr, DWORD dwSourceAddr, PMIB_IPFORWARDROW pBestRoute)

Referenced by testWin98Functions().

◆ testGetIcmpStatistics()

static void testGetIcmpStatistics ( void  )
static

Definition at line 599 of file iphlpapi.c.

600{
601 DWORD apiReturn;
602 MIB_ICMP stats;
603
604 /* Crashes on Vista */
605 if (0) {
606 apiReturn = GetIcmpStatistics(NULL);
607 if (apiReturn == ERROR_NOT_SUPPORTED)
608 return;
609 ok(apiReturn == ERROR_INVALID_PARAMETER,
610 "GetIcmpStatistics(NULL) returned %ld, expected ERROR_INVALID_PARAMETER\n",
611 apiReturn);
612 }
613
614 apiReturn = GetIcmpStatistics(&stats);
615 if (apiReturn == ERROR_NOT_SUPPORTED)
616 {
617 skip("GetIcmpStatistics is not supported\n");
618 return;
619 }
620 ok(apiReturn == NO_ERROR,
621 "GetIcmpStatistics returned %ld, expected NO_ERROR\n", apiReturn);
622 if (apiReturn == NO_ERROR && winetest_debug > 1)
623 {
624 trace( "ICMP stats: %8s %8s\n", "in", "out" );
625 trace( " dwMsgs: %8lu %8lu\n", stats.stats.icmpInStats.dwMsgs, stats.stats.icmpOutStats.dwMsgs );
626 trace( " dwErrors: %8lu %8lu\n", stats.stats.icmpInStats.dwErrors, stats.stats.icmpOutStats.dwErrors );
627 trace( " dwDestUnreachs: %8lu %8lu\n", stats.stats.icmpInStats.dwDestUnreachs, stats.stats.icmpOutStats.dwDestUnreachs );
628 trace( " dwTimeExcds: %8lu %8lu\n", stats.stats.icmpInStats.dwTimeExcds, stats.stats.icmpOutStats.dwTimeExcds );
629 trace( " dwParmProbs: %8lu %8lu\n", stats.stats.icmpInStats.dwParmProbs, stats.stats.icmpOutStats.dwParmProbs );
630 trace( " dwSrcQuenchs: %8lu %8lu\n", stats.stats.icmpInStats.dwSrcQuenchs, stats.stats.icmpOutStats.dwSrcQuenchs );
631 trace( " dwRedirects: %8lu %8lu\n", stats.stats.icmpInStats.dwRedirects, stats.stats.icmpOutStats.dwRedirects );
632 trace( " dwEchos: %8lu %8lu\n", stats.stats.icmpInStats.dwEchos, stats.stats.icmpOutStats.dwEchos );
633 trace( " dwEchoReps: %8lu %8lu\n", stats.stats.icmpInStats.dwEchoReps, stats.stats.icmpOutStats.dwEchoReps );
634 trace( " dwTimestamps: %8lu %8lu\n", stats.stats.icmpInStats.dwTimestamps, stats.stats.icmpOutStats.dwTimestamps );
635 trace( " dwTimestampReps: %8lu %8lu\n", stats.stats.icmpInStats.dwTimestampReps, stats.stats.icmpOutStats.dwTimestampReps );
636 trace( " dwAddrMasks: %8lu %8lu\n", stats.stats.icmpInStats.dwAddrMasks, stats.stats.icmpOutStats.dwAddrMasks );
637 trace( " dwAddrMaskReps: %8lu %8lu\n", stats.stats.icmpInStats.dwAddrMaskReps, stats.stats.icmpOutStats.dwAddrMaskReps );
638 }
639}
DWORD WINAPI GetIcmpStatistics(PMIB_ICMP pStats)
MIBICMPSTATS icmpOutStats
Definition: ipmib.h:194
MIBICMPSTATS icmpInStats
Definition: ipmib.h:193
DWORD dwTimeExcds
Definition: ipmib.h:179
DWORD dwAddrMasks
Definition: ipmib.h:187
DWORD dwEchoReps
Definition: ipmib.h:184
DWORD dwParmProbs
Definition: ipmib.h:180
DWORD dwAddrMaskReps
Definition: ipmib.h:188
DWORD dwSrcQuenchs
Definition: ipmib.h:181
DWORD dwTimestamps
Definition: ipmib.h:185
DWORD dwRedirects
Definition: ipmib.h:182
DWORD dwMsgs
Definition: ipmib.h:176
DWORD dwErrors
Definition: ipmib.h:177
DWORD dwEchos
Definition: ipmib.h:183
DWORD dwTimestampReps
Definition: ipmib.h:186
DWORD dwDestUnreachs
Definition: ipmib.h:178
MIBICMPINFO stats
Definition: ipmib.h:199

Referenced by testWinNT4Functions().

◆ testGetIcmpStatisticsEx()

static void testGetIcmpStatisticsEx ( void  )
static

Definition at line 750 of file iphlpapi.c.

751{
752 DWORD apiReturn;
753 MIB_ICMP_EX stats;
754
755 /* Crashes on Vista */
756 if (1) {
757 apiReturn = GetIcmpStatisticsEx(NULL, AF_INET);
758 ok(apiReturn == ERROR_INVALID_PARAMETER,
759 "GetIcmpStatisticsEx(NULL, AF_INET) returned %ld, expected ERROR_INVALID_PARAMETER\n", apiReturn);
760 }
761
762 apiReturn = GetIcmpStatisticsEx(&stats, AF_BAN);
763 ok(apiReturn == ERROR_INVALID_PARAMETER,
764 "GetIcmpStatisticsEx(&stats, AF_BAN) returned %ld, expected ERROR_INVALID_PARAMETER\n", apiReturn);
765
766 apiReturn = GetIcmpStatisticsEx(&stats, AF_INET);
767 ok(apiReturn == NO_ERROR, "GetIcmpStatisticsEx returned %ld, expected NO_ERROR\n", apiReturn);
768 if (apiReturn == NO_ERROR && winetest_debug > 1)
769 {
770 INT i;
771 trace( "ICMP IPv4 Ex stats: %8s %8s\n", "in", "out" );
772 trace( " dwMsgs: %8lu %8lu\n", stats.icmpInStats.dwMsgs, stats.icmpOutStats.dwMsgs );
773 trace( " dwErrors: %8lu %8lu\n", stats.icmpInStats.dwErrors, stats.icmpOutStats.dwErrors );
774 for (i = 0; i < 256; i++)
775 trace( " rgdwTypeCount[%3i]: %8lu %8lu\n", i, stats.icmpInStats.rgdwTypeCount[i], stats.icmpOutStats.rgdwTypeCount[i] );
776 }
777
778 apiReturn = GetIcmpStatisticsEx(&stats, AF_INET6);
779 ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
780 "GetIcmpStatisticsEx returned %ld, expected NO_ERROR\n", apiReturn);
781 if (apiReturn == NO_ERROR && winetest_debug > 1)
782 {
783 INT i;
784 trace( "ICMP IPv6 Ex stats: %8s %8s\n", "in", "out" );
785 trace( " dwMsgs: %8lu %8lu\n", stats.icmpInStats.dwMsgs, stats.icmpOutStats.dwMsgs );
786 trace( " dwErrors: %8lu %8lu\n", stats.icmpInStats.dwErrors, stats.icmpOutStats.dwErrors );
787 for (i = 0; i < 256; i++)
788 trace( " rgdwTypeCount[%3i]: %8lu %8lu\n", i, stats.icmpInStats.rgdwTypeCount[i], stats.icmpOutStats.rgdwTypeCount[i] );
789 }
790}
DWORD WINAPI GetIcmpStatisticsEx(PMIB_ICMP_EX pStats, DWORD dwFamily)
DWORD dwMsgs
Definition: ipmib.h:240
DWORD rgdwTypeCount[256]
Definition: ipmib.h:242
DWORD dwErrors
Definition: ipmib.h:241
MIBICMPSTATS_EX icmpOutStats
Definition: ipmib.h:248
MIBICMPSTATS_EX icmpInStats
Definition: ipmib.h:247
int32_t INT
Definition: typedefs.h:58

Referenced by testWinNT4Functions().

◆ testGetIfEntry()

static void testGetIfEntry ( DWORD  index)
static

Definition at line 239 of file iphlpapi.c.

240{
241 DWORD apiReturn;
243
244 memset(&row, 0, sizeof(row));
245 apiReturn = GetIfEntry(NULL);
246 if (apiReturn == ERROR_NOT_SUPPORTED) {
247 skip("GetIfEntry is not supported\n");
248 return;
249 }
250 ok(apiReturn == ERROR_INVALID_PARAMETER,
251 "GetIfEntry(NULL) returned %ld, expected ERROR_INVALID_PARAMETER\n",
252 apiReturn);
253 row.dwIndex = -1; /* hope that's always bogus! */
254 apiReturn = GetIfEntry(&row);
255 ok(apiReturn == ERROR_INVALID_DATA ||
256 apiReturn == ERROR_FILE_NOT_FOUND /* Vista */,
257 "GetIfEntry(bogus row) returned %ld, expected ERROR_INVALID_DATA or ERROR_FILE_NOT_FOUND\n",
258 apiReturn);
259 row.dwIndex = index;
260 apiReturn = GetIfEntry(&row);
261 ok(apiReturn == NO_ERROR,
262 "GetIfEntry returned %ld, expected NO_ERROR\n", apiReturn);
263}
#define ERROR_INVALID_DATA
Definition: winerror.h:238

Referenced by testGetIpAddrTable().

◆ testGetIfTable()

static void testGetIfTable ( void  )
static

Definition at line 306 of file iphlpapi.c.

307{
308 DWORD apiReturn;
309 ULONG dwSize = 0;
310
311#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
312 if (!GetIfEntry2)
313 skip("Missing APIs!\n");
314#endif
315 apiReturn = GetIfTable(NULL, NULL, FALSE);
316 if (apiReturn == ERROR_NOT_SUPPORTED) {
317 skip("GetIfTable is not supported\n");
318 return;
319 }
320 ok(apiReturn == ERROR_INVALID_PARAMETER,
321 "GetIfTable(NULL, NULL, FALSE) returned %ld, expected ERROR_INVALID_PARAMETER\n",
322 apiReturn);
323 apiReturn = GetIfTable(NULL, &dwSize, FALSE);
324 ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
325 "GetIfTable(NULL, &dwSize, FALSE) returned %ld, expected ERROR_INSUFFICIENT_BUFFER\n",
326 apiReturn);
327 if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
329
330 apiReturn = GetIfTable(buf, &dwSize, FALSE);
331 ok(apiReturn == NO_ERROR,
332 "GetIfTable(buf, &dwSize, FALSE) returned %ld, expected NO_ERROR\n\n",
333 apiReturn);
334
335 if (apiReturn == NO_ERROR)
336 {
339 DWORD i, index;
340
341 if (winetest_debug > 1) trace( "interface table: %lu entries\n", buf->dwNumEntries );
342#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
343 if (GetIfEntry2) {
344#endif
345 for (i = 0; i < buf->dwNumEntries; i++)
346 {
347 MIB_IFROW *row = &buf->table[i];
348 MIB_IF_ROW2 row2;
349 GUID *guid;
350
351 if (winetest_debug > 1)
352 {
353 trace( "%lu: '%s' type %lu mtu %lu speed %lu\n",
354 row->dwIndex, debugstr_w(row->wszName), row->dwType, row->dwMtu, row->dwSpeed );
355 trace( " in: bytes %lu upkts %lu nupkts %lu disc %lu err %lu unk %lu\n",
356 row->dwInOctets, row->dwInUcastPkts, row->dwInNUcastPkts,
357 row->dwInDiscards, row->dwInErrors, row->dwInUnknownProtos );
358 trace( " out: bytes %lu upkts %lu nupkts %lu disc %lu err %lu\n",
359 row->dwOutOctets, row->dwOutUcastPkts, row->dwOutNUcastPkts,
360 row->dwOutDiscards, row->dwOutErrors );
361 }
362 apiReturn = GetAdapterIndex( row->wszName, &index );
363 ok( !apiReturn, "got %ld\n", apiReturn );
364 ok( index == row->dwIndex ||
365 broken( index != row->dwIndex && index ), /* Win8 can have identical guids for two different ifaces */
366 "got %ld vs %ld\n", index, row->dwIndex );
367 memset( &row2, 0, sizeof(row2) );
368 row2.InterfaceIndex = row->dwIndex;
369 GetIfEntry2( &row2 );
370 WideCharToMultiByte( CP_ACP, 0, row2.Description, -1, descr, sizeof(descr), NULL, NULL );
371 ok( !strcmp( (char *)row->bDescr, descr ), "got %s vs %s\n", row->bDescr, descr );
372 guid = &row2.InterfaceGuid;
373#ifdef __REACTOS__
374 _snwprintf( name, ARRAY_SIZE(name), L"\\DEVICE\\TCPIP_{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
375 guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1],
376 guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5],
377 guid->Data4[6], guid->Data4[7]);
378#else
379 swprintf( name, ARRAY_SIZE(name), L"\\DEVICE\\TCPIP_{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
380 guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1],
381 guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5],
382 guid->Data4[6], guid->Data4[7]);
383#endif
384 ok( !wcscmp( row->wszName, name ), "got %s vs %s\n", debugstr_w( row->wszName ), debugstr_w( name ) );
385 }
386#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
387 }
388#endif
389 }
390 free(buf);
391 }
392}
#define WideCharToMultiByte
Definition: compat.h:111
#define MAX_INTERFACE_NAME_LEN
Definition: ifmib.h:31
DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder)
DWORD WINAPI GetAdapterIndex(LPWSTR AdapterName, PULONG IfIndex)
const char * descr
Definition: boot.c:45
GUID InterfaceGuid
Definition: netioapi.h:56
NET_IFINDEX InterfaceIndex
Definition: netioapi.h:55
WCHAR Description[IF_MAX_STRING_SIZE+1]
Definition: netioapi.h:58

Referenced by testWinNT4Functions().

◆ testGetInterfaceInfo()

static void testGetInterfaceInfo ( void  )
static

Definition at line 1563 of file iphlpapi.c.

1564{
1565 DWORD apiReturn;
1566 ULONG len = 0, i;
1567
1568 apiReturn = GetInterfaceInfo(NULL, NULL);
1569 if (apiReturn == ERROR_NOT_SUPPORTED) {
1570 skip("GetInterfaceInfo is not supported\n");
1571 return;
1572 }
1573 ok(apiReturn == ERROR_INVALID_PARAMETER,
1574 "GetInterfaceInfo returned %ld, expected ERROR_INVALID_PARAMETER\n",
1575 apiReturn);
1576 apiReturn = GetInterfaceInfo(NULL, &len);
1577 ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
1578 "GetInterfaceInfo returned %ld, expected ERROR_INSUFFICIENT_BUFFER\n",
1579 apiReturn);
1580 if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
1582
1583 apiReturn = GetInterfaceInfo(buf, &len);
1584 ok(apiReturn == NO_ERROR,
1585 "GetInterfaceInfo(buf, &dwSize) returned %ld, expected NO_ERROR\n",
1586 apiReturn);
1587
1588 for (i = 0; i < buf->NumAdapters; i++)
1589 {
1590 MIB_IFROW row = { .dwIndex = buf->Adapter[i].Index };
1591 GetIfEntry( &row );
1592#ifdef __REACTOS__
1593 if (LOBYTE(LOWORD(GetVersion())) >= 6) {
1594#endif
1595 ok( !wcscmp( buf->Adapter[i].Name, row.wszName ), "got %s vs %s\n",
1596 debugstr_w( buf->Adapter[i].Name ), debugstr_w( row.wszName ) );
1597#ifdef __REACTOS__
1598 }
1599#endif
1600 ok( row.dwType != IF_TYPE_SOFTWARE_LOOPBACK, "got loopback\n" );
1601 }
1602 free(buf);
1603 }
1604}
DWORD WINAPI GetInterfaceInfo(PIP_INTERFACE_INFO pIfTable, PULONG dwOutBufLen)
DWORD dwIndex
Definition: ifmib.h:38

Referenced by testWin98Functions().

◆ testGetIpAddrTable()

static void testGetIpAddrTable ( void  )
static

Definition at line 265 of file iphlpapi.c.

266{
267 DWORD apiReturn;
268 ULONG dwSize = 0;
269
270 apiReturn = GetIpAddrTable(NULL, NULL, FALSE);
271 if (apiReturn == ERROR_NOT_SUPPORTED) {
272 skip("GetIpAddrTable is not supported\n");
273 return;
274 }
275 ok(apiReturn == ERROR_INVALID_PARAMETER,
276 "GetIpAddrTable(NULL, NULL, FALSE) returned %ld, expected ERROR_INVALID_PARAMETER\n",
277 apiReturn);
278 apiReturn = GetIpAddrTable(NULL, &dwSize, FALSE);
279 ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
280 "GetIpAddrTable(NULL, &dwSize, FALSE) returned %ld, expected ERROR_INSUFFICIENT_BUFFER\n",
281 apiReturn);
282 if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
284
285 apiReturn = GetIpAddrTable(buf, &dwSize, FALSE);
286 ok(apiReturn == NO_ERROR,
287 "GetIpAddrTable(buf, &dwSize, FALSE) returned %ld, expected NO_ERROR\n",
288 apiReturn);
289 if (apiReturn == NO_ERROR && buf->dwNumEntries)
290 {
291 int i;
292 testGetIfEntry(buf->table[0].dwIndex);
293 for (i = 0; i < buf->dwNumEntries; i++)
294 {
295 ok (buf->table[i].wType != 0, "Test[%d]: expected wType > 0\n", i);
296 ok (buf->table[i].dwBCastAddr == 1, "Test[%d]: got %08lx\n", i, buf->table[i].dwBCastAddr);
297 ok (buf->table[i].dwReasmSize == 0xffff, "Test[%d]: got %08lx\n", i, buf->table[i].dwReasmSize);
298 trace("Entry[%d]: addr %s, dwIndex %lu, wType 0x%x\n", i,
299 ntoa(buf->table[i].dwAddr), buf->table[i].dwIndex, buf->table[i].wType);
300 }
301 }
302 free(buf);
303 }
304}
static void testGetIfEntry(DWORD index)
Definition: iphlpapi.c:239
DWORD WINAPI GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL bOrder)

Referenced by testWinNT4Functions().

◆ testGetIpForwardTable()

static void testGetIpForwardTable ( void  )
static

Definition at line 394 of file iphlpapi.c.

395{
396 DWORD err, i, j;
397 ULONG size = 0;
399 MIB_IPFORWARD_TABLE2 *table2;
401#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
403 skip("Missing APIs!\n");
404 return;
405 }
406#endif
407
409 ok( err == ERROR_INVALID_PARAMETER, "got %ld\n", err );
410
412 ok( err == ERROR_INSUFFICIENT_BUFFER, "got %ld\n", err );
413
414 buf = malloc( size );
416 ok( !err, "got %ld\n", err );
417
418 err = GetIpForwardTable2( AF_INET, &table2 );
419 ok( !err, "got %ld\n", err );
420 ok( buf->dwNumEntries == table2->NumEntries, "got %ld vs %ld\n",
421 buf->dwNumEntries, table2->NumEntries );
422
423 err = GetUnicastIpAddressTable( AF_INET, &unicast );
424 ok( !err, "got %ld\n", err );
425
426 trace( "IP forward table: %lu entries\n", buf->dwNumEntries );
427 for (i = 0; i < buf->dwNumEntries; i++)
428 {
429 MIB_IPFORWARDROW *row = buf->table + i;
430 MIB_IPFORWARD_ROW2 *row2 = table2->Table + i;
431 DWORD mask, next_hop;
432
433 winetest_push_context( "%ld", i );
434
435 trace( "dest %s mask %s gw %s if %lu type %lu proto %lu\n",
436 ntoa( row->dwForwardDest ), ntoa( row->dwForwardMask ),
437 ntoa( row->dwForwardNextHop ), row->dwForwardIfIndex,
438 row->dwForwardType, row->dwForwardProto );
439 ok( row->dwForwardDest == row2->DestinationPrefix.Prefix.Ipv4.sin_addr.s_addr,
440 "got %08lx vs %08lx\n", row->dwForwardDest, row2->DestinationPrefix.Prefix.Ipv4.sin_addr.s_addr );
442 ok( row->dwForwardMask == mask, "got %08lx vs %08lx\n", row->dwForwardMask, mask );
443 ok( row->dwForwardPolicy == 0, "got %ld\n", row->dwForwardPolicy );
444
445 next_hop = row2->NextHop.Ipv4.sin_addr.s_addr;
446 if (!next_hop) /* for direct addresses, dwForwardNextHop is set to the address of the appropriate interface */
447 {
448 for (j = 0; j < unicast->NumEntries; j++)
449 {
450 if (unicast->Table[j].InterfaceLuid.Value == row2->InterfaceLuid.Value)
451 {
452 next_hop = unicast->Table[j].Address.Ipv4.sin_addr.s_addr;
453 break;
454 }
455 }
456 }
457 ok( row->dwForwardNextHop == next_hop, "got %08lx vs %08lx\n", row->dwForwardNextHop, next_hop );
458
459 ok( row->dwForwardIfIndex == row2->InterfaceIndex, "got %ld vs %ld\n", row->dwForwardIfIndex, row2->InterfaceIndex );
460 if (!row2->NextHop.Ipv4.sin_addr.s_addr)
461 ok( buf->table[i].dwForwardType == MIB_IPROUTE_TYPE_DIRECT, "got %ld\n", buf->table[i].dwForwardType );
462 else
463 ok( buf->table[i].dwForwardType == MIB_IPROUTE_TYPE_INDIRECT, "got %ld\n", buf->table[i].dwForwardType );
464 ok( row->dwForwardProto == row2->Protocol, "got %ld vs %d\n", row->dwForwardProto, row2->Protocol );
465 ok( row->dwForwardAge == row2->Age || row->dwForwardAge + 1 == row2->Age,
466 "got %ld vs %ld\n", row->dwForwardAge, row2->Age );
467 ok( row->dwForwardNextHopAS == 0, "got %08lx\n", row->dwForwardNextHopAS );
468 /* FIXME: need to add the interface's metric from GetIpInterfaceTable() */
469 ok( row->dwForwardMetric1 >= row2->Metric, "got %ld vs %ld\n", row->dwForwardMetric1, row2->Metric );
470 ok( row->dwForwardMetric2 == 0, "got %ld\n", row->dwForwardMetric2 );
471 ok( row->dwForwardMetric3 == 0, "got %ld\n", row->dwForwardMetric3 );
472 ok( row->dwForwardMetric4 == 0, "got %ld\n", row->dwForwardMetric4 );
473 ok( row->dwForwardMetric5 == 0, "got %ld\n", row->dwForwardMetric5 );
474
476 }
477 FreeMibTable( unicast );
478 FreeMibTable( table2 );
479 free( buf );
480}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSize, BOOL bOrder)
@ MIB_IPROUTE_TYPE_DIRECT
Definition: ipmib.h:63
@ MIB_IPROUTE_TYPE_INDIRECT
Definition: ipmib.h:64
SOCKADDR_INET Prefix
Definition: netioapi.h:196
NL_ROUTE_PROTOCOL Protocol
Definition: netioapi.h:210
NET_LUID InterfaceLuid
Definition: netioapi.h:202
SOCKADDR_INET NextHop
Definition: netioapi.h:205
NET_IFINDEX InterfaceIndex
Definition: netioapi.h:203
IP_ADDRESS_PREFIX DestinationPrefix
Definition: netioapi.h:204
MIB_IPFORWARD_ROW2 Table[ANY_SIZE]
Definition: netioapi.h:222
SOCKADDR_INET Address
Definition: netioapi.h:160
MIB_UNICASTIPADDRESS_ROW Table[1]
Definition: netioapi.h:177
struct in_addr sin_addr
Definition: winsock.h:506
SOCKADDR_IN Ipv4
Definition: ws2ipdef.h:218
IPHLPAPI_DLL_LINKAGE DWORD WINAPI GetUnicastIpAddressTable(ADDRESS_FAMILY, MIB_UNICASTIPADDRESS_TABLE **)
IPHLPAPI_DLL_LINKAGE DWORD WINAPI ConvertLengthToIpv4Mask(ULONG, ULONG *)

Referenced by testWinNT4Functions().

◆ testGetIpNetTable()

static void testGetIpNetTable ( void  )
static

Definition at line 482 of file iphlpapi.c.

483{
484 DWORD apiReturn, ret, prev_idx;
485 BOOL igmp3_found, ssdp_found;
486 DWORD igmp3_addr, ssdp_addr;
487 MIB_IPNET_TABLE2 *table2;
488 ULONG dwSize = 0;
489 unsigned int i;
490#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
491 if (!GetIpNetTable2)
492 skip("Missing APIs!\n");
493#endif
494
495 igmp3_addr = ipv4_addr( 224, 0, 0, 22 );
496 ssdp_addr = ipv4_addr( 239, 255, 255, 250 );
497
498 apiReturn = GetIpNetTable(NULL, NULL, FALSE);
499 if (apiReturn == ERROR_NOT_SUPPORTED) {
500 skip("GetIpNetTable is not supported\n");
501 return;
502 }
503 ok(apiReturn == ERROR_INVALID_PARAMETER,
504 "GetIpNetTable(NULL, NULL, FALSE) returned %ld, expected ERROR_INVALID_PARAMETER\n",
505 apiReturn);
506 apiReturn = GetIpNetTable(NULL, &dwSize, FALSE);
507 ok(apiReturn == ERROR_NO_DATA || apiReturn == ERROR_INSUFFICIENT_BUFFER,
508 "GetIpNetTable(NULL, &dwSize, FALSE) returned %ld, expected ERROR_NO_DATA or ERROR_INSUFFICIENT_BUFFER\n",
509 apiReturn);
510 if (apiReturn == ERROR_NO_DATA)
511 ; /* empty ARP table's okay */
512 else if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
514
515 memset(buf, 0xcc, dwSize);
516 apiReturn = GetIpNetTable(buf, &dwSize, TRUE);
517 ok((apiReturn == NO_ERROR && buf->dwNumEntries) || (apiReturn == ERROR_NO_DATA && !buf->dwNumEntries),
518 "got apiReturn %lu, dwSize %lu, buf->dwNumEntries %lu.\n",
519 apiReturn, dwSize, buf->dwNumEntries);
520
521 if (apiReturn == NO_ERROR)
522 {
523 for (i = 0; i < buf->dwNumEntries - 1; ++i)
524 {
525 ok( buf->table[i].dwIndex <= buf->table[i + 1].dwIndex,
526 "Entries are not sorted by index, i %u.\n", i );
527 if (buf->table[i].dwIndex == buf->table[i + 1].dwIndex)
528 ok(ntohl(buf->table[i].dwAddr) <= ntohl(buf->table[i + 1].dwAddr),
529 "Entries are not sorted by address, i %u.\n", i );
530 }
531
532 igmp3_found = ssdp_found = FALSE;
533 prev_idx = ~0u;
534 for (i = 0; i < buf->dwNumEntries; ++i)
535 {
536 if (buf->table[i].dwIndex != prev_idx)
537 {
538 if (prev_idx != ~0u)
539 {
540 ok( igmp3_found, "%s not found, iface index %lu.\n", ntoa( igmp3_addr ), prev_idx);
541 ok( ssdp_found || broken(!ssdp_found) /* 239.255.255.250 is always present since Win10 */,
542 "%s not found.\n", ntoa( ssdp_addr ));
543 }
544 prev_idx = buf->table[i].dwIndex;
545 igmp3_found = ssdp_found = FALSE;
546 }
547 if (buf->table[i].dwAddr == igmp3_addr)
548 igmp3_found = TRUE;
549 else if (buf->table[i].dwAddr == ssdp_addr)
550 ssdp_found = TRUE;
551 }
552#if defined(__REACTOS__)
553 if (LOBYTE(LOWORD(GetVersion())) >= 6)
554#endif
555 ok( igmp3_found, "%s not found.\n", ntoa( igmp3_addr ));
556 ok( ssdp_found || broken(!ssdp_found) /* 239.255.255.250 is always present since Win10 */,
557 "%s not found.\n", ntoa( ssdp_addr ));
558
559#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
560 if(GetIpNetTable2) {
561#endif
562 ret = GetIpNetTable2( AF_INET, &table2 );
563 ok( !ret, "got ret %lu.\n", ret );
564 for (i = 0; i < table2->NumEntries; ++i)
565 {
566 MIB_IPNET_ROW2 *row = &table2->Table[i];
567 if (row->Address.Ipv4.sin_addr.s_addr == igmp3_addr
568 || row->Address.Ipv4.sin_addr.s_addr == ssdp_addr)
569 {
570 ok( row->State == NlnsPermanent, "got state %d.\n", row->State );
571 ok( !row->IsRouter, "IsRouter is set.\n" );
572 ok( !row->IsUnreachable, "IsUnreachable is set.\n" );
573 }
574 }
575 FreeMibTable( table2 );
576#if defined(__REACTOS__) && (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA)
577 }
578#endif
579 }
580
581 if (apiReturn == NO_ERROR && winetest_debug > 1)
582 {
583 DWORD i, j;
584
585 trace( "IP net table: %lu entries\n", buf->dwNumEntries );
586 for (i = 0; i < buf->dwNumEntries; i++)
587 {
588 trace( "%lu: idx %lu type %lu addr %s phys",
589 i, buf->table[i].dwIndex, buf->table[i].dwType, ntoa( buf->table[i].dwAddr ));
590 for (j = 0; j < buf->table[i].dwPhysAddrLen; j++)
591 printf( " %02x", buf->table[i].bPhysAddr[j] );
592 printf( "\n" );
593 }
594 }
595 free(buf);
596 }
597}
#define printf
Definition: freeldr.h:97
static DWORD ipv4_addr(BYTE b1, BYTE b2, BYTE b3, BYTE b4)
Definition: iphlpapi.c:207
DWORD WINAPI GetIpNetTable(PMIB_IPNETTABLE pIpNetTable, PULONG pdwSize, BOOL bOrder)
#define ntohl(x)
Definition: module.h:205
@ NlnsPermanent
Definition: nldef.h:114
MIB_IPNET_ROW2 Table[ANY_SIZE]
Definition: netioapi.h:254

Referenced by testWinNT4Functions().

◆ testGetIpStatistics()

static void testGetIpStatistics ( void  )
static

Definition at line 641 of file iphlpapi.c.

642{
643 DWORD apiReturn;
644 MIB_IPSTATS stats;
645
646 apiReturn = GetIpStatistics(NULL);
647 if (apiReturn == ERROR_NOT_SUPPORTED) {
648 skip("GetIpStatistics is not supported\n");
649 return;
650 }
651 ok(apiReturn == ERROR_INVALID_PARAMETER,
652 "GetIpStatistics(NULL) returned %ld, expected ERROR_INVALID_PARAMETER\n",
653 apiReturn);
654 apiReturn = GetIpStatistics(&stats);
655 ok(apiReturn == NO_ERROR,
656 "GetIpStatistics returned %ld, expected NO_ERROR\n", apiReturn);
657 if (apiReturn == NO_ERROR && winetest_debug > 1)
658 {
659 trace( "IP stats:\n" );
660 trace( " dwForwarding: %lu\n", stats.dwForwarding );
661 trace( " dwDefaultTTL: %lu\n", stats.dwDefaultTTL );
662 trace( " dwInReceives: %lu\n", stats.dwInReceives );
663 trace( " dwInHdrErrors: %lu\n", stats.dwInHdrErrors );
664 trace( " dwInAddrErrors: %lu\n", stats.dwInAddrErrors );
665 trace( " dwForwDatagrams: %lu\n", stats.dwForwDatagrams );
666 trace( " dwInUnknownProtos: %lu\n", stats.dwInUnknownProtos );
667 trace( " dwInDiscards: %lu\n", stats.dwInDiscards );
668 trace( " dwInDelivers: %lu\n", stats.dwInDelivers );
669 trace( " dwOutRequests: %lu\n", stats.dwOutRequests );
670 trace( " dwRoutingDiscards: %lu\n", stats.dwRoutingDiscards );
671 trace( " dwOutDiscards: %lu\n", stats.dwOutDiscards );
672 trace( " dwOutNoRoutes: %lu\n", stats.dwOutNoRoutes );
673 trace( " dwReasmTimeout: %lu\n", stats.dwReasmTimeout );
674 trace( " dwReasmReqds: %lu\n", stats.dwReasmReqds );
675 trace( " dwReasmOks: %lu\n", stats.dwReasmOks );
676 trace( " dwReasmFails: %lu\n", stats.dwReasmFails );
677 trace( " dwFragOks: %lu\n", stats.dwFragOks );
678 trace( " dwFragFails: %lu\n", stats.dwFragFails );
679 trace( " dwFragCreates: %lu\n", stats.dwFragCreates );
680 trace( " dwNumIf: %lu\n", stats.dwNumIf );
681 trace( " dwNumAddr: %lu\n", stats.dwNumAddr );
682 trace( " dwNumRoutes: %lu\n", stats.dwNumRoutes );
683 }
684}
DWORD WINAPI GetIpStatistics(PMIB_IPSTATS pStats)
DWORD dwInReceives
Definition: ipmib.h:148
DWORD dwInAddrErrors
Definition: ipmib.h:150
DWORD dwFragOks
Definition: ipmib.h:163
DWORD dwReasmOks
Definition: ipmib.h:161
DWORD dwOutNoRoutes
Definition: ipmib.h:158
DWORD dwNumIf
Definition: ipmib.h:166
DWORD dwInDelivers
Definition: ipmib.h:154
DWORD dwRoutingDiscards
Definition: ipmib.h:156
DWORD dwReasmReqds
Definition: ipmib.h:160
DWORD dwOutDiscards
Definition: ipmib.h:157
DWORD dwInHdrErrors
Definition: ipmib.h:149
DWORD dwDefaultTTL
Definition: ipmib.h:147
DWORD dwForwDatagrams
Definition: ipmib.h:151
DWORD dwNumAddr
Definition: ipmib.h:167
DWORD dwReasmTimeout
Definition: ipmib.h:159
DWORD dwInDiscards
Definition: ipmib.h:153
DWORD dwNumRoutes
Definition: ipmib.h:168
DWORD dwOutRequests
Definition: ipmib.h:155
DWORD dwFragCreates
Definition: ipmib.h:165
DWORD dwInUnknownProtos
Definition: ipmib.h:152
DWORD dwForwarding
Definition: ipmib.h:144
DWORD dwReasmFails
Definition: ipmib.h:162
DWORD dwFragFails
Definition: ipmib.h:164

Referenced by testWinNT4Functions().

◆ testGetIpStatisticsEx()

static void testGetIpStatisticsEx ( void  )
static

Definition at line 792 of file iphlpapi.c.

793{
794 DWORD apiReturn;
795 MIB_IPSTATS stats;
796
797 apiReturn = GetIpStatisticsEx(NULL, AF_INET);
798 ok(apiReturn == ERROR_INVALID_PARAMETER,
799 "GetIpStatisticsEx(NULL, AF_INET) returned %ld, expected ERROR_INVALID_PARAMETER\n", apiReturn);
800
801 apiReturn = GetIpStatisticsEx(&stats, AF_BAN);
802 ok(apiReturn == ERROR_INVALID_PARAMETER,
803 "GetIpStatisticsEx(&stats, AF_BAN) returned %ld, expected ERROR_INVALID_PARAMETER\n", apiReturn);
804
805 apiReturn = GetIpStatisticsEx(&stats, AF_INET);
806 ok(apiReturn == NO_ERROR, "GetIpStatisticsEx returned %ld, expected NO_ERROR\n", apiReturn);
807 if (apiReturn == NO_ERROR && winetest_debug > 1)
808 {
809 trace( "IP IPv4 Ex stats:\n" );
810 trace( " dwForwarding: %lu\n", stats.dwForwarding );
811 trace( " dwDefaultTTL: %lu\n", stats.dwDefaultTTL );
812 trace( " dwInReceives: %lu\n", stats.dwInReceives );
813 trace( " dwInHdrErrors: %lu\n", stats.dwInHdrErrors );
814 trace( " dwInAddrErrors: %lu\n", stats.dwInAddrErrors );
815 trace( " dwForwDatagrams: %lu\n", stats.dwForwDatagrams );
816 trace( " dwInUnknownProtos: %lu\n", stats.dwInUnknownProtos );
817 trace( " dwInDiscards: %lu\n", stats.dwInDiscards );
818 trace( " dwInDelivers: %lu\n", stats.dwInDelivers );
819 trace( " dwOutRequests: %lu\n", stats.dwOutRequests );
820 trace( " dwRoutingDiscards: %lu\n", stats.dwRoutingDiscards );
821 trace( " dwOutDiscards: %lu\n", stats.dwOutDiscards );
822 trace( " dwOutNoRoutes: %lu\n", stats.dwOutNoRoutes );
823 trace( " dwReasmTimeout: %lu\n", stats.dwReasmTimeout );
824 trace( " dwReasmReqds: %lu\n", stats.dwReasmReqds );
825 trace( " dwReasmOks: %lu\n", stats.dwReasmOks );
826 trace( " dwReasmFails: %lu\n", stats.dwReasmFails );
827 trace( " dwFragOks: %lu\n", stats.dwFragOks );
828 trace( " dwFragFails: %lu\n", stats.dwFragFails );
829 trace( " dwFragCreates: %lu\n", stats.dwFragCreates );
830 trace( " dwNumIf: %lu\n", stats.dwNumIf );
831 trace( " dwNumAddr: %lu\n", stats.dwNumAddr );
832 trace( " dwNumRoutes: %lu\n", stats.dwNumRoutes );
833 }
834
835 apiReturn = GetIpStatisticsEx(&stats, AF_INET6);
836 ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
837 "GetIpStatisticsEx returned %ld, expected NO_ERROR\n", apiReturn);
838 if (apiReturn == NO_ERROR && winetest_debug > 1)
839 {
840 trace( "IP IPv6 Ex stats:\n" );
841 trace( " dwForwarding: %lu\n", stats.dwForwarding );
842 trace( " dwDefaultTTL: %lu\n", stats.dwDefaultTTL );
843 trace( " dwInReceives: %lu\n", stats.dwInReceives );
844 trace( " dwInHdrErrors: %lu\n", stats.dwInHdrErrors );
845 trace( " dwInAddrErrors: %lu\n", stats.dwInAddrErrors );
846 trace( " dwForwDatagrams: %lu\n", stats.dwForwDatagrams );
847 trace( " dwInUnknownProtos: %lu\n", stats.dwInUnknownProtos );
848 trace( " dwInDiscards: %lu\n", stats.dwInDiscards );
849 trace( " dwInDelivers: %lu\n", stats.dwInDelivers );
850 trace( " dwOutRequests: %lu\n", stats.dwOutRequests );
851 trace( " dwRoutingDiscards: %lu\n", stats.dwRoutingDiscards );
852 trace( " dwOutDiscards: %lu\n", stats.dwOutDiscards );
853 trace( " dwOutNoRoutes: %lu\n", stats.dwOutNoRoutes );
854 trace( " dwReasmTimeout: %lu\n", stats.dwReasmTimeout );
855 trace( " dwReasmReqds: %lu\n", stats.dwReasmReqds );
856 trace( " dwReasmOks: %lu\n", stats.dwReasmOks );
857 trace( " dwReasmFails: %lu\n", stats.dwReasmFails );
858 trace( " dwFragOks: %lu\n", stats.dwFragOks );
859 trace( " dwFragFails: %lu\n", stats.dwFragFails );
860 trace( " dwFragCreates: %lu\n", stats.dwFragCreates );
861 trace( " dwNumIf: %lu\n", stats.dwNumIf );
862 trace( " dwNumAddr: %lu\n", stats.dwNumAddr );
863 trace( " dwNumRoutes: %lu\n", stats.dwNumRoutes );
864 }
865}
DWORD WINAPI GetIpStatisticsEx(PMIB_IPSTATS pStats, DWORD dwFamily)

Referenced by testWinNT4Functions().

◆ testGetNetworkParams()

static void testGetNetworkParams ( void  )
static

Definition at line 1660 of file iphlpapi.c.

1661{
1662 DWORD apiReturn;
1663 ULONG len = 0;
1664
1665 apiReturn = GetNetworkParams(NULL, NULL);
1666 if (apiReturn == ERROR_NOT_SUPPORTED) {
1667 skip("GetNetworkParams is not supported\n");
1668 return;
1669 }
1670 ok(apiReturn == ERROR_INVALID_PARAMETER,
1671 "GetNetworkParams returned %ld, expected ERROR_INVALID_PARAMETER\n",
1672 apiReturn);
1673 apiReturn = GetNetworkParams(NULL, &len);
1674 ok(apiReturn == ERROR_BUFFER_OVERFLOW,
1675 "GetNetworkParams returned %ld, expected ERROR_BUFFER_OVERFLOW\n",
1676 apiReturn);
1677 if (apiReturn == ERROR_BUFFER_OVERFLOW) {
1679
1680 apiReturn = GetNetworkParams(buf, &len);
1681 ok(apiReturn == NO_ERROR,
1682 "GetNetworkParams(buf, &dwSize) returned %ld, expected NO_ERROR\n",
1683 apiReturn);
1684 free(buf);
1685 }
1686}
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)

Referenced by testWin98Functions().

◆ testGetNumberOfInterfaces()

static void testGetNumberOfInterfaces ( void  )
static

Definition at line 220 of file iphlpapi.c.

221{
222 DWORD apiReturn, numInterfaces;
223
224 /* Crashes on Vista */
225 if (0) {
226 apiReturn = GetNumberOfInterfaces(NULL);
227 if (apiReturn == ERROR_NOT_SUPPORTED)
228 return;
229 ok(apiReturn == ERROR_INVALID_PARAMETER,
230 "GetNumberOfInterfaces(NULL) returned %ld, expected ERROR_INVALID_PARAMETER\n",
231 apiReturn);
232 }
233
234 apiReturn = GetNumberOfInterfaces(&numInterfaces);
235 ok(apiReturn == NO_ERROR,
236 "GetNumberOfInterfaces returned %ld, expected 0\n", apiReturn);
237}
DWORD WINAPI GetNumberOfInterfaces(PDWORD pdwNumIf)

Referenced by testWinNT4Functions().

◆ testGetPerAdapterInfo()

static void testGetPerAdapterInfo ( void  )
static

Definition at line 1808 of file iphlpapi.c.

1809{
1810 DWORD ret, needed;
1811 void *buffer;
1812
1814 ok( ret == ERROR_INVALID_PARAMETER, "got %lu instead of ERROR_INVALID_PARAMETER\n", ret );
1815 needed = 0xdeadbeef;
1816 ret = GetPerAdapterInfo(1, NULL, &needed);
1817 if (ret == ERROR_NO_DATA) return; /* no such adapter */
1818 ok( ret == ERROR_BUFFER_OVERFLOW, "got %lu instead of ERROR_BUFFER_OVERFLOW\n", ret );
1819 ok( needed != 0xdeadbeef, "needed not set\n" );
1820 buffer = malloc( needed );
1821 ret = GetPerAdapterInfo(1, buffer, &needed);
1822 ok( ret == NO_ERROR, "got %lu instead of NO_ERROR\n", ret );
1823 free( buffer );
1824}
GLuint buffer
Definition: glext.h:5915
DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen)

Referenced by testWin2KFunctions().

◆ testGetTcpStatistics()

static void testGetTcpStatistics ( void  )
static

Definition at line 686 of file iphlpapi.c.

687{
688 DWORD apiReturn;
689 MIB_TCPSTATS stats;
690
691 apiReturn = GetTcpStatistics(NULL);
692 if (apiReturn == ERROR_NOT_SUPPORTED) {
693 skip("GetTcpStatistics is not supported\n");
694 return;
695 }
696 ok(apiReturn == ERROR_INVALID_PARAMETER,
697 "GetTcpStatistics(NULL) returned %ld, expected ERROR_INVALID_PARAMETER\n",
698 apiReturn);
699 apiReturn = GetTcpStatistics(&stats);
700 ok(apiReturn == NO_ERROR,
701 "GetTcpStatistics returned %ld, expected NO_ERROR\n", apiReturn);
702 if (apiReturn == NO_ERROR && winetest_debug > 1)
703 {
704 trace( "TCP stats:\n" );
705 trace( " dwRtoAlgorithm: %lu\n", stats.dwRtoAlgorithm );
706 trace( " dwRtoMin: %lu\n", stats.dwRtoMin );
707 trace( " dwRtoMax: %lu\n", stats.dwRtoMax );
708 trace( " dwMaxConn: %lu\n", stats.dwMaxConn );
709 trace( " dwActiveOpens: %lu\n", stats.dwActiveOpens );
710 trace( " dwPassiveOpens: %lu\n", stats.dwPassiveOpens );
711 trace( " dwAttemptFails: %lu\n", stats.dwAttemptFails );
712 trace( " dwEstabResets: %lu\n", stats.dwEstabResets );
713 trace( " dwCurrEstab: %lu\n", stats.dwCurrEstab );
714 trace( " dwInSegs: %lu\n", stats.dwInSegs );
715 trace( " dwOutSegs: %lu\n", stats.dwOutSegs );
716 trace( " dwRetransSegs: %lu\n", stats.dwRetransSegs );
717 trace( " dwInErrs: %lu\n", stats.dwInErrs );
718 trace( " dwOutRsts: %lu\n", stats.dwOutRsts );
719 trace( " dwNumConns: %lu\n", stats.dwNumConns );
720 }
721}
DWORD WINAPI GetTcpStatistics(PMIB_TCPSTATS pStats)
DWORD dwRtoMax
Definition: tcpmib.h:130
DWORD dwMaxConn
Definition: tcpmib.h:131
DWORD dwPassiveOpens
Definition: tcpmib.h:133
DWORD dwActiveOpens
Definition: tcpmib.h:132
DWORD dwInErrs
Definition: tcpmib.h:140
DWORD dwRetransSegs
Definition: tcpmib.h:139
DWORD dwInSegs
Definition: tcpmib.h:137
DWORD dwRtoMin
Definition: tcpmib.h:129
DWORD dwRtoAlgorithm
Definition: tcpmib.h:126
DWORD dwOutSegs
Definition: tcpmib.h:138
DWORD dwEstabResets
Definition: tcpmib.h:135
DWORD dwOutRsts
Definition: tcpmib.h:141
DWORD dwCurrEstab
Definition: tcpmib.h:136
DWORD dwNumConns
Definition: tcpmib.h:142
DWORD dwAttemptFails
Definition: tcpmib.h:134

Referenced by testWinNT4Functions().

◆ testGetTcpStatisticsEx()

static void testGetTcpStatisticsEx ( void  )
static

Definition at line 867 of file iphlpapi.c.

868{
869 DWORD apiReturn;
870 MIB_TCPSTATS stats;
871
872 apiReturn = GetTcpStatisticsEx(NULL, AF_INET);
873 ok(apiReturn == ERROR_INVALID_PARAMETER,
874 "GetTcpStatisticsEx(NULL, AF_INET); returned %ld, expected ERROR_INVALID_PARAMETER\n", apiReturn);
875
876 apiReturn = GetTcpStatisticsEx(&stats, AF_BAN);
877 ok(apiReturn == ERROR_INVALID_PARAMETER || apiReturn == ERROR_NOT_SUPPORTED,
878 "GetTcpStatisticsEx(&stats, AF_BAN) returned %ld, expected ERROR_INVALID_PARAMETER\n", apiReturn);
879
880 apiReturn = GetTcpStatisticsEx(&stats, AF_INET);
881 ok(apiReturn == NO_ERROR, "GetTcpStatisticsEx returned %ld, expected NO_ERROR\n", apiReturn);
882 if (apiReturn == NO_ERROR && winetest_debug > 1)
883 {
884 trace( "TCP IPv4 Ex stats:\n" );
885 trace( " dwRtoAlgorithm: %lu\n", stats.dwRtoAlgorithm );
886 trace( " dwRtoMin: %lu\n", stats.dwRtoMin );
887 trace( " dwRtoMax: %lu\n", stats.dwRtoMax );
888 trace( " dwMaxConn: %lu\n", stats.dwMaxConn );
889 trace( " dwActiveOpens: %lu\n", stats.dwActiveOpens );
890 trace( " dwPassiveOpens: %lu\n", stats.dwPassiveOpens );
891 trace( " dwAttemptFails: %lu\n", stats.dwAttemptFails );
892 trace( " dwEstabResets: %lu\n", stats.dwEstabResets );
893 trace( " dwCurrEstab: %lu\n", stats.dwCurrEstab );
894 trace( " dwInSegs: %lu\n", stats.dwInSegs );
895 trace( " dwOutSegs: %lu\n", stats.dwOutSegs );
896 trace( " dwRetransSegs: %lu\n", stats.dwRetransSegs );
897 trace( " dwInErrs: %lu\n", stats.dwInErrs );
898 trace( " dwOutRsts: %lu\n", stats.dwOutRsts );
899 trace( " dwNumConns: %lu\n", stats.dwNumConns );
900 }
901
902 apiReturn = GetTcpStatisticsEx(&stats, AF_INET6);
903 ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
904 "GetTcpStatisticsEx returned %ld, expected NO_ERROR\n", apiReturn);
905 if (apiReturn == NO_ERROR && winetest_debug > 1)
906 {
907 trace( "TCP IPv6 Ex stats:\n" );
908 trace( " dwRtoAlgorithm: %lu\n", stats.dwRtoAlgorithm );
909 trace( " dwRtoMin: %lu\n", stats.dwRtoMin );
910 trace( " dwRtoMax: %lu\n", stats.dwRtoMax );
911 trace( " dwMaxConn: %lu\n", stats.dwMaxConn );
912 trace( " dwActiveOpens: %lu\n", stats.dwActiveOpens );
913 trace( " dwPassiveOpens: %lu\n", stats.dwPassiveOpens );
914 trace( " dwAttemptFails: %lu\n", stats.dwAttemptFails );
915 trace( " dwEstabResets: %lu\n", stats.dwEstabResets );
916 trace( " dwCurrEstab: %lu\n", stats.dwCurrEstab );
917 trace( " dwInSegs: %lu\n", stats.dwInSegs );
918 trace( " dwOutSegs: %lu\n", stats.dwOutSegs );
919 trace( " dwRetransSegs: %lu\n", stats.dwRetransSegs );
920 trace( " dwInErrs: %lu\n", stats.dwInErrs );
921 trace( " dwOutRsts: %lu\n", stats.dwOutRsts );
922 trace( " dwNumConns: %lu\n", stats.dwNumConns );
923 }
924}
DWORD WINAPI GetTcpStatisticsEx(PMIB_TCPSTATS pStats, DWORD dwFamily)

Referenced by testWinNT4Functions().

◆ testGetTcpTable()

static void testGetTcpTable ( void  )
static

Definition at line 965 of file iphlpapi.c.

966{
967 DWORD apiReturn;
968 ULONG dwSize = 0;
969
970 apiReturn = GetTcpTable(NULL, &dwSize, FALSE);
971 if (apiReturn == ERROR_NOT_SUPPORTED) {
972 skip("GetTcpTable is not supported\n");
973 return;
974 }
975 ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
976 "GetTcpTable(NULL, &dwSize, FALSE) returned %ld, expected ERROR_INSUFFICIENT_BUFFER\n",
977 apiReturn);
978 if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
980
981 apiReturn = GetTcpTable(buf, &dwSize, FALSE);
982 ok(apiReturn == NO_ERROR,
983 "GetTcpTable(buf, &dwSize, FALSE) returned %ld, expected NO_ERROR\n",
984 apiReturn);
985
986 if (apiReturn == NO_ERROR && winetest_debug > 1)
987 {
988 DWORD i;
989 trace( "TCP table: %lu entries\n", buf->dwNumEntries );
990 for (i = 0; i < buf->dwNumEntries; i++)
991 {
992 trace( "%lu: local %s:%u remote %s:%u state %lu\n", i,
993 ntoa(buf->table[i].dwLocalAddr), ntohs(buf->table[i].dwLocalPort),
994 ntoa(buf->table[i].dwRemoteAddr), ntohs(buf->table[i].dwRemotePort),
995 buf->table[i].dwState );
996 }
997 }
998 free(buf);
999 }
1000}
DWORD WINAPI GetTcpTable(PMIB_TCPTABLE pTcpTable, PDWORD pdwSize, BOOL bOrder)

Referenced by testWinNT4Functions().

◆ testGetUdpStatistics()

static void testGetUdpStatistics ( void  )
static

Definition at line 723 of file iphlpapi.c.

724{
725 DWORD apiReturn;
726 MIB_UDPSTATS stats;
727
728 apiReturn = GetUdpStatistics(NULL);
729 if (apiReturn == ERROR_NOT_SUPPORTED) {
730 skip("GetUdpStatistics is not supported\n");
731 return;
732 }
733 ok(apiReturn == ERROR_INVALID_PARAMETER,
734 "GetUdpStatistics(NULL) returned %ld, expected ERROR_INVALID_PARAMETER\n",
735 apiReturn);
736 apiReturn = GetUdpStatistics(&stats);
737 ok(apiReturn == NO_ERROR,
738 "GetUdpStatistics returned %ld, expected NO_ERROR\n", apiReturn);
739 if (apiReturn == NO_ERROR && winetest_debug > 1)
740 {
741 trace( "UDP stats:\n" );
742 trace( " dwInDatagrams: %lu\n", stats.dwInDatagrams );
743 trace( " dwNoPorts: %lu\n", stats.dwNoPorts );
744 trace( " dwInErrors: %lu\n", stats.dwInErrors );
745 trace( " dwOutDatagrams: %lu\n", stats.dwOutDatagrams );
746 trace( " dwNumAddrs: %lu\n", stats.dwNumAddrs );
747 }
748}
DWORD WINAPI GetUdpStatistics(PMIB_UDPSTATS pStats)
DWORD dwOutDatagrams
Definition: udpmib.h:91
DWORD dwInDatagrams
Definition: udpmib.h:88
DWORD dwNoPorts
Definition: udpmib.h:89
DWORD dwNumAddrs
Definition: udpmib.h:92
DWORD dwInErrors
Definition: udpmib.h:90

Referenced by testWinNT4Functions().

◆ testGetUdpStatisticsEx()

static void testGetUdpStatisticsEx ( void  )
static

Definition at line 926 of file iphlpapi.c.

927{
928 DWORD apiReturn;
929 MIB_UDPSTATS stats;
930
931 apiReturn = GetUdpStatisticsEx(NULL, AF_INET);
932 ok(apiReturn == ERROR_INVALID_PARAMETER,
933 "GetUdpStatisticsEx(NULL, AF_INET); returned %ld, expected ERROR_INVALID_PARAMETER\n", apiReturn);
934
935 apiReturn = GetUdpStatisticsEx(&stats, AF_BAN);
936 ok(apiReturn == ERROR_INVALID_PARAMETER || apiReturn == ERROR_NOT_SUPPORTED,
937 "GetUdpStatisticsEx(&stats, AF_BAN) returned %ld, expected ERROR_INVALID_PARAMETER\n", apiReturn);
938
939 apiReturn = GetUdpStatisticsEx(&stats, AF_INET);
940 ok(apiReturn == NO_ERROR, "GetUdpStatisticsEx returned %ld, expected NO_ERROR\n", apiReturn);
941 if (apiReturn == NO_ERROR && winetest_debug > 1)
942 {
943 trace( "UDP IPv4 Ex stats:\n" );
944 trace( " dwInDatagrams: %lu\n", stats.dwInDatagrams );
945 trace( " dwNoPorts: %lu\n", stats.dwNoPorts );
946 trace( " dwInErrors: %lu\n", stats.dwInErrors );
947 trace( " dwOutDatagrams: %lu\n", stats.dwOutDatagrams );
948 trace( " dwNumAddrs: %lu\n", stats.dwNumAddrs );
949 }
950
951 apiReturn = GetUdpStatisticsEx(&stats, AF_INET6);
952 ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
953 "GetUdpStatisticsEx returned %ld, expected NO_ERROR\n", apiReturn);
954 if (apiReturn == NO_ERROR && winetest_debug > 1)
955 {
956 trace( "UDP IPv6 Ex stats:\n" );
957 trace( " dwInDatagrams: %lu\n", stats.dwInDatagrams );
958 trace( " dwNoPorts: %lu\n", stats.dwNoPorts );
959 trace( " dwInErrors: %lu\n", stats.dwInErrors );
960 trace( " dwOutDatagrams: %lu\n", stats.dwOutDatagrams );
961 trace( " dwNumAddrs: %lu\n", stats.dwNumAddrs );
962 }
963}
DWORD WINAPI GetUdpStatisticsEx(PMIB_UDPSTATS pStats, DWORD dwFamily)

Referenced by testWinNT4Functions().

◆ testGetUdpTable()

static void testGetUdpTable ( void  )
static

Definition at line 1002 of file iphlpapi.c.

1003{
1004 DWORD apiReturn;
1005 ULONG dwSize = 0;
1006
1007 apiReturn = GetUdpTable(NULL, &dwSize, FALSE);
1008 if (apiReturn == ERROR_NOT_SUPPORTED) {
1009 skip("GetUdpTable is not supported\n");
1010 return;
1011 }
1012 ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
1013 "GetUdpTable(NULL, &dwSize, FALSE) returned %ld, expected ERROR_INSUFFICIENT_BUFFER\n",
1014 apiReturn);
1015 if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
1017
1018 apiReturn = GetUdpTable(buf, &dwSize, FALSE);
1019 ok(apiReturn == NO_ERROR,
1020 "GetUdpTable(buf, &dwSize, FALSE) returned %ld, expected NO_ERROR\n",
1021 apiReturn);
1022
1023 if (apiReturn == NO_ERROR && winetest_debug > 1)
1024 {
1025 DWORD i;
1026 trace( "UDP table: %lu entries\n", buf->dwNumEntries );
1027 for (i = 0; i < buf->dwNumEntries; i++)
1028 trace( "%lu: %s:%u\n",
1029 i, ntoa( buf->table[i].dwLocalAddr ), ntohs(buf->table[i].dwLocalPort) );
1030 }
1031 free(buf);
1032 }
1033}
DWORD WINAPI GetUdpTable(PMIB_UDPTABLE pUdpTable, PDWORD pdwSize, BOOL bOrder)

Referenced by testWinNT4Functions().

◆ testIcmpParseReplies()

static void testIcmpParseReplies ( void  )
static

Definition at line 1500 of file iphlpapi.c.

1501{
1502 ICMP_ECHO_REPLY reply = { 0 };
1503 DWORD ret;
1504
1505 SetLastError( 0xdeadbeef );
1506 ret = IcmpParseReplies( &reply, sizeof(reply) );
1507 ok( ret == 0, "ret %ld\n", ret );
1508 ok( GetLastError() == 0, "gle %ld\n", GetLastError() );
1509
1510 reply.Status = 12345;
1511 SetLastError( 0xdeadbeef );
1512 ret = IcmpParseReplies( &reply, sizeof(reply) );
1513 ok( ret == 0, "ret %ld\n", ret );
1514 ok( GetLastError() == 12345, "gle %ld\n", GetLastError() );
1515 ok( reply.Status == 12345, "status %ld\n", reply.Status );
1516
1517 reply.Reserved = 1;
1518 SetLastError( 0xdeadbeef );
1519 ret = IcmpParseReplies( &reply, sizeof(reply) );
1520 ok( ret == 1, "ret %ld\n", ret );
1521 ok( GetLastError() == 0xdeadbeef, "gle %ld\n", GetLastError() );
1522 ok( reply.Status == 12345, "status %ld\n", reply.Status );
1523 ok( !reply.Reserved, "reserved %d\n", reply.Reserved );
1524
1525#if defined(__REACTOS__) && defined(_MSC_VER)
1526 /* This crashes on WS03 when compiled with MSVC. It does work on ReactOS. */
1527 if (LOBYTE(LOWORD(GetVersion())) >= 6) {
1528#endif
1529 reply.Reserved = 3;
1530 SetLastError( 0xdeadbeef );
1531 ret = IcmpParseReplies( &reply, sizeof(reply) );
1532 ok( ret == 3, "ret %ld\n", ret );
1533 ok( GetLastError() == 0xdeadbeef, "gle %ld\n", GetLastError() );
1534 ok( reply.Status == 12345, "status %ld\n", reply.Status );
1535 ok( !reply.Reserved, "reserved %d\n", reply.Reserved );
1536#if defined(__REACTOS__) && defined(_MSC_VER)
1537 }
1538#endif
1539}
#define SetLastError(x)
Definition: compat.h:752
DWORD WINAPI IcmpParseReplies(_In_ LPVOID ReplyBuffer, _In_ DWORD ReplySize)
Definition: icmp.c:258
UINT32 Status
Definition: ipexport.h:85
UINT16 Reserved
Definition: ipexport.h:88
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

Referenced by testWinNT4Functions().

◆ testIcmpSendEcho()

static void testIcmpSendEcho ( void  )
static

Definition at line 1077 of file iphlpapi.c.

1078{
1079 /* The APC's signature is different pre-Vista */
1083 HANDLE icmp;
1084 char senddata[32], replydata[sizeof(senddata) + sizeof(ICMP_ECHO_REPLY)];
1085 char replydata2[sizeof(replydata) + sizeof(IO_STATUS_BLOCK)];
1086 DWORD ret, error, replysz = sizeof(replydata);
1088 ICMP_ECHO_REPLY *reply;
1089 HANDLE event;
1090 INT i;
1091
1092 memset(senddata, 0, sizeof(senddata));
1093
1095 SetLastError(0xdeadbeef);
1096 ret = IcmpSendEcho(INVALID_HANDLE_VALUE, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
1097 error = GetLastError();
1098 ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
1100 || broken(error == ERROR_INVALID_HANDLE) /* <= 2003 */,
1101 "expected 87, got %ld\n", error);
1102
1104 SetLastError(0xdeadbeef);
1105 ret = IcmpSendEcho2(INVALID_HANDLE_VALUE, NULL, NULL, NULL, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
1106 error = GetLastError();
1107 ok (!ret, "IcmpSendEcho2 succeeded unexpectedly\n");
1109 || broken(error == ERROR_INVALID_HANDLE) /* <= 2003 */,
1110 "expected 87, got %ld\n", error);
1111
1112 icmp = IcmpCreateFile();
1113 ok (icmp != INVALID_HANDLE_VALUE, "IcmpCreateFile failed unexpectedly with error %ld\n", GetLastError());
1114
1115 address = 0;
1116 SetLastError(0xdeadbeef);
1117 ret = IcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
1118 error = GetLastError();
1119 ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
1121 || broken(error == IP_BAD_DESTINATION) /* <= 2003 */,
1122 "expected 1214, got %ld\n", error);
1123
1125 if (0) /* crashes in XP */
1126 {
1127 ret = IcmpSendEcho(icmp, address, NULL, sizeof(senddata), NULL, replydata, replysz, 1000);
1128 ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
1129 }
1130
1131 SetLastError(0xdeadbeef);
1132 ret = IcmpSendEcho(icmp, address, senddata, 0, NULL, replydata, replysz, 1000);
1133 error = GetLastError();
1134 if (!ret && error == ERROR_ACCESS_DENIED)
1135 {
1136 skip( "ICMP is not available.\n" );
1137 return;
1138 }
1139 ok (ret, "IcmpSendEcho failed unexpectedly with error %ld\n", error);
1140
1141 SetLastError(0xdeadbeef);
1142 ret = IcmpSendEcho(icmp, address, NULL, 0, NULL, replydata, replysz, 1000);
1143 error = GetLastError();
1144 ok (ret, "IcmpSendEcho failed unexpectedly with error %ld\n", error);
1145
1146 SetLastError(0xdeadbeef);
1147 ret = IcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, NULL, replysz, 1000);
1148 error = GetLastError();
1149 ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
1150 ok (error == ERROR_INVALID_PARAMETER, "expected 87, got %ld\n", error);
1151
1152 SetLastError(0xdeadbeef);
1153 ret = IcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, 0, 1000);
1154 error = GetLastError();
1155 ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
1157 || broken(error == ERROR_INSUFFICIENT_BUFFER) /* <= 2003 */,
1158 "expected 87, got %ld\n", error);
1159
1160 SetLastError(0xdeadbeef);
1161 ret = IcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, NULL, 0, 1000);
1162 error = GetLastError();
1163 ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
1165 || broken(error == ERROR_INSUFFICIENT_BUFFER) /* <= 2003 */,
1166 "expected 87, got %ld\n", error);
1167
1168 SetLastError(0xdeadbeef);
1169 replysz = sizeof(replydata) - 1;
1170 ret = IcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
1171 error = GetLastError();
1172 ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
1174 || broken(error == IP_BUF_TOO_SMALL) /* <= 2003 */,
1175 "expected 11050, got %ld\n", error);
1176
1177 SetLastError(0xdeadbeef);
1178 replysz = sizeof(ICMP_ECHO_REPLY);
1179 ret = IcmpSendEcho(icmp, address, senddata, 0, NULL, replydata, replysz, 1000);
1180 error = GetLastError();
1181 ok (ret, "IcmpSendEcho failed unexpectedly with error %ld\n", error);
1182
1183 SetLastError(0xdeadbeef);
1184 replysz = sizeof(ICMP_ECHO_REPLY) + ICMP_MINLEN;
1185 ret = IcmpSendEcho(icmp, address, senddata, ICMP_MINLEN, NULL, replydata, replysz, 1000);
1186 error = GetLastError();
1187 ok (ret, "IcmpSendEcho failed unexpectedly with error %ld\n", error);
1188
1189 SetLastError(0xdeadbeef);
1190 replysz = sizeof(ICMP_ECHO_REPLY) + ICMP_MINLEN;
1191 ret = IcmpSendEcho(icmp, address, senddata, ICMP_MINLEN + 1, NULL, replydata, replysz, 1000);
1192 error = GetLastError();
1193 ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
1195 || broken(error == IP_BUF_TOO_SMALL) /* <= 2003 */,
1196 "expected 11050, got %ld\n", error);
1197
1198 SetLastError(0xdeadbeef);
1199 ret = IcmpSendEcho(icmp, address, senddata, ICMP_MINLEN, NULL, replydata, replysz - 1, 1000);
1200 error = GetLastError();
1201 ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
1203 || broken(error == IP_BUF_TOO_SMALL) /* <= 2003 */,
1204 "expected 11050, got %ld\n", error);
1205
1206 /* in windows >= vista the timeout can't be invalid */
1207 SetLastError(0xdeadbeef);
1208 replysz = sizeof(replydata);
1209 ret = IcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 0);
1210 error = GetLastError();
1211 if (!ret) ok(error == ERROR_INVALID_PARAMETER, "expected 87, got %ld\n", error);
1212
1213 SetLastError(0xdeadbeef);
1214 ret = IcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, -1);
1215 error = GetLastError();
1216 if (!ret) ok(error == ERROR_INVALID_PARAMETER, "expected 87, got %ld\n", error);
1217
1218 /* real ping test */
1219 SetLastError(0xdeadbeef);
1221 ret = IcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
1222 error = GetLastError();
1223 if (!ret)
1224 {
1225 skip ("Failed to ping with error %ld, is lo interface down?.\n", error);
1226 }
1227 else if (winetest_debug > 1)
1228 {
1229 PICMP_ECHO_REPLY pong = (PICMP_ECHO_REPLY) replydata;
1230 trace ("send addr : %s\n", ntoa(address));
1231 trace ("reply addr : %s\n", ntoa(pong->Address));
1232 trace ("reply size : %lu\n", replysz);
1233 trace ("roundtrip : %lu ms\n", pong->RoundTripTime);
1234 trace ("status : %lu\n", pong->Status);
1235 trace ("recv size : %u\n", pong->DataSize);
1236 trace ("ttl : %u\n", pong->Options.Ttl);
1237 trace ("flags : 0x%x\n", pong->Options.Flags);
1238 }
1239
1240 /* check reply data */
1241 SetLastError(0xdeadbeef);
1243 for (i = 0; i < ARRAY_SIZE(senddata); i++) senddata[i] = i & 0xff;
1244 ret = IcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
1245 error = GetLastError();
1246 reply = (ICMP_ECHO_REPLY *)replydata;
1247 ok(ret, "IcmpSendEcho failed unexpectedly\n");
1248 ok(error == NO_ERROR, "Expect last error:0x%08x, got:0x%08lx\n", NO_ERROR, error);
1249 ok(INADDR_LOOPBACK == ntohl(reply->Address), "Address mismatch, expect:%s, got: %s\n", ntoa(INADDR_LOOPBACK),
1250 ntoa(reply->Address));
1251 ok(reply->Status == IP_SUCCESS, "Expect status:0x%08x, got:0x%08lx\n", IP_SUCCESS, reply->Status);
1252 ok(reply->DataSize == sizeof(senddata), "Got size:%d\n", reply->DataSize);
1253 ok(!memcmp(senddata, reply->Data, min(sizeof(senddata), reply->DataSize)), "Data mismatch\n");
1254
1255
1256 /*
1257 * IcmpSendEcho2
1258 */
1259 address = 0;
1260 replysz = sizeof(replydata2);
1261 memset(senddata, 0, sizeof(senddata));
1262
1263 SetLastError(0xdeadbeef);
1264 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, senddata, sizeof(senddata), NULL, replydata2, replysz, 1000);
1265 error = GetLastError();
1266 ok(!ret, "IcmpSendEcho2 succeeded unexpectedly\n");
1268 || broken(error == IP_BAD_DESTINATION) /* <= 2003 */,
1269 "expected 1214, got %ld\n", error);
1270
1271 event = CreateEventW(NULL, FALSE, FALSE, NULL);
1272 ok(event != NULL, "CreateEventW failed unexpectedly with error %ld\n", GetLastError());
1273
1274 SetLastError(0xdeadbeef);
1275 ret = IcmpSendEcho2(icmp, event, NULL, NULL, address, senddata, sizeof(senddata), NULL, replydata2, replysz, 1000);
1276 error = GetLastError();
1277 ok(!ret, "IcmpSendEcho2 returned success unexpectedly\n");
1279 || broken(error == ERROR_IO_PENDING) /* <= 2003 */,
1280 "Got last error: 0x%08lx\n", error);
1281 if (error == ERROR_IO_PENDING)
1282 {
1284 ok(ret == WAIT_OBJECT_0, "WaitForSingleObjectEx failed unexpectedly with %lu\n", ret);
1285 }
1286
1288 SetLastError(0xdeadbeef);
1289 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, senddata, sizeof(senddata), NULL, NULL, replysz, 1000);
1290 error = GetLastError();
1291 ok(!ret, "IcmpSendEcho2 succeeded unexpectedly\n");
1293 || broken(error == ERROR_NOACCESS) /* <= 2003 */,
1294 "expected 87, got %ld\n", error);
1295
1296 SetLastError(0xdeadbeef);
1297 ret = IcmpSendEcho2(icmp, event, NULL, NULL, address, senddata, sizeof(senddata), NULL, NULL, replysz, 1000);
1298 error = GetLastError();
1299 ok(!ret, "IcmpSendEcho2 succeeded unexpectedly\n");
1301 || broken(error == ERROR_NOACCESS) /* <= 2003 */,
1302 "expected 87, got %ld\n", error);
1303 ok(WaitForSingleObjectEx(event, 0, TRUE) == WAIT_TIMEOUT, "Event was unexpectedly signalled.\n");
1304
1305 SetLastError(0xdeadbeef);
1306 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, senddata, sizeof(senddata), NULL, replydata2, 0, 1000);
1307 error = GetLastError();
1308 ok(!ret, "IcmpSendEcho2 succeeded unexpectedly\n");
1310 || broken(error == ERROR_INSUFFICIENT_BUFFER) /* <= 2003 */,
1311 "expected 87, got %ld\n", error);
1312
1313 SetLastError(0xdeadbeef);
1314 ret = IcmpSendEcho2(icmp, event, NULL, NULL, address, senddata, sizeof(senddata), NULL, replydata2, 0, 1000);
1315 error = GetLastError();
1316 ok(!ret, "IcmpSendEcho2 succeeded unexpectedly\n");
1318 || broken(error == ERROR_INSUFFICIENT_BUFFER) /* <= 2003 */,
1319 "expected 87, got %ld\n", error);
1320 ok(WaitForSingleObjectEx(event, 0, TRUE) == WAIT_TIMEOUT, "Event was unexpectedly signalled.\n");
1321
1322 SetLastError(0xdeadbeef);
1323 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, senddata, sizeof(senddata), NULL, NULL, 0, 1000);
1324 error = GetLastError();
1325 ok(!ret, "IcmpSendEcho2 succeeded unexpectedly\n");
1327 || broken(error == ERROR_INSUFFICIENT_BUFFER) /* <= 2003 */,
1328 "expected 87, got %ld\n", error);
1329
1330 SetLastError(0xdeadbeef);
1331 ret = IcmpSendEcho2(icmp, event, NULL, NULL, address, senddata, sizeof(senddata), NULL, NULL, 0, 1000);
1332 error = GetLastError();
1333 ok(!ret, "IcmpSendEcho2 succeeded unexpectedly\n");
1335 || broken(error == ERROR_INSUFFICIENT_BUFFER) /* <= 2003 */,
1336 "expected 87, got %ld\n", error);
1337 ok(WaitForSingleObjectEx(event, 0, TRUE) == WAIT_TIMEOUT, "Event was unexpectedly signalled.\n");
1338
1339 /* synchronous tests */
1340#ifdef __REACTOS__
1341 if (LOBYTE(LOWORD(GetVersion())) >= 6) {
1342#endif
1343 SetLastError(0xdeadbeef);
1345 replysz = sizeof(ICMP_ECHO_REPLY) + sizeof(IO_STATUS_BLOCK);
1346 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, senddata, 0, NULL, replydata2, replysz, 1000);
1347 ok(ret, "IcmpSendEcho2 failed unexpectedly with error %ld\n", GetLastError());
1348
1349 SetLastError(0xdeadbeef);
1350 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, NULL, 0, NULL, replydata2, replysz, 1000);
1351 ok(ret, "IcmpSendEcho2 failed unexpectedly with error %ld\n", GetLastError());
1352
1353 SetLastError(0xdeadbeef);
1354 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, senddata, 0, NULL, replydata2, replysz, 1000);
1355 ok(ret, "IcmpSendEcho2 failed unexpectedly with error %ld\n", GetLastError());
1356
1357 SetLastError(0xdeadbeef);
1358 replysz = sizeof(ICMP_ECHO_REPLY) + sizeof(IO_STATUS_BLOCK) + ICMP_MINLEN;
1359 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, senddata, ICMP_MINLEN, NULL, replydata2, replysz, 1000);
1360 ok(ret, "IcmpSendEcho2 failed unexpectedly with error %ld\n", GetLastError());
1361
1362 SetLastError(0xdeadbeef);
1363 replysz = sizeof(replydata2);
1364 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, senddata, sizeof(senddata), NULL, replydata2, replysz, 1000);
1365 if (!ret)
1366 {
1367 error = GetLastError();
1368 skip("Failed to ping with error %ld, is lo interface down?\n", error);
1369 }
1370 else if (winetest_debug > 1)
1371 {
1372 reply = (ICMP_ECHO_REPLY*)replydata2;
1373 trace("send addr : %s\n", ntoa(address));
1374 trace("reply addr : %s\n", ntoa(reply->Address));
1375 trace("reply size : %lu\n", replysz);
1376 trace("roundtrip : %lu ms\n", reply->RoundTripTime);
1377 trace("status : %lu\n", reply->Status);
1378 trace("recv size : %u\n", reply->DataSize);
1379 trace("ttl : %u\n", reply->Options.Ttl);
1380 trace("flags : 0x%x\n", reply->Options.Flags);
1381 }
1382
1383 SetLastError(0xdeadbeef);
1384 for (i = 0; i < ARRAY_SIZE(senddata); i++) senddata[i] = i & 0xff;
1385 ret = IcmpSendEcho2(icmp, NULL, NULL, NULL, address, senddata, sizeof(senddata), NULL, replydata2, replysz, 1000);
1386 error = GetLastError();
1387 reply = (ICMP_ECHO_REPLY*)replydata2;
1388 ok(ret, "IcmpSendEcho2 failed unexpectedly\n");
1389 ok(error == NO_ERROR, "Expect last error: 0x%08x, got: 0x%08lx\n", NO_ERROR, error);
1390 ok(ntohl(reply->Address) == INADDR_LOOPBACK, "Address mismatch, expect: %s, got: %s\n", ntoa(INADDR_LOOPBACK),
1391 ntoa(reply->Address));
1392 ok(reply->Status == IP_SUCCESS, "Expect status: 0x%08x, got: 0x%08lx\n", IP_SUCCESS, reply->Status);
1393 ok(reply->DataSize == sizeof(senddata), "Got size: %d\n", reply->DataSize);
1394 ok(!memcmp(senddata, reply->Data, min(sizeof(senddata), reply->DataSize)), "Data mismatch\n");
1395#ifdef __REACTOS__
1396 }
1397#endif
1398
1399 /* asynchronous tests with event */
1400 SetLastError(0xdeadbeef);
1401 replysz = sizeof(replydata2);
1403 memset(senddata, 0, sizeof(senddata));
1404 ret = IcmpSendEcho2(icmp, event, NULL, NULL, address, senddata, sizeof(senddata), NULL, replydata2, replysz, 1000);
1405 error = GetLastError();
1406 if (!ret && error != ERROR_IO_PENDING)
1407 {
1408 skip("Failed to ping with error %ld, is lo interface down?\n", error);
1409 }
1410 else
1411 {
1412 ok(!ret, "IcmpSendEcho2 returned success unexpectedly\n");
1413 ok(error == ERROR_IO_PENDING, "Expect last error: 0x%08x, got: 0x%08lx\n", ERROR_IO_PENDING, error);
1415 ok(ret == WAIT_OBJECT_0, "WaitForSingleObjectEx failed unexpectedly with %lu\n", ret);
1416 reply = (ICMP_ECHO_REPLY*)replydata2;
1417 ok(ntohl(reply->Address) == INADDR_LOOPBACK, "Address mismatch, expect: %s, got: %s\n", ntoa(INADDR_LOOPBACK),
1418 ntoa(reply->Address));
1419#ifdef __REACTOS__
1420 if (LOBYTE(LOWORD(GetVersion())) >= 6) {
1421#endif
1422 ok(reply->Status == IP_SUCCESS, "Expect status: 0x%08x, got: 0x%08lx\n", IP_SUCCESS, reply->Status);
1423 ok(reply->DataSize == sizeof(senddata), "Got size: %d\n", reply->DataSize);
1424#ifdef __REACTOS__
1425 }
1426#endif
1427 if (winetest_debug > 1)
1428 {
1429 reply = (ICMP_ECHO_REPLY*)replydata2;
1430 trace("send addr : %s\n", ntoa(address));
1431 trace("reply addr : %s\n", ntoa(reply->Address));
1432 trace("reply size : %lu\n", replysz);
1433 trace("roundtrip : %lu ms\n", reply->RoundTripTime);
1434 trace("status : %lu\n", reply->Status);
1435 trace("recv size : %u\n", reply->DataSize);
1436 trace("ttl : %u\n", reply->Options.Ttl);
1437 trace("flags : 0x%x\n", reply->Options.Flags);
1438 }
1439 }
1440
1441 SetLastError(0xdeadbeef);
1442 for (i = 0; i < ARRAY_SIZE(senddata); i++) senddata[i] = i & 0xff;
1443 ret = IcmpSendEcho2(icmp, event, NULL, NULL, address, senddata, sizeof(senddata), NULL, replydata2, replysz, 1000);
1444 error = GetLastError();
1445 ok(!ret, "IcmpSendEcho2 returned success unexpectedly\n");
1446 ok(error == ERROR_IO_PENDING, "Expect last error: 0x%08x, got: 0x%08lx\n", ERROR_IO_PENDING, error);
1448 ok(ret == WAIT_OBJECT_0, "WaitForSingleObjectEx failed unexpectedly with %lu\n", ret);
1449 reply = (ICMP_ECHO_REPLY*)replydata2;
1450 ok(ntohl(reply->Address) == INADDR_LOOPBACK, "Address mismatch, expect: %s, got: %s\n", ntoa(INADDR_LOOPBACK),
1451 ntoa(reply->Address));
1452#ifdef __REACTOS__
1453 if (LOBYTE(LOWORD(GetVersion())) >= 6) {
1454#endif
1455 ok(reply->Status == IP_SUCCESS, "Expect status: 0x%08x, got: 0x%08lx\n", IP_SUCCESS, reply->Status);
1456 ok(reply->DataSize == sizeof(senddata), "Got size: %d\n", reply->DataSize);
1457#ifdef __REACTOS__
1458 }
1459#endif
1460 /* pre-Vista, reply->Data is an offset; otherwise it's a pointer, so hardcode the offset */
1461 ok(!memcmp(senddata, reply + 1, min(sizeof(senddata), reply->DataSize)), "Data mismatch\n");
1462
1464
1465 /* asynchronous tests with APC */
1466 SetLastError(0xdeadbeef);
1467 replysz = sizeof(replydata2) + 10;
1469 for (i = 0; i < ARRAY_SIZE(senddata); i++) senddata[i] = ~i & 0xff;
1471 /*
1472 NOTE: Supplying both event and apc has varying behavior across Windows versions, so not tested.
1473 */
1474#if defined(__REACTOS__) && defined(_MSC_VER)
1475 /* The call to IcmpSendEcho2() below with the invalid APC context causes
1476 * stack corruption on WS03 and ReactOS when compiled with MSVC but not GCC. */
1477 if (LOBYTE(LOWORD(GetVersion())) >= 6) {
1478#endif
1479 ret = IcmpSendEcho2(icmp, NULL, apc, (void*)0xdeadc0de, address, senddata, sizeof(senddata), NULL, replydata2, replysz, 1000);
1480 error = GetLastError();
1481 ok(!ret, "IcmpSendEcho2 returned success unexpectedly\n");
1482 ok(error == ERROR_IO_PENDING, "Expect last error: 0x%08x, got: 0x%08lx\n", ERROR_IO_PENDING, error);
1483 SleepEx(200, TRUE);
1484 SleepEx(0, TRUE);
1485 ok(icmp_send_echo_test_apc_expect == FALSE, "APC was not executed!\n");
1486 reply = (ICMP_ECHO_REPLY*)replydata2;
1487 ok(ntohl(reply->Address) == INADDR_LOOPBACK, "Address mismatch, expect: %s, got: %s\n", ntoa(INADDR_LOOPBACK),
1488 ntoa(reply->Address));
1489 ok(reply->Status == IP_SUCCESS, "Expect status: 0x%08x, got: 0x%08lx\n", IP_SUCCESS, reply->Status);
1490 ok(reply->DataSize == sizeof(senddata), "Got size: %d\n", reply->DataSize);
1491 /* pre-Vista, reply->Data is an offset; otherwise it's a pointer, so hardcode the offset */
1492 ok(!memcmp(senddata, reply + 1, min(sizeof(senddata), reply->DataSize)), "Data mismatch\n");
1493#if defined(__REACTOS__) && defined(_MSC_VER)
1494 }
1495#endif
1496
1498}
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define ERROR_IO_PENDING
Definition: dderror.h:15
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
BOOL WINAPI IcmpCloseHandle(_In_ HANDLE IcmpHandle)
Definition: icmp.c:202
DWORD WINAPI IcmpSendEcho2(_In_ HANDLE IcmpHandle, _In_opt_ HANDLE Event, _In_opt_ PIO_APC_ROUTINE ApcRoutine, _In_opt_ PVOID ApcContext, _In_ IPAddr DestinationAddress, _In_ LPVOID RequestData, _In_ WORD RequestSize, _In_opt_ PIP_OPTION_INFORMATION RequestOptions, _Out_ LPVOID ReplyBuffer, _In_ DWORD ReplySize, _In_ DWORD Timeout)
Definition: icmp.c:285
HANDLE WINAPI IcmpCreateFile(void)
Definition: icmp.c:219
DWORD WINAPI IcmpSendEcho(_In_ HANDLE IcmpHandle, _In_ IPAddr DestinationAddress, _In_ LPVOID RequestData, _In_ WORD RequestSize, _In_opt_ PIP_OPTION_INFORMATION RequestOptions, _Out_ LPVOID ReplyBuffer, _In_ DWORD ReplySize, _In_ DWORD Timeout)
Definition: icmp.c:423
struct _cl_event * event
Definition: glext.h:7739
GLuint address
Definition: glext.h:9393
#define IP_BUF_TOO_SMALL
Definition: ipexport.h:114
#define IP_BAD_DESTINATION
Definition: ipexport.h:131
struct icmp_echo_reply * PICMP_ECHO_REPLY
struct icmp_echo_reply ICMP_ECHO_REPLY
#define IP_GENERAL_FAILURE
Definition: ipexport.h:138
#define IP_SUCCESS
Definition: ipexport.h:113
#define ICMP_MINLEN
Definition: iphlpapi.c:56
static void WINAPI icmp_send_echo_test_apc(void *context, IO_STATUS_BLOCK *io_status, ULONG reserved)
Definition: iphlpapi.c:1069
#define error(str)
Definition: mkdosfs.c:1605
static HANDLE PIO_APC_ROUTINE apc
Definition: comm.c:55
#define min(a, b)
Definition: monoChain.cc:55
VOID(* PIO_APC_ROUTINE)(IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG Reserved)
Definition: nt_native.h:880
ULONG IPAddr
Definition: pfhook.h:35
UINT16 DataSize
Definition: ipexport.h:87
IPAddr Address
Definition: ipexport.h:84
IP_OPTION_INFORMATION Options
Definition: ipexport.h:90
UINT32 RoundTripTime
Definition: ipexport.h:86
Definition: ip_icmp.h:52
unsigned char Flags
Definition: ipexport.h:35
unsigned char Ttl
Definition: ipexport.h:33
DWORD WINAPI SleepEx(IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:802
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:94
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
#define WAIT_OBJECT_0
Definition: winbase.h:383
#define ERROR_NOACCESS
Definition: winerror.h:902
#define ERROR_INVALID_NETNAME
Definition: winerror.h:1046

Referenced by testWinNT4Functions().

◆ testNotifyAddrChange()

static void testNotifyAddrChange ( void  )
static

Definition at line 1826 of file iphlpapi.c.

1827{
1828 DWORD ret, bytes;
1830 HANDLE handle;
1831 BOOL success;
1832
1833#ifdef __REACTOS__
1834 if (IsReactOS()) {
1835 skip("FIXME: testNotifyAddrChange() hangs on ReactOS! (works on Windows)\n");
1836 return;
1837 }
1838#endif
1839 handle = NULL;
1840 ZeroMemory(&overlapped, sizeof(overlapped));
1842 ok(ret == ERROR_IO_PENDING, "NotifyAddrChange returned %ld, expected ERROR_IO_PENDING\n", ret);
1843 ret = GetLastError();
1844 ok(ret == ERROR_IO_PENDING, "GetLastError returned %ld, expected ERROR_IO_PENDING\n", ret);
1846 ok(success == TRUE, "CancelIPChangeNotify returned FALSE, expected TRUE\n");
1848 ok( !success && GetLastError() == ERROR_OPERATION_ABORTED, "got bret %d, err %lu.\n", success, GetLastError() );
1849
1850 ZeroMemory(&overlapped, sizeof(overlapped));
1852 ok(success == FALSE, "CancelIPChangeNotify returned TRUE, expected FALSE\n");
1853
1854 handle = NULL;
1855 ZeroMemory(&overlapped, sizeof(overlapped));
1858 ok(ret == ERROR_IO_PENDING, "NotifyAddrChange returned %ld, expected ERROR_IO_PENDING\n", ret);
1859 ok(handle != INVALID_HANDLE_VALUE, "NotifyAddrChange returned invalid file handle\n");
1861 ok(success == FALSE, "GetOverlappedResult returned TRUE, expected FALSE\n");
1862 ret = GetLastError();
1863 ok(ret == ERROR_IO_INCOMPLETE, "GetLastError returned %ld, expected ERROR_IO_INCOMPLETE\n", ret);
1865 ok(success == TRUE, "CancelIPChangeNotify returned FALSE, expected TRUE\n");
1867 ok( !success && GetLastError() == ERROR_OPERATION_ABORTED, "got bret %d, err %lu.\n", success, GetLastError() );
1868
1870 {
1871 handle = NULL;
1872 ZeroMemory(&overlapped, sizeof(overlapped));
1874 trace("Testing asynchronous ipv4 address change notification. Please "
1875 "change the ipv4 address of one of your network interfaces\n");
1877 ok(ret == ERROR_IO_PENDING, "NotifyAddrChange returned %ld, expected NO_ERROR\n", ret);
1879 ok(success == TRUE, "GetOverlappedResult returned FALSE, expected TRUE\n");
1880 }
1881
1882 /* test synchronous functionality */
1884 {
1885 trace("Testing synchronous ipv4 address change notification. Please "
1886 "change the ipv4 address of one of your network interfaces\n");
1888 ok(ret == NO_ERROR, "NotifyAddrChange returned %ld, expected NO_ERROR\n", ret);
1889 }
1890}
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
Definition: iocompl.c:221
DWORD WINAPI NotifyAddrChange(PHANDLE Handle, LPOVERLAPPED overlapped)
BOOL WINAPI CancelIPChangeNotify(LPOVERLAPPED notifyOverlapped)
int winetest_interactive
#define ZeroMemory
Definition: minwinbase.h:31
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED * overlapped
Definition: sock.c:81
#define success(from, fromstr, to, tostr)
#define ERROR_IO_INCOMPLETE
Definition: winerror.h:900
#define ERROR_OPERATION_ABORTED
Definition: winerror.h:899

Referenced by testWin2KFunctions().

◆ testSetTcpEntry()

static void testSetTcpEntry ( void  )
static

Definition at line 1035 of file iphlpapi.c.

1036{
1037 DWORD ret;
1039
1040 memset(&row, 0, sizeof(row));
1041 if(0) /* This test crashes in OS >= VISTA */
1042 {
1043 ret = SetTcpEntry(NULL);
1044 ok( ret == ERROR_INVALID_PARAMETER, "got %lu, expected %u\n", ret, ERROR_INVALID_PARAMETER);
1045 }
1046
1047 ret = SetTcpEntry(&row);
1049 {
1050 win_skip("SetTcpEntry failed with access error. Skipping test.\n");
1051 return;
1052 }
1053 todo_wine ok( ret == ERROR_INVALID_PARAMETER, "got %lu, expected %u\n", ret, ERROR_INVALID_PARAMETER);
1054
1055 row.dwState = MIB_TCP_STATE_DELETE_TCB;
1056 ret = SetTcpEntry(&row);
1058 "got %lu, expected %u\n", ret, ERROR_MR_MID_NOT_FOUND);
1059}
DWORD WINAPI SetTcpEntry(PMIB_TCPROW pTcpRow)
#define todo_wine
Definition: minitest.h:80
@ MIB_TCP_STATE_DELETE_TCB
Definition: tcpmib.h:26
#define ERROR_MR_MID_NOT_FOUND
Definition: winerror.h:442
#define ERROR_NETWORK_ACCESS_DENIED
Definition: winerror.h:279

Referenced by testWinNT4Functions().

◆ testWin2KFunctions()

static void testWin2KFunctions ( void  )
static

Definition at line 1905 of file iphlpapi.c.

1906{
1909}
static void testNotifyAddrChange(void)
Definition: iphlpapi.c:1826
static void testGetPerAdapterInfo(void)
Definition: iphlpapi.c:1808

Referenced by START_TEST().

◆ testWin98Functions()

static DWORD CALLBACK testWin98Functions ( void p)
static

Definition at line 1797 of file iphlpapi.c.

1798{
1805 return 0;
1806}
static void testGetBestInterfaceEx(void)
Definition: iphlpapi.c:1712
static void testGetInterfaceInfo(void)
Definition: iphlpapi.c:1563
static void testGetNetworkParams(void)
Definition: iphlpapi.c:1660
static void testGetBestRoute(void)
Definition: iphlpapi.c:1768
static void testGetAdaptersInfo(void)
Definition: iphlpapi.c:1606
static void testGetBestInterface(void)
Definition: iphlpapi.c:1688

Referenced by START_TEST().

◆ testWin98OnlyFunctions()

static void testWin98OnlyFunctions ( void  )
static

Definition at line 216 of file iphlpapi.c.

217{
218}

Referenced by START_TEST().

◆ testWinNT4Functions()

static void testWinNT4Functions ( void  )
static

Definition at line 1541 of file iphlpapi.c.

1542{
1561}
static void testGetIfTable(void)
Definition: iphlpapi.c:306
static void testGetTcpStatistics(void)
Definition: iphlpapi.c:686
static void testGetUdpTable(void)
Definition: iphlpapi.c:1002
static void testSetTcpEntry(void)
Definition: iphlpapi.c:1035
static void testIcmpSendEcho(void)
Definition: iphlpapi.c:1077
static void testGetTcpTable(void)
Definition: iphlpapi.c:965
static void testGetIpStatistics(void)
Definition: iphlpapi.c:641
static void testGetIpStatisticsEx(void)
Definition: iphlpapi.c:792
static void testIcmpParseReplies(void)
Definition: iphlpapi.c:1500
static void testGetIpForwardTable(void)
Definition: iphlpapi.c:394
static void testGetIcmpStatistics(void)
Definition: iphlpapi.c:599
static void testGetUdpStatistics(void)
Definition: iphlpapi.c:723
static void testGetIpNetTable(void)
Definition: iphlpapi.c:482
static void testGetIpAddrTable(void)
Definition: iphlpapi.c:265
static void testGetIcmpStatisticsEx(void)
Definition: iphlpapi.c:750
static void testGetTcpStatisticsEx(void)
Definition: iphlpapi.c:867
static void testGetNumberOfInterfaces(void)
Definition: iphlpapi.c:220
static void testGetUdpStatisticsEx(void)
Definition: iphlpapi.c:926

Referenced by START_TEST().

Variable Documentation

◆ BOOL

Definition at line 60 of file iphlpapi.c.

◆ BOOLEAN

const PSOCKADDR_IN6_PAIR ULONG *static ULONG *static NET_ADDRESS_INFO USHORT BYTE *static BOOLEAN

Definition at line 72 of file iphlpapi.c.

◆ DWORD

Definition at line 60 of file iphlpapi.c.

◆ HANDLE

Definition at line 60 of file iphlpapi.c.

◆ hLibrary

HMODULE hLibrary = NULL
static

Definition at line 58 of file iphlpapi.c.

Referenced by freeIPHlpApi(), loadIPHlpApi(), and START_TEST().

◆ icmp_send_echo_test_apc_expect

BOOL icmp_send_echo_test_apc_expect
static

Definition at line 1061 of file iphlpapi.c.

Referenced by icmp_send_echo_test_apc_xp(), and testIcmpSendEcho().

◆ PDWORD

Definition at line 61 of file iphlpapi.c.

◆ PSOCKADDR_IN6

Definition at line 67 of file iphlpapi.c.

◆ PUNICAST_IPADDRESS_CHANGE_CALLBACK

const PSOCKADDR_IN6_PAIR ULONG *static ULONG *static NET_ADDRESS_INFO USHORT BYTE *static PUNICAST_IPADDRESS_CHANGE_CALLBACK

Definition at line 71 of file iphlpapi.c.

◆ PVOID

const PSOCKADDR_IN6_PAIR ULONG *static ULONG *static NET_ADDRESS_INFO USHORT BYTE *static PVOID

Definition at line 72 of file iphlpapi.c.

◆ TCP_TABLE_CLASS

Definition at line 65 of file iphlpapi.c.

◆ UDP_TABLE_CLASS

Definition at line 66 of file iphlpapi.c.

◆ ULONG

Definition at line 65 of file iphlpapi.c.