msxml3: Use LoadTypeLibEx to register typelib.

This commit is contained in:
Piotr Caban 2008-08-21 23:36:07 +02:00 committed by Alexandre Julliard
parent dc22442141
commit 379e543bba
3 changed files with 8 additions and 48 deletions

View File

@ -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:

View File

@ -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__ */

View File

@ -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;
}