From 9bfe1fe1f2dcea66b549fa9e2a2fbb01cf007562 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sun, 5 May 2019 00:24:28 -0500 Subject: [PATCH] server-Desktop_Refcount: Swap dependency with ws2_32-WSACleanup. To avoid a circular dependency. --- patches/patchinstall.sh | 4 +++ ...-desktop-handle-count-more-correctly.patch | 33 +++++++++++++------ patches/server-Desktop_Refcount/definition | 1 + ...ACleanup-implementation-using-winese.patch | 20 +++++------ patches/ws2_32-WSACleanup/definition | 1 - 5 files changed, 38 insertions(+), 21 deletions(-) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 040c1f9e..17424b0b 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -1737,7 +1737,11 @@ if test "$enable_server_Desktop_Refcount" -eq 1; then if test "$enable_eventfd_synchronization" -gt 1; then abort "Patchset eventfd_synchronization disabled, but server-Desktop_Refcount depends on that." fi + if test "$enable_ws2_32_WSACleanup" -gt 1; then + abort "Patchset ws2_32-WSACleanup disabled, but server-Desktop_Refcount depends on that." + fi enable_eventfd_synchronization=1 + enable_ws2_32_WSACleanup=1 fi if test "$enable_oleaut32_OLEPictureImpl_SaveAsFile" -eq 1; then diff --git a/patches/server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch b/patches/server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch index 64e68233..75f0bc08 100644 --- a/patches/server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch +++ b/patches/server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch @@ -1,4 +1,4 @@ -From 64eb8d1af7948f239a48a47c346445added70a94 Mon Sep 17 00:00:00 2001 +From 7d35e2176637947cd0d8072830408db42a4037d8 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 4 Dec 2015 01:22:29 +0100 Subject: [PATCH] server: Track desktop handle count more correctly. @@ -13,14 +13,15 @@ Signed-off-by: Sebastian Lackner server/handle.c | 3 +- server/handle.h | 2 +- server/process.c | 1 - + server/sock.c | 2 +- server/winstation.c | 88 +++++++++++++++++++------------------ - 5 files changed, 65 insertions(+), 47 deletions(-) + 6 files changed, 66 insertions(+), 48 deletions(-) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c -index 27b9b24901..381012ac86 100644 +index 2857fcfca..f45bd9d43 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c -@@ -37,6 +37,8 @@ +@@ -34,6 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(explorer); @@ -29,7 +30,7 @@ index 27b9b24901..381012ac86 100644 #define DESKTOP_CLASS_ATOM ((LPCWSTR)MAKEINTATOM(32769)) #define DESKTOP_ALL_ACCESS 0x01ff -@@ -1030,8 +1032,22 @@ void manage_desktop( WCHAR *arg ) +@@ -1009,8 +1011,22 @@ void manage_desktop( WCHAR *arg ) /* run the desktop message loop */ if (hwnd) { @@ -54,7 +55,7 @@ index 27b9b24901..381012ac86 100644 } diff --git a/server/handle.c b/server/handle.c -index 879098aee8..0aa5aa52bb 100644 +index 879098aee..0aa5aa52b 100644 --- a/server/handle.c +++ b/server/handle.c @@ -499,7 +499,7 @@ obj_handle_t find_inherited_handle( struct process *process, const struct object @@ -75,7 +76,7 @@ index 879098aee8..0aa5aa52bb 100644 } return 0; diff --git a/server/handle.h b/server/handle.h -index f1deb79fb5..13478368fa 100644 +index f1deb79fb..13478368f 100644 --- a/server/handle.h +++ b/server/handle.h @@ -49,7 +49,7 @@ extern obj_handle_t open_object( struct process *process, obj_handle_t parent, u @@ -88,7 +89,7 @@ index f1deb79fb5..13478368fa 100644 extern struct handle_table *alloc_handle_table( struct process *process, int count ); extern struct handle_table *copy_handle_table( struct process *process, struct process *parent ); diff --git a/server/process.c b/server/process.c -index e6568ecebb..3221b15da5 100644 +index e6568eceb..3221b15da 100644 --- a/server/process.c +++ b/server/process.c @@ -899,7 +899,6 @@ static void process_killed( struct process *process ) @@ -99,8 +100,20 @@ index e6568ecebb..3221b15da5 100644 process->winstation = 0; process->desktop = 0; close_process_handles( process ); +diff --git a/server/sock.c b/server/sock.c +index f951f23d6..d373768c9 100644 +--- a/server/sock.c ++++ b/server/sock.c +@@ -1344,6 +1344,6 @@ DECL_HANDLER(socket_cleanup) + unsigned int index = 0; + obj_handle_t sock; + +- while ((sock = enumerate_handles(current->process, &sock_ops, &index))) ++ while ((sock = enumerate_handles(current->process, &sock_ops, &index, NULL))) + close_handle(current->process, sock); + } diff --git a/server/winstation.c b/server/winstation.c -index d7e8a5c800..f9c0054962 100644 +index d7e8a5c80..f9c005496 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -53,6 +53,7 @@ static unsigned int winstation_map_access( struct object *obj, unsigned int acce @@ -249,5 +262,5 @@ index d7e8a5c800..f9c0054962 100644 remove_desktop_user( desktop ); release_object( desktop ); -- -2.20.1 +2.21.0 diff --git a/patches/server-Desktop_Refcount/definition b/patches/server-Desktop_Refcount/definition index eb257f56..c56a7052 100644 --- a/patches/server-Desktop_Refcount/definition +++ b/patches/server-Desktop_Refcount/definition @@ -2,3 +2,4 @@ Fixes: Fix possible leak of explorer.exe processes and implement proper desktop Fixes: Assign random name when trying to create Window Station without name Fixes: [46967] GOG Galaxy doesn't run in virtual desktop. Depends: eventfd_synchronization +Depends: ws2_32-WSACleanup 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 index 0fef2c8e..38e0e9f6 100644 --- 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 @@ -1,4 +1,4 @@ -From cbff2078d971bf23a0a6b289f544cd13fbb26873 Mon Sep 17 00:00:00 2001 +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 @@ -12,10 +12,10 @@ Subject: [PATCH] ws2_32: Proper WSACleanup implementation using wineserver 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c -index e39901d..c013258 100644 +index a3026126b..a2b9aea49 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c -@@ -1663,13 +1663,23 @@ int WINAPI WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) +@@ -1697,13 +1697,23 @@ int WINAPI WSAStartup(WORD wVersionRequested, LPWSADATA lpWSAData) */ INT WINAPI WSACleanup(void) { @@ -46,7 +46,7 @@ index e39901d..c013258 100644 diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c -index 7c55c21..f61df89f 100644 +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) @@ -91,10 +91,10 @@ index 7c55c21..f61df89f 100644 for (i = 0; i < socks; i++) { diff --git a/server/protocol.def b/server/protocol.def -index 35824ae..199f470 100644 +index 21008d7a8..4013a7cec 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -987,6 +987,9 @@ struct rawinput_device +@@ -1025,6 +1025,9 @@ struct rawinput_device obj_handle_t handle; /* handle to close */ @END @@ -105,10 +105,10 @@ index 35824ae..199f470 100644 /* Set a handle information */ @REQ(set_handle_info) diff --git a/server/sock.c b/server/sock.c -index 84f54f6..9ad4e87 100644 +index 1a53ce4b0..5095a6ef9 100644 --- a/server/sock.c +++ b/server/sock.c -@@ -1355,3 +1355,12 @@ DECL_HANDLER(get_socket_info) +@@ -1334,3 +1334,12 @@ DECL_HANDLER(get_socket_info) release_object( &sock->obj ); } @@ -118,9 +118,9 @@ index 84f54f6..9ad4e87 100644 + unsigned int index = 0; + obj_handle_t sock; + -+ while ((sock = enumerate_handles(current->process, &sock_ops, &index, NULL))) ++ while ((sock = enumerate_handles(current->process, &sock_ops, &index))) + close_handle(current->process, sock); +} -- -1.9.1 +2.21.0 diff --git a/patches/ws2_32-WSACleanup/definition b/patches/ws2_32-WSACleanup/definition index 1a0400a7..f3dfff71 100644 --- a/patches/ws2_32-WSACleanup/definition +++ b/patches/ws2_32-WSACleanup/definition @@ -1,2 +1 @@ Fixes: [18670] Properly close sockets when WSACleanup is called -Depends: server-Desktop_Refcount