iphlpapi/tests: Run the interface conversion tests on all interfaces.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3bee9c080b
commit
e4e70f6755
|
@ -65,23 +65,12 @@ static DWORD (WINAPI *pGetExtendedUdpTable)(PVOID,PDWORD,BOOL,ULONG,UDP_TABLE_CL
|
||||||
static DWORD (WINAPI *pCreateSortedAddressPairs)(const PSOCKADDR_IN6,ULONG,const PSOCKADDR_IN6,ULONG,ULONG,
|
static DWORD (WINAPI *pCreateSortedAddressPairs)(const PSOCKADDR_IN6,ULONG,const PSOCKADDR_IN6,ULONG,ULONG,
|
||||||
PSOCKADDR_IN6_PAIR*,ULONG*);
|
PSOCKADDR_IN6_PAIR*,ULONG*);
|
||||||
static void (WINAPI *pFreeMibTable)(void*);
|
static void (WINAPI *pFreeMibTable)(void*);
|
||||||
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*);
|
|
||||||
static DWORD (WINAPI *pConvertLengthToIpv4Mask)(ULONG,ULONG*);
|
static DWORD (WINAPI *pConvertLengthToIpv4Mask)(ULONG,ULONG*);
|
||||||
static DWORD (WINAPI *pParseNetworkString)(const WCHAR*,DWORD,NET_ADDRESS_INFO*,USHORT*,BYTE*);
|
static DWORD (WINAPI *pParseNetworkString)(const WCHAR*,DWORD,NET_ADDRESS_INFO*,USHORT*,BYTE*);
|
||||||
static DWORD (WINAPI *pNotifyUnicastIpAddressChange)(ADDRESS_FAMILY, PUNICAST_IPADDRESS_CHANGE_CALLBACK,
|
static DWORD (WINAPI *pNotifyUnicastIpAddressChange)(ADDRESS_FAMILY, PUNICAST_IPADDRESS_CHANGE_CALLBACK,
|
||||||
PVOID, BOOLEAN, HANDLE *);
|
PVOID, BOOLEAN, HANDLE *);
|
||||||
static DWORD (WINAPI *pCancelMibChangeNotify2)(HANDLE);
|
static DWORD (WINAPI *pCancelMibChangeNotify2)(HANDLE);
|
||||||
|
|
||||||
static PCHAR (WINAPI *pif_indextoname)(NET_IFINDEX,PCHAR);
|
|
||||||
static NET_IFINDEX (WINAPI *pif_nametoindex)(const char*);
|
|
||||||
|
|
||||||
static void loadIPHlpApi(void)
|
static void loadIPHlpApi(void)
|
||||||
{
|
{
|
||||||
hLibrary = LoadLibraryA("iphlpapi.dll");
|
hLibrary = LoadLibraryA("iphlpapi.dll");
|
||||||
|
@ -98,18 +87,8 @@ static void loadIPHlpApi(void)
|
||||||
pGetExtendedUdpTable = (void *)GetProcAddress(hLibrary, "GetExtendedUdpTable");
|
pGetExtendedUdpTable = (void *)GetProcAddress(hLibrary, "GetExtendedUdpTable");
|
||||||
pCreateSortedAddressPairs = (void *)GetProcAddress(hLibrary, "CreateSortedAddressPairs");
|
pCreateSortedAddressPairs = (void *)GetProcAddress(hLibrary, "CreateSortedAddressPairs");
|
||||||
pFreeMibTable = (void *)GetProcAddress(hLibrary, "FreeMibTable");
|
pFreeMibTable = (void *)GetProcAddress(hLibrary, "FreeMibTable");
|
||||||
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");
|
|
||||||
pConvertLengthToIpv4Mask = (void *)GetProcAddress(hLibrary, "ConvertLengthToIpv4Mask");
|
pConvertLengthToIpv4Mask = (void *)GetProcAddress(hLibrary, "ConvertLengthToIpv4Mask");
|
||||||
pParseNetworkString = (void *)GetProcAddress(hLibrary, "ParseNetworkString");
|
pParseNetworkString = (void *)GetProcAddress(hLibrary, "ParseNetworkString");
|
||||||
pif_indextoname = (void *)GetProcAddress(hLibrary, "if_indextoname");
|
|
||||||
pif_nametoindex = (void *)GetProcAddress(hLibrary, "if_nametoindex");
|
|
||||||
pNotifyUnicastIpAddressChange = (void *)GetProcAddress(hLibrary, "NotifyUnicastIpAddressChange");
|
pNotifyUnicastIpAddressChange = (void *)GetProcAddress(hLibrary, "NotifyUnicastIpAddressChange");
|
||||||
pCancelMibChangeNotify2 = (void *)GetProcAddress(hLibrary, "CancelMibChangeNotify2");
|
pCancelMibChangeNotify2 = (void *)GetProcAddress(hLibrary, "CancelMibChangeNotify2");
|
||||||
}
|
}
|
||||||
|
@ -1384,16 +1363,13 @@ static void test_GetAdaptersAddresses(void)
|
||||||
aa->Ipv4Metric, aa->Ipv6Metric, wine_dbgstr_guid((GUID*) &aa->NetworkGuid),
|
aa->Ipv4Metric, aa->Ipv6Metric, wine_dbgstr_guid((GUID*) &aa->NetworkGuid),
|
||||||
aa->ConnectionType, aa->TunnelType);
|
aa->ConnectionType, aa->TunnelType);
|
||||||
|
|
||||||
if (pConvertInterfaceLuidToGuid)
|
status = ConvertInterfaceLuidToGuid(&aa->Luid, &guid);
|
||||||
{
|
ok(!status, "got %u\n", status);
|
||||||
status = pConvertInterfaceLuidToGuid(&aa->Luid, &guid);
|
sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||||
ok(!status, "got %u\n", status);
|
guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1],
|
||||||
sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5],
|
||||||
guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1],
|
guid.Data4[6], guid.Data4[7]);
|
||||||
guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5],
|
ok(!strcasecmp(aa->AdapterName, buf), "expected '%s' got '%s'\n", aa->AdapterName, buf);
|
||||||
guid.Data4[6], guid.Data4[7]);
|
|
||||||
ok(!strcasecmp(aa->AdapterName, buf), "expected '%s' got '%s'\n", aa->AdapterName, buf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ok(dns_eligible_found, "Did not find any dns eligible addresses.\n");
|
ok(dns_eligible_found, "Did not find any dns eligible addresses.\n");
|
||||||
HeapFree(GetProcessHeap(), 0, ptr);
|
HeapFree(GetProcessHeap(), 0, ptr);
|
||||||
|
@ -1644,204 +1620,193 @@ static DWORD get_interface_index(void)
|
||||||
|
|
||||||
static void test_interface_identifier_conversion(void)
|
static void test_interface_identifier_conversion(void)
|
||||||
{
|
{
|
||||||
DWORD ret;
|
DWORD ret, i;
|
||||||
NET_LUID luid;
|
NET_LUID luid;
|
||||||
GUID guid;
|
GUID guid;
|
||||||
SIZE_T len;
|
SIZE_T len;
|
||||||
WCHAR nameW[IF_MAX_STRING_SIZE + 1];
|
WCHAR nameW[IF_MAX_STRING_SIZE + 1];
|
||||||
char nameA[IF_MAX_STRING_SIZE + 1], *name;
|
char nameA[IF_MAX_STRING_SIZE + 1], *name;
|
||||||
NET_IFINDEX index, index2;
|
NET_IFINDEX index;
|
||||||
|
MIB_IF_TABLE2 *table;
|
||||||
|
|
||||||
if (!pConvertInterfaceIndexToLuid)
|
ret = GetIfTable2( &table );
|
||||||
|
ok( !ret, "got %d\n", ret );
|
||||||
|
|
||||||
|
for (i = 0; i < table->NumEntries; i++)
|
||||||
{
|
{
|
||||||
win_skip( "ConvertInterfaceIndexToLuid not available\n" );
|
MIB_IF_ROW2 *row = table->Table + i;
|
||||||
return;
|
|
||||||
}
|
/* ConvertInterfaceIndexToLuid */
|
||||||
if (!(index = get_interface_index()))
|
ret = ConvertInterfaceIndexToLuid( 0, NULL );
|
||||||
{
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
skip( "no suitable interface found\n" );
|
|
||||||
return;
|
memset( &luid, 0xff, sizeof(luid) );
|
||||||
}
|
ret = ConvertInterfaceIndexToLuid( 0, &luid );
|
||||||
|
ok( ret == ERROR_FILE_NOT_FOUND, "got %u\n", ret );
|
||||||
/* ConvertInterfaceIndexToLuid */
|
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
||||||
ret = pConvertInterfaceIndexToLuid( 0, NULL );
|
ok( !luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ok( !luid.Info.IfType, "got %u\n", luid.Info.IfType );
|
||||||
|
|
||||||
memset( &luid, 0xff, sizeof(luid) );
|
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
||||||
ret = pConvertInterfaceIndexToLuid( 0, &luid );
|
ret = ConvertInterfaceIndexToLuid( row->InterfaceIndex, &luid );
|
||||||
ok( ret == ERROR_FILE_NOT_FOUND, "got %u\n", ret );
|
ok( !ret, "got %u\n", ret );
|
||||||
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
ok( luid.Value == row->InterfaceLuid.Value, "mismatch\n" );
|
||||||
ok( !luid.Info.NetLuidIndex, "got %u\n", luid.Info.NetLuidIndex );
|
|
||||||
ok( !luid.Info.IfType, "got %u\n", luid.Info.IfType );
|
/* ConvertInterfaceLuidToIndex */
|
||||||
|
ret = ConvertInterfaceLuidToIndex( NULL, NULL );
|
||||||
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
ret = pConvertInterfaceIndexToLuid( index, &luid );
|
|
||||||
ok( !ret, "got %u\n", ret );
|
ret = ConvertInterfaceLuidToIndex( NULL, &index );
|
||||||
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
ok( luid.Info.NetLuidIndex != 0xdead, "index not set\n" );
|
|
||||||
ok( luid.Info.IfType == IF_TYPE_ETHERNET_CSMACD, "got %u\n", luid.Info.IfType );
|
ret = ConvertInterfaceLuidToIndex( &luid, NULL );
|
||||||
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
/* ConvertInterfaceLuidToIndex */
|
|
||||||
ret = pConvertInterfaceLuidToIndex( NULL, NULL );
|
ret = ConvertInterfaceLuidToIndex( &luid, &index );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ok( !ret, "got %u\n", ret );
|
||||||
|
ok( index == row->InterfaceIndex, "mismatch\n" );
|
||||||
ret = pConvertInterfaceLuidToIndex( NULL, &index );
|
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
/* ConvertInterfaceLuidToGuid */
|
||||||
|
ret = ConvertInterfaceLuidToGuid( NULL, NULL );
|
||||||
ret = pConvertInterfaceLuidToIndex( &luid, NULL );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
||||||
|
memset( &guid, 0xff, sizeof(guid) );
|
||||||
ret = pConvertInterfaceLuidToIndex( &luid, &index );
|
ret = ConvertInterfaceLuidToGuid( NULL, &guid );
|
||||||
ok( !ret, "got %u\n", ret );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
|
ok( guid.Data1 == 0xffffffff, "got %x\n", guid.Data1 );
|
||||||
/* ConvertInterfaceLuidToGuid */
|
|
||||||
ret = pConvertInterfaceLuidToGuid( NULL, NULL );
|
ret = ConvertInterfaceLuidToGuid( &luid, NULL );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
|
|
||||||
memset( &guid, 0xff, sizeof(guid) );
|
memset( &guid, 0, sizeof(guid) );
|
||||||
ret = pConvertInterfaceLuidToGuid( NULL, &guid );
|
ret = ConvertInterfaceLuidToGuid( &luid, &guid );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ok( !ret, "got %u\n", ret );
|
||||||
ok( guid.Data1 == 0xffffffff, "got %x\n", guid.Data1 );
|
ok( IsEqualGUID( &guid, &row->InterfaceGuid ), "mismatch\n" );
|
||||||
|
|
||||||
ret = pConvertInterfaceLuidToGuid( &luid, NULL );
|
/* ConvertInterfaceGuidToLuid */
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ret = ConvertInterfaceGuidToLuid( NULL, NULL );
|
||||||
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
memset( &guid, 0, sizeof(guid) );
|
|
||||||
ret = pConvertInterfaceLuidToGuid( &luid, &guid );
|
luid.Info.NetLuidIndex = 1;
|
||||||
ok( !ret, "got %u\n", ret );
|
ret = ConvertInterfaceGuidToLuid( NULL, &luid );
|
||||||
ok( guid.Data1, "got %x\n", guid.Data1 );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
|
ok( luid.Info.NetLuidIndex == 1, "got %u\n", luid.Info.NetLuidIndex );
|
||||||
/* ConvertInterfaceGuidToLuid */
|
|
||||||
ret = pConvertInterfaceGuidToLuid( NULL, NULL );
|
ret = ConvertInterfaceGuidToLuid( &guid, NULL );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
|
|
||||||
luid.Info.NetLuidIndex = 1;
|
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
||||||
ret = pConvertInterfaceGuidToLuid( NULL, &luid );
|
ret = ConvertInterfaceGuidToLuid( &guid, &luid );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ok( !ret, "got %u\n", ret );
|
||||||
ok( luid.Info.NetLuidIndex == 1, "got %u\n", luid.Info.NetLuidIndex );
|
ok( luid.Value == row->InterfaceLuid.Value ||
|
||||||
|
broken( luid.Value != row->InterfaceLuid.Value), /* Win8 can have identical guids for two different ifaces */
|
||||||
ret = pConvertInterfaceGuidToLuid( &guid, NULL );
|
"mismatch\n" );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
if (luid.Value != row->InterfaceLuid.Value) continue;
|
||||||
|
|
||||||
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
/* ConvertInterfaceLuidToNameW */
|
||||||
ret = pConvertInterfaceGuidToLuid( &guid, &luid );
|
ret = ConvertInterfaceLuidToNameW( NULL, NULL, 0 );
|
||||||
ok( !ret, "got %u\n", ret );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
|
||||||
ok( luid.Info.NetLuidIndex != 0xdead, "index not set\n" );
|
ret = ConvertInterfaceLuidToNameW( &luid, NULL, 0 );
|
||||||
ok( luid.Info.IfType == IF_TYPE_ETHERNET_CSMACD, "got %u\n", luid.Info.IfType );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
|
|
||||||
/* ConvertInterfaceLuidToNameW */
|
ret = ConvertInterfaceLuidToNameW( NULL, nameW, 0 );
|
||||||
ret = pConvertInterfaceLuidToNameW( NULL, NULL, 0 );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
||||||
|
ret = ConvertInterfaceLuidToNameW( &luid, nameW, 0 );
|
||||||
ret = pConvertInterfaceLuidToNameW( &luid, NULL, 0 );
|
ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %u\n", ret );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
||||||
|
nameW[0] = 0;
|
||||||
ret = pConvertInterfaceLuidToNameW( NULL, nameW, 0 );
|
len = ARRAY_SIZE(nameW);
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ret = ConvertInterfaceLuidToNameW( &luid, nameW, len );
|
||||||
|
ok( !ret, "got %u\n", ret );
|
||||||
ret = pConvertInterfaceLuidToNameW( &luid, nameW, 0 );
|
ok( nameW[0], "name not set\n" );
|
||||||
ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %u\n", ret );
|
|
||||||
|
/* ConvertInterfaceLuidToNameA */
|
||||||
nameW[0] = 0;
|
ret = ConvertInterfaceLuidToNameA( NULL, NULL, 0 );
|
||||||
len = ARRAY_SIZE(nameW);
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
ret = pConvertInterfaceLuidToNameW( &luid, nameW, len );
|
|
||||||
ok( !ret, "got %u\n", ret );
|
ret = ConvertInterfaceLuidToNameA( &luid, NULL, 0 );
|
||||||
ok( nameW[0], "name not set\n" );
|
ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %u\n", ret );
|
||||||
|
|
||||||
/* ConvertInterfaceLuidToNameA */
|
ret = ConvertInterfaceLuidToNameA( NULL, nameA, 0 );
|
||||||
ret = pConvertInterfaceLuidToNameA( NULL, NULL, 0 );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
|
||||||
|
ret = ConvertInterfaceLuidToNameA( &luid, nameA, 0 );
|
||||||
ret = pConvertInterfaceLuidToNameA( &luid, NULL, 0 );
|
ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %u\n", ret );
|
||||||
ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %u\n", ret );
|
|
||||||
|
nameA[0] = 0;
|
||||||
ret = pConvertInterfaceLuidToNameA( NULL, nameA, 0 );
|
len = ARRAY_SIZE(nameA);
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ret = ConvertInterfaceLuidToNameA( &luid, nameA, len );
|
||||||
|
ok( !ret, "got %u\n", ret );
|
||||||
ret = pConvertInterfaceLuidToNameA( &luid, nameA, 0 );
|
ok( nameA[0], "name not set\n" );
|
||||||
ok( ret == ERROR_NOT_ENOUGH_MEMORY, "got %u\n", ret );
|
|
||||||
|
/* ConvertInterfaceNameToLuidW */
|
||||||
nameA[0] = 0;
|
ret = ConvertInterfaceNameToLuidW( NULL, NULL );
|
||||||
len = ARRAY_SIZE(nameA);
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
ret = pConvertInterfaceLuidToNameA( &luid, nameA, len );
|
|
||||||
ok( !ret, "got %u\n", ret );
|
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
||||||
ok( nameA[0], "name not set\n" );
|
ret = ConvertInterfaceNameToLuidW( NULL, &luid );
|
||||||
|
ok( ret == ERROR_INVALID_NAME, "got %u\n", ret );
|
||||||
/* ConvertInterfaceNameToLuidW */
|
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
||||||
ret = pConvertInterfaceNameToLuidW( NULL, NULL );
|
ok( luid.Info.NetLuidIndex != 0xdead, "index not set\n" );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
ok( !luid.Info.IfType, "got %u\n", luid.Info.IfType );
|
||||||
|
|
||||||
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
ret = ConvertInterfaceNameToLuidW( nameW, NULL );
|
||||||
ret = pConvertInterfaceNameToLuidW( NULL, &luid );
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
ok( ret == ERROR_INVALID_NAME, "got %u\n", ret );
|
|
||||||
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
||||||
ok( luid.Info.NetLuidIndex != 0xdead, "index not set\n" );
|
ret = ConvertInterfaceNameToLuidW( nameW, &luid );
|
||||||
ok( !luid.Info.IfType, "got %u\n", luid.Info.IfType );
|
ok( !ret, "got %u\n", ret );
|
||||||
|
ok( luid.Value == row->InterfaceLuid.Value, "mismatch\n" );
|
||||||
ret = pConvertInterfaceNameToLuidW( nameW, NULL );
|
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
/* ConvertInterfaceNameToLuidA */
|
||||||
|
ret = ConvertInterfaceNameToLuidA( NULL, NULL );
|
||||||
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
ok( ret == ERROR_INVALID_NAME, "got %u\n", ret );
|
||||||
ret = pConvertInterfaceNameToLuidW( nameW, &luid );
|
|
||||||
ok( !ret, "got %u\n", ret );
|
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
||||||
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
ret = ConvertInterfaceNameToLuidA( NULL, &luid );
|
||||||
ok( luid.Info.NetLuidIndex != 0xdead, "index not set\n" );
|
ok( ret == ERROR_INVALID_NAME, "got %u\n", ret );
|
||||||
ok( luid.Info.IfType == IF_TYPE_ETHERNET_CSMACD, "got %u\n", luid.Info.IfType );
|
ok( luid.Info.Reserved == 0xdead, "reserved set\n" );
|
||||||
|
ok( luid.Info.NetLuidIndex == 0xdead, "index set\n" );
|
||||||
/* ConvertInterfaceNameToLuidA */
|
ok( luid.Info.IfType == 0xdead, "type set\n" );
|
||||||
ret = pConvertInterfaceNameToLuidA( NULL, NULL );
|
|
||||||
ok( ret == ERROR_INVALID_NAME, "got %u\n", ret );
|
ret = ConvertInterfaceNameToLuidA( nameA, NULL );
|
||||||
|
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
||||||
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
|
||||||
ret = pConvertInterfaceNameToLuidA( NULL, &luid );
|
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
||||||
ok( ret == ERROR_INVALID_NAME, "got %u\n", ret );
|
ret = ConvertInterfaceNameToLuidA( nameA, &luid );
|
||||||
ok( luid.Info.Reserved == 0xdead, "reserved set\n" );
|
ok( !ret, "got %u\n", ret );
|
||||||
ok( luid.Info.NetLuidIndex == 0xdead, "index set\n" );
|
ok( luid.Value == row->InterfaceLuid.Value, "mismatch\n" );
|
||||||
ok( luid.Info.IfType == 0xdead, "type set\n" );
|
|
||||||
|
index = if_nametoindex( NULL );
|
||||||
ret = pConvertInterfaceNameToLuidA( nameA, NULL );
|
ok( !index, "Got unexpected index %u\n", index );
|
||||||
ok( ret == ERROR_INVALID_PARAMETER, "got %u\n", ret );
|
index = if_nametoindex( nameA );
|
||||||
|
ok( index == row->InterfaceIndex, "Got index %u for %s, expected %u\n", index, nameA, row->InterfaceIndex );
|
||||||
luid.Info.Reserved = luid.Info.NetLuidIndex = luid.Info.IfType = 0xdead;
|
/* Wargaming.net Game Center passes a GUID-like string. */
|
||||||
ret = pConvertInterfaceNameToLuidA( nameA, &luid );
|
index = if_nametoindex( "{00000001-0000-0000-0000-000000000000}" );
|
||||||
ok( !ret, "got %u\n", ret );
|
ok( !index, "Got unexpected index %u\n", index );
|
||||||
ok( !luid.Info.Reserved, "got %x\n", luid.Info.Reserved );
|
index = if_nametoindex( wine_dbgstr_guid( &guid ) );
|
||||||
ok( luid.Info.NetLuidIndex != 0xdead, "index not set\n" );
|
ok( !index, "Got unexpected index %u for input %s\n", index, wine_dbgstr_guid( &guid ) );
|
||||||
ok( luid.Info.IfType == IF_TYPE_ETHERNET_CSMACD, "got %u\n", luid.Info.IfType );
|
|
||||||
|
name = if_indextoname( 0, NULL );
|
||||||
if (!pif_nametoindex || !pif_indextoname)
|
ok( name == NULL, "got %s\n", name );
|
||||||
{
|
|
||||||
skip("if_nametoindex/if_indextoname not supported\n");
|
name = if_indextoname( 0, nameA );
|
||||||
return;
|
ok( name == NULL, "got %p\n", name );
|
||||||
}
|
|
||||||
|
name = if_indextoname( ~0u, nameA );
|
||||||
index2 = pif_nametoindex( NULL );
|
ok( name == NULL, "got %p\n", name );
|
||||||
ok( !index2, "Got unexpected index %u\n", index2 );
|
|
||||||
index2 = pif_nametoindex( nameA );
|
nameA[0] = 0;
|
||||||
ok( index2 == index, "Got index %u for %s, expected %u\n", index2, nameA, index );
|
name = if_indextoname( 1, nameA );
|
||||||
/* Wargaming.net Game Center passes a GUID-like string. */
|
if (name != NULL)
|
||||||
index2 = pif_nametoindex( "{00000001-0000-0000-0000-000000000000}" );
|
{
|
||||||
ok( !index2, "Got unexpected index %u\n", index2 );
|
ok( name[0], "empty name\n" );
|
||||||
index2 = pif_nametoindex( wine_dbgstr_guid( &guid ) );
|
ok( name == nameA, "got %p\n", name );
|
||||||
ok( !index2, "Got unexpected index %u for input %s\n", index2, wine_dbgstr_guid( &guid ) );
|
}
|
||||||
|
|
||||||
name = pif_indextoname( 0, NULL );
|
|
||||||
ok( name == NULL, "got %s\n", name );
|
|
||||||
|
|
||||||
name = pif_indextoname( 0, nameA );
|
|
||||||
ok( name == NULL, "got %p\n", name );
|
|
||||||
|
|
||||||
name = pif_indextoname( ~0u, nameA );
|
|
||||||
ok( name == NULL, "got %p\n", name );
|
|
||||||
|
|
||||||
nameA[0] = 0;
|
|
||||||
name = pif_indextoname( 1, nameA );
|
|
||||||
if (name != NULL)
|
|
||||||
{
|
|
||||||
ok( name[0], "empty name\n" );
|
|
||||||
ok( name == nameA, "got %p\n", name );
|
|
||||||
}
|
}
|
||||||
|
FreeMibTable( table );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_GetIfEntry2(void)
|
static void test_GetIfEntry2(void)
|
||||||
|
|
Loading…
Reference in New Issue