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
40e3e959
Commit
40e3e959
authored
May 21, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
May 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Extend WSARecvMsg() tests a bit.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2e6ae164
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
8 deletions
+55
-8
sock.c
dlls/ws2_32/tests/sock.c
+55
-8
No files found.
dlls/ws2_32/tests/sock.c
View file @
40e3e959
...
...
@@ -1769,6 +1769,16 @@ static void test_so_reuseaddr(void)
#define IP_PKTINFO_LEN (sizeof(WSACMSGHDR) + WSA_CMSG_ALIGN(sizeof(struct in_pktinfo)))
static
unsigned
int
got_ip_pktinfo_apc
;
static
void
WINAPI
ip_pktinfo_apc
(
DWORD
error
,
DWORD
size
,
OVERLAPPED
*
overlapped
,
DWORD
flags
)
{
ok
(
error
==
WSAEMSGSIZE
,
"got error %u
\n
"
,
error
);
ok
(
size
==
6
,
"got size %u
\n
"
,
size
);
ok
(
!
flags
,
"got flags %#x
\n
"
,
flags
);
++
got_ip_pktinfo_apc
;
}
static
void
test_ip_pktinfo
(
void
)
{
ULONG
addresses
[
2
]
=
{
inet_addr
(
"127.0.0.1"
),
htonl
(
INADDR_ANY
)};
...
...
@@ -1858,14 +1868,20 @@ static void test_ip_pktinfo(void)
ok
(
rc
==
sizeof
(
msg
),
"sendto() failed error: %d
\n
"
,
WSAGetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
hdr
.
Control
.
len
=
1
;
rc
=
pWSARecvMsg
(
s1
,
&
hdr
,
&
dwSize
,
NULL
,
NULL
);
err
=
WSAGetLastError
();
ok
(
rc
==
SOCKET_ERROR
&&
err
==
WSAEMSGSIZE
&&
(
hdr
.
dwFlags
&
MSG_CTRUNC
),
"WSARecvMsg() failed error: %d (ret: %d, flags: %d)
\n
"
,
err
,
rc
,
hdr
.
dwFlags
);
dwSize
=
0xdeadbeef
;
rc
=
pWSARecvMsg
(
s1
,
&
hdr
,
&
dwSize
,
NULL
,
NULL
);
ok
(
rc
==
-
1
,
"expected failure
\n
"
);
ok
(
WSAGetLastError
()
==
WSAEMSGSIZE
,
"got error %u
\n
"
,
WSAGetLastError
());
todo_wine
ok
(
dwSize
==
sizeof
(
msg
),
"got size %u
\n
"
,
dwSize
);
ok
(
hdr
.
dwFlags
==
MSG_CTRUNC
,
"got flags %#x
\n
"
,
hdr
.
dwFlags
);
hdr
.
dwFlags
=
0
;
/* Reset flags */
/* Perform another short control header test, this time with an overlapped receive */
hdr
.
Control
.
len
=
1
;
ov
.
Internal
=
0xdead1
;
ov
.
InternalHigh
=
0xdead2
;
ov
.
Offset
=
0xdead3
;
ov
.
OffsetHigh
=
0xdead4
;
rc
=
pWSARecvMsg
(
s1
,
&
hdr
,
NULL
,
&
ov
,
NULL
);
err
=
WSAGetLastError
();
ok
(
rc
!=
0
&&
err
==
WSA_IO_PENDING
,
"WSARecvMsg() failed error: %d
\n
"
,
err
);
...
...
@@ -1874,14 +1890,45 @@ static void test_ip_pktinfo(void)
ok
(
rc
==
sizeof
(
msg
),
"sendto() failed error: %d
\n
"
,
WSAGetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
ok
(
!
WaitForSingleObject
(
ov
.
hEvent
,
100
),
"wait failed
\n
"
);
dwFlags
=
0
;
WSAGetOverlappedResult
(
s1
,
&
ov
,
NULL
,
FALSE
,
&
dwFlags
);
ok
(
dwFlags
==
0
,
"WSAGetOverlappedResult() returned unexpected flags %d!
\n
"
,
dwFlags
);
ok
((
NTSTATUS
)
ov
.
Internal
==
STATUS_BUFFER_OVERFLOW
,
"got status %#x
\n
"
,
(
NTSTATUS
)
ov
.
Internal
);
todo_wine
ok
(
ov
.
InternalHigh
==
sizeof
(
msg
),
"got size %Iu
\n
"
,
ov
.
InternalHigh
);
ok
(
ov
.
Offset
==
0xdead3
,
"got Offset %Iu
\n
"
,
ov
.
Offset
);
ok
(
ov
.
OffsetHigh
==
0xdead4
,
"got OffsetHigh %Iu
\n
"
,
ov
.
OffsetHigh
);
dwFlags
=
0xdeadbeef
;
rc
=
WSAGetOverlappedResult
(
s1
,
&
ov
,
&
dwSize
,
FALSE
,
&
dwFlags
);
ok
(
!
rc
,
"expected failure
\n
"
);
ok
(
WSAGetLastError
()
==
WSAEMSGSIZE
,
"got error %u
\n
"
,
WSAGetLastError
());
todo_wine
ok
(
dwSize
==
sizeof
(
msg
),
"got size %u
\n
"
,
dwSize
);
todo_wine
ok
(
dwFlags
==
0xdeadbeef
,
"got flags %#x
\n
"
,
dwFlags
);
ok
(
hdr
.
dwFlags
==
MSG_CTRUNC
,
"WSARecvMsg() overlapped operation set unexpected flags %d.
\n
"
,
hdr
.
dwFlags
);
hdr
.
dwFlags
=
0
;
/* Reset flags */
/* And with an APC. */
SetLastError
(
0xdeadbeef
);
rc
=
sendto
(
s2
,
msg
,
sizeof
(
msg
),
0
,
(
struct
sockaddr
*
)
&
s2addr
,
sizeof
(
s2addr
));
ok
(
rc
==
sizeof
(
msg
),
"sendto() failed error: %d
\n
"
,
WSAGetLastError
());
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
hdr
.
Control
.
len
=
1
;
ov
.
Internal
=
0xdead1
;
ov
.
InternalHigh
=
0xdead2
;
ov
.
Offset
=
0xdead3
;
ov
.
OffsetHigh
=
0xdead4
;
dwSize
=
0xdeadbeef
;
rc
=
pWSARecvMsg
(
s1
,
&
hdr
,
NULL
,
&
ov
,
ip_pktinfo_apc
);
ok
(
rc
==
-
1
,
"expected failure
\n
"
);
todo_wine
ok
(
WSAGetLastError
()
==
ERROR_IO_PENDING
,
"got error %u
\n
"
,
WSAGetLastError
());
rc
=
SleepEx
(
1000
,
TRUE
);
todo_wine
ok
(
rc
==
WAIT_IO_COMPLETION
,
"got %d
\n
"
,
rc
);
todo_wine
ok
(
got_ip_pktinfo_apc
==
1
,
"apc was called %u times
\n
"
,
got_ip_pktinfo_apc
);
ok
(
hdr
.
dwFlags
==
MSG_CTRUNC
,
"got flags %#x
\n
"
,
hdr
.
dwFlags
);
got_ip_pktinfo_apc
=
0
;
hdr
.
dwFlags
=
0
;
/* Reset flags */
/*
* Setup an overlapped receive, send a packet, then wait for the packet to be retrieved
* on the server end and check that the returned packet matches what was sent.
...
...
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