Juan Lang : winhttp: Unload OpenSSL when unloading winhttp.

Alexandre Julliard julliard at winehq.org
Mon Oct 5 09:54:23 CDT 2009


Module: wine
Branch: master
Commit: d7d8a0eec46219adc421065223959737a91f92ba
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d7d8a0eec46219adc421065223959737a91f92ba

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri Oct  2 07:53:01 2009 -0700

winhttp: Unload OpenSSL when unloading winhttp.

---

 dlls/winhttp/main.c            |    1 +
 dlls/winhttp/net.c             |   16 ++++++++++++++++
 dlls/winhttp/winhttp_private.h |    1 +
 3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/winhttp/main.c b/dlls/winhttp/main.c
index c0ac9cb..945123a 100644
--- a/dlls/winhttp/main.c
+++ b/dlls/winhttp/main.c
@@ -42,6 +42,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
         DisableThreadLibraryCalls(hInstDLL);
         break;
     case DLL_PROCESS_DETACH:
+        netconn_unload();
         break;
     }
     return TRUE;
diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c
index a824271..7ab9944 100644
--- a/dlls/winhttp/net.c
+++ b/dlls/winhttp/net.c
@@ -97,6 +97,7 @@ static SSL_CTX *ctx;
 MAKE_FUNCPTR( SSL_library_init );
 MAKE_FUNCPTR( SSL_load_error_strings );
 MAKE_FUNCPTR( SSLv23_method );
+MAKE_FUNCPTR( SSL_CTX_free );
 MAKE_FUNCPTR( SSL_CTX_new );
 MAKE_FUNCPTR( SSL_new );
 MAKE_FUNCPTR( SSL_free );
@@ -221,6 +222,7 @@ BOOL netconn_init( netconn_t *conn, BOOL secure )
     LOAD_FUNCPTR( SSL_library_init );
     LOAD_FUNCPTR( SSL_load_error_strings );
     LOAD_FUNCPTR( SSLv23_method );
+    LOAD_FUNCPTR( SSL_CTX_free );
     LOAD_FUNCPTR( SSL_CTX_new );
     LOAD_FUNCPTR( SSL_new );
     LOAD_FUNCPTR( SSL_free );
@@ -270,6 +272,20 @@ BOOL netconn_init( netconn_t *conn, BOOL secure )
     return TRUE;
 }
 
+void netconn_unload( void )
+{
+#if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO)
+    if (libcrypto_handle)
+        wine_dlclose( libcrypto_handle, NULL, 0 );
+    if (libssl_handle)
+    {
+        if (ctx)
+            pSSL_CTX_free( ctx );
+        wine_dlclose( libssl_handle, NULL, 0 );
+    }
+#endif
+}
+
 BOOL netconn_connected( netconn_t *conn )
 {
     return (conn->socket != -1);
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index e445109..64348a2 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -215,6 +215,7 @@ BOOL netconn_connected( netconn_t * );
 BOOL netconn_create( netconn_t *, int, int, int );
 BOOL netconn_get_next_line( netconn_t *, char *, DWORD * );
 BOOL netconn_init( netconn_t *, BOOL );
+void netconn_unload( void );
 BOOL netconn_query_data_available( netconn_t *, DWORD * );
 BOOL netconn_recv( netconn_t *, void *, size_t, int, int * );
 BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr *, socklen_t * );




More information about the wine-cvs mailing list