setupapi: Make hinstance global for all dialogs.

This commit is contained in:
Ricardo Filipe 2009-02-18 08:39:40 +00:00 committed by Alexandre Julliard
parent 1056771b91
commit 7ab7a74171
3 changed files with 4 additions and 9 deletions

View File

@ -29,6 +29,8 @@
#define REGPART_RENAME "\\Rename" #define REGPART_RENAME "\\Rename"
#define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager" #define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager"
extern HINSTANCE SETUPAPI_hInstance;
static inline WCHAR *strdupW( const WCHAR *str ) static inline WCHAR *strdupW( const WCHAR *str )
{ {
WCHAR *ret = NULL; WCHAR *ret = NULL;

View File

@ -65,6 +65,7 @@
OSVERSIONINFOW OsVersionInfo; OSVERSIONINFOW OsVersionInfo;
static HINSTANCE CABINET_hInstance = 0; static HINSTANCE CABINET_hInstance = 0;
HINSTANCE SETUPAPI_hInstance = 0;
static HFDI (__cdecl *sc_FDICreate)(PFNALLOC, PFNFREE, PFNOPEN, static HFDI (__cdecl *sc_FDICreate)(PFNALLOC, PFNFREE, PFNOPEN,
PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF); PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF);
@ -695,6 +696,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
if (!GetVersionExW(&OsVersionInfo)) if (!GetVersionExW(&OsVersionInfo))
return FALSE; return FALSE;
SETUPAPI_hInstance = hinstDLL;
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
UnloadCABINETDll(); UnloadCABINETDll();

View File

@ -43,8 +43,6 @@ static BOOL VCP_opened = FALSE;
static VCPSTATUS vcp_status; static VCPSTATUS vcp_status;
static HINSTANCE SETUPAPI_hInstance;
static WORD VCP_Callback( LPVOID obj, UINT16 msg, WPARAM16 wParam, LPARAM lParam, LPARAM lParamRef ) static WORD VCP_Callback( LPVOID obj, UINT16 msg, WPARAM16 wParam, LPARAM lParam, LPARAM lParamRef )
{ {
WORD args[8]; WORD args[8];
@ -308,13 +306,6 @@ RETERR16 WINAPI VcpOpen16(VIFPROC vifproc, LPARAM lparamMsgRef)
VCP_Proc = (FARPROC16)vifproc; VCP_Proc = (FARPROC16)vifproc;
VCP_MsgRef = lparamMsgRef; 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; VCP_opened = TRUE;
return OK; return OK;
} }