https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f9131763ed848739a097c34e6d85c510d197a0b3

commit f9131763ed848739a097c34e6d85c510d197a0b3
Author:     winesync <[email protected]>
AuthorDate: Sat Mar 12 15:11:44 2022 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Mar 20 19:27:34 2022 +0100

    [WINESYNC] msi: Allocate the remote handle on the server side.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Hans Leidekker <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id b9b459810f646c48bdac981a066f0102acb9201c by Zebediah Figura 
<[email protected]>
---
 dll/win32/msi/custom.c      | 17 ++++++++---------
 dll/win32/msi/msipriv.h     |  4 +++-
 dll/win32/msi/msiserver.idl |  3 +--
 dll/win32/msi/package.c     | 12 ++----------
 4 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c
index 8680b7214b3..f9abcd2f8a6 100644
--- a/dll/win32/msi/custom.c
+++ b/dll/win32/msi/custom.c
@@ -495,7 +495,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 )
 {
@@ -518,7 +518,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))
     {
@@ -555,7 +555,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;
@@ -565,7 +565,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;
 
@@ -584,7 +584,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 );
 
@@ -613,7 +612,6 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
     IWineMsiRemotePackage_Release( remote_package );
     SysFreeString( dll );
     SysFreeString( function );
-    MsiCloseHandle( handle );
 
     return r;
 }
@@ -1433,21 +1431,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/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h
index c0a02780b81..f7e3cfe788a 100644
--- a/dll/win32/msi/msipriv.h
+++ b/dll/win32/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/dll/win32/msi/msiserver.idl b/dll/win32/msi/msiserver.idl
index e7346905074..704f6ea9cfc 100644
--- a/dll/win32/msi/msiserver.idl
+++ b/dll/win32/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/dll/win32/msi/package.c b/dll/win32/msi/package.c
index f65e2eea4cf..d14dd8a33c9 100644
--- a/dll/win32/msi/package.c
+++ b/dll/win32/msi/package.c
@@ -2568,13 +2568,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 );
@@ -2763,7 +2756,6 @@ static const IWineMsiRemotePackageVtbl 
msi_remote_package_vtbl =
     mrp_QueryInterface,
     mrp_AddRef,
     mrp_Release,
-    mrp_SetMsiHandle,
     mrp_GetActiveDatabase,
     mrp_GetProperty,
     mrp_SetProperty,
@@ -2787,7 +2779,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;
 
@@ -2796,7 +2788,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;

Reply via email to