mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 04:00:56 +00:00
ws2_32/tests: Add WSAEnumNameSpaceProviders[A|W] tests.
Signed-off-by: Bruno Jesus <00cpxxx@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2964c2b34b
commit
ad2405daa4
|
@ -72,6 +72,8 @@ static int (WINAPI *pInetPtonW)(INT,LPWSTR,LPVOID);
|
|||
static int (WINAPI *pWSALookupServiceBeginW)(LPWSAQUERYSETW,DWORD,LPHANDLE);
|
||||
static int (WINAPI *pWSALookupServiceEnd)(HANDLE);
|
||||
static int (WINAPI *pWSALookupServiceNextW)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW);
|
||||
static int (WINAPI *pWSAEnumNameSpaceProvidersA)(LPDWORD,LPWSANAMESPACE_INFOA);
|
||||
static int (WINAPI *pWSAEnumNameSpaceProvidersW)(LPDWORD,LPWSANAMESPACE_INFOW);
|
||||
|
||||
/**************** Structs and typedefs ***************/
|
||||
|
||||
|
@ -1165,6 +1167,8 @@ static void Init (void)
|
|||
pWSALookupServiceBeginW = (void *)GetProcAddress(hws2_32, "WSALookupServiceBeginW");
|
||||
pWSALookupServiceEnd = (void *)GetProcAddress(hws2_32, "WSALookupServiceEnd");
|
||||
pWSALookupServiceNextW = (void *)GetProcAddress(hws2_32, "WSALookupServiceNextW");
|
||||
pWSAEnumNameSpaceProvidersA = (void *)GetProcAddress(hws2_32, "WSAEnumNameSpaceProvidersA");
|
||||
pWSAEnumNameSpaceProvidersW = (void *)GetProcAddress(hws2_32, "WSAEnumNameSpaceProvidersW");
|
||||
|
||||
ok ( WSAStartup ( ver, &data ) == 0, "WSAStartup failed\n" );
|
||||
tls = TlsAlloc();
|
||||
|
@ -8834,6 +8838,160 @@ todo_wine
|
|||
ok(!ret, "WSALookupServiceEnd failed unexpectedly\n");
|
||||
}
|
||||
|
||||
static void test_WSAEnumNameSpaceProvidersA(void)
|
||||
{
|
||||
LPWSANAMESPACE_INFOA name = NULL;
|
||||
DWORD ret, error, blen = 0, i;
|
||||
if (!pWSAEnumNameSpaceProvidersA)
|
||||
{
|
||||
win_skip("WSAEnumNameSpaceProvidersA not found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWSAEnumNameSpaceProvidersA(&blen, name);
|
||||
error = WSAGetLastError();
|
||||
todo_wine
|
||||
ok(ret == SOCKET_ERROR, "Expected failure, got %u\n", ret);
|
||||
todo_wine
|
||||
ok(error == WSAEFAULT, "Expected 10014, got %u\n", error);
|
||||
|
||||
/* Invalid parameter tests */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWSAEnumNameSpaceProvidersA(NULL, name);
|
||||
error = WSAGetLastError();
|
||||
todo_wine
|
||||
ok(ret == SOCKET_ERROR, "Expected failure, got %u\n", ret);
|
||||
todo_wine
|
||||
ok(error == WSAEFAULT, "Expected 10014, got %u\n", error);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWSAEnumNameSpaceProvidersA(NULL, NULL);
|
||||
error = WSAGetLastError();
|
||||
todo_wine
|
||||
ok(ret == SOCKET_ERROR, "Expected failure, got %u\n", ret);
|
||||
todo_wine
|
||||
ok(error == WSAEFAULT, "Expected 10014, got %u\n", error);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWSAEnumNameSpaceProvidersA(&blen, NULL);
|
||||
error = WSAGetLastError();
|
||||
todo_wine
|
||||
ok(ret == SOCKET_ERROR, "Expected failure, got %u\n", ret);
|
||||
todo_wine
|
||||
ok(error == WSAEFAULT, "Expected 10014, got %u\n", error);
|
||||
|
||||
name = HeapAlloc(GetProcessHeap(), 0, blen);
|
||||
if (!name)
|
||||
{
|
||||
skip("Failed to alloc memory\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = pWSAEnumNameSpaceProvidersA(&blen, name);
|
||||
todo_wine
|
||||
ok(ret > 0, "Expected more than zero name space providers\n");
|
||||
|
||||
for (i = 0;i < ret; i++)
|
||||
{
|
||||
trace("Name space Identifier (%p): %s\n", name[i].lpszIdentifier,
|
||||
name[i].lpszIdentifier);
|
||||
switch (name[i].dwNameSpace)
|
||||
{
|
||||
case NS_DNS:
|
||||
trace("\tName space ID: NS_DNS (%u)\n", name[i].dwNameSpace);
|
||||
break;
|
||||
case NS_NLA:
|
||||
trace("\tName space ID: NS_NLA (%u)\n", name[i].dwNameSpace);
|
||||
break;
|
||||
default:
|
||||
trace("\tName space ID: Unknown (%u)\n", name[i].dwNameSpace);
|
||||
break;
|
||||
}
|
||||
trace("\tActive: %d\n", name[i].fActive);
|
||||
trace("\tVersion: %d\n", name[i].dwVersion);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, name);
|
||||
}
|
||||
|
||||
static void test_WSAEnumNameSpaceProvidersW(void)
|
||||
{
|
||||
LPWSANAMESPACE_INFOW name = NULL;
|
||||
DWORD ret, error, blen = 0, i;
|
||||
if (!pWSAEnumNameSpaceProvidersW)
|
||||
{
|
||||
win_skip("WSAEnumNameSpaceProvidersW not found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWSAEnumNameSpaceProvidersW(&blen, name);
|
||||
error = WSAGetLastError();
|
||||
todo_wine
|
||||
ok(ret == SOCKET_ERROR, "Expected failure, got %u\n", ret);
|
||||
todo_wine
|
||||
ok(error == WSAEFAULT, "Expected 10014, got %u\n", error);
|
||||
|
||||
/* Invalid parameter tests */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWSAEnumNameSpaceProvidersW(NULL, name);
|
||||
error = WSAGetLastError();
|
||||
todo_wine
|
||||
ok(ret == SOCKET_ERROR, "Expected failure, got %u\n", ret);
|
||||
todo_wine
|
||||
ok(error == WSAEFAULT, "Expected 10014, got %u\n", error);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWSAEnumNameSpaceProvidersW(NULL, NULL);
|
||||
error = WSAGetLastError();
|
||||
todo_wine
|
||||
ok(ret == SOCKET_ERROR, "Expected failure, got %u\n", ret);
|
||||
todo_wine
|
||||
ok(error == WSAEFAULT, "Expected 10014, got %u\n", error);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = pWSAEnumNameSpaceProvidersW(&blen, NULL);
|
||||
error = WSAGetLastError();
|
||||
todo_wine
|
||||
ok(ret == SOCKET_ERROR, "Expected failure, got %u\n", ret);
|
||||
todo_wine
|
||||
ok(error == WSAEFAULT, "Expected 10014, got %u\n", error);
|
||||
|
||||
name = HeapAlloc(GetProcessHeap(), 0, blen);
|
||||
if (!name)
|
||||
{
|
||||
skip("Failed to alloc memory\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = pWSAEnumNameSpaceProvidersW(&blen, name);
|
||||
todo_wine
|
||||
ok(ret > 0, "Expected more than zero name space providers\n");
|
||||
|
||||
for (i = 0;i < ret; i++)
|
||||
{
|
||||
trace("Name space Identifier (%p): %s\n", name[i].lpszIdentifier,
|
||||
wine_dbgstr_w(name[i].lpszIdentifier));
|
||||
switch (name[i].dwNameSpace)
|
||||
{
|
||||
case NS_DNS:
|
||||
trace("\tName space ID: NS_DNS (%u)\n", name[i].dwNameSpace);
|
||||
break;
|
||||
case NS_NLA:
|
||||
trace("\tName space ID: NS_NLA (%u)\n", name[i].dwNameSpace);
|
||||
break;
|
||||
default:
|
||||
trace("\tName space ID: Unknown (%u)\n", name[i].dwNameSpace);
|
||||
break;
|
||||
}
|
||||
trace("\tActive: %d\n", name[i].fActive);
|
||||
trace("\tVersion: %d\n", name[i].dwVersion);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, name);
|
||||
}
|
||||
|
||||
/**************** Main program ***************/
|
||||
|
||||
START_TEST( sock )
|
||||
|
@ -8905,6 +9063,8 @@ START_TEST( sock )
|
|||
test_sioAddressListChange();
|
||||
|
||||
test_WSALookupService();
|
||||
test_WSAEnumNameSpaceProvidersA();
|
||||
test_WSAEnumNameSpaceProvidersW();
|
||||
|
||||
test_WSAAsyncGetServByPort();
|
||||
test_WSAAsyncGetServByName();
|
||||
|
|
|
@ -211,6 +211,33 @@ extern "C" {
|
|||
#define LUP_RETURN_ALL (LUP_RETURN_ADDR|LUP_RETURN_BLOB|LUP_RETURN_ALIASES|LUP_RETURN_QUERY_STRING \
|
||||
|LUP_RETURN_NAME|LUP_RETURN_TYPE|LUP_RETURN_VERSION|LUP_RETURN_COMMENT)
|
||||
|
||||
/* Constants for dwNameSpace from struct WSANAMESPACE_INFO */
|
||||
#define NS_ALL 0
|
||||
#define NS_SAP 1
|
||||
#define NS_NDS 2
|
||||
#define NS_PEER_BROWSE 3
|
||||
#define NS_SLP 5
|
||||
#define NS_DHCP 6
|
||||
#define NS_TCPIP_LOCAL 10
|
||||
#define NS_TCPIP_HOSTS 11
|
||||
#define NS_DNS 12
|
||||
#define NS_NETBT 13
|
||||
#define NS_WINS 14
|
||||
#define NS_NLA 15
|
||||
#define NS_BTH 16
|
||||
#define NS_NBP 20
|
||||
#define NS_MS 30
|
||||
#define NS_STDA 31
|
||||
#define NS_NTDS 32
|
||||
#define NS_EMAIL 37
|
||||
#define NS_PNRPNAME 38
|
||||
#define NS_PNRPCLOUD 39
|
||||
#define NS_X500 40
|
||||
#define NS_NIS 41
|
||||
#define NS_NISPLUS 42
|
||||
#define NS_WRQ 50
|
||||
#define NS_NETDES 60
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#include <guiddef.h>
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue