msxml3: Register msxml3 typelib.

This commit is contained in:
Alistair Leslie-Hughes 2008-03-12 20:09:32 +11:00 committed by Alexandre Julliard
parent 99e1e90f0f
commit a1cce9288b
3 changed files with 56 additions and 1 deletions

View File

@ -37,7 +37,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
static HINSTANCE hInstance;
static ITypeLib *typelib;
static ITypeInfo *typeinfos[LAST_tid];
@ -96,6 +96,41 @@ 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) {
@ -123,6 +158,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
#ifdef HAVE_LIBXML2
xmlInitParser();
#endif
hInstance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL);
break;
case DLL_PROCESS_DETACH:

View File

@ -112,5 +112,6 @@ 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

@ -3,6 +3,7 @@
*
* Copyright (C) 2003 John K. Hohm
* Copyright (C) 2006 Robert Shearman
* Copyright (C) 2008 Alistair Leslie-Hughes
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -24,6 +25,8 @@
#include <stdarg.h>
#include <string.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
@ -651,6 +654,8 @@ static struct progid const progid_list[] = {
HRESULT WINAPI DllRegisterServer(void)
{
HRESULT hr;
ITypeLib *tl;
LPWSTR path = NULL;
TRACE("\n");
@ -659,6 +664,16 @@ HRESULT WINAPI DllRegisterServer(void)
hr = register_interfaces(interface_list);
if (SUCCEEDED(hr))
hr = register_progids(progid_list);
tl = get_msxml3_typelib( &path );
if (tl)
{
hr = RegisterTypeLib( tl, path, NULL );
ITypeLib_Release( tl );
}
else
hr = E_FAIL;
return hr;
}
@ -676,5 +691,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);
return hr;
}