[1/7] setupapi: make hinstance global for all dialogs

Ricardo Filipe ricardo_barbano at hotmail.com
Sun Feb 22 18:30:25 CST 2009


this is a resend of the patch series of last week, starting with the
blocking change: get hinstance from DllMain making it global.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-patches/attachments/20090223/68272843/attachment-0001.htm 
-------------- next part --------------
From 252f119dd37a261b50c8982c5748775bc6881386 Mon Sep 17 00:00:00 2001
From: Ricardo Filipe <ricardo_barbano at hotmail.com>
Date: Wed, 18 Feb 2009 08:39:40 +0000
Subject: setupapi: make hinstance global for all dialogs

---
 dlls/setupapi/setupapi_private.h |    2 ++
 dlls/setupapi/setupcab.c         |    2 ++
 dlls/setupapi/virtcopy.c         |    9 ---------
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/dlls/setupapi/setupapi_private.h b/dlls/setupapi/setupapi_private.h
index d01edba..428cba4 100644
--- a/dlls/setupapi/setupapi_private.h
+++ b/dlls/setupapi/setupapi_private.h
@@ -29,6 +29,8 @@
 #define REGPART_RENAME "\\Rename"
 #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
 
+extern HINSTANCE SETUPAPI_hInstance;
+
 static inline WCHAR *strdupW( const WCHAR *str )
 {
     WCHAR *ret = NULL;
diff --git a/dlls/setupapi/setupcab.c b/dlls/setupapi/setupcab.c
index 96050e2..d879f9d 100644
--- a/dlls/setupapi/setupcab.c
+++ b/dlls/setupapi/setupcab.c
@@ -65,6 +65,7 @@
 OSVERSIONINFOW OsVersionInfo;
 
 static HINSTANCE CABINET_hInstance = 0;
+HINSTANCE SETUPAPI_hInstance = 0;
 
 static HFDI (__cdecl *sc_FDICreate)(PFNALLOC, PFNFREE, PFNOPEN,
                 PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF);
@@ -695,6 +696,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
         OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
         if (!GetVersionExW(&OsVersionInfo))
             return FALSE;
+        SETUPAPI_hInstance = hinstDLL;
         break;
     case DLL_PROCESS_DETACH:
         UnloadCABINETDll();
diff --git a/dlls/setupapi/virtcopy.c b/dlls/setupapi/virtcopy.c
index 9dddc88..c2fded2 100644
--- a/dlls/setupapi/virtcopy.c
+++ b/dlls/setupapi/virtcopy.c
@@ -43,8 +43,6 @@ static BOOL VCP_opened = FALSE;
 
 static VCPSTATUS vcp_status;
 
-static HINSTANCE SETUPAPI_hInstance;
-
 static WORD VCP_Callback( LPVOID obj, UINT16 msg, WPARAM16 wParam, LPARAM lParam, LPARAM lParamRef )
 {
     WORD args[8];
@@ -308,13 +306,6 @@ RETERR16 WINAPI VcpOpen16(VIFPROC vifproc, LPARAM lparamMsgRef)
     VCP_Proc = (FARPROC16)vifproc;
     VCP_MsgRef = lparamMsgRef;
 
-    /* load SETUPAPI needed for dialog resources etc. */
-    SETUPAPI_hInstance = GetModuleHandleA("setupapi.dll");
-    if (!SETUPAPI_hInstance)
-    {
-	ERR("Could not load sibling setupapi.dll\n");
-	return ERR_VCP_NOMEM;
-    }
     VCP_opened = TRUE;
     return OK;
 }
-- 
1.5.6.3


More information about the wine-patches mailing list