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>
This commit is contained in:
Zebediah Figura 2018-04-15 20:52:09 -05:00 committed by Alexandre Julliard
parent d26336a944
commit b9b459810f
4 changed files with 14 additions and 22 deletions

View File

@ -490,7 +490,7 @@ static void handle_msi_break( LPCWSTR target )
DebugBreak(); 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, BSTR *dll, BSTR *funcname,
IWineMsiRemotePackage **package ) IWineMsiRemotePackage **package )
{ {
@ -513,7 +513,7 @@ static UINT get_action_info( const GUID *guid, INT *type, MSIHANDLE *handle,
return ERROR_FUNCTION_FAILED; 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 ); IWineMsiRemoteCustomAction_Release( rca );
if (FAILED(r)) if (FAILED(r))
{ {
@ -550,7 +550,7 @@ static inline UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE
static DWORD ACTION_CallDllFunction( const GUID *guid ) static DWORD ACTION_CallDllFunction( const GUID *guid )
{ {
MsiCustomActionEntryPoint fn; MsiCustomActionEntryPoint fn;
MSIHANDLE hPackage, handle; MSIHANDLE hPackage;
HANDLE hModule; HANDLE hModule;
LPSTR proc; LPSTR proc;
UINT r = ERROR_FUNCTION_FAILED; UINT r = ERROR_FUNCTION_FAILED;
@ -560,7 +560,7 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
TRACE("%s\n", debugstr_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) if (r != ERROR_SUCCESS)
return r; return r;
@ -579,7 +579,6 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package ); hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package );
if (hPackage) if (hPackage)
{ {
IWineMsiRemotePackage_SetMsiHandle( remote_package, handle );
TRACE("calling %s\n", debugstr_w( function ) ); TRACE("calling %s\n", debugstr_w( function ) );
handle_msi_break( function ); handle_msi_break( function );
@ -608,7 +607,6 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
IWineMsiRemotePackage_Release( remote_package ); IWineMsiRemotePackage_Release( remote_package );
SysFreeString( dll ); SysFreeString( dll );
SysFreeString( function ); SysFreeString( function );
MsiCloseHandle( handle );
return r; return r;
} }
@ -1428,21 +1426,22 @@ static ULONG WINAPI mcr_Release( IWineMsiRemoteCustomAction *iface )
} }
static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid, 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; msi_custom_action_info *info;
MSIHANDLE handle;
info = find_action_by_guid( custom_action_guid ); info = find_action_by_guid( custom_action_guid );
if (!info) if (!info)
return E_FAIL; return E_FAIL;
*type = info->type; *type = info->type;
*handle = alloc_msihandle( &info->package->hdr ); handle = alloc_msihandle( &info->package->hdr );
*dll = SysAllocString( info->source ); *dll = SysAllocString( info->source );
*func = SysAllocString( info->target ); *func = SysAllocString( info->target );
release_custom_action_data( info ); 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 = static const IWineMsiRemoteCustomActionVtbl msi_custom_remote_vtbl =

View File

@ -38,6 +38,8 @@
#include "wine/list.h" #include "wine/list.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "msiserver.h"
static const BOOL is_64bit = sizeof(void *) > sizeof(int); static const BOOL is_64bit = sizeof(void *) > sizeof(int);
BOOL is_wow64 DECLSPEC_HIDDEN; BOOL is_wow64 DECLSPEC_HIDDEN;
@ -733,7 +735,7 @@ UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *) DECLSPEC_HI
/* msi server interface */ /* msi server interface */
extern HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; 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 HRESULT create_msi_remote_database( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN;
extern IUnknown *msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN; extern IUnknown *msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN;

View File

@ -56,7 +56,6 @@ interface IWineMsiRemoteDatabase : IUnknown
] ]
interface IWineMsiRemotePackage : IUnknown interface IWineMsiRemotePackage : IUnknown
{ {
HRESULT SetMsiHandle( [in] MSIHANDLE handle );
HRESULT GetActiveDatabase( [out] MSIHANDLE *handle ); HRESULT GetActiveDatabase( [out] MSIHANDLE *handle );
HRESULT GetProperty( [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size ); HRESULT GetProperty( [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
HRESULT SetProperty( [in] BSTR property, [in] BSTR value ); HRESULT SetProperty( [in] BSTR property, [in] BSTR value );
@ -88,7 +87,7 @@ interface IWineMsiRemotePackage : IUnknown
] ]
interface IWineMsiRemoteCustomAction : 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 ); [out] BSTR *function, [out] IWineMsiRemotePackage **package );
} }

View File

@ -2561,13 +2561,6 @@ static ULONG WINAPI mrp_Release( IWineMsiRemotePackage *iface )
return r; 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 ) static HRESULT WINAPI mrp_GetActiveDatabase( IWineMsiRemotePackage *iface, MSIHANDLE *handle )
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface );
@ -2756,7 +2749,6 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
mrp_QueryInterface, mrp_QueryInterface,
mrp_AddRef, mrp_AddRef,
mrp_Release, mrp_Release,
mrp_SetMsiHandle,
mrp_GetActiveDatabase, mrp_GetActiveDatabase,
mrp_GetProperty, mrp_GetProperty,
mrp_SetProperty, mrp_SetProperty,
@ -2780,7 +2772,7 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
mrp_EnumComponentCosts 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; msi_remote_package_impl* This;
@ -2789,7 +2781,7 @@ HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->IWineMsiRemotePackage_iface.lpVtbl = &msi_remote_package_vtbl; This->IWineMsiRemotePackage_iface.lpVtbl = &msi_remote_package_vtbl;
This->package = 0; This->package = handle;
This->refs = 1; This->refs = 1;
*ppObj = &This->IWineMsiRemotePackage_iface; *ppObj = &This->IWineMsiRemotePackage_iface;