Piotr Caban : msxml3: Use LoadTypeLibEx to register typelib.
Alexandre Julliard
julliard at winehq.org
Fri Aug 22 04:43:55 CDT 2008
Module: wine
Branch: master
Commit: 379e543bbaf673f71f8551d126da76500d280d6a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=379e543bbaf673f71f8551d126da76500d280d6a
Author: Piotr Caban <piotr.caban at gmail.com>
Date: Thu Aug 21 23:36:07 2008 +0200
msxml3: Use LoadTypeLibEx to register typelib.
---
dlls/msxml3/main.c | 37 -------------------------------------
dlls/msxml3/msxml_private.h | 1 -
dlls/msxml3/regsvr.c | 18 ++++++++----------
3 files changed, 8 insertions(+), 48 deletions(-)
diff --git a/dlls/msxml3/main.c b/dlls/msxml3/main.c
index 8a1496f..93f890a 100644
--- a/dlls/msxml3/main.c
+++ b/dlls/msxml3/main.c
@@ -41,7 +41,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
-static HINSTANCE hInstance;
static ITypeLib *typelib;
static ITypeInfo *typeinfos[LAST_tid];
@@ -114,41 +113,6 @@ HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo)
return S_OK;
}
-static CRITICAL_SECTION MSXML3_typelib_cs;
-static CRITICAL_SECTION_DEBUG MSXML3_typelib_cs_debug =
-{
- 0, 0, &MSXML3_typelib_cs,
- { &MSXML3_typelib_cs_debug.ProcessLocksList,
- &MSXML3_typelib_cs_debug.ProcessLocksList },
- 0, 0, { (DWORD_PTR)(__FILE__ ": MSXML3_typelib_cs") }
-};
-static CRITICAL_SECTION MSXML3_typelib_cs = { &MSXML3_typelib_cs_debug, -1, 0, 0, 0, 0 };
-
-ITypeLib *get_msxml3_typelib( LPWSTR *path )
-{
- static WCHAR msxml3_path[MAX_PATH];
-
- EnterCriticalSection( &MSXML3_typelib_cs );
-
- if (!typelib)
- {
- TRACE("loading typelib\n");
-
- if (GetModuleFileNameW( hInstance, msxml3_path, MAX_PATH ))
- LoadTypeLib( msxml3_path, &typelib );
- }
-
- LeaveCriticalSection( &MSXML3_typelib_cs );
-
- if (path)
- *path = msxml3_path;
-
- if (typelib)
- ITypeLib_AddRef( typelib );
-
- return typelib;
-}
-
static void process_detach(void)
{
if(typelib) {
@@ -187,7 +151,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
/* Set the current ident to the default */
xmlTreeIndentString = "\t";
#endif
- hInstance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL);
break;
case DLL_PROCESS_DETACH:
diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h
index d065e3b..13d35be 100644
--- a/dlls/msxml3/msxml_private.h
+++ b/dlls/msxml3/msxml_private.h
@@ -134,6 +134,5 @@ enum tid_t {
};
extern HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo);
-extern ITypeLib *get_msxml3_typelib( LPWSTR *path );
#endif /* __MSXML_PRIVATE__ */
diff --git a/dlls/msxml3/regsvr.c b/dlls/msxml3/regsvr.c
index 05bf74d..320d51e 100644
--- a/dlls/msxml3/regsvr.c
+++ b/dlls/msxml3/regsvr.c
@@ -663,7 +663,7 @@ HRESULT WINAPI DllRegisterServer(void)
{
HRESULT hr;
ITypeLib *tl;
- LPWSTR path = NULL;
+ static const WCHAR wszMsXml3[] = {'m','s','x','m','l','3','.','d','l','l',0};
TRACE("\n");
@@ -673,14 +673,12 @@ HRESULT WINAPI DllRegisterServer(void)
if (SUCCEEDED(hr))
hr = register_progids(progid_list);
- tl = get_msxml3_typelib( &path );
- if (tl)
- {
- hr = RegisterTypeLib( tl, path, NULL );
- ITypeLib_Release( tl );
+ if(SUCCEEDED(hr)) {
+
+ hr = LoadTypeLibEx(wszMsXml3, REGKIND_REGISTER, &tl);
+ if(SUCCEEDED(hr))
+ ITypeLib_Release(tl);
}
- else
- hr = E_FAIL;
return hr;
}
@@ -699,8 +697,8 @@ HRESULT WINAPI DllUnregisterServer(void)
hr = unregister_interfaces(interface_list);
if (SUCCEEDED(hr))
hr = unregister_progids(progid_list);
- if (SUCCEEDED(hr))
- hr = UnRegisterTypeLib(&LIBID_MSXML2, 3, 0, LOCALE_SYSTEM_DEFAULT, SYS_WIN32);
+ if (SUCCEEDED(hr))
+ hr = UnRegisterTypeLib(&LIBID_MSXML2, 3, 0, LOCALE_SYSTEM_DEFAULT, SYS_WIN32);
return hr;
}
More information about the wine-cvs
mailing list