2004-01-07 02:08:55 +01:00
|
|
|
/*
|
|
|
|
* iphlpapi dll test
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Juan Lang
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-01-07 02:08:55 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some observations that an automated test can't produce:
|
|
|
|
* An adapter index is a key for an adapter. That is, if an index is returned
|
|
|
|
* from one API, that same index may be used successfully in another API, as
|
|
|
|
* long as the adapter remains present.
|
|
|
|
* If the adapter is removed and reinserted, however, the index may change (and
|
|
|
|
* indeed it does change on Win2K).
|
|
|
|
*
|
|
|
|
* The Name field of the IP_ADAPTER_INDEX_MAP entries returned by
|
|
|
|
* GetInterfaceInfo is declared as a wide string, but the bytes are actually
|
|
|
|
* an ASCII string on some versions of the IP helper API under Win9x. This was
|
|
|
|
* apparently an MS bug, it's corrected in later versions.
|
|
|
|
*
|
|
|
|
* The DomainName field of FIXED_INFO isn't NULL-terminated on Win98.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2009-03-10 17:50:50 +01:00
|
|
|
#include "winsock2.h"
|
2004-01-07 02:08:55 +01:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2015-07-21 11:01:16 +02:00
|
|
|
#include "ws2tcpip.h"
|
2004-01-07 02:08:55 +01:00
|
|
|
#include "iphlpapi.h"
|
|
|
|
#include "iprtrmib.h"
|
2015-07-22 14:28:05 +02:00
|
|
|
#include "netioapi.h"
|
2004-01-07 02:08:55 +01:00
|
|
|
#include "wine/test.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2014-01-09 00:47:11 +01:00
|
|
|
#define ICMP_MINLEN 8 /* copied from dlls/iphlpapi/ip_icmp.h file */
|
|
|
|
|
2004-01-07 02:08:55 +01:00
|
|
|
static HMODULE hLibrary = NULL;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
static DWORD (WINAPI *pGetNumberOfInterfaces)(PDWORD);
|
|
|
|
static DWORD (WINAPI *pGetIpAddrTable)(PMIB_IPADDRTABLE,PULONG,BOOL);
|
|
|
|
static DWORD (WINAPI *pGetIfEntry)(PMIB_IFROW);
|
2015-07-22 14:28:05 +02:00
|
|
|
static DWORD (WINAPI *pGetIfEntry2)(PMIB_IF_ROW2);
|
2012-04-25 17:16:24 +02:00
|
|
|
static DWORD (WINAPI *pGetFriendlyIfIndex)(DWORD);
|
|
|
|
static DWORD (WINAPI *pGetIfTable)(PMIB_IFTABLE,PULONG,BOOL);
|
|
|
|
static DWORD (WINAPI *pGetIpForwardTable)(PMIB_IPFORWARDTABLE,PULONG,BOOL);
|
|
|
|
static DWORD (WINAPI *pGetIpNetTable)(PMIB_IPNETTABLE,PULONG,BOOL);
|
|
|
|
static DWORD (WINAPI *pGetInterfaceInfo)(PIP_INTERFACE_INFO,PULONG);
|
|
|
|
static DWORD (WINAPI *pGetAdaptersInfo)(PIP_ADAPTER_INFO,PULONG);
|
|
|
|
static DWORD (WINAPI *pGetNetworkParams)(PFIXED_INFO,PULONG);
|
|
|
|
static DWORD (WINAPI *pGetIcmpStatistics)(PMIB_ICMP);
|
|
|
|
static DWORD (WINAPI *pGetIpStatistics)(PMIB_IPSTATS);
|
|
|
|
static DWORD (WINAPI *pGetTcpStatistics)(PMIB_TCPSTATS);
|
|
|
|
static DWORD (WINAPI *pGetUdpStatistics)(PMIB_UDPSTATS);
|
2012-04-27 22:11:07 +02:00
|
|
|
static DWORD (WINAPI *pGetIcmpStatisticsEx)(PMIB_ICMP_EX,DWORD);
|
|
|
|
static DWORD (WINAPI *pGetIpStatisticsEx)(PMIB_IPSTATS,DWORD);
|
|
|
|
static DWORD (WINAPI *pGetTcpStatisticsEx)(PMIB_TCPSTATS,DWORD);
|
|
|
|
static DWORD (WINAPI *pGetUdpStatisticsEx)(PMIB_UDPSTATS,DWORD);
|
2012-04-25 17:16:24 +02:00
|
|
|
static DWORD (WINAPI *pGetTcpTable)(PMIB_TCPTABLE,PDWORD,BOOL);
|
|
|
|
static DWORD (WINAPI *pGetUdpTable)(PMIB_UDPTABLE,PDWORD,BOOL);
|
|
|
|
static DWORD (WINAPI *pGetPerAdapterInfo)(ULONG,PIP_PER_ADAPTER_INFO,PULONG);
|
|
|
|
static DWORD (WINAPI *pGetAdaptersAddresses)(ULONG,ULONG,PVOID,PIP_ADAPTER_ADDRESSES,PULONG);
|
|
|
|
static DWORD (WINAPI *pNotifyAddrChange)(PHANDLE,LPOVERLAPPED);
|
|
|
|
static BOOL (WINAPI *pCancelIPChangeNotify)(LPOVERLAPPED);
|
|
|
|
static DWORD (WINAPI *pGetExtendedTcpTable)(PVOID,PDWORD,BOOL,ULONG,TCP_TABLE_CLASS,ULONG);
|
2012-09-07 13:35:36 +02:00
|
|
|
static DWORD (WINAPI *pGetExtendedUdpTable)(PVOID,PDWORD,BOOL,ULONG,UDP_TABLE_CLASS,ULONG);
|
2012-04-25 17:16:24 +02:00
|
|
|
static DWORD (WINAPI *pSetTcpEntry)(PMIB_TCPROW);
|
2014-01-07 07:00:19 +01:00
|
|
|
static HANDLE(WINAPI *pIcmpCreateFile)(VOID);
|
|
|
|
static DWORD (WINAPI *pIcmpSendEcho)(HANDLE,IPAddr,LPVOID,WORD,PIP_OPTION_INFORMATION,LPVOID,DWORD,DWORD);
|
2015-07-21 11:01:16 +02:00
|
|
|
static DWORD (WINAPI *pCreateSortedAddressPairs)(const PSOCKADDR_IN6,ULONG,const PSOCKADDR_IN6,ULONG,ULONG,
|
|
|
|
PSOCKADDR_IN6_PAIR*,ULONG*);
|
|
|
|
static void (WINAPI *pFreeMibTable)(void*);
|
2015-07-22 14:26:59 +02:00
|
|
|
static DWORD (WINAPI *pConvertInterfaceGuidToLuid)(const GUID*,NET_LUID*);
|
|
|
|
static DWORD (WINAPI *pConvertInterfaceIndexToLuid)(NET_IFINDEX,NET_LUID*);
|
|
|
|
static DWORD (WINAPI *pConvertInterfaceLuidToGuid)(const NET_LUID*,GUID*);
|
|
|
|
static DWORD (WINAPI *pConvertInterfaceLuidToIndex)(const NET_LUID*,NET_IFINDEX*);
|
|
|
|
static DWORD (WINAPI *pConvertInterfaceLuidToNameW)(const NET_LUID*,WCHAR*,SIZE_T);
|
|
|
|
static DWORD (WINAPI *pConvertInterfaceLuidToNameA)(const NET_LUID*,char*,SIZE_T);
|
|
|
|
static DWORD (WINAPI *pConvertInterfaceNameToLuidA)(const char*,NET_LUID*);
|
|
|
|
static DWORD (WINAPI *pConvertInterfaceNameToLuidW)(const WCHAR*,NET_LUID*);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
|
|
|
static void loadIPHlpApi(void)
|
|
|
|
{
|
|
|
|
hLibrary = LoadLibraryA("iphlpapi.dll");
|
|
|
|
if (hLibrary) {
|
2012-04-25 17:16:24 +02:00
|
|
|
pGetNumberOfInterfaces = (void *)GetProcAddress(hLibrary, "GetNumberOfInterfaces");
|
|
|
|
pGetIpAddrTable = (void *)GetProcAddress(hLibrary, "GetIpAddrTable");
|
|
|
|
pGetIfEntry = (void *)GetProcAddress(hLibrary, "GetIfEntry");
|
2015-07-22 14:28:05 +02:00
|
|
|
pGetIfEntry2 = (void *)GetProcAddress(hLibrary, "GetIfEntry2");
|
2012-04-25 17:16:24 +02:00
|
|
|
pGetFriendlyIfIndex = (void *)GetProcAddress(hLibrary, "GetFriendlyIfIndex");
|
|
|
|
pGetIfTable = (void *)GetProcAddress(hLibrary, "GetIfTable");
|
|
|
|
pGetIpForwardTable = (void *)GetProcAddress(hLibrary, "GetIpForwardTable");
|
|
|
|
pGetIpNetTable = (void *)GetProcAddress(hLibrary, "GetIpNetTable");
|
|
|
|
pGetInterfaceInfo = (void *)GetProcAddress(hLibrary, "GetInterfaceInfo");
|
|
|
|
pGetAdaptersInfo = (void *)GetProcAddress(hLibrary, "GetAdaptersInfo");
|
|
|
|
pGetNetworkParams = (void *)GetProcAddress(hLibrary, "GetNetworkParams");
|
|
|
|
pGetIcmpStatistics = (void *)GetProcAddress(hLibrary, "GetIcmpStatistics");
|
|
|
|
pGetIpStatistics = (void *)GetProcAddress(hLibrary, "GetIpStatistics");
|
|
|
|
pGetTcpStatistics = (void *)GetProcAddress(hLibrary, "GetTcpStatistics");
|
|
|
|
pGetUdpStatistics = (void *)GetProcAddress(hLibrary, "GetUdpStatistics");
|
2012-04-27 22:11:07 +02:00
|
|
|
pGetIcmpStatisticsEx = (void *)GetProcAddress(hLibrary, "GetIcmpStatisticsEx");
|
|
|
|
pGetIpStatisticsEx = (void *)GetProcAddress(hLibrary, "GetIpStatisticsEx");
|
|
|
|
pGetTcpStatisticsEx = (void *)GetProcAddress(hLibrary, "GetTcpStatisticsEx");
|
|
|
|
pGetUdpStatisticsEx = (void *)GetProcAddress(hLibrary, "GetUdpStatisticsEx");
|
2012-04-25 17:16:24 +02:00
|
|
|
pGetTcpTable = (void *)GetProcAddress(hLibrary, "GetTcpTable");
|
|
|
|
pGetUdpTable = (void *)GetProcAddress(hLibrary, "GetUdpTable");
|
|
|
|
pGetPerAdapterInfo = (void *)GetProcAddress(hLibrary, "GetPerAdapterInfo");
|
|
|
|
pGetAdaptersAddresses = (void *)GetProcAddress(hLibrary, "GetAdaptersAddresses");
|
|
|
|
pNotifyAddrChange = (void *)GetProcAddress(hLibrary, "NotifyAddrChange");
|
|
|
|
pCancelIPChangeNotify = (void *)GetProcAddress(hLibrary, "CancelIPChangeNotify");
|
|
|
|
pGetExtendedTcpTable = (void *)GetProcAddress(hLibrary, "GetExtendedTcpTable");
|
2012-09-07 13:35:36 +02:00
|
|
|
pGetExtendedUdpTable = (void *)GetProcAddress(hLibrary, "GetExtendedUdpTable");
|
2012-04-25 17:16:24 +02:00
|
|
|
pSetTcpEntry = (void *)GetProcAddress(hLibrary, "SetTcpEntry");
|
2014-01-07 07:00:19 +01:00
|
|
|
pIcmpCreateFile = (void *)GetProcAddress(hLibrary, "IcmpCreateFile");
|
|
|
|
pIcmpSendEcho = (void *)GetProcAddress(hLibrary, "IcmpSendEcho");
|
2015-07-21 11:01:16 +02:00
|
|
|
pCreateSortedAddressPairs = (void *)GetProcAddress(hLibrary, "CreateSortedAddressPairs");
|
|
|
|
pFreeMibTable = (void *)GetProcAddress(hLibrary, "FreeMibTable");
|
2015-07-22 14:26:59 +02:00
|
|
|
pConvertInterfaceGuidToLuid = (void *)GetProcAddress(hLibrary, "ConvertInterfaceGuidToLuid");
|
|
|
|
pConvertInterfaceIndexToLuid = (void *)GetProcAddress(hLibrary, "ConvertInterfaceIndexToLuid");
|
|
|
|
pConvertInterfaceLuidToGuid = (void *)GetProcAddress(hLibrary, "ConvertInterfaceLuidToGuid");
|
|
|
|
pConvertInterfaceLuidToIndex = (void *)GetProcAddress(hLibrary, "ConvertInterfaceLuidToIndex");
|
|
|
|
pConvertInterfaceLuidToNameA = (void *)GetProcAddress(hLibrary, "ConvertInterfaceLuidToNameA");
|
|
|
|
pConvertInterfaceLuidToNameW = (void *)GetProcAddress(hLibrary, "ConvertInterfaceLuidToNameW");
|
|
|
|
pConvertInterfaceNameToLuidA = (void *)GetProcAddress(hLibrary, "ConvertInterfaceNameToLuidA");
|
|
|
|
pConvertInterfaceNameToLuidW = (void *)GetProcAddress(hLibrary, "ConvertInterfaceNameToLuidW");
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void freeIPHlpApi(void)
|
|
|
|
{
|
|
|
|
FreeLibrary(hLibrary);
|
|
|
|
}
|
|
|
|
|
2009-03-10 17:50:50 +01:00
|
|
|
/* replacement for inet_ntoa */
|
|
|
|
static const char *ntoa( DWORD ip )
|
|
|
|
{
|
|
|
|
static char buffer[40];
|
|
|
|
|
|
|
|
ip = htonl(ip);
|
|
|
|
sprintf( buffer, "%u.%u.%u.%u", (ip >> 24) & 0xff, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff );
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2015-04-16 06:23:26 +02:00
|
|
|
static inline const char* debugstr_longlong(ULONGLONG ll)
|
|
|
|
{
|
|
|
|
static char string[17];
|
|
|
|
if (sizeof(ll) > sizeof(unsigned long) && ll >> 32)
|
|
|
|
sprintf(string, "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll);
|
|
|
|
else
|
|
|
|
sprintf(string, "%lx", (unsigned long)ll);
|
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
2004-01-07 02:08:55 +01:00
|
|
|
/*
|
|
|
|
still-to-be-tested 98-only functions:
|
|
|
|
GetUniDirectionalAdapterInfo
|
|
|
|
*/
|
2005-07-05 13:05:50 +02:00
|
|
|
static void testWin98OnlyFunctions(void)
|
2004-01-07 02:08:55 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetNumberOfInterfaces(void)
|
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetNumberOfInterfaces) {
|
2008-06-06 21:34:32 +02:00
|
|
|
DWORD apiReturn, numInterfaces;
|
|
|
|
|
|
|
|
/* Crashes on Vista */
|
|
|
|
if (0) {
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetNumberOfInterfaces(NULL);
|
2008-06-06 21:34:32 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED)
|
|
|
|
return;
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
|
|
|
"GetNumberOfInterfaces(NULL) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
|
|
|
apiReturn);
|
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetNumberOfInterfaces(&numInterfaces);
|
2008-06-06 21:34:32 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetNumberOfInterfaces is not supported\n");
|
|
|
|
return;
|
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetNumberOfInterfaces returned %d, expected 0\n", apiReturn);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetIfEntry(DWORD index)
|
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetIfEntry) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
MIB_IFROW row;
|
|
|
|
|
|
|
|
memset(&row, 0, sizeof(row));
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIfEntry(NULL);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetIfEntry is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIfEntry(NULL) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
row.dwIndex = -1; /* hope that's always bogus! */
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIfEntry(&row);
|
2008-06-06 21:37:51 +02:00
|
|
|
ok(apiReturn == ERROR_INVALID_DATA ||
|
|
|
|
apiReturn == ERROR_FILE_NOT_FOUND /* Vista */,
|
|
|
|
"GetIfEntry(bogus row) returned %d, expected ERROR_INVALID_DATA or ERROR_FILE_NOT_FOUND\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
row.dwIndex = index;
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIfEntry(&row);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIfEntry returned %d, expected NO_ERROR\n", apiReturn);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetIpAddrTable(void)
|
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetIpAddrTable) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
ULONG dwSize = 0;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpAddrTable(NULL, NULL, FALSE);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetIpAddrTable is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpAddrTable(NULL, NULL, FALSE) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpAddrTable(NULL, &dwSize, FALSE);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpAddrTable(NULL, &dwSize, FALSE) returned %d, expected ERROR_INSUFFICIENT_BUFFER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
|
2008-12-01 02:09:11 +01:00
|
|
|
PMIB_IPADDRTABLE buf = HeapAlloc(GetProcessHeap(), 0, dwSize);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpAddrTable(buf, &dwSize, FALSE);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpAddrTable(buf, &dwSize, FALSE) returned %d, expected NO_ERROR\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2004-05-07 01:39:59 +02:00
|
|
|
if (apiReturn == NO_ERROR && buf->dwNumEntries)
|
2015-05-14 03:02:24 +02:00
|
|
|
{
|
|
|
|
int i;
|
2004-01-07 02:08:55 +01:00
|
|
|
testGetIfEntry(buf->table[0].dwIndex);
|
2015-05-14 03:02:24 +02:00
|
|
|
for (i = 0; i < buf->dwNumEntries; i++)
|
|
|
|
{
|
|
|
|
ok (buf->table[i].wType != 0, "Test[%d]: expected wType > 0\n", i);
|
|
|
|
trace("Entry[%d]: addr %s, dwIndex %u, wType 0x%x\n", i,
|
|
|
|
ntoa(buf->table[i].dwAddr), buf->table[i].dwIndex, buf->table[i].wType);
|
|
|
|
}
|
|
|
|
}
|
2008-12-01 02:09:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetIfTable(void)
|
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetIfTable) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
ULONG dwSize = 0;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIfTable(NULL, NULL, FALSE);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetIfTable is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIfTable(NULL, NULL, FALSE) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIfTable(NULL, &dwSize, FALSE);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIfTable(NULL, &dwSize, FALSE) returned %d, expected ERROR_INSUFFICIENT_BUFFER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
|
2008-12-01 02:09:11 +01:00
|
|
|
PMIB_IFTABLE buf = HeapAlloc(GetProcessHeap(), 0, dwSize);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIfTable(buf, &dwSize, FALSE);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIfTable(buf, &dwSize, FALSE) returned %d, expected NO_ERROR\n\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
|
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
DWORD i, j;
|
|
|
|
char name[MAX_INTERFACE_NAME_LEN];
|
|
|
|
|
|
|
|
trace( "interface table: %u entries\n", buf->dwNumEntries );
|
|
|
|
for (i = 0; i < buf->dwNumEntries; i++)
|
|
|
|
{
|
|
|
|
MIB_IFROW *row = &buf->table[i];
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, row->wszName, -1, name, MAX_INTERFACE_NAME_LEN, NULL, NULL );
|
|
|
|
trace( "%u: '%s' type %u mtu %u speed %u phys",
|
|
|
|
row->dwIndex, name, row->dwType, row->dwMtu, row->dwSpeed );
|
|
|
|
for (j = 0; j < row->dwPhysAddrLen; j++)
|
|
|
|
printf( " %02x", row->bPhysAddr[j] );
|
|
|
|
printf( "\n" );
|
|
|
|
trace( " in: bytes %u upkts %u nupkts %u disc %u err %u unk %u\n",
|
|
|
|
row->dwInOctets, row->dwInUcastPkts, row->dwInNUcastPkts,
|
|
|
|
row->dwInDiscards, row->dwInErrors, row->dwInUnknownProtos );
|
|
|
|
trace( " out: bytes %u upkts %u nupkts %u disc %u err %u\n",
|
|
|
|
row->dwOutOctets, row->dwOutUcastPkts, row->dwOutNUcastPkts,
|
|
|
|
row->dwOutDiscards, row->dwOutErrors );
|
|
|
|
}
|
|
|
|
}
|
2008-12-01 02:09:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetIpForwardTable(void)
|
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetIpForwardTable) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
ULONG dwSize = 0;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpForwardTable(NULL, NULL, FALSE);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetIpForwardTable is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpForwardTable(NULL, NULL, FALSE) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpForwardTable(NULL, &dwSize, FALSE);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpForwardTable(NULL, &dwSize, FALSE) returned %d, expected ERROR_INSUFFICIENT_BUFFER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
|
2008-12-01 02:09:11 +01:00
|
|
|
PMIB_IPFORWARDTABLE buf = HeapAlloc(GetProcessHeap(), 0, dwSize);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpForwardTable(buf, &dwSize, FALSE);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpForwardTable(buf, &dwSize, FALSE) returned %d, expected NO_ERROR\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
|
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
DWORD i;
|
|
|
|
|
|
|
|
trace( "IP forward table: %u entries\n", buf->dwNumEntries );
|
|
|
|
for (i = 0; i < buf->dwNumEntries; i++)
|
|
|
|
{
|
2013-09-13 13:52:52 +02:00
|
|
|
char buffer[100];
|
2009-03-10 17:50:50 +01:00
|
|
|
sprintf( buffer, "dest %s", ntoa( buf->table[i].dwForwardDest ));
|
|
|
|
sprintf( buffer + strlen(buffer), " mask %s", ntoa( buf->table[i].dwForwardMask ));
|
|
|
|
trace( "%u: %s gw %s if %u type %u\n", i, buffer,
|
|
|
|
ntoa( buf->table[i].dwForwardNextHop ),
|
2011-12-15 10:06:24 +01:00
|
|
|
buf->table[i].dwForwardIfIndex, U1(buf->table[i]).dwForwardType );
|
2009-03-10 17:50:50 +01:00
|
|
|
}
|
|
|
|
}
|
2008-12-01 02:09:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void testGetIpNetTable(void)
|
2004-01-07 02:08:55 +01:00
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetIpNetTable) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
ULONG dwSize = 0;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpNetTable(NULL, NULL, FALSE);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetIpNetTable is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpNetTable(NULL, NULL, FALSE) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpNetTable(NULL, &dwSize, FALSE);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_NO_DATA || apiReturn == ERROR_INSUFFICIENT_BUFFER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpNetTable(NULL, &dwSize, FALSE) returned %d, expected ERROR_NO_DATA or ERROR_INSUFFICIENT_BUFFER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
if (apiReturn == ERROR_NO_DATA)
|
|
|
|
; /* empty ARP table's okay */
|
|
|
|
else if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
|
2008-12-01 02:09:11 +01:00
|
|
|
PMIB_IPNETTABLE buf = HeapAlloc(GetProcessHeap(), 0, dwSize);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpNetTable(buf, &dwSize, FALSE);
|
2008-12-30 14:09:03 +01:00
|
|
|
ok(apiReturn == NO_ERROR ||
|
|
|
|
apiReturn == ERROR_NO_DATA, /* empty ARP table's okay */
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpNetTable(buf, &dwSize, FALSE) returned %d, expected NO_ERROR\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
|
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
DWORD i, j;
|
|
|
|
|
|
|
|
trace( "IP net table: %u entries\n", buf->dwNumEntries );
|
|
|
|
for (i = 0; i < buf->dwNumEntries; i++)
|
|
|
|
{
|
|
|
|
trace( "%u: idx %u type %u addr %s phys",
|
2011-12-27 12:27:17 +01:00
|
|
|
i, buf->table[i].dwIndex, U(buf->table[i]).dwType, ntoa( buf->table[i].dwAddr ));
|
2009-03-10 17:50:50 +01:00
|
|
|
for (j = 0; j < buf->table[i].dwPhysAddrLen; j++)
|
|
|
|
printf( " %02x", buf->table[i].bPhysAddr[j] );
|
|
|
|
printf( "\n" );
|
|
|
|
}
|
|
|
|
}
|
2008-12-01 02:09:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void testGetIcmpStatistics(void)
|
2004-01-07 02:08:55 +01:00
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetIcmpStatistics) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
MIB_ICMP stats;
|
|
|
|
|
2008-06-06 21:34:32 +02:00
|
|
|
/* Crashes on Vista */
|
|
|
|
if (0) {
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIcmpStatistics(NULL);
|
2008-06-06 21:34:32 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED)
|
|
|
|
return;
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
|
|
|
"GetIcmpStatistics(NULL) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
|
|
|
apiReturn);
|
|
|
|
}
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIcmpStatistics(&stats);
|
2004-01-07 02:08:55 +01:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED)
|
2008-06-06 21:34:32 +02:00
|
|
|
{
|
|
|
|
skip("GetIcmpStatistics is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-06-06 21:34:32 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIcmpStatistics returned %d, expected NO_ERROR\n", apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
trace( "ICMP stats: %8s %8s\n", "in", "out" );
|
|
|
|
trace( " dwMsgs: %8u %8u\n", stats.stats.icmpInStats.dwMsgs, stats.stats.icmpOutStats.dwMsgs );
|
|
|
|
trace( " dwErrors: %8u %8u\n", stats.stats.icmpInStats.dwErrors, stats.stats.icmpOutStats.dwErrors );
|
|
|
|
trace( " dwDestUnreachs: %8u %8u\n", stats.stats.icmpInStats.dwDestUnreachs, stats.stats.icmpOutStats.dwDestUnreachs );
|
|
|
|
trace( " dwTimeExcds: %8u %8u\n", stats.stats.icmpInStats.dwTimeExcds, stats.stats.icmpOutStats.dwTimeExcds );
|
|
|
|
trace( " dwParmProbs: %8u %8u\n", stats.stats.icmpInStats.dwParmProbs, stats.stats.icmpOutStats.dwParmProbs );
|
|
|
|
trace( " dwSrcQuenchs: %8u %8u\n", stats.stats.icmpInStats.dwSrcQuenchs, stats.stats.icmpOutStats.dwSrcQuenchs );
|
|
|
|
trace( " dwRedirects: %8u %8u\n", stats.stats.icmpInStats.dwRedirects, stats.stats.icmpOutStats.dwRedirects );
|
|
|
|
trace( " dwEchos: %8u %8u\n", stats.stats.icmpInStats.dwEchos, stats.stats.icmpOutStats.dwEchos );
|
|
|
|
trace( " dwEchoReps: %8u %8u\n", stats.stats.icmpInStats.dwEchoReps, stats.stats.icmpOutStats.dwEchoReps );
|
|
|
|
trace( " dwTimestamps: %8u %8u\n", stats.stats.icmpInStats.dwTimestamps, stats.stats.icmpOutStats.dwTimestamps );
|
|
|
|
trace( " dwTimestampReps: %8u %8u\n", stats.stats.icmpInStats.dwTimestampReps, stats.stats.icmpOutStats.dwTimestampReps );
|
|
|
|
trace( " dwAddrMasks: %8u %8u\n", stats.stats.icmpInStats.dwAddrMasks, stats.stats.icmpOutStats.dwAddrMasks );
|
|
|
|
trace( " dwAddrMaskReps: %8u %8u\n", stats.stats.icmpInStats.dwAddrMaskReps, stats.stats.icmpOutStats.dwAddrMaskReps );
|
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void testGetIpStatistics(void)
|
2004-01-07 02:08:55 +01:00
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetIpStatistics) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
MIB_IPSTATS stats;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpStatistics(NULL);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetIpStatistics is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpStatistics(NULL) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetIpStatistics(&stats);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetIpStatistics returned %d, expected NO_ERROR\n", apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
trace( "IP stats:\n" );
|
2011-12-15 10:06:24 +01:00
|
|
|
trace( " dwForwarding: %u\n", U(stats).dwForwarding );
|
2009-03-10 17:50:50 +01:00
|
|
|
trace( " dwDefaultTTL: %u\n", stats.dwDefaultTTL );
|
|
|
|
trace( " dwInReceives: %u\n", stats.dwInReceives );
|
|
|
|
trace( " dwInHdrErrors: %u\n", stats.dwInHdrErrors );
|
|
|
|
trace( " dwInAddrErrors: %u\n", stats.dwInAddrErrors );
|
|
|
|
trace( " dwForwDatagrams: %u\n", stats.dwForwDatagrams );
|
|
|
|
trace( " dwInUnknownProtos: %u\n", stats.dwInUnknownProtos );
|
|
|
|
trace( " dwInDiscards: %u\n", stats.dwInDiscards );
|
|
|
|
trace( " dwInDelivers: %u\n", stats.dwInDelivers );
|
|
|
|
trace( " dwOutRequests: %u\n", stats.dwOutRequests );
|
|
|
|
trace( " dwRoutingDiscards: %u\n", stats.dwRoutingDiscards );
|
|
|
|
trace( " dwOutDiscards: %u\n", stats.dwOutDiscards );
|
|
|
|
trace( " dwOutNoRoutes: %u\n", stats.dwOutNoRoutes );
|
|
|
|
trace( " dwReasmTimeout: %u\n", stats.dwReasmTimeout );
|
|
|
|
trace( " dwReasmReqds: %u\n", stats.dwReasmReqds );
|
|
|
|
trace( " dwReasmOks: %u\n", stats.dwReasmOks );
|
|
|
|
trace( " dwReasmFails: %u\n", stats.dwReasmFails );
|
|
|
|
trace( " dwFragOks: %u\n", stats.dwFragOks );
|
|
|
|
trace( " dwFragFails: %u\n", stats.dwFragFails );
|
|
|
|
trace( " dwFragCreates: %u\n", stats.dwFragCreates );
|
|
|
|
trace( " dwNumIf: %u\n", stats.dwNumIf );
|
|
|
|
trace( " dwNumAddr: %u\n", stats.dwNumAddr );
|
|
|
|
trace( " dwNumRoutes: %u\n", stats.dwNumRoutes );
|
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void testGetTcpStatistics(void)
|
2004-01-07 02:08:55 +01:00
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetTcpStatistics) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
MIB_TCPSTATS stats;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetTcpStatistics(NULL);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetTcpStatistics is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetTcpStatistics(NULL) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetTcpStatistics(&stats);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetTcpStatistics returned %d, expected NO_ERROR\n", apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
trace( "TCP stats:\n" );
|
2011-12-15 10:06:24 +01:00
|
|
|
trace( " dwRtoAlgorithm: %u\n", U(stats).dwRtoAlgorithm );
|
2009-03-10 17:50:50 +01:00
|
|
|
trace( " dwRtoMin: %u\n", stats.dwRtoMin );
|
|
|
|
trace( " dwRtoMax: %u\n", stats.dwRtoMax );
|
|
|
|
trace( " dwMaxConn: %u\n", stats.dwMaxConn );
|
|
|
|
trace( " dwActiveOpens: %u\n", stats.dwActiveOpens );
|
|
|
|
trace( " dwPassiveOpens: %u\n", stats.dwPassiveOpens );
|
|
|
|
trace( " dwAttemptFails: %u\n", stats.dwAttemptFails );
|
|
|
|
trace( " dwEstabResets: %u\n", stats.dwEstabResets );
|
|
|
|
trace( " dwCurrEstab: %u\n", stats.dwCurrEstab );
|
|
|
|
trace( " dwInSegs: %u\n", stats.dwInSegs );
|
|
|
|
trace( " dwOutSegs: %u\n", stats.dwOutSegs );
|
|
|
|
trace( " dwRetransSegs: %u\n", stats.dwRetransSegs );
|
|
|
|
trace( " dwInErrs: %u\n", stats.dwInErrs );
|
|
|
|
trace( " dwOutRsts: %u\n", stats.dwOutRsts );
|
|
|
|
trace( " dwNumConns: %u\n", stats.dwNumConns );
|
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void testGetUdpStatistics(void)
|
2004-01-07 02:08:55 +01:00
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetUdpStatistics) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
MIB_UDPSTATS stats;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetUdpStatistics(NULL);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetUdpStatistics is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetUdpStatistics(NULL) returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetUdpStatistics(&stats);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetUdpStatistics returned %d, expected NO_ERROR\n", apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
trace( "UDP stats:\n" );
|
|
|
|
trace( " dwInDatagrams: %u\n", stats.dwInDatagrams );
|
|
|
|
trace( " dwNoPorts: %u\n", stats.dwNoPorts );
|
|
|
|
trace( " dwInErrors: %u\n", stats.dwInErrors );
|
|
|
|
trace( " dwOutDatagrams: %u\n", stats.dwOutDatagrams );
|
|
|
|
trace( " dwNumAddrs: %u\n", stats.dwNumAddrs );
|
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-27 22:11:07 +02:00
|
|
|
static void testGetIcmpStatisticsEx(void)
|
|
|
|
{
|
|
|
|
DWORD apiReturn;
|
|
|
|
MIB_ICMP_EX stats;
|
|
|
|
|
|
|
|
if (!pGetIcmpStatisticsEx)
|
|
|
|
{
|
2012-09-19 23:53:37 +02:00
|
|
|
win_skip( "GetIcmpStatisticsEx not available\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Crashes on Vista */
|
|
|
|
if (1) {
|
|
|
|
apiReturn = pGetIcmpStatisticsEx(NULL, AF_INET);
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
|
|
|
"GetIcmpStatisticsEx(NULL, AF_INET) returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
|
|
|
|
}
|
|
|
|
|
2012-09-19 23:53:37 +02:00
|
|
|
apiReturn = pGetIcmpStatisticsEx(&stats, AF_BAN);
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
|
|
|
"GetIcmpStatisticsEx(&stats, AF_BAN) returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
|
|
|
|
|
2012-04-27 22:11:07 +02:00
|
|
|
apiReturn = pGetIcmpStatisticsEx(&stats, AF_INET);
|
|
|
|
ok(apiReturn == NO_ERROR, "GetIcmpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
|
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
INT i;
|
2012-09-19 23:52:30 +02:00
|
|
|
trace( "ICMP IPv4 Ex stats: %8s %8s\n", "in", "out" );
|
2012-04-27 22:11:07 +02:00
|
|
|
trace( " dwMsgs: %8u %8u\n", stats.icmpInStats.dwMsgs, stats.icmpOutStats.dwMsgs );
|
|
|
|
trace( " dwErrors: %8u %8u\n", stats.icmpInStats.dwErrors, stats.icmpOutStats.dwErrors );
|
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
trace( " rgdwTypeCount[%3i]: %8u %8u\n", i, stats.icmpInStats.rgdwTypeCount[i], stats.icmpOutStats.rgdwTypeCount[i] );
|
|
|
|
}
|
|
|
|
|
|
|
|
apiReturn = pGetIcmpStatisticsEx(&stats, AF_INET6);
|
2012-05-03 10:10:45 +02:00
|
|
|
ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
|
|
|
|
"GetIcmpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
|
2012-04-27 22:11:07 +02:00
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
INT i;
|
2012-09-19 23:52:30 +02:00
|
|
|
trace( "ICMP IPv6 Ex stats: %8s %8s\n", "in", "out" );
|
2012-04-27 22:11:07 +02:00
|
|
|
trace( " dwMsgs: %8u %8u\n", stats.icmpInStats.dwMsgs, stats.icmpOutStats.dwMsgs );
|
|
|
|
trace( " dwErrors: %8u %8u\n", stats.icmpInStats.dwErrors, stats.icmpOutStats.dwErrors );
|
|
|
|
for (i = 0; i < 256; i++)
|
|
|
|
trace( " rgdwTypeCount[%3i]: %8u %8u\n", i, stats.icmpInStats.rgdwTypeCount[i], stats.icmpOutStats.rgdwTypeCount[i] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetIpStatisticsEx(void)
|
|
|
|
{
|
|
|
|
DWORD apiReturn;
|
|
|
|
MIB_IPSTATS stats;
|
|
|
|
|
|
|
|
if (!pGetIpStatisticsEx)
|
|
|
|
{
|
2012-09-19 23:48:59 +02:00
|
|
|
win_skip( "GetIpStatisticsEx not available\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
apiReturn = pGetIpStatisticsEx(NULL, AF_INET);
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
|
|
|
"GetIpStatisticsEx(NULL, AF_INET) returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
|
|
|
|
|
2012-09-19 23:48:59 +02:00
|
|
|
apiReturn = pGetIpStatisticsEx(&stats, AF_BAN);
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
|
|
|
"GetIpStatisticsEx(&stats, AF_BAN) returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
|
|
|
|
|
2012-04-27 22:11:07 +02:00
|
|
|
apiReturn = pGetIpStatisticsEx(&stats, AF_INET);
|
|
|
|
ok(apiReturn == NO_ERROR, "GetIpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
|
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
2012-09-19 23:52:30 +02:00
|
|
|
trace( "IP IPv4 Ex stats:\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
trace( " dwForwarding: %u\n", U(stats).dwForwarding );
|
|
|
|
trace( " dwDefaultTTL: %u\n", stats.dwDefaultTTL );
|
|
|
|
trace( " dwInReceives: %u\n", stats.dwInReceives );
|
|
|
|
trace( " dwInHdrErrors: %u\n", stats.dwInHdrErrors );
|
|
|
|
trace( " dwInAddrErrors: %u\n", stats.dwInAddrErrors );
|
|
|
|
trace( " dwForwDatagrams: %u\n", stats.dwForwDatagrams );
|
|
|
|
trace( " dwInUnknownProtos: %u\n", stats.dwInUnknownProtos );
|
|
|
|
trace( " dwInDiscards: %u\n", stats.dwInDiscards );
|
|
|
|
trace( " dwInDelivers: %u\n", stats.dwInDelivers );
|
|
|
|
trace( " dwOutRequests: %u\n", stats.dwOutRequests );
|
|
|
|
trace( " dwRoutingDiscards: %u\n", stats.dwRoutingDiscards );
|
|
|
|
trace( " dwOutDiscards: %u\n", stats.dwOutDiscards );
|
|
|
|
trace( " dwOutNoRoutes: %u\n", stats.dwOutNoRoutes );
|
|
|
|
trace( " dwReasmTimeout: %u\n", stats.dwReasmTimeout );
|
|
|
|
trace( " dwReasmReqds: %u\n", stats.dwReasmReqds );
|
|
|
|
trace( " dwReasmOks: %u\n", stats.dwReasmOks );
|
|
|
|
trace( " dwReasmFails: %u\n", stats.dwReasmFails );
|
|
|
|
trace( " dwFragOks: %u\n", stats.dwFragOks );
|
|
|
|
trace( " dwFragFails: %u\n", stats.dwFragFails );
|
|
|
|
trace( " dwFragCreates: %u\n", stats.dwFragCreates );
|
|
|
|
trace( " dwNumIf: %u\n", stats.dwNumIf );
|
|
|
|
trace( " dwNumAddr: %u\n", stats.dwNumAddr );
|
|
|
|
trace( " dwNumRoutes: %u\n", stats.dwNumRoutes );
|
|
|
|
}
|
|
|
|
|
|
|
|
apiReturn = pGetIpStatisticsEx(&stats, AF_INET6);
|
2012-05-03 10:10:45 +02:00
|
|
|
ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
|
|
|
|
"GetIpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
|
2012-04-27 22:11:07 +02:00
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
2012-09-19 23:52:30 +02:00
|
|
|
trace( "IP IPv6 Ex stats:\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
trace( " dwForwarding: %u\n", U(stats).dwForwarding );
|
|
|
|
trace( " dwDefaultTTL: %u\n", stats.dwDefaultTTL );
|
|
|
|
trace( " dwInReceives: %u\n", stats.dwInReceives );
|
|
|
|
trace( " dwInHdrErrors: %u\n", stats.dwInHdrErrors );
|
|
|
|
trace( " dwInAddrErrors: %u\n", stats.dwInAddrErrors );
|
|
|
|
trace( " dwForwDatagrams: %u\n", stats.dwForwDatagrams );
|
|
|
|
trace( " dwInUnknownProtos: %u\n", stats.dwInUnknownProtos );
|
|
|
|
trace( " dwInDiscards: %u\n", stats.dwInDiscards );
|
|
|
|
trace( " dwInDelivers: %u\n", stats.dwInDelivers );
|
|
|
|
trace( " dwOutRequests: %u\n", stats.dwOutRequests );
|
|
|
|
trace( " dwRoutingDiscards: %u\n", stats.dwRoutingDiscards );
|
|
|
|
trace( " dwOutDiscards: %u\n", stats.dwOutDiscards );
|
|
|
|
trace( " dwOutNoRoutes: %u\n", stats.dwOutNoRoutes );
|
|
|
|
trace( " dwReasmTimeout: %u\n", stats.dwReasmTimeout );
|
|
|
|
trace( " dwReasmReqds: %u\n", stats.dwReasmReqds );
|
|
|
|
trace( " dwReasmOks: %u\n", stats.dwReasmOks );
|
|
|
|
trace( " dwReasmFails: %u\n", stats.dwReasmFails );
|
|
|
|
trace( " dwFragOks: %u\n", stats.dwFragOks );
|
|
|
|
trace( " dwFragFails: %u\n", stats.dwFragFails );
|
|
|
|
trace( " dwFragCreates: %u\n", stats.dwFragCreates );
|
|
|
|
trace( " dwNumIf: %u\n", stats.dwNumIf );
|
|
|
|
trace( " dwNumAddr: %u\n", stats.dwNumAddr );
|
|
|
|
trace( " dwNumRoutes: %u\n", stats.dwNumRoutes );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetTcpStatisticsEx(void)
|
|
|
|
{
|
|
|
|
DWORD apiReturn;
|
|
|
|
MIB_TCPSTATS stats;
|
|
|
|
|
|
|
|
if (!pGetTcpStatisticsEx)
|
|
|
|
{
|
2012-09-20 23:57:33 +02:00
|
|
|
win_skip( "GetTcpStatisticsEx not available\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
apiReturn = pGetTcpStatisticsEx(NULL, AF_INET);
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
|
|
|
"GetTcpStatisticsEx(NULL, AF_INET); returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
|
|
|
|
|
2012-09-20 23:57:33 +02:00
|
|
|
apiReturn = pGetTcpStatisticsEx(&stats, AF_BAN);
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER || apiReturn == ERROR_NOT_SUPPORTED,
|
|
|
|
"GetTcpStatisticsEx(&stats, AF_BAN) returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
|
|
|
|
|
2012-04-27 22:11:07 +02:00
|
|
|
apiReturn = pGetTcpStatisticsEx(&stats, AF_INET);
|
|
|
|
ok(apiReturn == NO_ERROR, "GetTcpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
|
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
2012-09-19 23:52:30 +02:00
|
|
|
trace( "TCP IPv4 Ex stats:\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
trace( " dwRtoAlgorithm: %u\n", U(stats).dwRtoAlgorithm );
|
|
|
|
trace( " dwRtoMin: %u\n", stats.dwRtoMin );
|
|
|
|
trace( " dwRtoMax: %u\n", stats.dwRtoMax );
|
|
|
|
trace( " dwMaxConn: %u\n", stats.dwMaxConn );
|
|
|
|
trace( " dwActiveOpens: %u\n", stats.dwActiveOpens );
|
|
|
|
trace( " dwPassiveOpens: %u\n", stats.dwPassiveOpens );
|
|
|
|
trace( " dwAttemptFails: %u\n", stats.dwAttemptFails );
|
|
|
|
trace( " dwEstabResets: %u\n", stats.dwEstabResets );
|
|
|
|
trace( " dwCurrEstab: %u\n", stats.dwCurrEstab );
|
|
|
|
trace( " dwInSegs: %u\n", stats.dwInSegs );
|
|
|
|
trace( " dwOutSegs: %u\n", stats.dwOutSegs );
|
|
|
|
trace( " dwRetransSegs: %u\n", stats.dwRetransSegs );
|
|
|
|
trace( " dwInErrs: %u\n", stats.dwInErrs );
|
|
|
|
trace( " dwOutRsts: %u\n", stats.dwOutRsts );
|
|
|
|
trace( " dwNumConns: %u\n", stats.dwNumConns );
|
|
|
|
}
|
|
|
|
|
|
|
|
apiReturn = pGetTcpStatisticsEx(&stats, AF_INET6);
|
2012-09-20 23:57:33 +02:00
|
|
|
todo_wine ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
|
|
|
|
"GetTcpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
|
2012-04-27 22:11:07 +02:00
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
2012-09-19 23:52:30 +02:00
|
|
|
trace( "TCP IPv6 Ex stats:\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
trace( " dwRtoAlgorithm: %u\n", U(stats).dwRtoAlgorithm );
|
|
|
|
trace( " dwRtoMin: %u\n", stats.dwRtoMin );
|
|
|
|
trace( " dwRtoMax: %u\n", stats.dwRtoMax );
|
|
|
|
trace( " dwMaxConn: %u\n", stats.dwMaxConn );
|
|
|
|
trace( " dwActiveOpens: %u\n", stats.dwActiveOpens );
|
|
|
|
trace( " dwPassiveOpens: %u\n", stats.dwPassiveOpens );
|
|
|
|
trace( " dwAttemptFails: %u\n", stats.dwAttemptFails );
|
|
|
|
trace( " dwEstabResets: %u\n", stats.dwEstabResets );
|
|
|
|
trace( " dwCurrEstab: %u\n", stats.dwCurrEstab );
|
|
|
|
trace( " dwInSegs: %u\n", stats.dwInSegs );
|
|
|
|
trace( " dwOutSegs: %u\n", stats.dwOutSegs );
|
|
|
|
trace( " dwRetransSegs: %u\n", stats.dwRetransSegs );
|
|
|
|
trace( " dwInErrs: %u\n", stats.dwInErrs );
|
|
|
|
trace( " dwOutRsts: %u\n", stats.dwOutRsts );
|
|
|
|
trace( " dwNumConns: %u\n", stats.dwNumConns );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetUdpStatisticsEx(void)
|
|
|
|
{
|
|
|
|
DWORD apiReturn;
|
|
|
|
MIB_UDPSTATS stats;
|
|
|
|
|
|
|
|
if (!pGetUdpStatisticsEx)
|
|
|
|
{
|
2012-09-19 23:52:30 +02:00
|
|
|
win_skip( "GetUdpStatisticsEx not available\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
apiReturn = pGetUdpStatisticsEx(NULL, AF_INET);
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
|
|
|
"GetUdpStatisticsEx(NULL, AF_INET); returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
|
|
|
|
|
2012-09-19 23:52:30 +02:00
|
|
|
apiReturn = pGetUdpStatisticsEx(&stats, AF_BAN);
|
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER || apiReturn == ERROR_NOT_SUPPORTED,
|
|
|
|
"GetUdpStatisticsEx(&stats, AF_BAN) returned %d, expected ERROR_INVALID_PARAMETER\n", apiReturn);
|
|
|
|
|
2012-04-27 22:11:07 +02:00
|
|
|
apiReturn = pGetUdpStatisticsEx(&stats, AF_INET);
|
|
|
|
ok(apiReturn == NO_ERROR, "GetUdpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
|
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
2012-09-19 23:52:30 +02:00
|
|
|
trace( "UDP IPv4 Ex stats:\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
trace( " dwInDatagrams: %u\n", stats.dwInDatagrams );
|
|
|
|
trace( " dwNoPorts: %u\n", stats.dwNoPorts );
|
|
|
|
trace( " dwInErrors: %u\n", stats.dwInErrors );
|
|
|
|
trace( " dwOutDatagrams: %u\n", stats.dwOutDatagrams );
|
|
|
|
trace( " dwNumAddrs: %u\n", stats.dwNumAddrs );
|
|
|
|
}
|
|
|
|
|
|
|
|
apiReturn = pGetUdpStatisticsEx(&stats, AF_INET6);
|
2012-05-03 10:10:45 +02:00
|
|
|
ok(apiReturn == NO_ERROR || broken(apiReturn == ERROR_NOT_SUPPORTED),
|
|
|
|
"GetUdpStatisticsEx returned %d, expected NO_ERROR\n", apiReturn);
|
2012-04-27 22:11:07 +02:00
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
2012-09-19 23:52:30 +02:00
|
|
|
trace( "UDP IPv6 Ex stats:\n" );
|
2012-04-27 22:11:07 +02:00
|
|
|
trace( " dwInDatagrams: %u\n", stats.dwInDatagrams );
|
|
|
|
trace( " dwNoPorts: %u\n", stats.dwNoPorts );
|
|
|
|
trace( " dwInErrors: %u\n", stats.dwInErrors );
|
|
|
|
trace( " dwOutDatagrams: %u\n", stats.dwOutDatagrams );
|
|
|
|
trace( " dwNumAddrs: %u\n", stats.dwNumAddrs );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void testGetTcpTable(void)
|
2004-01-07 02:08:55 +01:00
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetTcpTable) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
ULONG dwSize = 0;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetTcpTable(NULL, &dwSize, FALSE);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetTcpTable is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2008-09-03 05:51:37 +02:00
|
|
|
ok(apiReturn == ERROR_INSUFFICIENT_BUFFER ||
|
|
|
|
broken(apiReturn == ERROR_NO_DATA), /* win95 */
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetTcpTable(NULL, &dwSize, FALSE) returned %d, expected ERROR_INSUFFICIENT_BUFFER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
|
2008-12-01 02:09:11 +01:00
|
|
|
PMIB_TCPTABLE buf = HeapAlloc(GetProcessHeap(), 0, dwSize);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetTcpTable(buf, &dwSize, FALSE);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetTcpTable(buf, &dwSize, FALSE) returned %d, expected NO_ERROR\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
|
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
DWORD i;
|
|
|
|
trace( "TCP table: %u entries\n", buf->dwNumEntries );
|
|
|
|
for (i = 0; i < buf->dwNumEntries; i++)
|
|
|
|
{
|
|
|
|
char buffer[40];
|
|
|
|
sprintf( buffer, "local %s:%u",
|
|
|
|
ntoa(buf->table[i].dwLocalAddr), ntohs(buf->table[i].dwLocalPort) );
|
|
|
|
trace( "%u: %s remote %s:%u state %u\n",
|
|
|
|
i, buffer, ntoa( buf->table[i].dwRemoteAddr ),
|
2011-12-15 10:06:24 +01:00
|
|
|
ntohs(buf->table[i].dwRemotePort), U(buf->table[i]).dwState );
|
2009-03-10 17:50:50 +01:00
|
|
|
}
|
|
|
|
}
|
2008-12-01 02:09:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-20 17:35:54 +02:00
|
|
|
static void testGetUdpTable(void)
|
2004-01-07 02:08:55 +01:00
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetUdpTable) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
ULONG dwSize = 0;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetUdpTable(NULL, &dwSize, FALSE);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetUdpTable is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetUdpTable(NULL, &dwSize, FALSE) returned %d, expected ERROR_INSUFFICIENT_BUFFER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
|
2008-12-01 02:09:11 +01:00
|
|
|
PMIB_UDPTABLE buf = HeapAlloc(GetProcessHeap(), 0, dwSize);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetUdpTable(buf, &dwSize, FALSE);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetUdpTable(buf, &dwSize, FALSE) returned %d, expected NO_ERROR\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2009-03-10 17:50:50 +01:00
|
|
|
|
|
|
|
if (apiReturn == NO_ERROR && winetest_debug > 1)
|
|
|
|
{
|
|
|
|
DWORD i;
|
|
|
|
trace( "UDP table: %u entries\n", buf->dwNumEntries );
|
|
|
|
for (i = 0; i < buf->dwNumEntries; i++)
|
|
|
|
trace( "%u: %s:%u\n",
|
|
|
|
i, ntoa( buf->table[i].dwLocalAddr ), ntohs(buf->table[i].dwLocalPort) );
|
|
|
|
}
|
2008-12-01 02:09:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-25 06:50:21 +02:00
|
|
|
static void testSetTcpEntry(void)
|
|
|
|
{
|
|
|
|
DWORD ret;
|
|
|
|
MIB_TCPROW row;
|
|
|
|
|
|
|
|
memset(&row, 0, sizeof(row));
|
|
|
|
if(0) /* This test crashes in OS >= VISTA */
|
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pSetTcpEntry(NULL);
|
2012-04-25 06:50:21 +02:00
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u, expected %u\n", ret, ERROR_INVALID_PARAMETER);
|
|
|
|
}
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pSetTcpEntry(&row);
|
2014-06-27 09:11:45 +02:00
|
|
|
if (ret == ERROR_NETWORK_ACCESS_DENIED)
|
|
|
|
{
|
|
|
|
win_skip("SetTcpEntry failed with access error. Skipping test.\n");
|
|
|
|
return;
|
|
|
|
}
|
2012-04-25 06:50:21 +02:00
|
|
|
todo_wine ok( ret == ERROR_INVALID_PARAMETER, "got %u, expected %u\n", ret, ERROR_INVALID_PARAMETER);
|
|
|
|
|
2012-04-29 11:34:20 +02:00
|
|
|
U(row).dwState = MIB_TCP_STATE_DELETE_TCB;
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pSetTcpEntry(&row);
|
2012-04-25 06:50:21 +02:00
|
|
|
todo_wine ok( ret == ERROR_MR_MID_NOT_FOUND || broken(ret == ERROR_INVALID_PARAMETER),
|
|
|
|
"got %u, expected %u\n", ret, ERROR_MR_MID_NOT_FOUND);
|
|
|
|
}
|
|
|
|
|
2014-01-07 07:00:19 +01:00
|
|
|
static void testIcmpSendEcho(void)
|
|
|
|
{
|
|
|
|
HANDLE icmp;
|
|
|
|
char senddata[32], replydata[sizeof(senddata) + sizeof(ICMP_ECHO_REPLY)];
|
|
|
|
DWORD ret, error, replysz = sizeof(replydata);
|
|
|
|
IPAddr address;
|
|
|
|
|
|
|
|
if (!pIcmpSendEcho || !pIcmpCreateFile)
|
|
|
|
{
|
2014-09-07 19:04:14 +02:00
|
|
|
win_skip( "IcmpSendEcho or IcmpCreateFile not available\n" );
|
2014-01-07 07:00:19 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
memset(senddata, 0, sizeof(senddata));
|
|
|
|
|
|
|
|
address = htonl(INADDR_LOOPBACK);
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = pIcmpSendEcho(INVALID_HANDLE_VALUE, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
|
|
|
|
todo_wine
|
|
|
|
ok (error == ERROR_INVALID_PARAMETER
|
|
|
|
|| broken(error == ERROR_INVALID_HANDLE) /* <= 2003 */,
|
|
|
|
"expected 87, got %d\n", error);
|
|
|
|
|
|
|
|
icmp = pIcmpCreateFile();
|
|
|
|
if (icmp == INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
error = GetLastError();
|
|
|
|
if (error == ERROR_ACCESS_DENIED)
|
|
|
|
{
|
|
|
|
skip ("ICMP is not available.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ok (icmp != INVALID_HANDLE_VALUE, "IcmpCreateFile failed unexpectedly with error %d\n", GetLastError());
|
|
|
|
|
|
|
|
address = 0;
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
|
|
|
|
ok (error == ERROR_INVALID_NETNAME
|
|
|
|
|| broken(error == IP_BAD_DESTINATION) /* <= 2003 */,
|
|
|
|
"expected 1214, got %d\n", error);
|
|
|
|
|
|
|
|
address = htonl(INADDR_LOOPBACK);
|
|
|
|
if (0) /* crashes in XP */
|
|
|
|
{
|
|
|
|
ret = pIcmpSendEcho(icmp, address, NULL, sizeof(senddata), NULL, replydata, replysz, 1000);
|
|
|
|
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, 0, NULL, replydata, replysz, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
ok (ret, "IcmpSendEcho failed unexpectedly with error %d\n", error);
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, NULL, 0, NULL, replydata, replysz, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
ok (ret, "IcmpSendEcho failed unexpectedly with error %d\n", error);
|
|
|
|
|
|
|
|
if (0) /* crashes in wine, remove IF when fixed */
|
|
|
|
{
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, NULL, replysz, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
|
|
|
|
ok (error == ERROR_INVALID_PARAMETER, "expected 87, got %d\n", error);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, 0, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
|
|
|
|
todo_wine
|
|
|
|
ok (error == ERROR_INVALID_PARAMETER
|
|
|
|
|| broken(error == ERROR_INSUFFICIENT_BUFFER) /* <= 2003 */,
|
|
|
|
"expected 87, got %d\n", error);
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, NULL, 0, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
|
|
|
|
todo_wine
|
|
|
|
ok (error == ERROR_INVALID_PARAMETER
|
|
|
|
|| broken(error == ERROR_INSUFFICIENT_BUFFER) /* <= 2003 */,
|
|
|
|
"expected 87, got %d\n", error);
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
2014-01-09 00:47:11 +01:00
|
|
|
replysz = sizeof(replydata) - 1;
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
|
2014-01-07 07:00:19 +01:00
|
|
|
error = GetLastError();
|
|
|
|
todo_wine {
|
|
|
|
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
|
|
|
|
ok (error == IP_GENERAL_FAILURE
|
|
|
|
|| broken(error == IP_BUF_TOO_SMALL) /* <= 2003 */,
|
|
|
|
"expected 11050, got %d\n", error);
|
|
|
|
}
|
|
|
|
|
2014-01-09 00:47:11 +01:00
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
replysz = sizeof(ICMP_ECHO_REPLY);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, 0, NULL, replydata, replysz, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
todo_wine
|
|
|
|
ok (ret, "IcmpSendEcho failed unexpectedly with error %d\n", error);
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
replysz = sizeof(ICMP_ECHO_REPLY) + ICMP_MINLEN;
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, ICMP_MINLEN, NULL, replydata, replysz, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
todo_wine
|
|
|
|
ok (ret, "IcmpSendEcho failed unexpectedly with error %d\n", error);
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
replysz = sizeof(ICMP_ECHO_REPLY) + ICMP_MINLEN;
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, ICMP_MINLEN + 1, NULL, replydata, replysz, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
|
|
|
|
todo_wine
|
|
|
|
ok (error == IP_GENERAL_FAILURE
|
|
|
|
|| broken(error == IP_BUF_TOO_SMALL) /* <= 2003 */,
|
|
|
|
"expected 11050, got %d\n", error);
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, ICMP_MINLEN, NULL, replydata, replysz - 1, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
ok (!ret, "IcmpSendEcho succeeded unexpectedly\n");
|
|
|
|
todo_wine
|
|
|
|
ok (error == IP_GENERAL_FAILURE
|
|
|
|
|| broken(error == IP_BUF_TOO_SMALL) /* <= 2003 */,
|
|
|
|
"expected 11050, got %d\n", error);
|
|
|
|
|
2014-01-07 07:00:19 +01:00
|
|
|
/* in windows >= vista the timeout can't be invalid */
|
|
|
|
SetLastError(0xdeadbeef);
|
2014-01-09 00:47:11 +01:00
|
|
|
replysz = sizeof(replydata);
|
2014-01-07 07:00:19 +01:00
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 0);
|
|
|
|
error = GetLastError();
|
|
|
|
if (!ret) ok(error == ERROR_INVALID_PARAMETER, "expected 87, got %d\n", error);
|
|
|
|
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, -1);
|
|
|
|
error = GetLastError();
|
|
|
|
if (!ret) ok(error == ERROR_INVALID_PARAMETER, "expected 87, got %d\n", error);
|
|
|
|
|
|
|
|
/* real ping test */
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
address = htonl(INADDR_LOOPBACK);
|
|
|
|
ret = pIcmpSendEcho(icmp, address, senddata, sizeof(senddata), NULL, replydata, replysz, 1000);
|
|
|
|
error = GetLastError();
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
PICMP_ECHO_REPLY pong = (PICMP_ECHO_REPLY) replydata;
|
2015-05-15 04:27:47 +02:00
|
|
|
trace ("send addr : %s\n", ntoa(address));
|
|
|
|
trace ("reply addr : %s\n", ntoa(pong->Address));
|
|
|
|
trace ("reply size : %u\n", replysz);
|
|
|
|
trace ("roundtrip : %u ms\n", pong->RoundTripTime);
|
|
|
|
trace ("status : %u\n", pong->Status);
|
|
|
|
trace ("recv size : %u\n", pong->DataSize);
|
|
|
|
trace ("ttl : %u\n", pong->Options.Ttl);
|
|
|
|
trace ("flags : 0x%x\n", pong->Options.Flags);
|
2014-01-07 07:00:19 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
skip ("Failed to ping with error %d, is lo interface down?.\n", error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-07 02:08:55 +01:00
|
|
|
/*
|
|
|
|
still-to-be-tested NT4-onward functions:
|
|
|
|
CreateIpForwardEntry
|
|
|
|
DeleteIpForwardEntry
|
|
|
|
CreateIpNetEntry
|
|
|
|
DeleteIpNetEntry
|
|
|
|
GetFriendlyIfIndex
|
|
|
|
GetRTTAndHopCount
|
|
|
|
SetIfEntry
|
|
|
|
SetIpForwardEntry
|
|
|
|
SetIpNetEntry
|
|
|
|
SetIpStatistics
|
|
|
|
SetIpTTL
|
|
|
|
*/
|
|
|
|
static void testWinNT4Functions(void)
|
|
|
|
{
|
|
|
|
testGetNumberOfInterfaces();
|
|
|
|
testGetIpAddrTable();
|
|
|
|
testGetIfTable();
|
|
|
|
testGetIpForwardTable();
|
|
|
|
testGetIpNetTable();
|
|
|
|
testGetIcmpStatistics();
|
|
|
|
testGetIpStatistics();
|
|
|
|
testGetTcpStatistics();
|
|
|
|
testGetUdpStatistics();
|
2012-04-27 22:11:07 +02:00
|
|
|
testGetIcmpStatisticsEx();
|
|
|
|
testGetIpStatisticsEx();
|
|
|
|
testGetTcpStatisticsEx();
|
|
|
|
testGetUdpStatisticsEx();
|
2004-01-07 02:08:55 +01:00
|
|
|
testGetTcpTable();
|
|
|
|
testGetUdpTable();
|
2012-04-25 06:50:21 +02:00
|
|
|
testSetTcpEntry();
|
2014-01-07 07:00:19 +01:00
|
|
|
testIcmpSendEcho();
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetInterfaceInfo(void)
|
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetInterfaceInfo) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
ULONG len = 0;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetInterfaceInfo(NULL, NULL);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetInterfaceInfo is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetInterfaceInfo returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetInterfaceInfo(NULL, &len);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INSUFFICIENT_BUFFER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetInterfaceInfo returned %d, expected ERROR_INSUFFICIENT_BUFFER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
if (apiReturn == ERROR_INSUFFICIENT_BUFFER) {
|
2008-12-01 02:09:11 +01:00
|
|
|
PIP_INTERFACE_INFO buf = HeapAlloc(GetProcessHeap(), 0, len);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetInterfaceInfo(buf, &len);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetInterfaceInfo(buf, &dwSize) returned %d, expected NO_ERROR\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2008-12-01 02:09:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetAdaptersInfo(void)
|
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetAdaptersInfo) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
ULONG len = 0;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetAdaptersInfo(NULL, NULL);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetAdaptersInfo is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetAdaptersInfo returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetAdaptersInfo(NULL, &len);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_NO_DATA || apiReturn == ERROR_BUFFER_OVERFLOW,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetAdaptersInfo returned %d, expected ERROR_NO_DATA or ERROR_BUFFER_OVERFLOW\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
if (apiReturn == ERROR_NO_DATA)
|
|
|
|
; /* no adapter's, that's okay */
|
|
|
|
else if (apiReturn == ERROR_BUFFER_OVERFLOW) {
|
2015-01-15 13:13:34 +01:00
|
|
|
PIP_ADAPTER_INFO ptr, buf = HeapAlloc(GetProcessHeap(), 0, len);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetAdaptersInfo(buf, &len);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetAdaptersInfo(buf, &dwSize) returned %d, expected NO_ERROR\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2015-01-15 13:13:34 +01:00
|
|
|
ptr = buf;
|
|
|
|
while (ptr) {
|
|
|
|
ok(ptr->IpAddressList.IpAddress.String[0], "A valid IP must be present\n");
|
|
|
|
ok(ptr->IpAddressList.IpMask.String[0], "A valid mask must be present\n");
|
|
|
|
trace("Adapter '%s', IP %s, Mask %s\n", ptr->AdapterName,
|
|
|
|
ptr->IpAddressList.IpAddress.String, ptr->IpAddressList.IpMask.String);
|
|
|
|
ptr = ptr->Next;
|
|
|
|
}
|
2008-12-01 02:09:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void testGetNetworkParams(void)
|
|
|
|
{
|
2012-04-25 17:16:24 +02:00
|
|
|
if (pGetNetworkParams) {
|
2004-01-07 02:08:55 +01:00
|
|
|
DWORD apiReturn;
|
|
|
|
ULONG len = 0;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetNetworkParams(NULL, NULL);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (apiReturn == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetNetworkParams is not supported\n");
|
2004-01-07 02:08:55 +01:00
|
|
|
return;
|
2008-08-04 14:29:41 +02:00
|
|
|
}
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_INVALID_PARAMETER,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetNetworkParams returned %d, expected ERROR_INVALID_PARAMETER\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetNetworkParams(NULL, &len);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == ERROR_BUFFER_OVERFLOW,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetNetworkParams returned %d, expected ERROR_BUFFER_OVERFLOW\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
|
|
|
if (apiReturn == ERROR_BUFFER_OVERFLOW) {
|
2008-12-01 02:09:11 +01:00
|
|
|
PFIXED_INFO buf = HeapAlloc(GetProcessHeap(), 0, len);
|
2004-01-07 02:08:55 +01:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
apiReturn = pGetNetworkParams(buf, &len);
|
2004-01-07 02:08:55 +01:00
|
|
|
ok(apiReturn == NO_ERROR,
|
2006-10-07 20:18:10 +02:00
|
|
|
"GetNetworkParams(buf, &dwSize) returned %d, expected NO_ERROR\n",
|
2004-01-07 02:08:55 +01:00
|
|
|
apiReturn);
|
2008-12-01 02:09:11 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, buf);
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
still-to-be-tested 98-onward functions:
|
|
|
|
GetBestInterface
|
|
|
|
GetBestRoute
|
|
|
|
IpReleaseAddress
|
|
|
|
IpRenewAddress
|
|
|
|
*/
|
2010-02-08 15:25:36 +01:00
|
|
|
static DWORD CALLBACK testWin98Functions(void *p)
|
2004-01-07 02:08:55 +01:00
|
|
|
{
|
|
|
|
testGetInterfaceInfo();
|
|
|
|
testGetAdaptersInfo();
|
|
|
|
testGetNetworkParams();
|
2010-02-08 15:25:36 +01:00
|
|
|
return 0;
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
|
2008-07-02 17:27:37 +02:00
|
|
|
static void testGetPerAdapterInfo(void)
|
|
|
|
{
|
|
|
|
DWORD ret, needed;
|
|
|
|
void *buffer;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
if (!pGetPerAdapterInfo) return;
|
|
|
|
ret = pGetPerAdapterInfo(1, NULL, NULL);
|
2008-08-04 14:29:41 +02:00
|
|
|
if (ret == ERROR_NOT_SUPPORTED) {
|
|
|
|
skip("GetPerAdapterInfo is not supported\n");
|
|
|
|
return;
|
|
|
|
}
|
2008-07-02 17:27:37 +02:00
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u instead of ERROR_INVALID_PARAMETER\n", ret );
|
|
|
|
needed = 0xdeadbeef;
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetPerAdapterInfo(1, NULL, &needed);
|
2008-07-02 17:27:37 +02:00
|
|
|
if (ret == ERROR_NO_DATA) return; /* no such adapter */
|
|
|
|
ok( ret == ERROR_BUFFER_OVERFLOW, "got %u instead of ERROR_BUFFER_OVERFLOW\n", ret );
|
|
|
|
ok( needed != 0xdeadbeef, "needed not set\n" );
|
|
|
|
buffer = HeapAlloc( GetProcessHeap(), 0, needed );
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetPerAdapterInfo(1, buffer, &needed);
|
2008-07-02 17:27:37 +02:00
|
|
|
ok( ret == NO_ERROR, "got %u instead of NO_ERROR\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, buffer );
|
|
|
|
}
|
|
|
|
|
2011-02-08 19:43:59 +01:00
|
|
|
static void testNotifyAddrChange(void)
|
|
|
|
{
|
|
|
|
DWORD ret, bytes;
|
|
|
|
OVERLAPPED overlapped;
|
|
|
|
HANDLE handle;
|
|
|
|
BOOL success;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
if (!pNotifyAddrChange)
|
2011-02-08 19:43:59 +01:00
|
|
|
{
|
|
|
|
win_skip("NotifyAddrChange not present\n");
|
|
|
|
return;
|
|
|
|
}
|
2012-04-25 17:16:24 +02:00
|
|
|
if (!pCancelIPChangeNotify)
|
2011-02-08 19:43:59 +01:00
|
|
|
{
|
|
|
|
win_skip("CancelIPChangeNotify not present\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
handle = NULL;
|
|
|
|
ZeroMemory(&overlapped, sizeof(overlapped));
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pNotifyAddrChange(&handle, &overlapped);
|
2011-02-08 19:43:59 +01:00
|
|
|
if (ret == ERROR_NOT_SUPPORTED)
|
|
|
|
{
|
|
|
|
win_skip("NotifyAddrChange is not supported\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(ret == ERROR_IO_PENDING, "NotifyAddrChange returned %d, expected ERROR_IO_PENDING\n", ret);
|
|
|
|
ret = GetLastError();
|
2011-05-09 09:03:40 +02:00
|
|
|
todo_wine ok(ret == ERROR_IO_PENDING, "GetLastError returned %d, expected ERROR_IO_PENDING\n", ret);
|
2012-04-25 17:16:24 +02:00
|
|
|
success = pCancelIPChangeNotify(&overlapped);
|
2011-02-08 19:43:59 +01:00
|
|
|
todo_wine ok(success == TRUE, "CancelIPChangeNotify returned FALSE, expected TRUE\n");
|
|
|
|
|
|
|
|
ZeroMemory(&overlapped, sizeof(overlapped));
|
2012-04-25 17:16:24 +02:00
|
|
|
success = pCancelIPChangeNotify(&overlapped);
|
2011-02-08 19:43:59 +01:00
|
|
|
ok(success == FALSE, "CancelIPChangeNotify returned TRUE, expected FALSE\n");
|
|
|
|
|
|
|
|
handle = NULL;
|
|
|
|
ZeroMemory(&overlapped, sizeof(overlapped));
|
2013-10-01 23:17:55 +02:00
|
|
|
overlapped.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pNotifyAddrChange(&handle, &overlapped);
|
2011-02-08 19:43:59 +01:00
|
|
|
ok(ret == ERROR_IO_PENDING, "NotifyAddrChange returned %d, expected ERROR_IO_PENDING\n", ret);
|
|
|
|
todo_wine ok(handle != INVALID_HANDLE_VALUE, "NotifyAddrChange returned invalid file handle\n");
|
|
|
|
success = GetOverlappedResult(handle, &overlapped, &bytes, FALSE);
|
2011-05-22 09:22:45 +02:00
|
|
|
ok(success == FALSE, "GetOverlappedResult returned TRUE, expected FALSE\n");
|
2011-02-08 19:43:59 +01:00
|
|
|
ret = GetLastError();
|
2011-05-22 09:22:45 +02:00
|
|
|
ok(ret == ERROR_IO_INCOMPLETE, "GetLastError returned %d, expected ERROR_IO_INCOMPLETE\n", ret);
|
2012-04-25 17:16:24 +02:00
|
|
|
success = pCancelIPChangeNotify(&overlapped);
|
2011-02-08 19:43:59 +01:00
|
|
|
todo_wine ok(success == TRUE, "CancelIPChangeNotify returned FALSE, expected TRUE\n");
|
|
|
|
|
|
|
|
if (winetest_interactive)
|
|
|
|
{
|
|
|
|
handle = NULL;
|
|
|
|
ZeroMemory(&overlapped, sizeof(overlapped));
|
2013-10-01 23:17:55 +02:00
|
|
|
overlapped.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
2011-05-09 09:03:40 +02:00
|
|
|
trace("Testing asynchronous ipv4 address change notification. Please "
|
|
|
|
"change the ipv4 address of one of your network interfaces\n");
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pNotifyAddrChange(&handle, &overlapped);
|
2011-02-08 19:43:59 +01:00
|
|
|
ok(ret == ERROR_IO_PENDING, "NotifyAddrChange returned %d, expected NO_ERROR\n", ret);
|
|
|
|
success = GetOverlappedResult(handle, &overlapped, &bytes, TRUE);
|
2011-05-09 09:03:40 +02:00
|
|
|
ok(success == TRUE, "GetOverlappedResult returned FALSE, expected TRUE\n");
|
2011-02-08 19:43:59 +01:00
|
|
|
}
|
|
|
|
|
2011-05-09 09:03:40 +02:00
|
|
|
/* test synchronous functionality */
|
2011-02-08 19:43:59 +01:00
|
|
|
if (winetest_interactive)
|
|
|
|
{
|
2011-05-09 09:03:40 +02:00
|
|
|
trace("Testing synchronous ipv4 address change notification. Please "
|
|
|
|
"change the ipv4 address of one of your network interfaces\n");
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pNotifyAddrChange(NULL, NULL);
|
2011-02-08 19:43:59 +01:00
|
|
|
todo_wine ok(ret == NO_ERROR, "NotifyAddrChange returned %d, expected NO_ERROR\n", ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-07 02:08:55 +01:00
|
|
|
/*
|
|
|
|
still-to-be-tested 2K-onward functions:
|
|
|
|
AddIPAddress
|
|
|
|
CreateProxyArpEntry
|
|
|
|
DeleteIPAddress
|
|
|
|
DeleteProxyArpEntry
|
|
|
|
EnableRouter
|
|
|
|
FlushIpNetTable
|
|
|
|
GetAdapterIndex
|
2011-02-08 19:43:59 +01:00
|
|
|
NotifyRouteChange + CancelIPChangeNotify
|
2004-01-07 02:08:55 +01:00
|
|
|
SendARP
|
|
|
|
UnenableRouter
|
|
|
|
*/
|
|
|
|
static void testWin2KFunctions(void)
|
|
|
|
{
|
2008-07-02 17:27:37 +02:00
|
|
|
testGetPerAdapterInfo();
|
2011-02-08 19:43:59 +01:00
|
|
|
testNotifyAddrChange();
|
2004-01-07 02:08:55 +01:00
|
|
|
}
|
|
|
|
|
2009-04-29 11:57:48 +02:00
|
|
|
static void test_GetAdaptersAddresses(void)
|
|
|
|
{
|
2015-04-16 06:23:26 +02:00
|
|
|
ULONG ret, size, osize, i;
|
2010-12-27 08:56:21 +01:00
|
|
|
IP_ADAPTER_ADDRESSES *aa, *ptr;
|
2009-04-29 11:57:48 +02:00
|
|
|
IP_ADAPTER_UNICAST_ADDRESS *ua;
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
if (!pGetAdaptersAddresses)
|
2009-04-29 11:57:48 +02:00
|
|
|
{
|
|
|
|
win_skip("GetAdaptersAddresses not present\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetAdaptersAddresses(AF_UNSPEC, 0, NULL, NULL, NULL);
|
2009-04-29 11:57:48 +02:00
|
|
|
ok(ret == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", ret);
|
|
|
|
|
2010-12-27 08:56:21 +01:00
|
|
|
/* size should be ignored and overwritten if buffer is NULL */
|
|
|
|
size = 0x7fffffff;
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetAdaptersAddresses(AF_UNSPEC, 0, NULL, NULL, &size);
|
2009-04-29 11:57:48 +02:00
|
|
|
ok(ret == ERROR_BUFFER_OVERFLOW, "expected ERROR_BUFFER_OVERFLOW, got %u\n", ret);
|
|
|
|
if (ret != ERROR_BUFFER_OVERFLOW) return;
|
|
|
|
|
2010-12-27 08:56:21 +01:00
|
|
|
ptr = HeapAlloc(GetProcessHeap(), 0, size);
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetAdaptersAddresses(AF_UNSPEC, 0, NULL, ptr, &size);
|
2009-04-29 11:57:48 +02:00
|
|
|
ok(!ret, "expected ERROR_SUCCESS got %u\n", ret);
|
2015-04-16 06:23:26 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, ptr);
|
|
|
|
|
|
|
|
/* higher size must not be changed to lower size */
|
|
|
|
size *= 2;
|
|
|
|
osize = size;
|
|
|
|
ptr = HeapAlloc(GetProcessHeap(), 0, osize);
|
|
|
|
ret = pGetAdaptersAddresses(AF_UNSPEC, 0, NULL, ptr, &osize);
|
|
|
|
ok(!ret, "expected ERROR_SUCCESS got %u\n", ret);
|
|
|
|
ok(osize == size, "expected %d, got %d\n", size, osize);
|
2009-04-29 11:57:48 +02:00
|
|
|
|
2010-12-27 08:56:21 +01:00
|
|
|
for (aa = ptr; !ret && aa; aa = aa->Next)
|
2009-04-29 11:57:48 +02:00
|
|
|
{
|
2015-04-16 06:23:26 +02:00
|
|
|
char temp[128];
|
|
|
|
|
|
|
|
ok(S(U(*aa)).Length == sizeof(IP_ADAPTER_ADDRESSES_LH) ||
|
|
|
|
S(U(*aa)).Length == sizeof(IP_ADAPTER_ADDRESSES_XP),
|
|
|
|
"Unknown structure size of %u bytes\n", S(U(*aa)).Length);
|
2010-12-27 08:56:21 +01:00
|
|
|
ok(aa->DnsSuffix != NULL, "DnsSuffix is not a valid pointer\n");
|
|
|
|
ok(aa->Description != NULL, "Description is not a valid pointer\n");
|
|
|
|
ok(aa->FriendlyName != NULL, "FriendlyName is not a valid pointer\n");
|
|
|
|
|
2015-04-16 06:23:26 +02:00
|
|
|
trace("\n");
|
2009-08-31 11:52:21 +02:00
|
|
|
trace("Length: %u\n", S(U(*aa)).Length);
|
|
|
|
trace("IfIndex: %u\n", S(U(*aa)).IfIndex);
|
2009-04-29 11:57:48 +02:00
|
|
|
trace("Next: %p\n", aa->Next);
|
|
|
|
trace("AdapterName: %s\n", aa->AdapterName);
|
|
|
|
trace("FirstUnicastAddress: %p\n", aa->FirstUnicastAddress);
|
|
|
|
ua = aa->FirstUnicastAddress;
|
|
|
|
while (ua)
|
|
|
|
{
|
2015-04-16 06:23:26 +02:00
|
|
|
ok(ua->PrefixOrigin != IpPrefixOriginOther,
|
|
|
|
"bad address config value %d\n", ua->PrefixOrigin);
|
|
|
|
ok(ua->SuffixOrigin != IpSuffixOriginOther,
|
|
|
|
"bad address config value %d\n", ua->PrefixOrigin);
|
|
|
|
/* Address configured manually or from DHCP server? */
|
|
|
|
if (ua->PrefixOrigin == IpPrefixOriginManual ||
|
|
|
|
ua->PrefixOrigin == IpPrefixOriginDhcp)
|
|
|
|
{
|
|
|
|
ok(ua->ValidLifetime, "expected non-zero value\n");
|
|
|
|
ok(ua->PreferredLifetime, "expected non-zero value\n");
|
|
|
|
ok(ua->LeaseLifetime, "expected non-zero\n");
|
|
|
|
}
|
|
|
|
/* Is the address ok in the network (not duplicated)? */
|
|
|
|
ok(ua->DadState != IpDadStateInvalid && ua->DadState != IpDadStateDuplicate,
|
|
|
|
"bad address duplication value %d\n", ua->DadState);
|
2009-08-31 11:52:21 +02:00
|
|
|
trace("\tLength: %u\n", S(U(*ua)).Length);
|
|
|
|
trace("\tFlags: 0x%08x\n", S(U(*ua)).Flags);
|
2009-04-29 11:57:48 +02:00
|
|
|
trace("\tNext: %p\n", ua->Next);
|
|
|
|
trace("\tAddress.lpSockaddr: %p\n", ua->Address.lpSockaddr);
|
|
|
|
trace("\tAddress.iSockaddrLength: %d\n", ua->Address.iSockaddrLength);
|
|
|
|
trace("\tPrefixOrigin: %u\n", ua->PrefixOrigin);
|
|
|
|
trace("\tSuffixOrigin: %u\n", ua->SuffixOrigin);
|
|
|
|
trace("\tDadState: %u\n", ua->DadState);
|
2015-04-16 06:23:26 +02:00
|
|
|
trace("\tValidLifetime: %u seconds\n", ua->ValidLifetime);
|
|
|
|
trace("\tPreferredLifetime: %u seconds\n", ua->PreferredLifetime);
|
|
|
|
trace("\tLeaseLifetime: %u seconds\n", ua->LeaseLifetime);
|
2009-04-29 11:57:48 +02:00
|
|
|
trace("\n");
|
|
|
|
ua = ua->Next;
|
|
|
|
}
|
|
|
|
trace("FirstAnycastAddress: %p\n", aa->FirstAnycastAddress);
|
|
|
|
trace("FirstMulticastAddress: %p\n", aa->FirstMulticastAddress);
|
|
|
|
trace("FirstDnsServerAddress: %p\n", aa->FirstDnsServerAddress);
|
2015-04-16 06:23:26 +02:00
|
|
|
trace("DnsSuffix: %s %p\n", wine_dbgstr_w(aa->DnsSuffix), aa->DnsSuffix);
|
|
|
|
trace("Description: %s %p\n", wine_dbgstr_w(aa->Description), aa->Description);
|
|
|
|
trace("FriendlyName: %s %p\n", wine_dbgstr_w(aa->FriendlyName), aa->FriendlyName);
|
2009-04-29 11:57:48 +02:00
|
|
|
trace("PhysicalAddressLength: %u\n", aa->PhysicalAddressLength);
|
2015-04-16 06:23:26 +02:00
|
|
|
for (i = 0; i < aa->PhysicalAddressLength; i++)
|
|
|
|
sprintf(temp + i * 3, "%02X-", aa->PhysicalAddress[i]);
|
|
|
|
temp[i ? i * 3 - 1 : 0] = '\0';
|
|
|
|
trace("PhysicalAddress: %s\n", temp);
|
2009-04-29 11:57:48 +02:00
|
|
|
trace("Flags: 0x%08x\n", aa->Flags);
|
|
|
|
trace("Mtu: %u\n", aa->Mtu);
|
|
|
|
trace("IfType: %u\n", aa->IfType);
|
|
|
|
trace("OperStatus: %u\n", aa->OperStatus);
|
2015-04-16 06:23:26 +02:00
|
|
|
trace("Ipv6IfIndex: %u\n", aa->Ipv6IfIndex);
|
|
|
|
for (i = 0, temp[0] = '\0'; i < sizeof(aa->ZoneIndices) / sizeof(aa->ZoneIndices[0]); i++)
|
|
|
|
sprintf(temp + strlen(temp), "%d ", aa->ZoneIndices[i]);
|
|
|
|
trace("ZoneIndices: %s\n", temp);
|
|
|
|
trace("FirstPrefix: %p\n", aa->FirstPrefix);
|
|
|
|
|
|
|
|
if (S(U(*aa)).Length < sizeof(IP_ADAPTER_ADDRESSES_LH)) continue;
|
|
|
|
trace("TransmitLinkSpeed: %s\n", debugstr_longlong(aa->TransmitLinkSpeed));
|
|
|
|
trace("ReceiveLinkSpeed: %s\n", debugstr_longlong(aa->ReceiveLinkSpeed));
|
|
|
|
trace("FirstWinsServerAddress:%p\n", aa->FirstWinsServerAddress);
|
|
|
|
trace("FirstGatewayAddress: %p\n", aa->FirstGatewayAddress);
|
|
|
|
trace("Ipv4Metric: %u\n", aa->Ipv4Metric);
|
|
|
|
trace("Ipv6Metric: %u\n", aa->Ipv6Metric);
|
|
|
|
trace("Luid: %p\n", &aa->Luid);
|
|
|
|
trace("Dhcpv4Server: %p\n", &aa->Dhcpv4Server);
|
|
|
|
trace("CompartmentId: %u\n", aa->CompartmentId);
|
|
|
|
trace("NetworkGuid: %s\n", wine_dbgstr_guid((GUID*) &aa->NetworkGuid));
|
|
|
|
trace("ConnectionType: %u\n", aa->ConnectionType);
|
|
|
|
trace("TunnelType: %u\n", aa->TunnelType);
|
|
|
|
trace("Dhcpv6Server: %p\n", &aa->Dhcpv6Server);
|
|
|
|
trace("Dhcpv6ClientDuidLength:%u\n", aa->Dhcpv6ClientDuidLength);
|
|
|
|
trace("Dhcpv6ClientDuid: %p\n", aa->Dhcpv6ClientDuid);
|
|
|
|
trace("Dhcpv6Iaid: %u\n", aa->Dhcpv6Iaid);
|
|
|
|
trace("FirstDnsSuffix: %p\n", aa->FirstDnsSuffix);
|
2009-04-29 11:57:48 +02:00
|
|
|
trace("\n");
|
|
|
|
}
|
2010-12-27 08:56:21 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, ptr);
|
2009-04-29 11:57:48 +02:00
|
|
|
}
|
|
|
|
|
2012-04-16 12:35:44 +02:00
|
|
|
static void test_GetExtendedTcpTable(void)
|
|
|
|
{
|
|
|
|
DWORD ret, size;
|
|
|
|
MIB_TCPTABLE *table;
|
|
|
|
MIB_TCPTABLE_OWNER_PID *table_pid;
|
2013-07-30 12:57:50 +02:00
|
|
|
MIB_TCPTABLE_OWNER_MODULE *table_module;
|
2012-04-16 12:35:44 +02:00
|
|
|
|
2012-04-25 17:16:24 +02:00
|
|
|
if (!pGetExtendedTcpTable)
|
2012-04-16 12:35:44 +02:00
|
|
|
{
|
|
|
|
win_skip("GetExtendedTcpTable not available\n");
|
|
|
|
return;
|
|
|
|
}
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetExtendedTcpTable( NULL, NULL, TRUE, AF_INET, TCP_TABLE_BASIC_ALL, 0 );
|
2012-04-16 12:35:44 +02:00
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
size = 0;
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_BASIC_ALL, 0 );
|
2012-04-16 12:35:44 +02:00
|
|
|
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
|
|
|
|
|
|
|
|
table = HeapAlloc( GetProcessHeap(), 0, size );
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetExtendedTcpTable( table, &size, TRUE, AF_INET, TCP_TABLE_BASIC_ALL, 0 );
|
2012-04-16 12:35:44 +02:00
|
|
|
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, table );
|
|
|
|
|
2013-07-30 12:56:57 +02:00
|
|
|
size = 0;
|
|
|
|
ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_BASIC_LISTENER, 0 );
|
|
|
|
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
|
|
|
|
|
|
|
|
table = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
ret = pGetExtendedTcpTable( table, &size, TRUE, AF_INET, TCP_TABLE_BASIC_LISTENER, 0 );
|
|
|
|
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, table );
|
|
|
|
|
2012-04-16 12:35:44 +02:00
|
|
|
size = 0;
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0 );
|
2012-04-16 12:35:44 +02:00
|
|
|
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
|
|
|
|
|
|
|
|
table_pid = HeapAlloc( GetProcessHeap(), 0, size );
|
2012-04-25 17:16:24 +02:00
|
|
|
ret = pGetExtendedTcpTable( table_pid, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0 );
|
2012-04-16 12:35:44 +02:00
|
|
|
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, table_pid );
|
2013-07-30 12:56:57 +02:00
|
|
|
|
|
|
|
size = 0;
|
|
|
|
ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_LISTENER, 0 );
|
|
|
|
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
|
|
|
|
|
|
|
|
table_pid = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
ret = pGetExtendedTcpTable( table_pid, &size, TRUE, AF_INET, TCP_TABLE_OWNER_PID_LISTENER, 0 );
|
|
|
|
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, table_pid );
|
2013-07-30 12:57:50 +02:00
|
|
|
|
|
|
|
size = 0;
|
|
|
|
ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_OWNER_MODULE_ALL, 0 );
|
|
|
|
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
|
|
|
|
|
|
|
|
table_module = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
ret = pGetExtendedTcpTable( table_module, &size, TRUE, AF_INET, TCP_TABLE_OWNER_MODULE_ALL, 0 );
|
|
|
|
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, table_module );
|
|
|
|
|
|
|
|
size = 0;
|
|
|
|
ret = pGetExtendedTcpTable( NULL, &size, TRUE, AF_INET, TCP_TABLE_OWNER_MODULE_LISTENER, 0 );
|
|
|
|
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
|
|
|
|
|
|
|
|
table_module = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
ret = pGetExtendedTcpTable( table_module, &size, TRUE, AF_INET, TCP_TABLE_OWNER_MODULE_LISTENER, 0 );
|
|
|
|
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, table_module );
|
2012-04-16 12:35:44 +02:00
|
|
|
}
|
|
|
|
|
2012-09-07 13:35:36 +02:00
|
|
|
static void test_GetExtendedUdpTable(void)
|
|
|
|
{
|
|
|
|
DWORD ret, size;
|
|
|
|
MIB_UDPTABLE *table;
|
|
|
|
MIB_UDPTABLE_OWNER_PID *table_pid;
|
2013-07-30 12:57:50 +02:00
|
|
|
MIB_UDPTABLE_OWNER_MODULE *table_module;
|
2012-09-07 13:35:36 +02:00
|
|
|
|
|
|
|
if (!pGetExtendedUdpTable)
|
|
|
|
{
|
|
|
|
win_skip("GetExtendedUdpTable not available\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ret = pGetExtendedUdpTable( NULL, NULL, TRUE, AF_INET, UDP_TABLE_BASIC, 0 );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
size = 0;
|
|
|
|
ret = pGetExtendedUdpTable( NULL, &size, TRUE, AF_INET, UDP_TABLE_BASIC, 0 );
|
|
|
|
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
|
|
|
|
|
|
|
|
table = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
ret = pGetExtendedUdpTable( table, &size, TRUE, AF_INET, UDP_TABLE_BASIC, 0 );
|
|
|
|
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, table );
|
|
|
|
|
|
|
|
size = 0;
|
|
|
|
ret = pGetExtendedUdpTable( NULL, &size, TRUE, AF_INET, UDP_TABLE_OWNER_PID, 0 );
|
|
|
|
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
|
|
|
|
|
|
|
|
table_pid = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
ret = pGetExtendedUdpTable( table_pid, &size, TRUE, AF_INET, UDP_TABLE_OWNER_PID, 0 );
|
|
|
|
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, table_pid );
|
2013-07-30 12:57:50 +02:00
|
|
|
|
|
|
|
size = 0;
|
|
|
|
ret = pGetExtendedUdpTable( NULL, &size, TRUE, AF_INET, UDP_TABLE_OWNER_MODULE, 0 );
|
|
|
|
ok( ret == ERROR_INSUFFICIENT_BUFFER, "got %u\n", ret );
|
|
|
|
|
|
|
|
table_module = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
ret = pGetExtendedUdpTable( table_module, &size, TRUE, AF_INET, UDP_TABLE_OWNER_MODULE, 0 );
|
|
|
|
ok( ret == ERROR_SUCCESS, "got %u\n", ret );
|
|
|
|
HeapFree( GetProcessHeap(), 0, table_module );
|
2012-09-07 13:35:36 +02:00
|
|
|
}
|
|
|
|
|
2015-07-21 11:01:16 +02:00
|
|
|
static void test_CreateSortedAddressPairs(void)
|
|
|
|
{
|
|
|
|
SOCKADDR_IN6 dst[2];
|
|
|
|
SOCKADDR_IN6_PAIR *pair;
|
|
|
|
ULONG pair_count;
|
|
|
|
DWORD ret;
|
|
|
|
|
|
|
|
if (!pCreateSortedAddressPairs)
|
|
|
|
{
|
|
|
|
win_skip( "CreateSortedAddressPairs not available\n" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset( dst, 0, sizeof(dst) );
|
|
|
|
dst[0].sin6_family = AF_INET6;
|
|
|
|
dst[0].sin6_addr.u.Word[5] = 0xffff;
|
|
|
|
dst[0].sin6_addr.u.Word[6] = 0x0808;
|
|
|
|
dst[0].sin6_addr.u.Word[7] = 0x0808;
|
|
|
|
|
|
|
|
pair_count = 0xdeadbeef;
|
|
|
|
ret = pCreateSortedAddressPairs( NULL, 0, dst, 1, 0, NULL, &pair_count );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
ok( pair_count == 0xdeadbeef, "got %u\n", pair_count );
|
|
|
|
|
|
|
|
pair = (SOCKADDR_IN6_PAIR *)0xdeadbeef;
|
|
|
|
pair_count = 0xdeadbeef;
|
|
|
|
ret = pCreateSortedAddressPairs( NULL, 0, NULL, 1, 0, &pair, &pair_count );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
ok( pair == (SOCKADDR_IN6_PAIR *)0xdeadbeef, "got %p\n", pair );
|
|
|
|
ok( pair_count == 0xdeadbeef, "got %u\n", pair_count );
|
|
|
|
|
|
|
|
pair = NULL;
|
|
|
|
pair_count = 0xdeadbeef;
|
|
|
|
ret = pCreateSortedAddressPairs( NULL, 0, dst, 1, 0, &pair, &pair_count );
|
|
|
|
ok( ret == NO_ERROR, "got %u\n", ret );
|
|
|
|
ok( pair != NULL, "pair not set\n" );
|
|
|
|
ok( pair_count == 1, "got %u\n", pair_count );
|
|
|
|
ok( pair[0].SourceAddress != NULL, "src address not set\n" );
|
|
|
|
ok( pair[0].DestinationAddress != NULL, "dst address not set\n" );
|
|
|
|
pFreeMibTable( pair );
|
|
|
|
|
|
|
|
dst[1].sin6_family = AF_INET6;
|
|
|
|
dst[1].sin6_addr.u.Word[5] = 0xffff;
|
|
|
|
dst[1].sin6_addr.u.Word[6] = 0x0404;
|
|
|
|
dst[1].sin6_addr.u.Word[7] = 0x0808;
|
|
|
|
|
|
|
|
pair = NULL;
|
|
|
|
pair_count = 0xdeadbeef;
|
|
|
|
ret = pCreateSortedAddressPairs( NULL, 0, dst, 2, 0, &pair, &pair_count );
|
|
|
|
ok( ret == NO_ERROR, "got %u\n", ret );
|
|
|
|
ok( pair != NULL, "pair not set\n" );
|
|
|
|
ok( pair_count == 2, "got %u\n", pair_count );
|
|
|
|
ok( pair[0].SourceAddress != NULL, "src address not set\n" );
|
|
|
|
ok( pair[0].DestinationAddress != NULL, "dst address not set\n" );
|
|
|
|
ok( pair[1].SourceAddress != NULL, "src address not set\n" );
|
|
|
|
ok( pair[1].DestinationAddress != NULL, "dst address not set\n" );
|
|
|
|
pFreeMibTable( pair );
|
|
|
|
}
|
|
|
|
|
2015-07-22 14:28:05 +02:00
|
|
|
static DWORD get_interface_index(void)
|
|
|
|
{
|
|
|
|
DWORD size = 0, ret = 0;
|
|
|
|
IP_ADAPTER_ADDRESSES *buf, *aa;
|
|
|
|
|
|
|
|
if (pGetAdaptersAddresses( AF_UNSPEC, 0, NULL, NULL, &size ) != ERROR_BUFFER_OVERFLOW)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
buf = HeapAlloc( GetProcessHeap(), 0, size );
|
|
|
|
pGetAdaptersAddresses( AF_UNSPEC, 0, NULL, buf, &size );
|
|
|
|
for (aa = buf; aa; aa = aa->Next)
|
|
|
|
{
|
|
|
|
if (aa->IfType == IF_TYPE_ETHERNET_CSMACD)
|
|
|
|
{
|
|
|
|
ret = aa->IfIndex;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HeapFree( GetProcessHeap(), 0, buf );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2015-07-22 14:26:59 +02:00
|
|
|
static void test_interface_identifier_conversion(void)
|
|
|
|
{
|
2015-07-22 14:28:05 +02:00
|
|
|
DWORD ret;
|
2015-07-22 14:26:59 +02:00
|
|
|
NET_LUID luid;
|
|
|
|
GUID guid;
|
|
|
|
SIZE_T len;
|
|
|
|
WCHAR nameW[IF_MAX_STRING_SIZE + 1];
|
|
|
|
char nameA[IF_MAX_STRING_SIZE + 1];
|
|
|
|
NET_IFINDEX index;
|
|
|
|
|
|
|
|
if (!pConvertInterfaceIndexToLuid)
|
|
|
|
{
|
|
|
|
win_skip( "ConvertInterfaceIndexToLuid not available\n" );
|
|
|
|
return;
|
|
|
|
}
|
2015-07-22 14:28:05 +02:00
|
|
|
if (!(index = get_interface_index()))
|
2015-07-22 14:26:59 +02:00
|
|
|
{
|
|
|
|
skip( "no suitable interface found\n" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ConvertInterfaceIndexToLuid */
|
|
|
|
ret = pConvertInterfaceIndexToLuid( 0, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &luid, 0xff, sizeof(luid) );
|
|
|
|
ret = pConvertInterfaceIndexToLuid( 0, &luid );
|
|
|
|
ok( ret == ERROR_FILE_NOT_FOUND, "got %u\n", ret );
|
|
|
|
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
|
|
|
ok( !luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
|
|
|
|
ok( !luid.Info.IfType, "got %u\n", luid.Info.IfType );
|
|
|
|
|
|
|
|
memset( &luid, 0, sizeof(luid) );
|
2015-07-22 14:28:05 +02:00
|
|
|
ret = pConvertInterfaceIndexToLuid( index, &luid );
|
2015-07-22 14:26:59 +02:00
|
|
|
ok( !ret, "got %u\n", ret );
|
|
|
|
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
|
|
|
ok( luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
|
|
|
|
ok( luid.Info.IfType == IF_TYPE_ETHERNET_CSMACD, "got %u\n", luid.Info.IfType );
|
|
|
|
|
|
|
|
/* ConvertInterfaceLuidToIndex */
|
|
|
|
ret = pConvertInterfaceLuidToIndex( NULL, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToIndex( NULL, &index );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToIndex( &luid, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToIndex( &luid, &index );
|
|
|
|
ok( !ret, "got %u\n", ret );
|
|
|
|
|
|
|
|
/* ConvertInterfaceLuidToGuid */
|
|
|
|
ret = pConvertInterfaceLuidToGuid( NULL, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &guid, 0xff, sizeof(guid) );
|
|
|
|
ret = pConvertInterfaceLuidToGuid( NULL, &guid );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
ok( guid.Data1 == 0xffffffff, "got %x\n", guid.Data1 );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToGuid( &luid, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &guid, 0, sizeof(guid) );
|
|
|
|
ret = pConvertInterfaceLuidToGuid( &luid, &guid );
|
|
|
|
ok( !ret, "got %u\n", ret );
|
|
|
|
ok( guid.Data1, "got %x\n", guid.Data1 );
|
|
|
|
|
|
|
|
/* ConvertInterfaceGuidToLuid */
|
|
|
|
ret = pConvertInterfaceGuidToLuid( NULL, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
luid.Info.NetLuidIndex = 1;
|
|
|
|
ret = pConvertInterfaceGuidToLuid( NULL, &luid );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
ok( luid.Info.NetLuidIndex == 1, "got %u\n", luid.Info.NetLuidIndex );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceGuidToLuid( &guid, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &luid, 0, sizeof(luid) );
|
|
|
|
ret = pConvertInterfaceGuidToLuid( &guid, &luid );
|
|
|
|
ok( !ret, "got %u\n", ret );
|
|
|
|
ok( luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
|
|
|
|
|
|
|
|
/* ConvertInterfaceLuidToNameW */
|
|
|
|
ret = pConvertInterfaceLuidToNameW( NULL, NULL, 0 );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToNameW( &luid, NULL, 0 );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToNameW( NULL, nameW, 0 );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToNameW( &luid, nameW, 0 );
|
|
|
|
ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %u\n", ret );
|
|
|
|
|
|
|
|
nameW[0] = 0;
|
|
|
|
len = sizeof(nameW)/sizeof(nameW[0]);
|
|
|
|
ret = pConvertInterfaceLuidToNameW( &luid, nameW, len );
|
|
|
|
ok( !ret, "got %u\n", ret );
|
|
|
|
ok( nameW[0], "name not set\n" );
|
|
|
|
|
|
|
|
/* ConvertInterfaceLuidToNameA */
|
|
|
|
ret = pConvertInterfaceLuidToNameA( NULL, NULL, 0 );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToNameA( &luid, NULL, 0 );
|
|
|
|
ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToNameA( NULL, nameA, 0 );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceLuidToNameA( &luid, nameA, 0 );
|
|
|
|
ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %u\n", ret );
|
|
|
|
|
|
|
|
nameA[0] = 0;
|
|
|
|
len = sizeof(nameA)/sizeof(nameA[0]);
|
|
|
|
ret = pConvertInterfaceLuidToNameA( &luid, nameA, len );
|
|
|
|
ok( !ret, "got %u\n", ret );
|
|
|
|
ok( nameA[0], "name not set\n" );
|
|
|
|
|
|
|
|
/* ConvertInterfaceNameToLuidW */
|
|
|
|
ret = pConvertInterfaceNameToLuidW( NULL, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &luid, 0xff, sizeof(luid) );
|
|
|
|
ret = pConvertInterfaceNameToLuidW( NULL, &luid );
|
|
|
|
ok( ret == ERROR_INVALID_NAME, "got %u\n", ret );
|
|
|
|
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
|
|
|
ok( !luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
|
|
|
|
ok( !luid.Info.IfType, "got %u\n", luid.Info.IfType );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceNameToLuidW( nameW, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &luid, 0xff, sizeof(luid) );
|
|
|
|
ret = pConvertInterfaceNameToLuidW( nameW, &luid );
|
|
|
|
ok( !ret, "got %u\n", ret );
|
|
|
|
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
|
|
|
ok( luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
|
|
|
|
ok( luid.Info.IfType == IF_TYPE_ETHERNET_CSMACD, "got %u\n", luid.Info.IfType );
|
|
|
|
|
|
|
|
/* ConvertInterfaceNameToLuidA */
|
|
|
|
ret = pConvertInterfaceNameToLuidA( NULL, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_NAME, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &luid, 0xff, sizeof(luid) );
|
|
|
|
ret = pConvertInterfaceNameToLuidA( NULL, &luid );
|
|
|
|
ok( ret == ERROR_INVALID_NAME, "got %u\n", ret );
|
|
|
|
ok( luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
|
|
|
ok( luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
|
|
|
|
ok( luid.Info.IfType, "got %u\n", luid.Info.IfType );
|
|
|
|
|
|
|
|
ret = pConvertInterfaceNameToLuidA( nameA, NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &luid, 0xff, sizeof(luid) );
|
|
|
|
ret = pConvertInterfaceNameToLuidA( nameA, &luid );
|
|
|
|
ok( !ret, "got %u\n", ret );
|
|
|
|
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
|
|
|
ok( luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
|
|
|
|
ok( luid.Info.IfType == IF_TYPE_ETHERNET_CSMACD, "got %u\n", luid.Info.IfType );
|
2015-07-22 14:28:05 +02:00
|
|
|
}
|
2015-07-22 14:26:59 +02:00
|
|
|
|
2015-07-22 14:28:05 +02:00
|
|
|
static void test_GetIfEntry2(void)
|
|
|
|
{
|
|
|
|
DWORD ret;
|
|
|
|
MIB_IF_ROW2 row;
|
|
|
|
NET_IFINDEX index;
|
|
|
|
|
|
|
|
if (!pGetIfEntry2)
|
|
|
|
{
|
|
|
|
win_skip( "GetIfEntry2 not available\n" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!(index = get_interface_index()))
|
|
|
|
{
|
|
|
|
skip( "no suitable interface found\n" );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = pGetIfEntry2( NULL );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &row, 0, sizeof(row) );
|
|
|
|
ret = pGetIfEntry2( &row );
|
|
|
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
|
|
|
|
|
|
memset( &row, 0, sizeof(row) );
|
|
|
|
row.InterfaceIndex = index;
|
|
|
|
ret = pGetIfEntry2( &row );
|
|
|
|
ok( ret == NO_ERROR, "got %u\n", ret );
|
|
|
|
ok( row.InterfaceIndex == index, "got %u\n", index );
|
|
|
|
ok( row.InterfaceLuid.Info.NetLuidIndex, "got %u\n", index );
|
2015-07-22 14:26:59 +02:00
|
|
|
}
|
|
|
|
|
2004-01-07 02:08:55 +01:00
|
|
|
START_TEST(iphlpapi)
|
|
|
|
{
|
|
|
|
|
|
|
|
loadIPHlpApi();
|
|
|
|
if (hLibrary) {
|
2010-02-08 15:25:36 +01:00
|
|
|
HANDLE thread;
|
|
|
|
|
2004-01-07 02:08:55 +01:00
|
|
|
testWin98OnlyFunctions();
|
|
|
|
testWinNT4Functions();
|
2010-02-08 15:25:36 +01:00
|
|
|
|
|
|
|
/* run testGetXXXX in two threads at once to make sure we don't crash in that case */
|
|
|
|
thread = CreateThread(NULL, 0, testWin98Functions, NULL, 0, NULL);
|
|
|
|
testWin98Functions(NULL);
|
|
|
|
WaitForSingleObject(thread, INFINITE);
|
|
|
|
|
2004-01-07 02:08:55 +01:00
|
|
|
testWin2KFunctions();
|
2009-04-29 11:57:48 +02:00
|
|
|
test_GetAdaptersAddresses();
|
2012-04-16 12:35:44 +02:00
|
|
|
test_GetExtendedTcpTable();
|
2012-09-07 13:35:36 +02:00
|
|
|
test_GetExtendedUdpTable();
|
2015-07-21 11:01:16 +02:00
|
|
|
test_CreateSortedAddressPairs();
|
2015-07-22 14:26:59 +02:00
|
|
|
test_interface_identifier_conversion();
|
2015-07-22 14:28:05 +02:00
|
|
|
test_GetIfEntry2();
|
2004-01-07 02:08:55 +01:00
|
|
|
freeIPHlpApi();
|
|
|
|
}
|
|
|
|
}
|