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

View File

@ -112,5 +112,6 @@ enum tid_t {
}; };
extern HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo); extern HRESULT get_typeinfo(enum tid_t tid, ITypeInfo **typeinfo);
extern ITypeLib *get_msxml3_typelib( LPWSTR *path );
#endif /* __MSXML_PRIVATE__ */ #endif /* __MSXML_PRIVATE__ */

View File

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