Commit 94edfde1 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Register the typelib.

parent aa28ed01
......@@ -27,6 +27,7 @@
#include "winbase.h"
#include "winreg.h"
#include "shlwapi.h"
#include "oleauto.h"
#include "msipriv.h"
#include "wine/debug.h"
......@@ -43,6 +44,8 @@ INSTALLUI_HANDLERW gUIHandlerW = NULL;
DWORD gUIFilter = 0;
LPVOID gUIContext = NULL;
WCHAR gszLogFile[MAX_PATH];
WCHAR msi_path[MAX_PATH];
ITypeLib *msi_typelib = NULL;
HINSTANCE msi_hInstance;
/*
......@@ -71,6 +74,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
msi_dialog_register_class();
break;
case DLL_PROCESS_DETACH:
if (msi_typelib) ITypeLib_Release( msi_typelib );
msi_dialog_unregister_class();
msi_free_handle_table();
break;
......@@ -78,10 +82,38 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE;
}
typedef struct tagIClassFactoryImpl {
const IClassFactoryVtbl *lpVtbl;
HRESULT (*create_object)( IUnknown*, LPVOID* );
} IClassFactoryImpl;
static CRITICAL_SECTION MSI_typelib_cs;
static CRITICAL_SECTION_DEBUG MSI_typelib_cs_debug =
{
0, 0, &MSI_typelib_cs,
{ &MSI_typelib_cs_debug.ProcessLocksList,
&MSI_typelib_cs_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": MSI_typelib_cs") }
};
static CRITICAL_SECTION MSI_typelib_cs = { &MSI_typelib_cs_debug, -1, 0, 0, 0, 0 };
ITypeLib *get_msi_typelib( LPWSTR *path )
{
EnterCriticalSection( &MSI_typelib_cs );
if (!msi_typelib)
{
TRACE("loading typelib\n");
if (GetModuleFileNameW( msi_hInstance, msi_path, MAX_PATH ))
LoadTypeLib( msi_path, &msi_typelib );
}
LeaveCriticalSection( &MSI_typelib_cs );
if (path)
*path = msi_path;
if (msi_typelib)
ITypeLib_AddRef( msi_typelib );
return msi_typelib;
}
static HRESULT create_msiserver( IUnknown *pOuter, LPVOID *ppObj )
{
......@@ -89,6 +121,11 @@ static HRESULT create_msiserver( IUnknown *pOuter, LPVOID *ppObj )
return E_FAIL;
}
typedef struct tagIClassFactoryImpl {
const IClassFactoryVtbl *lpVtbl;
HRESULT (*create_object)( IUnknown*, LPVOID* );
} IClassFactoryImpl;
static HRESULT WINAPI MsiCF_QueryInterface(LPCLASSFACTORY iface,
REFIID riid,LPVOID *ppobj)
{
......
......@@ -525,6 +525,9 @@ typedef struct {
UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz );
/* msi server interface */
extern ITypeLib *get_msi_typelib( LPWSTR *path );
/* handle functions */
extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type);
extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * );
......
......@@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "config.h"
#include <stdarg.h>
......@@ -31,6 +33,7 @@
#include "ole2.h"
#include "olectl.h"
#include "oleauto.h"
#include "wine/debug.h"
......@@ -650,6 +653,8 @@ static HRESULT register_msiexec(void)
*/
HRESULT WINAPI DllRegisterServer(void)
{
LPWSTR path = NULL;
ITypeLib *tl;
HRESULT hr;
TRACE("\n");
......@@ -659,6 +664,16 @@ HRESULT WINAPI DllRegisterServer(void)
hr = register_interfaces(interface_list);
if (SUCCEEDED(hr))
hr = register_msiexec();
tl = get_msi_typelib( &path );
if (tl)
{
hr = RegisterTypeLib( tl, path, NULL );
ITypeLib_Release( tl );
}
else
hr = E_FAIL;
return hr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment