Commit Graph

733 Commits

Author SHA1 Message Date
Julian Klemann 881ee71a5c ws2_32: Add stub for SIO_ENABLE_CIRCULAR_QUEUEING in WSAIoctl().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47233
Signed-off-by: Julian Klemann <jklemann@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-20 10:23:21 +02:00
Paul Gofman 081ba0ee2f ws2_32: Manage shorter length for IPV6_V6ONLY.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-11 19:23:28 +01:00
Paul Gofman ed09d9a4c0 ws2_32: Manage shorter length for IPV6_UNICAST_HOPS.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-11 19:23:28 +01:00
Paul Gofman 91aa6b2828 ws2_32: Manage shorter length for IPV6_RECVTCLASS.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-11 19:23:28 +01:00
Paul Gofman adcff74cd2 ws2_32: Manage shorter length for IPV6_PKTINFO.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-11 19:23:28 +01:00
Paul Gofman 9890677b49 ws2_32: Manage shorter length for IPV6_MULTICAST_LOOP.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-11 19:23:28 +01:00
Paul Gofman 67ebbbf336 ws2_32: Manage shorter length for IPV6_MULTICAST_HOPS.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-11 19:23:28 +01:00
Paul Gofman afa4aef69b ws2_32: Manage shorter length for IPV6_HOPLIMIT.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-10 22:18:58 +01:00
Paul Gofman 320f48b08b ws2_32: Manage shorter length for IPV6_DONTFRAG.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-10 22:18:58 +01:00
Paul Gofman ab8b7ed549 ws2_32: Return WSAENOBUFS from setsockopt() for IPPROTO_IPV6 with negative optlen.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-10 22:18:58 +01:00
Paul Gofman 9ff978e572 ws2_32: Manage shorter length for IP_RECVTTL.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-10 22:18:58 +01:00
Paul Gofman f95fd91f1d ws2_32: Manage shorter length for IP_RECVTOS.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-10 22:18:58 +01:00
Paul Gofman d4595a9a26 ws2_32: Manage shorter length for IP_PKTINFO.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-10 22:18:58 +01:00
Paul Gofman 4259f93337 ws2_32: Manage shorter length for TCP_NODELAY.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-10 22:12:00 +01:00
Paul Gofman 4ed93b5380 ws2_32: Manage shorter length for SO_SNDBUF.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Paul Gofman 9a198964f7 ws2_32: Manage shorter length for SO_REUSEADDR.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Paul Gofman d5f79cbfaa ws2_32: Manage shorter length for SO_RCVBUF.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Paul Gofman 173407286e ws2_32: Set last error on success for SO_OPENTYPE.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Paul Gofman e60f009dc7 ws2_32: Manage shorter length for SO_OOBINLINE.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Paul Gofman 8a851dd75c ws2_32: Manage shorter length for SO_LINGER.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Paul Gofman f7c48f23e3 ws2_32: Manage shorter length for SO_KEEPALIVE.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-09 20:54:17 +01:00
Paul Gofman 26c2670203 ws2_32: Manage shorter length for SO_DONTROUTE.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-08 22:43:37 +01:00
Paul Gofman a73cb3f137 ws2_32: Manage shorter length for SO_DONTLINGER.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-08 22:43:36 +01:00
Paul Gofman 666eb2c628 ws2_32: Manage shorter length for SO_BROADCAST.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-08 22:43:36 +01:00
Paul Gofman 0baf44e320 ws2_32: Return WSAEFAULT from setsockopt() for IP_TTL with zero optlen.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-08 22:43:36 +01:00
Paul Gofman 5f9da35af1 ws2_32: Return WSAEFAULT from setsockopt() for IP_MULTICAST_TTL with zero optlen.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-08 22:43:36 +01:00
Paul Gofman c593b2f48e ws2_32: Return WSAEFAULT from setsockopt() for IP_MULTICAST_LOOP with zero optlen.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-08 22:43:36 +01:00
Paul Gofman 84bb7cd88d ws2_32: Validate IP_TOS value.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-07 21:45:09 +01:00
Paul Gofman 9744055cf4 ws2_32: Return WSAENOBUFS from setsockopt() for IPPROTO_IP with negative optlen.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-07 21:43:18 +01:00
Paul Gofman b2d1d09083 ws2_32: Treat optlen as unsigned in setsockopt() for SO_SNDTIMEO.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-07 21:43:13 +01:00
Paul Gofman 4fa4339748 ws2_32: Treat optlen as unsigned in setsockopt() for SO_RCVTIMEO.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-07 21:43:07 +01:00
Paul Gofman 20e2edba07 ws2_32: Pre-validate optlen in getsockopt().
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-07 21:42:58 +01:00
Paul Gofman 2a38dab2d2 ws2_32: Trace status on operation failure.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-09 20:08:37 +01:00
Zebediah Figura 4a56c41462 ws2_32: Build without -DWINE_NO_LONG_TYPES.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-07 10:58:20 +01:00
Zebediah Figura 2895f0fd22 ws2_32: Avoid an unnecessary goto.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-07 10:58:18 +01:00
Bastien Orivel d6ea38f32d ws2_32: Fix setsockopt(TCP_NODELAY) when optlen is less than 4.
According to MSDN [1], the `TCP_NODELAY` parameter should be of type
`BOOL` which is 4 bytes. Due to a bug [2] in rustc passing a byte
instead of an int, any program written in rust that tries to set that
option on a socket will fail with a "Invalid parameter supplied" error.

Turns out that setsockopt on linux does not want optlen to be less than
4 bytes [3].

Windows' behavior is the following:
- For optlen <= 0, return SOCKET_ERROR and set last error to WSAEFAULT
- For optlen > 0, ignore the optlen value and set the TCP_NODELAY value
  to one if the first byte of the given optvalue is not 0.

This will fix any rust program using the hyper library to do HTTP
requests.

[1]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
[2]: 44593aeb13/library/std/src/sys/windows/net.rs (L470)
[3]: d58071a8a7/net/ipv4/tcp.c (L3419-L3420)

Signed-off-by: Bastien Orivel <eijebong@bananium.fr>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-04 09:46:07 +01:00
Zebediah Figura a6cbdb7de8 ws2_32: Return WSAEFAULT instead of WSAEINVAL from WSAStartup() if "data" is NULL.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-01 18:23:18 +01:00
Zebediah Figura 5efc6369eb ws2_32: Return 65467 or 0 in the iMaxUdpDg field.
Depending on reported winsock version.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-01 18:23:18 +01:00
Zebediah Figura 699643c427 ws2_32: Return 32767 or 0 in the iMaxSockets field.
Depending on reported winsock version.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50352
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-01 18:23:18 +01:00
Zebediah Figura e078f69881 ws2_32: Cap the negotiated winsock version to 1.1 or 2.2.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-01 18:23:18 +01:00
Zebediah Figura 864bef4f8d ws2_32: Always fill the WSADATA structure in WSAStartup().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-01 18:23:18 +01:00
Zebediah Figura c0d20bb3c0 ws2_32: Cast the WSAPoll() timeout to LONGLONG before multiplying.
This is not particularly likely to overflow, but there is no harm in being
careful.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-14 19:26:26 +01:00
Zebediah Figura 894679ced8 ws2_32: Cast timeval fields to LONGLONG before multiplying.
WXWORK passes 300 seconds, which overflows 32-bit multiplication.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52383
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-14 19:26:22 +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 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
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
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