Zebediah Figura : msi: Allocate the remote handle on the server side.

Alexandre Julliard julliard at winehq.org
Mon Apr 16 15:26:25 CDT 2018


Module: wine
Branch: master
Commit: b9b459810f646c48bdac981a066f0102acb9201c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b9b459810f646c48bdac981a066f0102acb9201c

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun Apr 15 20:52:09 2018 -0500

msi: Allocate the remote handle on the server side.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msi/custom.c      | 17 ++++++++---------
 dlls/msi/msipriv.h     |  4 +++-
 dlls/msi/msiserver.idl |  3 +--
 dlls/msi/package.c     | 12 ++----------
 4 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 851c503..def36e3 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -490,7 +490,7 @@ static void handle_msi_break( LPCWSTR target )
     DebugBreak();
 }
 
-static UINT get_action_info( const GUID *guid, INT *type, MSIHANDLE *handle,
+static UINT get_action_info( const GUID *guid, INT *type,
                              BSTR *dll, BSTR *funcname,
                              IWineMsiRemotePackage **package )
 {
@@ -513,7 +513,7 @@ static UINT get_action_info( const GUID *guid, INT *type, MSIHANDLE *handle,
         return ERROR_FUNCTION_FAILED;
     }
 
-    r = IWineMsiRemoteCustomAction_GetActionInfo( rca, guid, type, handle, dll, funcname, package );
+    r = IWineMsiRemoteCustomAction_GetActionInfo( rca, guid, type, dll, funcname, package );
     IWineMsiRemoteCustomAction_Release( rca );
     if (FAILED(r))
     {
@@ -550,7 +550,7 @@ static inline UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE
 static DWORD ACTION_CallDllFunction( const GUID *guid )
 {
     MsiCustomActionEntryPoint fn;
-    MSIHANDLE hPackage, handle;
+    MSIHANDLE hPackage;
     HANDLE hModule;
     LPSTR proc;
     UINT r = ERROR_FUNCTION_FAILED;
@@ -560,7 +560,7 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
 
     TRACE("%s\n", debugstr_guid( guid ));
 
-    r = get_action_info( guid, &type, &handle, &dll, &function, &remote_package );
+    r = get_action_info( guid, &type, &dll, &function, &remote_package );
     if (r != ERROR_SUCCESS)
         return r;
 
@@ -579,7 +579,6 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
         hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package );
         if (hPackage)
         {
-            IWineMsiRemotePackage_SetMsiHandle( remote_package, handle );
             TRACE("calling %s\n", debugstr_w( function ) );
             handle_msi_break( function );
 
@@ -608,7 +607,6 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
     IWineMsiRemotePackage_Release( remote_package );
     SysFreeString( dll );
     SysFreeString( function );
-    MsiCloseHandle( handle );
 
     return r;
 }
@@ -1428,21 +1426,22 @@ static ULONG WINAPI mcr_Release( IWineMsiRemoteCustomAction *iface )
 }
 
 static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid,
-         INT *type, MSIHANDLE *handle, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package )
+         INT *type, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package )
 {
     msi_custom_action_info *info;
+    MSIHANDLE handle;
 
     info = find_action_by_guid( custom_action_guid );
     if (!info)
         return E_FAIL;
 
     *type = info->type;
-    *handle = alloc_msihandle( &info->package->hdr );
+    handle = alloc_msihandle( &info->package->hdr );
     *dll = SysAllocString( info->source );
     *func = SysAllocString( info->target );
 
     release_custom_action_data( info );
-    return create_msi_remote_package( NULL, (LPVOID *)remote_package );
+    return create_msi_remote_package( handle, remote_package );
 }
 
 static const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl =
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index ea65e2a..54acbc7 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -38,6 +38,8 @@
 #include "wine/list.h"
 #include "wine/debug.h"
 
+#include "msiserver.h"
+
 static const BOOL is_64bit = sizeof(void *) > sizeof(int);
 BOOL is_wow64 DECLSPEC_HIDDEN;
 
@@ -733,7 +735,7 @@ UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *) DECLSPEC_HI
 
 /* msi server interface */
 extern HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN;
-extern HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN;
+extern HRESULT create_msi_remote_package( MSIHANDLE handle, IWineMsiRemotePackage **package ) DECLSPEC_HIDDEN;
 extern HRESULT create_msi_remote_database( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN;
 extern IUnknown *msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN;
 
diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl
index e734690..704f6ea 100644
--- a/dlls/msi/msiserver.idl
+++ b/dlls/msi/msiserver.idl
@@ -56,7 +56,6 @@ interface IWineMsiRemoteDatabase : IUnknown
 ]
 interface IWineMsiRemotePackage : IUnknown
 {
-    HRESULT SetMsiHandle( [in] MSIHANDLE handle );
     HRESULT GetActiveDatabase( [out] MSIHANDLE *handle );
     HRESULT GetProperty( [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
     HRESULT SetProperty( [in] BSTR property, [in] BSTR value );
@@ -88,7 +87,7 @@ interface IWineMsiRemotePackage : IUnknown
 ]
 interface IWineMsiRemoteCustomAction : IUnknown
 {
-    HRESULT GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] MSIHANDLE *handle, [out] BSTR *dllname,
+    HRESULT GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] BSTR *dllname,
                            [out] BSTR *function, [out] IWineMsiRemotePackage **package );
 }
 
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 5aa3dd0..2d11ea8 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -2561,13 +2561,6 @@ static ULONG WINAPI mrp_Release( IWineMsiRemotePackage *iface )
     return r;
 }
 
-static HRESULT WINAPI mrp_SetMsiHandle( IWineMsiRemotePackage *iface, MSIHANDLE handle )
-{
-    msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface );
-    This->package = handle;
-    return S_OK;
-}
-
 static HRESULT WINAPI mrp_GetActiveDatabase( IWineMsiRemotePackage *iface, MSIHANDLE *handle )
 {
     msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface );
@@ -2756,7 +2749,6 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
     mrp_QueryInterface,
     mrp_AddRef,
     mrp_Release,
-    mrp_SetMsiHandle,
     mrp_GetActiveDatabase,
     mrp_GetProperty,
     mrp_SetProperty,
@@ -2780,7 +2772,7 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
     mrp_EnumComponentCosts
 };
 
-HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )
+HRESULT create_msi_remote_package( MSIHANDLE handle, IWineMsiRemotePackage **ppObj )
 {
     msi_remote_package_impl* This;
 
@@ -2789,7 +2781,7 @@ HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )
         return E_OUTOFMEMORY;
 
     This->IWineMsiRemotePackage_iface.lpVtbl = &msi_remote_package_vtbl;
-    This->package = 0;
+    This->package = handle;
     This->refs = 1;
 
     *ppObj = &This->IWineMsiRemotePackage_iface;




More information about the wine-cvs mailing list