Commit Graph

866 Commits

Author SHA1 Message Date
Zebediah Figura 5c1be1dbae ws2_32/tests: Add tests for IOCTL_AFD_POLL.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 21:13:00 +02:00
Zebediah Figura 30fd3019e1 server: Allow opening the Afd device with a file name.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50974
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 09:31:28 +02:00
Zebediah Figura 4fe9055499 ws2_32/tests: Add some tests for opening the Afd device.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-25 09:31:16 +02:00
Zebediah Figura 1ed574a03e ws2_32/tests: Add some tests for IOCTL_AFD_RECV.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-24 11:42:37 +02:00
Zebediah Figura 7fb3e57d8e ws2_32/tests: Add some tests for SO_RCVTIMEO.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-21 08:58:05 +02:00
Zebediah Figura 40e3e959fd 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>
2021-05-21 08:58:03 +02:00
Zebediah Figura 53dc1b0a58 ws2_32: Use IOCTL_AFD_WINE_SHUTDOWN in WS_shutdown().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-19 10:33:21 +02:00
Zebediah Figura 89e1cf3d44 ws2_32: Use IOCTL_AFD_WINE_SHUTDOWN in WS2_DisconnectEx().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-19 10:33:13 +02:00
Zebediah Figura 416072a84c ws2_32: Do not use SHUT_RD.
Win32 SD_RECEIVE has the following effects on a TCP or UDP socket:

* further calls to recv() et al. fail with ESHUTDOWN. However, Linux and Mac
  instead return 0.

* currently pending calls to recv() are not affected. However, Linux and Mac
  cause them to return 0.

* calls to WSAPoll() are unaffected. However, Linux and Mac instead signal
  both POLLHUP and POLLIN.

* for TCP connections, further data sent by the peer causes the connection to be
  reset. Mac and BSD will silently drop data, and Linux simply queues it
  forever.

In short, SHUT_RD does nothing that we want it to do on Linux or Mac (and
probably also BSD, though I am unable to test this).

Most of this impedance mismatch can be worked around in Wine, except for
WSAPoll(). Since poll() will always return POLLHUP, we can't safely ask for
POLLOUT, which we may need to do. Hence, since we aren't getting any benefit
from SHUT_RD, don't use it.

Note that this doesn't actually fix any tests, since we have some rather bizarre
logic to defer shutdown anyway (for an asynchronous socket, we don't call
shutdown(SHUT_RD) until the peer sends data; this is probably an unintended bug,
but "fixing" it ends up causing test failures, which is the main impetus for
this patch.)

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-19 10:32:51 +02:00
Zebediah Figura a891713f48 ws2_32: Use IOCTL_AFD_WINE_CONNECT in connect().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-18 09:56:29 +02:00
Zebediah Figura d3b6c772a5 ws2_32: Use IOCTL_AFD_WINE_CONNECT in ConnectEx().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-18 09:56:27 +02:00
Zebediah Figura 8fbf62ec47 ws2_32: Remove a leftover cast.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-18 09:56:20 +02:00
Zebediah Figura 520a84870f ws2_32: Cache the synchronous I/O event in the per-thread data.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-18 09:56:18 +02:00
Zebediah Figura cdd24b1d9f ws2_32: Use IOCTL_AFD_LISTEN.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 11:57:57 +02:00
Zebediah Figura 98d1dc31fb include: Rename Wine-specific socket ioctls.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 11:54:11 +02:00
Zebediah Figura 21efebbdc1 server: Always clear pending messages in sock_wake_up().
Instead of clearing all messages when any match.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 11:53:59 +02:00
Zebediah Figura aa6b2482cc server: Poll for FD_CLOSE even if we cannot receive more data.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-14 11:53:54 +02:00
Hans Leidekker e7af1f92a3 ws2_32: Add support for hints in GetAddrInfoExW.
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 16:45:28 +02:00
Zebediah Figura 4c409f8a3b server: Post socket events only if selecting for them.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 10:41:54 +02:00
Zebediah Figura 53210ceb0e ws2_32: Clear FD_OOB instead of FD_READ when receiving OOB data.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 10:41:38 +02:00
Zebediah Figura 037fccc0df server: Do not send messages for events that are not currently being selected for.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 10:41:25 +02:00
Zebediah Figura 11102116ac ws2_32/tests: Verify that recv() does not reset a pending FD_CLOSE.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 10:41:18 +02:00
Zebediah Figura 44a3c70d77 server: Reset the reported event mask in set_socket_event only when using window messages.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-13 10:41:12 +02:00
Zebediah Figura 9fd8a298dd ws2_32/tests: Add some tests for shutdown with completion ports.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-12 10:43:07 +02:00
Zebediah Figura ae76d94e55 ws2_32/tests: Clean up and expand tests for DisconnectEx().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-12 10:43:07 +02:00
Zebediah Figura c64f454808 ws2_32/tests: Add some tests for shutdown().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-11 20:34:07 +02:00
Zebediah Figura 32c095b0da ws2_32/tests: Add more tests for connect() and ConnectEx() with completion ports.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-11 20:34:05 +02:00
Zebediah Figura 19246e5089 ws2_32/tests: Do not close the port passed to CreateIoCompletionPort separately from the port returned.
They are the same port handle.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-11 20:34:03 +02:00
Zebediah Figura 9e448142c6 ws2_32/tests: Test calling ConnectEx() on a socket which is being accepted into.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-10 20:33:34 +02:00
Zebediah Figura 258cd1cdbc ws2_32/tests: Add a couple of tests for passing empty buffers to recv().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-10 20:33:34 +02:00
Zebediah Figura cb117a1a15 ws2_32/tests: Clean up and expand tests for WSAPoll().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-10 20:33:34 +02:00
Zebediah Figura 1f35115360 ws2_32/tests: Add some tests for nonblocking async recv().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-07 22:22:49 +02:00
Zebediah Figura 025d154463 ws2_32/tests: Always return overlapped sockets from tcp_socketpair().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-07 09:34:44 +02:00
Zebediah Figura 0abc324571 ws2_32: Return TRUE from WSAGetOverlappedResult() if the NT status denotes success.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-07 09:34:42 +02:00
Zebediah Figura 5a8dc6cd2e ws2_32: Use NtStatusToWSAError() in WSAGetOverlappedResult().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-07 09:34:40 +02:00
Zebediah Figura 54a39d5779 ws2_32: Add more status codes to NtStatusToWSAError().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-07 09:34:37 +02:00
Zebediah Figura 0f9d9a0326 ws2_32: Map EINPROGRESS to STATUS_DEVICE_NOT_READY.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-06 08:12:05 +02:00
Zebediah Figura 44c395d616 ws2_32: Map EFAULT to STATUS_ACCESS_VIOLATION.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-06 08:11:48 +02:00
Zebediah Figura cbd4f85ad3 ws2_32: Map ENOTCONN to STATUS_INVALID_CONNECTION.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-06 08:11:28 +02:00
Zebediah Figura 7a934b708c ws2_32: Map EADDRINUSE to STATUS_SHARING_VIOLATION.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-05 10:19:48 +02:00
Zebediah Figura 08da4ba927 ws2_32: Map EWOULDBLOCK to STATUS_DEVICE_NOT_READY.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-05 10:19:03 +02:00
Zebediah Figura 9195da83b9 ws2_32/tests: Add some tests for WSAGetOverlappedResult() status mapping.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-04 09:37:36 +02:00
Zebediah Figura b9cfd6eddb ws2_32: Move namespace provider stubs to protocol.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-04 09:37:31 +02:00
Zebediah Figura ec6940cd3f ws2_32: Move byte order conversion functions to protocol.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-04 09:37:28 +02:00
Zebediah Figura 615028f8ba ws2_32: Move address/string conversion functions to protocol.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-04 09:37:25 +02:00
Zebediah Figura cfdaa7fdaf ws2_32: Move service lookup functions to protocol.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-03 21:07:28 +02:00
Zebediah Figura 5d9fe03637 ws2_32: Move protocol lookup functions to protocol.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-03 21:07:26 +02:00
Zebediah Figura 877e3e24d4 ws2_32: Move name info functions to protocol.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-03 21:07:24 +02:00
Zebediah Figura ec9f311930 ws2_32: Move host lookup functions to protocol.c.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-03 21:07:21 +02:00
Zebediah Figura e30b16d738 ws2_32: Move getaddrinfo() and related functions to a separate file.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-05-03 21:07:18 +02:00