diff --git a/patches/ddraw-Device_Caps/definition b/patches/ddraw-Device_Caps/definition index aae8a53a..288845b1 100644 --- a/patches/ddraw-Device_Caps/definition +++ b/patches/ddraw-Device_Caps/definition @@ -1,3 +1,2 @@ -Fixes: Don't set HWTRANSFORMANDLIGHT flag on d3d7 RGB device +Fixes: [37019] Don't set HWTRANSFORMANDLIGHT flag on d3d7 RGB device Fixes: [27002] Properly initialize caps->dwZBufferBitDepths in ddraw7_GetCaps -Fixes: Properly set ddsOldCaps field in ddraw7_GetCaps diff --git a/patches/eventfd_synchronization/definition b/patches/eventfd_synchronization/definition index 29fc4c8a..84cb0e68 100644 --- a/patches/eventfd_synchronization/definition +++ b/patches/eventfd_synchronization/definition @@ -2,7 +2,6 @@ Fixes: [36692] Many multi-threaded applications have poor performance due to hea # Note: the following dependencies are essentially artificial; in particular # these patches do not make use of the Staging shared memory infrastructure. Depends: server-Shared_Memory -Depends: ws2_32-WSACleanup Depends: server-Realtime_Priority Depends: advapi32-Token_Integrity_Level Depends: ntdll-Junction_Points diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 0a75efe5..15d02668 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "1a0470443d12f6fc4c241a93af5bc34aa03b34b3" + echo "01bacebba418bf6f58a644b1aab41be215bd200a" } # Show version information @@ -215,7 +215,6 @@ patch_enable_all () enable_quartz_MediaSeeking_Positions="$1" enable_riched20_Class_Tests="$1" enable_riched20_IText_Interface="$1" - enable_server_Desktop_Refcount="$1" enable_server_FileEndOfFileInformation="$1" enable_server_File_Permissions="$1" enable_server_Inherited_ACLs="$1" @@ -263,7 +262,6 @@ patch_enable_all () enable_user32_QueryDisplayConfig="$1" enable_user32_Refresh_MDI_Menus="$1" enable_user32_ScrollWindowEx="$1" - enable_user32_ShowWindow="$1" enable_user32_msgbox_Support_WM_COPY_mesg="$1" enable_user32_rawinput_hid="$1" enable_user32_rawinput_mouse="$1" @@ -329,7 +327,6 @@ patch_enable_all () enable_ws2_32_APC_Performance="$1" enable_ws2_32_Connect_Time="$1" enable_ws2_32_TransmitFile="$1" - enable_ws2_32_WSACleanup="$1" enable_ws2_32_getaddrinfo="$1" enable_ws2_32_getsockopt="$1" enable_wtsapi32_EnumerateProcesses="$1" @@ -739,9 +736,6 @@ patch_enable () riched20-IText_Interface) enable_riched20_IText_Interface="$2" ;; - server-Desktop_Refcount) - enable_server_Desktop_Refcount="$2" - ;; server-FileEndOfFileInformation) enable_server_FileEndOfFileInformation="$2" ;; @@ -883,9 +877,6 @@ patch_enable () user32-ScrollWindowEx) enable_user32_ScrollWindowEx="$2" ;; - user32-ShowWindow) - enable_user32_ShowWindow="$2" - ;; user32-msgbox-Support-WM_COPY-mesg) enable_user32_msgbox_Support_WM_COPY_mesg="$2" ;; @@ -1081,9 +1072,6 @@ patch_enable () ws2_32-TransmitFile) enable_ws2_32_TransmitFile="$2" ;; - ws2_32-WSACleanup) - enable_ws2_32_WSACleanup="$2" - ;; ws2_32-getaddrinfo) enable_ws2_32_getaddrinfo="$2" ;; @@ -1443,13 +1431,6 @@ patch_apply() } -if test "$enable_ws2_32_TransmitFile" -eq 1; then - if test "$enable_server_Desktop_Refcount" -gt 1; then - abort "Patchset server-Desktop_Refcount disabled, but ws2_32-TransmitFile depends on that." - fi - enable_server_Desktop_Refcount=1 -fi - if test "$enable_winex11_WM_WINDOWPOSCHANGING" -eq 1; then if test "$enable_winex11__NET_ACTIVE_WINDOW" -gt 1; then abort "Patchset winex11-_NET_ACTIVE_WINDOW disabled, but winex11-WM_WINDOWPOSCHANGING depends on that." @@ -1581,13 +1562,6 @@ if test "$enable_server_File_Permissions" -eq 1; then enable_ntdll_Junction_Points=1 fi -if test "$enable_server_Desktop_Refcount" -eq 1; then - if test "$enable_ws2_32_WSACleanup" -gt 1; then - abort "Patchset ws2_32-WSACleanup disabled, but server-Desktop_Refcount depends on that." - fi - enable_ws2_32_WSACleanup=1 -fi - if test "$enable_oleaut32_OLEPictureImpl_SaveAsFile" -eq 1; then if test "$enable_oleaut32_Load_Save_EMF" -gt 1; then abort "Patchset oleaut32-Load_Save_EMF disabled, but oleaut32-OLEPictureImpl_SaveAsFile depends on that." @@ -2234,6 +2208,7 @@ fi # Patchset ddraw-Device_Caps # | # | This patchset fixes the following Wine bugs: +# | * [#37019] Don't set HWTRANSFORMANDLIGHT flag on d3d7 RGB device # | * [#27002] Properly initialize caps->dwZBufferBitDepths in ddraw7_GetCaps # | # | Modified files: @@ -3624,41 +3599,6 @@ if test "$enable_riched20_IText_Interface" -eq 1; then patch_apply riched20-IText_Interface/0010-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch fi -# Patchset ws2_32-WSACleanup -# | -# | This patchset fixes the following Wine bugs: -# | * [#18670] Properly close sockets when WSACleanup is called -# | -# | Modified files: -# | * dlls/ntdll/ntdll.spec, dlls/ntdll/unix/server.c, dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, include/wine/server.h, -# | server/protocol.def, server/sock.c -# | -if test "$enable_ws2_32_WSACleanup" -eq 1; then - patch_apply ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch - patch_apply ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch -fi - -# Patchset server-Desktop_Refcount -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * ws2_32-WSACleanup -# | -# | This patchset fixes the following Wine bugs: -# | * [#46967] GOG Galaxy doesn't run in virtual desktop. -# | -# | Modified files: -# | * programs/explorer/desktop.c, server/async.c, server/atom.c, server/change.c, server/clipboard.c, server/completion.c, -# | server/console.c, server/debugger.c, server/device.c, server/directory.c, server/event.c, server/fd.c, server/file.c, -# | server/handle.c, server/handle.h, server/hook.c, server/mailslot.c, server/mapping.c, server/mutex.c, -# | server/named_pipe.c, server/object.c, server/object.h, server/process.c, server/queue.c, server/registry.c, -# | server/request.c, server/semaphore.c, server/serial.c, server/signal.c, server/sock.c, server/symlink.c, -# | server/thread.c, server/timer.c, server/token.c, server/winstation.c -# | -if test "$enable_server_Desktop_Refcount" -eq 1; then - patch_apply server-Desktop_Refcount/0001-server-Introduce-a-new-alloc_handle-object-callback..patch - patch_apply server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch -fi - # Patchset server-FileEndOfFileInformation # | # | Modified files: @@ -4306,18 +4246,6 @@ if test "$enable_user32_ScrollWindowEx" -eq 1; then patch_apply user32-ScrollWindowEx/0001-user32-Fix-return-value-of-ScrollWindowEx-for-invisi.patch fi -# Patchset user32-ShowWindow -# | -# | This patchset fixes the following Wine bugs: -# | * [#39731] Fix handling of ShowWindow when window is already visible -# | -# | Modified files: -# | * dlls/user32/winpos.c -# | -if test "$enable_user32_ShowWindow" -eq 1; then - patch_apply user32-ShowWindow/0001-user32-ShowWindow-should-not-send-message-when-windo.patch -fi - # Patchset user32-msgbox-Support-WM_COPY-mesg # | # | This patchset fixes the following Wine bugs: @@ -5123,9 +5051,6 @@ fi # Patchset ws2_32-TransmitFile # | -# | This patchset has the following (direct or indirect) dependencies: -# | * ws2_32-WSACleanup, server-Desktop_Refcount -# | # | Modified files: # | * dlls/ws2_32/socket.c, dlls/ws2_32/tests/sock.c, include/winsock.h, server/protocol.def, server/sock.c # | diff --git a/patches/server-Desktop_Refcount/definition b/patches/server-Desktop_Refcount/definition index 03d22d5f..21139a4b 100644 --- a/patches/server-Desktop_Refcount/definition +++ b/patches/server-Desktop_Refcount/definition @@ -1,3 +1,4 @@ Fixes: Fix possible leak of explorer.exe processes and implement proper desktop refcounting Fixes: [46967] GOG Galaxy doesn't run in virtual desktop. -Depends: ws2_32-WSACleanup +# Needs work +Disabled: true diff --git a/patches/user32-ShowWindow/0001-user32-ShowWindow-should-not-send-message-when-windo.patch b/patches/user32-ShowWindow/0001-user32-ShowWindow-should-not-send-message-when-windo.patch deleted file mode 100644 index 83abb471..00000000 --- a/patches/user32-ShowWindow/0001-user32-ShowWindow-should-not-send-message-when-windo.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 33f637536046687bc533370397ed7fc704eaa0e2 Mon Sep 17 00:00:00 2001 -From: Kimmo Myllyvirta -Date: Fri, 28 Apr 2017 15:28:55 +0200 -Subject: user32: ShowWindow should not send message when window is already - visible. - ---- - dlls/user32/winpos.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c -index c2b35ec1f5..64fdfe01b0 100644 ---- a/dlls/user32/winpos.c -+++ b/dlls/user32/winpos.c -@@ -1239,6 +1239,9 @@ BOOL WINAPI ShowWindow( HWND hwnd, INT cmd ) - if ((cmd == SW_HIDE) && !(GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) - return FALSE; - -+ if ((cmd == SW_SHOW) && (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE)) -+ return TRUE; -+ - return SendMessageW( hwnd, WM_WINE_SHOWWINDOW, cmd, 0 ); - } - --- -2.12.2 - diff --git a/patches/user32-ShowWindow/definition b/patches/user32-ShowWindow/definition deleted file mode 100644 index 25d66644..00000000 --- a/patches/user32-ShowWindow/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [39731] Fix handling of ShowWindow when window is already visible diff --git a/patches/ws2_32-TransmitFile/0002-ws2_32-Add-support-for-TF_REUSE_SOCKET-to-TransmitFi.patch b/patches/ws2_32-TransmitFile/0002-ws2_32-Add-support-for-TF_REUSE_SOCKET-to-TransmitFi.patch index cbd65a5b..485bb784 100644 --- a/patches/ws2_32-TransmitFile/0002-ws2_32-Add-support-for-TF_REUSE_SOCKET-to-TransmitFi.patch +++ b/patches/ws2_32-TransmitFile/0002-ws2_32-Add-support-for-TF_REUSE_SOCKET-to-TransmitFi.patch @@ -1,21 +1,21 @@ -From 9565c624d9d70dc5433a89be22ea14ae58e52d28 Mon Sep 17 00:00:00 2001 +From 89a20d7e379e9be6da4230e303b830d190ab1b2c Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Thu, 16 Jan 2014 19:08:30 -0700 Subject: [PATCH] ws2_32: Add support for TF_REUSE_SOCKET to TransmitFile. --- - dlls/ws2_32/socket.c | 13 +++++++++- + dlls/ws2_32/socket.c | 13 ++++++++- dlls/ws2_32/tests/sock.c | 1 - include/winsock.h | 1 + - server/protocol.def | 6 +++++ - server/sock.c | 63 ++++++++++++++++++++++++++++++++++++++++++------ + server/protocol.def | 6 ++++ + server/sock.c | 63 +++++++++++++++++++++++++++++++++++----- 5 files changed, 74 insertions(+), 10 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index 6be4324..3cdd76b 100644 +index fed5329b37a..ee449cce581 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c -@@ -3103,6 +3103,17 @@ static NTSTATUS WS2_transmitfile_base( int fd, struct ws2_transmitfile_async *ws +@@ -3147,6 +3147,17 @@ static NTSTATUS WS2_transmitfile_base( int fd, struct ws2_transmitfile_async *ws if (status != STATUS_SUCCESS) return status; @@ -33,7 +33,7 @@ index 6be4324..3cdd76b 100644 if (wsa->flags & TF_DISCONNECT) { /* we can't use WS_closesocket because it modifies the last error */ -@@ -3145,7 +3156,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD +@@ -3189,7 +3200,7 @@ static BOOL WINAPI WS2_TransmitFile( SOCKET s, HANDLE h, DWORD file_bytes, DWORD LPOVERLAPPED overlapped, LPTRANSMIT_FILE_BUFFERS buffers, DWORD flags ) { @@ -43,10 +43,10 @@ index 6be4324..3cdd76b 100644 socklen_t uaddrlen = sizeof(uaddr); struct ws2_transmitfile_async *wsa; diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c -index dbcb2b2..c14f5f9 100644 +index 3d338741e0e..492d68e037c 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c -@@ -9095,7 +9095,6 @@ static void test_TransmitFile(void) +@@ -8874,7 +8874,6 @@ static void test_TransmitFile(void) err, WSAENOTSOCK); /* Test TransmitFile with a UDP datagram socket */ @@ -55,10 +55,10 @@ index dbcb2b2..c14f5f9 100644 bret = pTransmitFile(client, NULL, 0, 0, NULL, NULL, 0); err = WSAGetLastError(); diff --git a/include/winsock.h b/include/winsock.h -index 789e1da..86ce4ff 100644 +index a8bb35a4c41..42d8f751094 100644 --- a/include/winsock.h +++ b/include/winsock.h -@@ -829,6 +829,7 @@ typedef struct WS(WSAData) +@@ -835,6 +835,7 @@ typedef struct WS(WSAData) /* internal per-socket flags */ #ifdef __WINESRC__ @@ -67,10 +67,10 @@ index 789e1da..86ce4ff 100644 #define FD_WINE_NONBLOCKING 0x20000000 #define FD_WINE_CONNECTED 0x40000000 diff --git a/server/protocol.def b/server/protocol.def -index 8795c67..94c1535 100644 +index 92290af701c..77b823caad8 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -1382,6 +1382,12 @@ enum server_fd_type +@@ -1410,6 +1410,12 @@ enum server_fd_type @END @@ -84,7 +84,7 @@ index 8795c67..94c1535 100644 @REQ(set_socket_event) obj_handle_t handle; /* handle to the socket */ diff --git a/server/sock.c b/server/sock.c -index 77c3db8..8b85e59 100644 +index 1a53ce4b091..03e4ca2eec5 100644 --- a/server/sock.c +++ b/server/sock.c @@ -86,6 +86,7 @@ @@ -103,16 +103,16 @@ index 77c3db8..8b85e59 100644 static int sock_get_ntstatus( int err ); static unsigned int sock_get_error( int err ); -@@ -157,7 +159,7 @@ static const struct object_ops sock_ops = +@@ -155,7 +157,7 @@ static const struct object_ops sock_ops = + NULL, /* unlink_name */ no_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ - no_alloc_handle, /* alloc_handle */ - fd_close_handle, /* close_handle */ + sock_close_handle, /* close_handle */ sock_destroy /* destroy */ }; -@@ -609,6 +611,46 @@ static struct fd *sock_get_fd( struct object *obj ) +@@ -607,6 +609,46 @@ static struct fd *sock_get_fd( struct object *obj ) return (struct fd *)grab_object( sock->fd ); } @@ -159,7 +159,7 @@ index 77c3db8..8b85e59 100644 static void sock_destroy( struct object *obj ) { struct sock *sock = (struct sock *)obj; -@@ -662,14 +704,8 @@ static struct object *create_socket( int family, int type, int protocol, unsigne +@@ -660,14 +702,8 @@ static struct object *create_socket( int family, int type, int protocol, unsigne struct sock *sock; int sockfd; @@ -175,7 +175,7 @@ index 77c3db8..8b85e59 100644 if (!(sock = alloc_object( &sock_ops ))) { close( sockfd ); -@@ -1222,6 +1258,17 @@ DECL_HANDLER(accept_into_socket) +@@ -1218,6 +1254,17 @@ DECL_HANDLER(accept_into_socket) release_object( sock ); } @@ -194,5 +194,5 @@ index 77c3db8..8b85e59 100644 DECL_HANDLER(set_socket_event) { -- -1.9.1 +2.28.0 diff --git a/patches/ws2_32-TransmitFile/definition b/patches/ws2_32-TransmitFile/definition index dde30b29..f54cc82d 100644 --- a/patches/ws2_32-TransmitFile/definition +++ b/patches/ws2_32-TransmitFile/definition @@ -1,2 +1 @@ # Fixes: [5048] Support for TransmitFile -Depends: server-Desktop_Refcount diff --git a/patches/ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch b/patches/ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch deleted file mode 100644 index 38e0e9f6..00000000 --- a/patches/ws2_32-WSACleanup/0001-ws2_32-Proper-WSACleanup-implementation-using-winese.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 3350ed6375f384a25c8c60ab0a6ed5de948ad223 Mon Sep 17 00:00:00 2001 -From: Matt Durgavich -Date: Sun, 30 Aug 2015 11:04:08 -0400 -Subject: [PATCH] ws2_32: Proper WSACleanup implementation using wineserver - function (try 2) - ---- - dlls/ws2_32/socket.c | 22 ++++++++++++++++------ - dlls/ws2_32/tests/sock.c | 15 +++++++-------- - server/protocol.def | 3 +++ - server/sock.c | 9 +++++++++ - 4 files changed, 35 insertions(+), 14 deletions(-) - -diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index a3026126b..a2b9aea49 100644 ---- a/dlls/ws2_32/socket.c -+++ b/dlls/ws2_32/socket.c -@@ -1697,13 +1697,23 @@ int WINAPI WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) - */ - INT WINAPI WSACleanup(void) - { -- if (num_startup) { -- num_startup--; -- TRACE("pending cleanups: %d\n", num_startup); -- return 0; -+ if (!num_startup) -+ { -+ SetLastError(WSANOTINITIALISED); -+ return SOCKET_ERROR; - } -- SetLastError(WSANOTINITIALISED); -- return SOCKET_ERROR; -+ -+ if (!--num_startup) -+ { -+ SERVER_START_REQ(socket_cleanup) -+ { -+ wine_server_call( req ); -+ } -+ SERVER_END_REQ; -+ } -+ -+ TRACE("pending cleanups: %d\n", num_startup); -+ return 0; - } - - -diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c -index 0c7f7363b..f0fa8f0b6 100644 ---- a/dlls/ws2_32/tests/sock.c -+++ b/dlls/ws2_32/tests/sock.c -@@ -1218,18 +1218,17 @@ static void test_WithWSAStartup(void) - ok(res == 0, "WSAStartup() failed unexpectedly: %d\n", res); - - /* show that sockets are destroyed automatically after WSACleanup */ -- todo_wine { - SetLastError(0xdeadbeef); - res = send(pairs[0].src, "TEST", 4, 0); - error = WSAGetLastError(); - ok(res == SOCKET_ERROR, "send should have failed\n"); -- ok(error == WSAENOTSOCK, "expected 10038, got %d\n", error); -+ todo_wine ok(error == WSAENOTSOCK, "expected 10038, got %d\n", error); - - SetLastError(0xdeadbeef); - res = send(pairs[0].dst, "TEST", 4, 0); - error = WSAGetLastError(); - ok(res == SOCKET_ERROR, "send should have failed\n"); -- ok(error == WSAENOTSOCK, "expected 10038, got %d\n", error); -+ todo_wine ok(error == WSAENOTSOCK, "expected 10038, got %d\n", error); - - /* Check that all sockets were destroyed */ - for (i = 0; i < socks; i++) -@@ -1249,14 +1248,14 @@ static void test_WithWSAStartup(void) - SetLastError(0xdeadbeef); - res = getsockname(sock, (struct sockaddr *)&saddr, &size); - error = WSAGetLastError(); -- ok(res == SOCKET_ERROR, "Test[%d]: getsockname should have failed\n", i); -- if (res == SOCKET_ERROR) -- ok(error == WSAENOTSOCK, "Test[%d]: expected 10038, got %d\n", i, error); -+ if (j == 2 || (j == 0 && i == 0)) -+ todo_wine ok(res == SOCKET_ERROR, "Test[%d]: getsockname should have failed\n", i); -+ else -+ ok(res == SOCKET_ERROR, "Test[%d]: getsockname should have failed\n", i); -+ todo_wine ok(error == WSAENOTSOCK, "Test[%d]: expected 10038, got %d\n", i, error); - } - } - -- } -- - /* While wine is not fixed, close all sockets manually */ - for (i = 0; i < socks; i++) - { -diff --git a/server/protocol.def b/server/protocol.def -index 21008d7a8..4013a7cec 100644 ---- a/server/protocol.def -+++ b/server/protocol.def -@@ -1025,6 +1025,9 @@ struct rawinput_device - obj_handle_t handle; /* handle to close */ - @END - -+/* Close all sockets for the current process */ -+@REQ(socket_cleanup) -+@END - - /* Set a handle information */ - @REQ(set_handle_info) -diff --git a/server/sock.c b/server/sock.c -index 1a53ce4b0..5095a6ef9 100644 ---- a/server/sock.c -+++ b/server/sock.c -@@ -1334,3 +1334,12 @@ DECL_HANDLER(get_socket_info) - - release_object( &sock->obj ); - } -+ -+DECL_HANDLER(socket_cleanup) -+{ -+ unsigned int index = 0; -+ obj_handle_t sock; -+ -+ while ((sock = enumerate_handles(current->process, &sock_ops, &index))) -+ close_handle(current->process, sock); -+} --- -2.21.0 - diff --git a/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch b/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch deleted file mode 100644 index 7f2da5f8..00000000 --- a/patches/ws2_32-WSACleanup/0002-ws2_32-Invalidate-client-side-file-descriptor-cache-.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 68c0e9d7ae4c5c86ee112b991f723aafde57edbb Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sun, 6 Sep 2015 12:41:17 +0200 -Subject: [PATCH] ws2_32: Invalidate client-side file descriptor cache in - WSACleanup. - ---- - dlls/ntdll/ntdll.spec | 1 + - dlls/ntdll/unix/server.c | 20 ++++++++++++++++++++ - dlls/ws2_32/socket.c | 1 + - dlls/ws2_32/tests/sock.c | 5 +---- - include/wine/server.h | 1 + - 5 files changed, 24 insertions(+), 4 deletions(-) - -diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index fce1c40b56e..79386ba0078 100644 ---- a/dlls/ntdll/ntdll.spec -+++ b/dlls/ntdll/ntdll.spec -@@ -1583,6 +1583,7 @@ - - # Server interface - @ cdecl -syscall -norelay wine_server_call(ptr) -+@ cdecl -syscall wine_server_remove_fds_from_cache_by_type(long) - @ cdecl -syscall wine_server_fd_to_handle(long long long ptr) - @ cdecl -syscall wine_server_handle_to_fd(long long ptr ptr) - @ cdecl -syscall wine_server_release_fd(long long) -diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c -index 912da45956c..62f1cd8997d 100644 ---- a/dlls/ntdll/unix/server.c -+++ b/dlls/ntdll/unix/server.c -@@ -1005,6 +1005,26 @@ static int remove_fd_from_cache( HANDLE handle ) - return fd; - } - -+/*********************************************************************** -+ * server_remove_fds_from_cache_by_type -+ */ -+void CDECL wine_server_remove_fds_from_cache_by_type( enum server_fd_type type ) -+{ -+ union fd_cache_entry cache; -+ unsigned int entry, idx; -+ -+ for (entry = 0; entry < FD_CACHE_ENTRIES; entry++) -+ { -+ if (!fd_cache[entry]) continue; -+ for (idx = 0; idx < FD_CACHE_BLOCK_SIZE; idx++) -+ { -+ cache.data = InterlockedCompareExchange64( &fd_cache[entry][idx].data, 0, 0 ); -+ if (cache.s.type != type || cache.s.fd == 0) continue; -+ if (InterlockedCompareExchange64( &fd_cache[entry][idx].data, 0, cache.data ) != cache.data) continue; -+ close( cache.s.fd - 1 ); -+ } -+ } -+} - - /*********************************************************************** - * server_get_unix_fd -diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index ff8c96ab965..a304f4a82c1 100644 ---- a/dlls/ws2_32/socket.c -+++ b/dlls/ws2_32/socket.c -@@ -1740,6 +1740,7 @@ INT WINAPI WSACleanup(void) - - if (!--num_startup) - { -+ wine_server_remove_fds_from_cache_by_type( FD_TYPE_SOCKET ); - SERVER_START_REQ(socket_cleanup) - { - wine_server_call( req ); -diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c -index e550c86516b..cb8559efbf8 100644 ---- a/dlls/ws2_32/tests/sock.c -+++ b/dlls/ws2_32/tests/sock.c -@@ -1250,10 +1250,7 @@ static void test_WithWSAStartup(void) - SetLastError(0xdeadbeef); - res = getsockname(sock, (struct sockaddr *)&saddr, &size); - error = WSAGetLastError(); -- if (j == 2 || (j == 0 && i == 0)) -- todo_wine ok(res == SOCKET_ERROR, "Test[%d]: getsockname should have failed\n", i); -- else -- ok(res == SOCKET_ERROR, "Test[%d]: getsockname should have failed\n", i); -+ ok(res == SOCKET_ERROR, "Test[%d]: getsockname should have failed\n", i); - todo_wine ok(error == WSAENOTSOCK, "Test[%d]: expected 10038, got %d\n", i, error); - } - } -diff --git a/include/wine/server.h b/include/wine/server.h -index ac5dcc6f8bc..5cf52887516 100644 ---- a/include/wine/server.h -+++ b/include/wine/server.h -@@ -54,6 +54,7 @@ extern void CDECL wine_server_send_fd( int fd ); - extern int CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle ); - extern int CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, unsigned int *options ); - extern void CDECL wine_server_release_fd( HANDLE handle, int unix_fd ); -+extern void CDECL wine_server_close_fds_by_type( enum server_fd_type type ); - - /* do a server call and set the last error code */ - static inline unsigned int wine_server_call_err( void *req_ptr ) --- -2.28.0 - diff --git a/patches/ws2_32-WSACleanup/definition b/patches/ws2_32-WSACleanup/definition deleted file mode 100644 index f3dfff71..00000000 --- a/patches/ws2_32-WSACleanup/definition +++ /dev/null @@ -1 +0,0 @@ -Fixes: [18670] Properly close sockets when WSACleanup is called diff --git a/staging/upstream-commit b/staging/upstream-commit index 75fbe92d..bc1890ef 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -0ead40dc9b87ebbd74ad6ebda0182365ab2efde3 +01bacebba418bf6f58a644b1aab41be215bd200a