msi [3/6]: Add the IWineMsiRemoteCustomAction interface

James Hawkins truiken at gmail.com
Tue Jun 26 19:03:22 CDT 2007


Hi,

Changelog:
* 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(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 2ea73f9..ba16e5b 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -26,8 +26,11 @@ #include "winbase.h"
 #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"
@@ -1343,3 +1346,85 @@ void ACTION_FinishCustomActions(const MS
 
     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 = InterlockedIncrement( &This->refs );
+    if (r == 0)
+        msi_free( This );
+    return r;
+}
+
+static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid,
+         ULONG_PTR 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;
+
+    *(ULONG_PTR *)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_Vtb
 };
 
 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(REFCLSI
         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(REFCLSI
         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 3136c0d..b621c50 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -512,6 +512,7 @@ DEFINE_GUID(CLSID_IMsiServerX3, 0x000C10
 
 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
 
 /* 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 f652154..a4f4b9b 100644
--- a/dlls/msi/msiserver.idl
+++ b/dlls/msi/msiserver.idl
@@ -36,6 +36,17 @@ interface IWineMsiRemotePackage : IUnkno
     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] ULONG_PTR handle, [out] BSTR *dllname,
+                           [out] BSTR *function, [out] IWineMsiRemotePackage **package );
+}
+
 [ uuid(000C1092-0000-0000-C000-000000000046), version(1.0) ]
 library WindowsInstaller
 {
-- 
1.4.1


More information about the wine-patches mailing list