[WINESYNC] msi: Allocate the remote handle on the server side.

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

wine commit id b9b459810f646c48bdac981a066f0102acb9201c by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
winesync 2022-03-12 15:11:44 +01:00 committed by Mark Jansen
parent a5f9ac3b85
commit f9131763ed
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
4 changed files with 14 additions and 22 deletions

View file

@ -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 =

View file

@ -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;

View file

@ -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 );
}

View file

@ -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;