Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
b461fa44
Commit
b461fa44
authored
Jan 04, 2014
by
Bruno Jesus
Committed by
Alexandre Julliard
Jan 06, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add some WSALookupService[Begin|Next|End] tests.
parent
4712f361
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
168 additions
and
0 deletions
+168
-0
sock.c
dlls/ws2_32/tests/sock.c
+168
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
b461fa44
...
@@ -67,6 +67,9 @@ static int (WINAPI *pgetaddrinfo)(LPCSTR,LPCSTR,const struct addrinfo *,struct
...
@@ -67,6 +67,9 @@ static int (WINAPI *pgetaddrinfo)(LPCSTR,LPCSTR,const struct addrinfo *,struct
static
void
(
WINAPI
*
pFreeAddrInfoW
)(
PADDRINFOW
);
static
void
(
WINAPI
*
pFreeAddrInfoW
)(
PADDRINFOW
);
static
int
(
WINAPI
*
pGetAddrInfoW
)(
LPCWSTR
,
LPCWSTR
,
const
ADDRINFOW
*
,
PADDRINFOW
*
);
static
int
(
WINAPI
*
pGetAddrInfoW
)(
LPCWSTR
,
LPCWSTR
,
const
ADDRINFOW
*
,
PADDRINFOW
*
);
static
PCSTR
(
WINAPI
*
pInetNtop
)(
INT
,
LPVOID
,
LPSTR
,
ULONG
);
static
PCSTR
(
WINAPI
*
pInetNtop
)(
INT
,
LPVOID
,
LPSTR
,
ULONG
);
static
int
(
WINAPI
*
pWSALookupServiceBeginW
)(
LPWSAQUERYSETW
,
DWORD
,
LPHANDLE
);
static
int
(
WINAPI
*
pWSALookupServiceEnd
)(
HANDLE
);
static
int
(
WINAPI
*
pWSALookupServiceNextW
)(
HANDLE
,
DWORD
,
LPDWORD
,
LPWSAQUERYSETW
);
/**************** Structs and typedefs ***************/
/**************** Structs and typedefs ***************/
...
@@ -1047,6 +1050,9 @@ static void Init (void)
...
@@ -1047,6 +1050,9 @@ static void Init (void)
pFreeAddrInfoW
=
(
void
*
)
GetProcAddress
(
hws2_32
,
"FreeAddrInfoW"
);
pFreeAddrInfoW
=
(
void
*
)
GetProcAddress
(
hws2_32
,
"FreeAddrInfoW"
);
pGetAddrInfoW
=
(
void
*
)
GetProcAddress
(
hws2_32
,
"GetAddrInfoW"
);
pGetAddrInfoW
=
(
void
*
)
GetProcAddress
(
hws2_32
,
"GetAddrInfoW"
);
pInetNtop
=
(
void
*
)
GetProcAddress
(
hws2_32
,
"inet_ntop"
);
pInetNtop
=
(
void
*
)
GetProcAddress
(
hws2_32
,
"inet_ntop"
);
pWSALookupServiceBeginW
=
(
void
*
)
GetProcAddress
(
hws2_32
,
"WSALookupServiceBeginW"
);
pWSALookupServiceEnd
=
(
void
*
)
GetProcAddress
(
hws2_32
,
"WSALookupServiceEnd"
);
pWSALookupServiceNextW
=
(
void
*
)
GetProcAddress
(
hws2_32
,
"WSALookupServiceNextW"
);
ok
(
WSAStartup
(
ver
,
&
data
)
==
0
,
"WSAStartup failed
\n
"
);
ok
(
WSAStartup
(
ver
,
&
data
)
==
0
,
"WSAStartup failed
\n
"
);
tls
=
TlsAlloc
();
tls
=
TlsAlloc
();
...
@@ -7286,6 +7292,166 @@ static void test_inet_ntoa(void)
...
@@ -7286,6 +7292,166 @@ static void test_inet_ntoa(void)
CloseHandle
(
thread
);
CloseHandle
(
thread
);
}
}
static
void
test_WSALookupService
(
void
)
{
char
buffer
[
4096
],
strbuff
[
128
];
WSAQUERYSETW
*
qs
=
NULL
;
HANDLE
hnd
;
PNLA_BLOB
netdata
;
int
ret
;
DWORD
error
,
offset
,
bsize
;
if
(
!
pWSALookupServiceBeginW
||
!
pWSALookupServiceEnd
||
!
pWSALookupServiceNextW
)
{
win_skip
(
"WSALookupServiceBeginW or WSALookupServiceEnd or WSALookupServiceNextW not found"
);
return
;
}
qs
=
(
WSAQUERYSETW
*
)
buffer
;
memset
(
qs
,
0
,
sizeof
(
*
qs
));
/* invalid parameter tests */
ret
=
pWSALookupServiceBeginW
(
NULL
,
0
,
&
hnd
);
error
=
WSAGetLastError
();
ok
(
ret
==
SOCKET_ERROR
,
"WSALookupServiceBeginW should have failed
\n
"
);
todo_wine
ok
(
error
==
WSAEFAULT
,
"expected 10014, got %d
\n
"
,
error
);
ret
=
pWSALookupServiceBeginW
(
qs
,
0
,
NULL
);
error
=
WSAGetLastError
();
ok
(
ret
==
SOCKET_ERROR
,
"WSALookupServiceBeginW should have failed
\n
"
);
todo_wine
ok
(
error
==
WSAEFAULT
,
"expected 10014, got %d
\n
"
,
error
);
ret
=
pWSALookupServiceBeginW
(
qs
,
0
,
&
hnd
);
error
=
WSAGetLastError
();
ok
(
ret
==
SOCKET_ERROR
,
"WSALookupServiceBeginW should have failed
\n
"
);
todo_wine
ok
(
error
==
WSAEINVAL
||
broken
(
error
==
ERROR_INVALID_PARAMETER
)
/* <= XP */
||
broken
(
error
==
WSASERVICE_NOT_FOUND
)
/* == 2000 */
,
"expected 10022, got %d
\n
"
,
error
);
ret
=
pWSALookupServiceEnd
(
NULL
);
error
=
WSAGetLastError
();
todo_wine
ok
(
ret
==
SOCKET_ERROR
,
"WSALookupServiceEnd should have failed
\n
"
);
todo_wine
ok
(
error
==
ERROR_INVALID_HANDLE
,
"expected 6, got %d
\n
"
,
error
);
/* standard network list query */
qs
->
dwSize
=
sizeof
(
*
qs
);
hnd
=
(
HANDLE
)
0xdeadbeef
;
ret
=
pWSALookupServiceBeginW
(
qs
,
LUP_RETURN_ALL
|
LUP_DEEP
,
&
hnd
);
error
=
WSAGetLastError
();
if
(
ret
&&
error
==
ERROR_INVALID_PARAMETER
)
{
win_skip
(
"the current WSALookupServiceBeginW test is not supported in win 2000
\n
"
);
return
;
}
todo_wine
ok
(
!
ret
,
"WSALookupServiceBeginW failed unexpectedly with error %d
\n
"
,
error
);
todo_wine
ok
(
hnd
!=
(
HANDLE
)
0xdeadbeef
,
"Handle was not filled
\n
"
);
offset
=
0
;
do
{
memset
(
qs
,
0
,
sizeof
(
*
qs
));
bsize
=
sizeof
(
buffer
);
if
(
pWSALookupServiceNextW
(
hnd
,
0
,
&
bsize
,
qs
)
==
SOCKET_ERROR
)
{
error
=
WSAGetLastError
();
if
(
error
==
WSA_E_NO_MORE
)
break
;
ok
(
0
,
"Error %d happened while listing services
\n
"
,
error
);
break
;
}
WideCharToMultiByte
(
CP_ACP
,
0
,
qs
->
lpszServiceInstanceName
,
-
1
,
strbuff
,
sizeof
(
strbuff
),
NULL
,
NULL
);
trace
(
"Network Name: %s
\n
"
,
strbuff
);
/* network data is written in the blob field */
if
(
qs
->
lpBlob
)
{
/* each network may have multiple NLA_BLOB information structures */
do
{
netdata
=
(
PNLA_BLOB
)
&
qs
->
lpBlob
->
pBlobData
[
offset
];
switch
(
netdata
->
header
.
type
)
{
case
NLA_RAW_DATA
:
trace
(
"
\t
NLA Data Type: NLA_RAW_DATA
\n
"
);
break
;
case
NLA_INTERFACE
:
trace
(
"
\t
NLA Data Type: NLA_INTERFACE
\n
"
);
trace
(
"
\t\t
Type: %d
\n
"
,
netdata
->
data
.
interfaceData
.
dwType
);
trace
(
"
\t\t
Speed: %d
\n
"
,
netdata
->
data
.
interfaceData
.
dwSpeed
);
trace
(
"
\t\t
Adapter Name: %s
\n
"
,
netdata
->
data
.
interfaceData
.
adapterName
);
break
;
case
NLA_802_1X_LOCATION
:
trace
(
"
\t
NLA Data Type: NLA_802_1X_LOCATION
\n
"
);
trace
(
"
\t\t
Information: %s
\n
"
,
netdata
->
data
.
locationData
.
information
);
break
;
case
NLA_CONNECTIVITY
:
switch
(
netdata
->
data
.
connectivity
.
type
)
{
case
NLA_NETWORK_AD_HOC
:
trace
(
"
\t\t
Network Type: AD HOC
\n
"
);
break
;
case
NLA_NETWORK_MANAGED
:
trace
(
"
\t\t
Network Type: Managed
\n
"
);
break
;
case
NLA_NETWORK_UNMANAGED
:
trace
(
"
\t\t
Network Type: Unmanaged
\n
"
);
break
;
case
NLA_NETWORK_UNKNOWN
:
trace
(
"
\t\t
Network Type: Unknown
\n
"
);
}
switch
(
netdata
->
data
.
connectivity
.
internet
)
{
case
NLA_INTERNET_NO
:
trace
(
"
\t\t
Internet connectivity: No
\n
"
);
break
;
case
NLA_INTERNET_YES
:
trace
(
"
\t\t
Internet connectivity: Yes
\n
"
);
break
;
case
NLA_INTERNET_UNKNOWN
:
trace
(
"
\t\t
Internet connectivity: Unknown
\n
"
);
break
;
}
break
;
case
NLA_ICS
:
trace
(
"
\t
NLA Data Type: NLA_ICS
\n
"
);
trace
(
"
\t\t
Speed: %d
\n
"
,
netdata
->
data
.
ICS
.
remote
.
speed
);
trace
(
"
\t\t
Type: %d
\n
"
,
netdata
->
data
.
ICS
.
remote
.
type
);
trace
(
"
\t\t
State: %d
\n
"
,
netdata
->
data
.
ICS
.
remote
.
state
);
WideCharToMultiByte
(
CP_ACP
,
0
,
netdata
->
data
.
ICS
.
remote
.
machineName
,
-
1
,
strbuff
,
sizeof
(
strbuff
),
NULL
,
NULL
);
trace
(
"
\t\t
Machine Name: %s
\n
"
,
strbuff
);
WideCharToMultiByte
(
CP_ACP
,
0
,
netdata
->
data
.
ICS
.
remote
.
sharedAdapterName
,
-
1
,
strbuff
,
sizeof
(
strbuff
),
NULL
,
NULL
);
trace
(
"
\t\t
Shared Adapter Name: %s
\n
"
,
strbuff
);
break
;
default:
trace
(
"
\t
NLA Data Type: Unknown
\n
"
);
break
;
}
}
while
(
offset
);
}
}
while
(
1
);
ret
=
pWSALookupServiceEnd
(
hnd
);
ok
(
!
ret
,
"WSALookupServiceEnd failed unexpectedly
\n
"
);
}
/**************** Main program ***************/
/**************** Main program ***************/
START_TEST
(
sock
)
START_TEST
(
sock
)
...
@@ -7351,6 +7517,8 @@ START_TEST( sock )
...
@@ -7351,6 +7517,8 @@ START_TEST( sock )
test_sioRoutingInterfaceQuery
();
test_sioRoutingInterfaceQuery
();
test_WSALookupService
();
test_WSAAsyncGetServByPort
();
test_WSAAsyncGetServByPort
();
test_WSAAsyncGetServByName
();
test_WSAAsyncGetServByName
();
...
...
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