Module: wine Branch: master Commit: bc4750ff75f83498693cf420d513112c16617420 URL: http://source.winehq.org/git/wine.git/?a=commit;h=bc4750ff75f83498693cf420d5...
Author: James Hawkins truiken@gmail.com Date: Mon Jul 2 20:15:32 2007 -0700
msi: Add the IWineMsiRemoteCustomAction interface.
---
dlls/msi/custom.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ dlls/msi/msi_main.c | 17 +++++++--- dlls/msi/msipriv.h | 2 + dlls/msi/msiserver.idl | 11 ++++++ 4 files changed, 110 insertions(+), 5 deletions(-)
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index cd38af6..850db04 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -26,8 +26,11 @@ #include "winerror.h" #include "msidefs.h" #include "winuser.h" +#include "objbase.h" +#include "oleauto.h"
#include "msipriv.h" +#include "msiserver.h" #include "wine/debug.h" #include "wine/unicode.h" #include "wine/exception.h" @@ -1366,3 +1369,85 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
HeapFree( GetProcessHeap(), 0, wait_handles ); } + +typedef struct _msi_custom_remote_impl { + const IWineMsiRemoteCustomActionVtbl *lpVtbl; + LONG refs; +} msi_custom_remote_impl; + +static inline msi_custom_remote_impl* mcr_from_IWineMsiRemoteCustomAction( IWineMsiRemoteCustomAction* iface ) +{ + return (msi_custom_remote_impl*) iface; +} + +static HRESULT WINAPI mcr_QueryInterface( IWineMsiRemoteCustomAction *iface, + REFIID riid,LPVOID *ppobj) +{ + if( IsEqualCLSID( riid, &IID_IUnknown ) || + IsEqualCLSID( riid, &IID_IWineMsiRemoteCustomAction ) ) + { + IUnknown_AddRef( iface ); + *ppobj = iface; + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI mcr_AddRef( IWineMsiRemoteCustomAction *iface ) +{ + msi_custom_remote_impl* This = mcr_from_IWineMsiRemoteCustomAction( iface ); + + return InterlockedIncrement( &This->refs ); +} + +static ULONG WINAPI mcr_Release( IWineMsiRemoteCustomAction *iface ) +{ + msi_custom_remote_impl* This = mcr_from_IWineMsiRemoteCustomAction( iface ); + ULONG r; + + r = InterlockedDecrement( &This->refs ); + if (r == 0) + msi_free( This ); + return r; +} + +static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid, + MSIHANDLE *handle, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package ) +{ + msi_custom_action_info *info; + + info = find_action_by_guid( custom_action_guid ); + if (!info) + return E_FAIL; + + *handle = alloc_msihandle( &info->package->hdr ); + *dll = SysAllocString( info->source ); + *func = SysAllocString( info->target ); + + return create_msi_remote_package( NULL, (LPVOID *)remote_package ); +} + +static const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl = +{ + mcr_QueryInterface, + mcr_AddRef, + mcr_Release, + mcr_GetActionInfo, +}; + +HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ) +{ + msi_custom_remote_impl* This; + + This = msi_alloc( sizeof *This ); + if (!This) + return E_OUTOFMEMORY; + + This->lpVtbl = &msi_custom_remote_vtbl; + This->refs = 1; + + *ppObj = This; + + return S_OK; +} diff --git a/dlls/msi/msi_main.c b/dlls/msi/msi_main.c index 9384808..cf3f30c 100644 --- a/dlls/msi/msi_main.c +++ b/dlls/msi/msi_main.c @@ -189,6 +189,7 @@ static const IClassFactoryVtbl MsiCF_Vtbl = };
static IClassFactoryImpl MsiServer_CF = { &MsiCF_Vtbl, create_msiserver }; +static IClassFactoryImpl WineMsiCustomRemote_CF = { &MsiCF_Vtbl, create_msi_custom_remote }; static IClassFactoryImpl WineMsiRemotePackage_CF = { &MsiCF_Vtbl, create_msi_remote_package };
/****************************************************************** @@ -204,12 +205,10 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) return S_OK; }
- if( IsEqualCLSID (rclsid, &CLSID_IMsiServerMessage) || - IsEqualCLSID (rclsid, &CLSID_IMsiServer) || - IsEqualCLSID (rclsid, &CLSID_IMsiServerX1) || - IsEqualCLSID (rclsid, &CLSID_IMsiServerX3) ) + if ( IsEqualCLSID (rclsid, &CLSID_IWineMsiRemoteCustomAction) ) { - FIXME("create %s object\n", debugstr_guid( rclsid )); + *ppv = (LPVOID) &WineMsiCustomRemote_CF; + return S_OK; }
if ( IsEqualCLSID (rclsid, &CLSID_IWineMsiRemotePackage) ) @@ -218,6 +217,14 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) return S_OK; }
+ if( IsEqualCLSID (rclsid, &CLSID_IMsiServerMessage) || + IsEqualCLSID (rclsid, &CLSID_IMsiServer) || + IsEqualCLSID (rclsid, &CLSID_IMsiServerX1) || + IsEqualCLSID (rclsid, &CLSID_IMsiServerX3) ) + { + FIXME("create %s object\n", debugstr_guid( rclsid )); + } + return CLASS_E_CLASSNOTAVAILABLE; }
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index bb80bb3..93153e1 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -512,6 +512,7 @@ DEFINE_GUID(CLSID_IMsiServerX3, 0x000C1094,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x0
DEFINE_GUID(CLSID_IMsiServerMessage, 0x000C101D,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
+DEFINE_GUID(CLSID_IWineMsiRemoteCustomAction,0xBA26E6FA,0x4F27,0x4f56,0x95,0x3A,0x3F,0x90,0x27,0x20,0x18,0xAA); DEFINE_GUID(CLSID_IWineMsiRemotePackage,0x902b3592,0x9d08,0x4dfd,0xa5,0x93,0xd0,0x7c,0x52,0x54,0x64,0x21);
/* handle unicode/ascii output in the Msi* API functions */ @@ -535,6 +536,7 @@ UINT msi_strcpy_to_awstring( LPCWSTR str, awstring *awbuf, DWORD *sz );
/* msi server interface */ extern ITypeLib *get_msi_typelib( LPWSTR *path ); +extern HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ); extern HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj );
/* handle functions */ diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl index 5e9e56b..ee283f8 100644 --- a/dlls/msi/msiserver.idl +++ b/dlls/msi/msiserver.idl @@ -40,6 +40,17 @@ interface IWineMsiRemotePackage : IUnknown HRESULT SetProperty( [in] BSTR *property, [in] BSTR *value ); }
+[ + uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8), + oleautomation, + object +] +interface IWineMsiRemoteCustomAction : IUnknown +{ + HRESULT GetActionInfo( [in] LPCGUID guid, [out] MSIHANDLE *handle, [out] BSTR *dllname, + [out] BSTR *function, [out] IWineMsiRemotePackage **package ); +} + [ uuid(000C1092-0000-0000-C000-000000000046), version(1.0) ] library WindowsInstaller {