Added ws2_32-SIO_IDEAL_SEND_BACKLOG_QUERY patchset

This commit is contained in:
Alistair Leslie-Hughes 2022-01-23 12:15:20 +11:00
parent 95bf669895
commit 766e1ee8f8
3 changed files with 163 additions and 1 deletions

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "6fe37b465649bfff2085ea871ffad0fff7ee7d61"
echo "599ecd97a8fded8c00aa261535880a4d8b5d2693"
}
# Show version information
@ -264,6 +264,7 @@ patch_enable_all ()
enable_winmm_mciSendCommandA="$1"
enable_wintab32_improvements="$1"
enable_wintrust_WTHelperGetProvCertFromChain="$1"
enable_ws2_32_SIO_IDEAL_SEND_BACKLOG_QUERY="$1"
enable_wscript_support_d_u_switches="$1"
enable_xactengine_initial="$1"
enable_xactengine3_7_Notification="$1"
@ -820,6 +821,9 @@ patch_enable ()
wintrust-WTHelperGetProvCertFromChain)
enable_wintrust_WTHelperGetProvCertFromChain="$2"
;;
ws2_32-SIO_IDEAL_SEND_BACKLOG_QUERY)
enable_ws2_32_SIO_IDEAL_SEND_BACKLOG_QUERY="$2"
;;
wscript-support-d-u-switches)
enable_wscript_support_d_u_switches="$2"
;;
@ -3942,6 +3946,18 @@ if test "$enable_wintrust_WTHelperGetProvCertFromChain" -eq 1; then
patch_apply wintrust-WTHelperGetProvCertFromChain/0001-wintrust-Add-parameter-check-in-WTHelperGetProvCertF.patch
fi
# Patchset ws2_32-SIO_IDEAL_SEND_BACKLOG_QUERY
# |
# | This patchset fixes the following Wine bugs:
# | * [#49412] ws2_32: Support WSAIoctl SIO_IDEAL_SEND_BACKLOG_QUERY
# |
# | Modified files:
# | * dlls/ntdll/unix/socket.c, dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, include/wine/afd.h
# |
if test "$enable_ws2_32_SIO_IDEAL_SEND_BACKLOG_QUERY" -eq 1; then
patch_apply ws2_32-SIO_IDEAL_SEND_BACKLOG_QUERY/0001-ws2_32-Return-a-valid-value-for-WSAIoctl-SIO_IDEAL_S.patch
fi
# Patchset wscript-support-d-u-switches
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,145 @@
From 38b454cf42d01fe4558276b571842b213aa21e1a Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 15 Sep 2020 19:44:38 +1000
Subject: [PATCH] ws2_32: Return a valid value for WSAIoctl
SIO_IDEAL_SEND_BACKLOG_QUERY.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/ntdll/unix/socket.c | 31 +++++++++++++++++++++++++++++++
dlls/ws2_32/socket.c | 17 +++++++++++++++++
dlls/ws2_32/tests/sock.c | 13 ++++++++++++-
include/wine/afd.h | 1 +
4 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c
index 71dfcdd1114..f62d54ef148 100644
--- a/dlls/ntdll/unix/socket.c
+++ b/dlls/ntdll/unix/socket.c
@@ -1422,6 +1422,37 @@ NTSTATUS sock_ioctl( HANDLE handle, HANDLE event, PIO_APC_ROUTINE apc, void *apc
return STATUS_SUCCESS;
}
+ case IOCTL_AFD_WINE_SEND_BACKLOG_QUERY:
+ {
+ int proto;
+ unsigned protolen = sizeof(protolen);
+
+ if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
+ return status;
+
+ if (out_size < sizeof(DWORD))
+ {
+ status = STATUS_BUFFER_TOO_SMALL;
+ break;
+ }
+
+ if (getsockopt( fd, SOL_SOCKET, SO_PROTOCOL, &proto, &protolen ) < 0)
+ {
+ status = sock_errno_to_status( errno );
+ break;
+ }
+
+ if(proto != IPPROTO_TCP)
+ {
+ status = STATUS_NOT_SUPPORTED;
+ break;
+ }
+
+ *(DWORD*)out_buffer = 0x10000; /* 64k */
+
+ break;
+ }
+
case IOCTL_AFD_WINE_SIOCATMARK:
{
int value, ret;
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index fe7e4fb3464..9c133e94e60 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2007,6 +2007,23 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
return ret ? -1 : 0;
}
+ case SIO_IDEAL_SEND_BACKLOG_QUERY:
+ {
+ DWORD ret;
+
+ if (!out_buff)
+ {
+ SetLastError(WSAEFAULT);
+ return SOCKET_ERROR;
+ }
+
+ ret = server_ioctl_sock( s, IOCTL_AFD_WINE_SEND_BACKLOG_QUERY, in_buff, in_size,
+ out_buff, out_size, ret_size, overlapped, completion );
+ SetLastError( ret );
+ if (!ret) *ret_size = sizeof(u_long);
+ return ret ? -1 : 0;
+ }
+
case SIOCATMARK:
{
DWORD ret;
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 054e597b719..35102265cbf 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -6065,8 +6065,9 @@ static void test_WSASendTo(void)
struct sockaddr_in addr, ret_addr;
char buf[12] = "hello world";
WSABUF data_buf;
- DWORD bytesSent;
+ DWORD bytesSent, size;
int ret, len;
+ ULONG backlog = 0;
addr.sin_family = AF_INET;
addr.sin_port = htons(139);
@@ -6102,6 +6103,11 @@ static void test_WSASendTo(void)
ok(!ret, "got error %u\n", WSAGetLastError());
ok(ret_addr.sin_family == AF_INET, "got family %u\n", ret_addr.sin_family);
ok(ret_addr.sin_port, "expected nonzero port\n");
+
+ ret = WSAIoctl(s, SIO_IDEAL_SEND_BACKLOG_QUERY, NULL, 0, &backlog, sizeof(backlog), &size, NULL, NULL);
+ ok(ret == SOCKET_ERROR && WSAGetLastError() == WSAEOPNOTSUPP,
+ "WSAIoctl() failed: %d/%d\n", ret, WSAGetLastError());
+ closesocket(s);
}
static DWORD WINAPI recv_thread(LPVOID arg)
@@ -6142,6 +6148,7 @@ static void test_WSARecv(void)
DWORD dwret;
BOOL bret;
HANDLE thread, event = NULL, io_port;
+ ULONG backlog = 0, size;
tcp_socketpair(&src, &dest);
@@ -6290,6 +6297,10 @@ static void test_WSARecv(void)
CloseHandle(io_port);
+ iret = WSAIoctl(src, SIO_IDEAL_SEND_BACKLOG_QUERY, NULL, 0, &backlog, sizeof(backlog), &size, NULL, NULL);
+ ok(!iret, "WSAIoctl() failed: %d/%d\n", iret, WSAGetLastError());
+ ok(backlog == 0x10000, "got %08x\n", backlog);
+
end:
if (server != INVALID_SOCKET)
closesocket(server);
diff --git a/include/wine/afd.h b/include/wine/afd.h
index efd5787e90a..b6aad067770 100644
--- a/include/wine/afd.h
+++ b/include/wine/afd.h
@@ -283,6 +283,7 @@ C_ASSERT( sizeof(struct afd_get_events_params) == 56 );
#define IOCTL_AFD_WINE_SET_IP_RECVTTL WINE_AFD_IOC(294)
#define IOCTL_AFD_WINE_GET_IP_RECVTOS WINE_AFD_IOC(295)
#define IOCTL_AFD_WINE_SET_IP_RECVTOS WINE_AFD_IOC(296)
+#define IOCTL_AFD_WINE_SEND_BACKLOG_QUERY WINE_AFD_IOC(297)
struct afd_iovec
{
--
2.34.1

View File

@ -0,0 +1 @@
Fixes: [49412] ws2_32: Support WSAIoctl SIO_IDEAL_SEND_BACKLOG_QUERY