[WINHTTP] Sync with Wine Staging 3.9. CORE-14656
[reactos.git] / dll / win32 / winhttp / main.c
index 60625fa..a63f28c 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#define COBJMACROS
+#include "config.h"
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "objbase.h"
+#include "rpcproxy.h"
+#include "httprequest.h"
+#include "winhttp.h"
+
+#include "wine/debug.h"
 #include "winhttp_private.h"
 
-#include <rpcproxy.h>
-#include <httprequest.h>
+HINSTANCE winhttp_instance;
 
-static HINSTANCE instance;
+WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
 
 /******************************************************************
  *              DllMain (winhttp.@)
@@ -31,12 +42,13 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
     switch(fdwReason)
     {
     case DLL_PROCESS_ATTACH:
-        instance = hInstDLL;
+        winhttp_instance = hInstDLL;
         DisableThreadLibraryCalls(hInstDLL);
         break;
     case DLL_PROCESS_DETACH:
         if (lpv) break;
         netconn_unload();
+        release_typelib();
         break;
     }
     return TRUE;
@@ -157,7 +169,7 @@ HRESULT WINAPI DllCanUnloadNow(void)
  */
 HRESULT WINAPI DllRegisterServer(void)
 {
-    return __wine_register_resources( instance );
+    return __wine_register_resources( winhttp_instance );
 }
 
 /***********************************************************************
@@ -165,5 +177,5 @@ HRESULT WINAPI DllRegisterServer(void)
  */
 HRESULT WINAPI DllUnregisterServer(void)
 {
-    return __wine_unregister_resources( instance );
+    return __wine_unregister_resources( winhttp_instance );
 }