diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 3f502cb2..2cdc3de7 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -277,6 +277,7 @@ patch_enable_all () enable_winmm_mciSendCommandA="$1" enable_wintab32_improvements="$1" enable_wintrust_WTHelperGetProvCertFromChain="$1" + enable_ws2_32_connect_already_connected="$1" enable_wscript_support_d_u_switches="$1" enable_xactengine_initial="$1" enable_xactengine3_7_Notification="$1" @@ -872,6 +873,9 @@ patch_enable () wintrust-WTHelperGetProvCertFromChain) enable_wintrust_WTHelperGetProvCertFromChain="$2" ;; + ws2_32-connect-already-connected) + enable_ws2_32_connect_already_connected="$2" + ;; wscript-support-d-u-switches) enable_wscript_support_d_u_switches="$2" ;; @@ -4184,6 +4188,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-connect-already-connected +# | +# | This patchset fixes the following Wine bugs: +# | * [#51381] ws2_32: return correct error code when already connected. +# | +# | Modified files: +# | * dlls/ws2_32/socket.c, server/sock.c +# | +if test "$enable_ws2_32_connect_already_connected" -eq 1; then + patch_apply ws2_32-connect-already-connected/0001-ws2_32-Return-STATUS_ADDRESS_ALREADY_ASSOCIATED-for-.patch +fi + # Patchset wscript-support-d-u-switches # | # | This patchset fixes the following Wine bugs: diff --git a/patches/ws2_32-connect-already-connected/0001-ws2_32-Return-STATUS_ADDRESS_ALREADY_ASSOCIATED-for-.patch b/patches/ws2_32-connect-already-connected/0001-ws2_32-Return-STATUS_ADDRESS_ALREADY_ASSOCIATED-for-.patch new file mode 100644 index 00000000..846001e3 --- /dev/null +++ b/patches/ws2_32-connect-already-connected/0001-ws2_32-Return-STATUS_ADDRESS_ALREADY_ASSOCIATED-for-.patch @@ -0,0 +1,43 @@ +From 3cc8df69a7e3037530910dc1dbb310488b4c2d19 Mon Sep 17 00:00:00 2001 +From: Zebediah Figura +Date: Fri, 2 Jul 2021 13:07:26 +1000 +Subject: [PATCH] ws2_32: Return STATUS_ADDRESS_ALREADY_ASSOCIATED for + connected sockets + +--- + dlls/ws2_32/socket.c | 5 +++++ + server/sock.c | 2 +- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c +index 87966545bb8..aab338b3fad 100644 +--- a/dlls/ws2_32/socket.c ++++ b/dlls/ws2_32/socket.c +@@ -1867,6 +1867,11 @@ int WINAPI WS_connect( SOCKET s, const struct WS_sockaddr *addr, int len ) + if (WaitForSingleObject( sync_event, INFINITE ) == WAIT_FAILED) return -1; + status = io.u.Status; + } ++ if (status == STATUS_ADDRESS_ALREADY_ASSOCIATED) ++ { ++ SetLastError( WSAEALREADY ); ++ return -1; ++ } + if (status) + { + /* NtStatusToWSAError() has no mapping for WSAEALREADY */ +diff --git a/server/sock.c b/server/sock.c +index 65489c183ac..1de234d7eb5 100644 +--- a/server/sock.c ++++ b/server/sock.c +@@ -1928,7 +1928,7 @@ static int sock_get_ntstatus( int err ) + case EMFILE: return STATUS_TOO_MANY_OPENED_FILES; + case EINPROGRESS: + case EWOULDBLOCK: return STATUS_DEVICE_NOT_READY; +- case EALREADY: return STATUS_NETWORK_BUSY; ++ case EALREADY: return STATUS_ADDRESS_ALREADY_ASSOCIATED; + case ENOTSOCK: return STATUS_OBJECT_TYPE_MISMATCH; + case EDESTADDRREQ: return STATUS_INVALID_PARAMETER; + case EMSGSIZE: return STATUS_BUFFER_OVERFLOW; +-- +2.30.2 + diff --git a/patches/ws2_32-connect-already-connected/definition b/patches/ws2_32-connect-already-connected/definition new file mode 100644 index 00000000..e818fe51 --- /dev/null +++ b/patches/ws2_32-connect-already-connected/definition @@ -0,0 +1 @@ +Fixes: [51381] ws2_32: return correct error code when already connected.