[PATCH 1/4] webservices: Call WSACleanup when the dll is unloaded.

Hans Leidekker hans at codeweavers.com
Wed Jun 6 07:10:07 CDT 2018


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/webservices/listener.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/dlls/webservices/listener.c b/dlls/webservices/listener.c
index a178e276e4..357a1c6a53 100644
--- a/dlls/webservices/listener.c
+++ b/dlls/webservices/listener.c
@@ -31,6 +31,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(webservices);
 
+HINSTANCE webservices_instance;
+
 static BOOL winsock_loaded;
 
 static BOOL WINAPI winsock_startup( INIT_ONCE *once, void *param, void **ctx )
@@ -48,6 +50,26 @@ void winsock_init(void)
     InitOnceExecuteOnce( &once, winsock_startup, NULL, NULL );
 }
 
+/******************************************************************
+ *      DllMain (webservices.@)
+ */
+BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, void *reserved )
+{
+    switch (reason)
+    {
+    case DLL_PROCESS_ATTACH:
+        webservices_instance = hinst;
+        DisableThreadLibraryCalls( hinst );
+        break;
+
+    case DLL_PROCESS_DETACH:
+        if (reserved) break;
+        if (winsock_loaded) WSACleanup();
+        break;
+    }
+    return TRUE;
+}
+
 static const struct prop_desc listener_props[] =
 {
     { sizeof(ULONG), FALSE },                               /* WS_LISTENER_PROPERTY_LISTEN_BACKLOG */
-- 
2.11.0




More information about the wine-devel mailing list