Commit Graph

1101 Commits

Author SHA1 Message Date
Zebediah Figura 51e5995d47 server: Avoid reporting POLLOUT on connection failure in poll_single_socket().
Ideally we should be using sock_get_poll_events() and sock_poll_event() instead,
but that seems like an overly risky change for this late in code freeze.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51442
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-07 11:57:00 +01:00
Zebediah Figura 575e632d08 ws2_32: Trace the address bound to in bind().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-06 11:34:55 +01:00
Zebediah Figura 9632048c68 server: Set the event in IOCTL_AFD_EVENT_SELECT if the socket becomes signaled.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52335
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-06 11:34:47 +01:00
Zebediah Figura 131f913527 ws2_32/tests: Test whether WSAEventSelect() modifies the event state.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-06 11:34:43 +01:00
Jinoh Kang 9ef5c9c009 server: Reselect only after dequeueing async request.
Otherwise, async_waiting() returns 0, leading the socket object to
believe that the previous async request has not yet been acknowledged.
This results in I/O hang for subsequent reads (until shutdown).

Also, async_destroy() calls async_reselect() only after removing the
async request from the queue.  Make async_set_result() consistent with
this behaviour.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52332
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-04 18:49:32 +01:00
Jinoh Kang 62e0afda1e ws2_32/tests: Add a test for simultaneous WSARecv().
Signed-off-by: Jinoh Kang <jinoh.kang.kr@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-04 18:49:24 +01:00
Zebediah Figura 45b9dccb70 ws2_32: Do not assume that an fd_set is bounded by FD_SETSIZE.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52302
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-30 23:09:45 +01:00
Zebediah Figura 40494359cb ws2_32: Don't bother checking sockets against the input write or except sets.
We only need to check the input set for CLOSE. For all other flags we can
guarantee that the socket was included in a unique input set.

E.g. the presence of WRITE in the output flags implies that the socket must have
been in the "write" set to begin with.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-30 23:09:45 +01:00
Zebediah Figura b4609ec199 ws2_32/tests: Test selecting the same socket twice.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-30 23:09:45 +01:00
Zebediah Figura 9d7f41e702 ws2_32/tests: Increase tolerance in a timing test.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-30 23:09:45 +01:00
Zebediah Figura b1a2238a10 server: Reselect the socket returned from accept_socket().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52024
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-30 23:09:45 +01:00
Zebediah Figura 4c617058a2 ws2_32/tests: Test that the socket returned from accept() inherits event selection parameters.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-30 23:09:45 +01:00
Zebediah Figura 9947a8d0de ws2_32: Correctly null-terminate the addrinfo chain.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52288
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-29 21:48:26 +01:00
Torge Matthies 566668882e ws2_32/tests: Test short fd_set with select().
Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-26 14:03:42 +01:00
Torge Matthies ae0209a336 ws2_32: Don't read more than necessary from the inputs in select().
.NET Framework / old .NET Core seems to allocate not more space than
necessary for the fd_set inputs, so if the allocation fell on the edge
of the end of the heap, Wine tried to read past it.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52259
Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-26 14:00:49 +01:00
Connor McAdams 2f9f126a6e ws2_32: Return WSAEINVAL from GetAddrInfoExOverlappedResult if overlapped is NULL.
Signed-off-by: Connor McAdams <cmcadams@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-15 20:44:29 +01:00
Zebediah Figura 7747bf9551 ntdll: Make the afd_transmit_params structure WoW64-compatible.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura b3fd1ca20e ntdll: Handle WoW64 translation in IOCTL_AFD_WINE_SENDMSG.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura 6697759b99 ntdll: Make the afd_recvmsg_params structure WoW64-compatible.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Zebediah Figura 6fe23ed8c3 ntdll: Do not fill the IOSB in NtDeviceIoControlFile() if the NT status denotes error.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Alexandre Julliard b3ca48f39c configure: Assume that sys/time.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard a7ac3de3b3 configure: Assume that sys/socket.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard d3de3c584a ws2_32: Implement Wow64 entry points in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-07 16:19:48 +01:00
Alexandre Julliard 74045dc812 ws2_32: Fix a potential buffer overflow in the Unix interface.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-07 16:19:48 +01:00
Hans Leidekker 7c39ce0a6c ws2_32: Implement AI_DNS_ONLY using DNS APIs.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52133
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-30 22:07:21 +01:00
Huw Davies 6fdae1979b configure: Stop checking for poll.h and sys/poll.h - always use poll.h.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-31 17:56:54 +01:00
Alex Henrie 04f78cb5d0 ws2_32/tests: Correct name of IPV6_V6ONLY socket option in messages.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 11:33:05 +02:00
Alex Henrie a990e25bf0 ws2_32: Set WSAEFAULT if the bind address is null.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 18:34:22 +02:00
Alex Henrie 63110f9879 ws2_32: Clear last error in WSASocketW.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 18:34:18 +02:00
Zebediah Figura 3d521bc7b9 ws2_32: Close the new socket handle on CF_DEFER.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-08 11:28:01 +02:00
Alexandre Julliard 97479d3d32 ntdll: Move some exception definitions to winternl.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 13:52:42 +02:00
Alexandre Julliard 5a19769245 configure: Remove no longer needed poll() checks.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-04 15:26:24 +02:00
Alex Henrie f45bc4f238 ws2_32: Hook up IP_RECVTOS.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:12 +02:00
Alex Henrie 0853573caf ws2_32: Hook up IP_RECVTTL.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:12 +02:00
Alex Henrie 77f07a0da2 ws2_32/tests: Add tests for IPv4 control messages.
IP_PKTINFO already had tests, but it doesn't hurt to add a few more.
IP_RECVTTL and IP_RECVTCLASS didn't have any tests.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:12 +02:00
Alex Henrie f1bffc801f ws2_32/tests: Use %u and %Iu in test_ipv6_cmsg instead of casting.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-29 21:38:12 +02:00
Guillaume Charifi 5990f19bdc ntdll: Implement exclusive flag for IOCTL_AFD_POLL.
Signed-off-by: Guillaume Charifi <guillaume.charifi@sfr.fr>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 10:28:16 +02:00
Guillaume Charifi a215324c6b ws2_32: Add tests for IOCTL_AFD_POLL exclusive flag.
Signed-off-by: Guillaume Charifi <guillaume.charifi@sfr.fr>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-23 10:27:25 +02:00
Alexandre Julliard ab5664a5e6 makefiles: Explicitly name the Unix library in the makefile instead of using --subsystem unixlib.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 17:49:48 +02:00
Alexandre Julliard 088a787a2c makefiles: Make -mno-cygwin the default.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-20 22:45:48 +02:00
Zebediah Figura 15b8f91e24 server: Check the status code to determine whether the async has failed.
Instead of manually specifying success or failure.

Based on test_return_status() in ntoskrnl. The changes in this patch don't
affect device IRPs, but the tests show the heuristic that Windows uses, and in
practice it turns out to be correct for all known asyncs.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 23:19:36 +02:00
Akihiro Sagawa ee2e5c0242 ws2_32: Disallow NULL in socket lookups.
NULL means an unused slot, not a valid socket.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-24 19:46:55 +02:00
Akihiro Sagawa ffe20add58 ws2_32: Explicitly return WSAENOTSOCK for a file handle in getsockopt() except SO_OPENTYPE.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51671
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-24 19:46:53 +02:00
Akihiro Sagawa 2a45917ae2 ws2_32/tests: Add socket option validity tests for a file handle.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-24 19:46:50 +02:00
Alistair Leslie-Hughes d4f83ba77f ws2_32: Handle success in addrinfo_err_from_unix.
When unix_getnameinfo is called, we end up with a warning fixme for no reason.
0740:fixme:winsock:addrinfo_err_from_unix unhandled error 0

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-23 20:51:17 +02:00
Zebediah Figura eec47af638 ws2_32: Properly implement getsockopt(SO_CONNECT_TIME).
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-19 11:33:47 +02:00
Zebediah Figura 4af902eb4e ws2_32: Use realloc() in get_{host, proto, serv}ent_buffer().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-19 11:33:33 +02:00
Zebediah Figura 357fb2be9b ws2_32: Use malloc() instead of HeapAlloc().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-19 11:33:25 +02:00
Alex Henrie d949b66dfd ws2_32/tests: Add tabular socket option validity tests.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 20:08:08 +02:00
Alex Henrie cf358c9351 ws2_32: Return PROTECTION_LEVEL_UNRESTRICTED for IPV6_PROTECTION_LEVEL.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-18 20:08:06 +02:00