Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ad2405da
Commit
ad2405da
authored
Oct 11, 2015
by
Bruno Jesus
Committed by
Alexandre Julliard
Oct 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add WSAEnumNameSpaceProviders[A|W] tests.
Signed-off-by:
Bruno Jesus
<
00cpxxx@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2964c2b3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
187 additions
and
0 deletions
+187
-0
sock.c
dlls/ws2_32/tests/sock.c
+160
-0
winsock2.h
include/winsock2.h
+27
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
ad2405da
...
...
@@ -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
(
"
\t
Name space ID: NS_DNS (%u)
\n
"
,
name
[
i
].
dwNameSpace
);
break
;
case
NS_NLA
:
trace
(
"
\t
Name space ID: NS_NLA (%u)
\n
"
,
name
[
i
].
dwNameSpace
);
break
;
default:
trace
(
"
\t
Name space ID: Unknown (%u)
\n
"
,
name
[
i
].
dwNameSpace
);
break
;
}
trace
(
"
\t
Active: %d
\n
"
,
name
[
i
].
fActive
);
trace
(
"
\t
Version: %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
(
"
\t
Name space ID: NS_DNS (%u)
\n
"
,
name
[
i
].
dwNameSpace
);
break
;
case
NS_NLA
:
trace
(
"
\t
Name space ID: NS_NLA (%u)
\n
"
,
name
[
i
].
dwNameSpace
);
break
;
default:
trace
(
"
\t
Name space ID: Unknown (%u)
\n
"
,
name
[
i
].
dwNameSpace
);
break
;
}
trace
(
"
\t
Active: %d
\n
"
,
name
[
i
].
fActive
);
trace
(
"
\t
Version: %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
();
...
...
include/winsock2.h
View file @
ad2405da
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment