[WINESYNC] msi: Convert the IWineMsiRemote* remote interfaces to RPC stubs.

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 8bfb4e8b6209d02a18be3299717b1f38db7045fe by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
winesync 2022-03-12 15:11:45 +01:00 committed by Mark Jansen
parent f9131763ed
commit b74b77aa65
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
16 changed files with 264 additions and 692 deletions

View file

@ -6,6 +6,7 @@ include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
add_definitions(-D__WINESRC__ -D__ROS_LONG64__ -DMSIRUNMODE=MSIRUNMODE_T) add_definitions(-D__WINESRC__ -D__ROS_LONG64__ -DMSIRUNMODE=MSIRUNMODE_T)
spec2def(msi.dll msi.spec ADD_IMPORTLIB) spec2def(msi.dll msi.spec ADD_IMPORTLIB)
generate_idl_iids(msiserver.idl) generate_idl_iids(msiserver.idl)
generate_idl_iids(winemsi.idl)
list(APPEND SOURCE list(APPEND SOURCE
action.c action.c
@ -55,6 +56,7 @@ list(APPEND PCH_SKIP_SOURCE
${BISON_cond_OUTPUTS} ${BISON_cond_OUTPUTS}
${BISON_sql_OUTPUTS} ${BISON_sql_OUTPUTS}
${CMAKE_CURRENT_BINARY_DIR}/msiserver_i.c ${CMAKE_CURRENT_BINARY_DIR}/msiserver_i.c
${CMAKE_CURRENT_BINARY_DIR}/winemsi_i.c
${CMAKE_CURRENT_BINARY_DIR}/msi_stubs.c) ${CMAKE_CURRENT_BINARY_DIR}/msi_stubs.c)
add_library(msi MODULE add_library(msi MODULE
@ -71,9 +73,9 @@ if(MSVC)
target_compile_options(msi PRIVATE /wd4090 /wd4133 /wd4146 /wd4312) target_compile_options(msi PRIVATE /wd4090 /wd4133 /wd4146 /wd4312)
endif() endif()
add_idl_headers(msi_idlheader msiserver.idl) add_idl_headers(msi_idlheader msiserver.idl winemsi.idl)
add_typelib(msiserver.idl) add_typelib(msiserver.idl winemsi.idl)
set_source_files_properties(msi.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/msiserver.tlb) set_source_files_properties(msi.rc PROPERTIES OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/msiserver.tlb;${CMAKE_CURRENT_BINARY_DIR}/winemsi.tlb")
set_module_type(msi win32dll) set_module_type(msi win32dll)
target_link_libraries(msi uuid ${PSEH_LIB} wine) target_link_libraries(msi uuid ${PSEH_LIB} wine)
add_dependencies(msi msi_idlheader) add_dependencies(msi msi_idlheader)

View file

@ -37,7 +37,7 @@
#include "oleauto.h" #include "oleauto.h"
#include "msipriv.h" #include "msipriv.h"
#include "msiserver.h" #include "winemsi.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/list.h" #include "wine/list.h"
@ -850,25 +850,20 @@ MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szConditi
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
if( !package ) if( !package )
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
BSTR condition; BSTR condition;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return MSICONDITION_ERROR; return MSICONDITION_ERROR;
condition = SysAllocString( szCondition ); condition = SysAllocString( szCondition );
if (!condition) if (!condition)
{
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_EvaluateCondition( remote_package, condition ); hr = remote_EvaluateCondition(remote, condition);
SysFreeString( condition ); SysFreeString( condition );
IWineMsiRemotePackage_Release( remote_package );
if (FAILED(hr)) if (FAILED(hr))
{ {

View file

@ -34,7 +34,7 @@
#include "oleauto.h" #include "oleauto.h"
#include "msipriv.h" #include "msipriv.h"
#include "msiserver.h" #include "winemsi.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/exception.h" #include "wine/exception.h"
@ -495,40 +495,6 @@ static void handle_msi_break( LPCWSTR target )
DebugBreak(); DebugBreak();
} }
static UINT get_action_info( const GUID *guid, INT *type,
BSTR *dll, BSTR *funcname,
IWineMsiRemotePackage **package )
{
IClassFactory *cf = NULL;
IWineMsiRemoteCustomAction *rca = NULL;
HRESULT r;
r = DllGetClassObject( &CLSID_WineMsiRemoteCustomAction,
&IID_IClassFactory, (LPVOID *)&cf );
if (FAILED(r))
{
ERR("failed to get IClassFactory interface\n");
return ERROR_FUNCTION_FAILED;
}
r = IClassFactory_CreateInstance( cf, NULL, &IID_IWineMsiRemoteCustomAction, (LPVOID *)&rca );
if (FAILED(r))
{
ERR("failed to get IWineMsiRemoteCustomAction interface\n");
return ERROR_FUNCTION_FAILED;
}
r = IWineMsiRemoteCustomAction_GetActionInfo( rca, guid, type, dll, funcname, package );
IWineMsiRemoteCustomAction_Release( rca );
if (FAILED(r))
{
ERR("GetActionInfo failed\n");
return ERROR_FUNCTION_FAILED;
}
return ERROR_SUCCESS;
}
#ifdef __i386__ #ifdef __i386__
extern UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE handle ); extern UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE handle );
__ASM_GLOBAL_FUNC( CUSTOMPROC_wrapper, __ASM_GLOBAL_FUNC( CUSTOMPROC_wrapper,
@ -555,17 +521,17 @@ 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 remote_package = 0;
MSIHANDLE hPackage; MSIHANDLE hPackage;
HANDLE hModule; HANDLE hModule;
LPSTR proc; LPSTR proc;
UINT r = ERROR_FUNCTION_FAILED; UINT r = ERROR_FUNCTION_FAILED;
BSTR dll = NULL, function = NULL; BSTR dll = NULL, function = NULL;
INT type; INT type;
IWineMsiRemotePackage *remote_package = NULL;
TRACE("%s\n", debugstr_guid( guid )); TRACE("%s\n", debugstr_guid( guid ));
r = get_action_info( guid, &type, &dll, &function, &remote_package ); r = remote_GetActionInfo( guid, &type, &dll, &function, &remote_package );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return r; return r;
@ -581,7 +547,7 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
msi_free( proc ); msi_free( proc );
if (fn) if (fn)
{ {
hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package ); hPackage = alloc_msi_remote_handle( remote_package );
if (hPackage) if (hPackage)
{ {
TRACE("calling %s\n", debugstr_w( function ) ); TRACE("calling %s\n", debugstr_w( function ) );
@ -602,14 +568,14 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
MsiCloseHandle( hPackage ); MsiCloseHandle( hPackage );
} }
else else
ERR("failed to create handle for %p\n", remote_package ); ERR("failed to create handle for %x\n", remote_package );
} }
else else
ERR("GetProcAddress(%s) failed\n", debugstr_w( function ) ); ERR("GetProcAddress(%s) failed\n", debugstr_w( function ) );
FreeLibrary(hModule); FreeLibrary(hModule);
IWineMsiRemotePackage_Release( remote_package ); MsiCloseHandle(hPackage);
SysFreeString( dll ); SysFreeString( dll );
SysFreeString( function ); SysFreeString( function );
@ -1388,50 +1354,8 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
LeaveCriticalSection( &msi_custom_action_cs ); LeaveCriticalSection( &msi_custom_action_cs );
} }
typedef struct _msi_custom_remote_impl { HRESULT __cdecl remote_GetActionInfo( const GUID *custom_action_guid,
IWineMsiRemoteCustomAction IWineMsiRemoteCustomAction_iface; INT *type, BSTR *dll, BSTR *func, MSIHANDLE *remote_package )
LONG refs;
} msi_custom_remote_impl;
static inline msi_custom_remote_impl *impl_from_IWineMsiRemoteCustomAction( IWineMsiRemoteCustomAction *iface )
{
return CONTAINING_RECORD(iface, msi_custom_remote_impl, IWineMsiRemoteCustomAction_iface);
}
static HRESULT WINAPI mcr_QueryInterface( IWineMsiRemoteCustomAction *iface,
REFIID riid,LPVOID *ppobj)
{
if( IsEqualCLSID( riid, &IID_IUnknown ) ||
IsEqualCLSID( riid, &IID_IWineMsiRemoteCustomAction ) )
{
IWineMsiRemoteCustomAction_AddRef( iface );
*ppobj = iface;
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI mcr_AddRef( IWineMsiRemoteCustomAction *iface )
{
msi_custom_remote_impl* This = impl_from_IWineMsiRemoteCustomAction( iface );
return InterlockedIncrement( &This->refs );
}
static ULONG WINAPI mcr_Release( IWineMsiRemoteCustomAction *iface )
{
msi_custom_remote_impl* This = impl_from_IWineMsiRemoteCustomAction( iface );
ULONG r;
r = InterlockedDecrement( &This->refs );
if (r == 0)
msi_free( This );
return r;
}
static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCGUID custom_action_guid,
INT *type, BSTR *dll, BSTR *func, IWineMsiRemotePackage **remote_package )
{ {
msi_custom_action_info *info; msi_custom_action_info *info;
MSIHANDLE handle; MSIHANDLE handle;
@ -1446,29 +1370,6 @@ static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCG
*func = SysAllocString( info->target ); *func = SysAllocString( info->target );
release_custom_action_data( info ); release_custom_action_data( info );
return create_msi_remote_package( handle, remote_package ); *remote_package = handle;
}
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->IWineMsiRemoteCustomAction_iface.lpVtbl = &msi_custom_remote_vtbl;
This->refs = 1;
*ppObj = &This->IWineMsiRemoteCustomAction_iface;
return S_OK; return S_OK;
} }

View file

@ -880,13 +880,10 @@ UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, LPCWSTR szFolder, LPCWSTR szFil
db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE );
if( !db ) if( !db )
{ {
IWineMsiRemoteDatabase *remote_database; MSIHANDLE remote_database = msi_get_remote( handle );
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle );
if ( !remote_database ) if ( !remote_database )
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiDatabaseImport not allowed during a custom action!\n"); WARN("MsiDatabaseImport not allowed during a custom action!\n");
return ERROR_SUCCESS; return ERROR_SUCCESS;
@ -1206,13 +1203,10 @@ UINT WINAPI MsiDatabaseExportW( MSIHANDLE handle, LPCWSTR szTable,
db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE );
if( !db ) if( !db )
{ {
IWineMsiRemoteDatabase *remote_database; MSIHANDLE remote_database = msi_get_remote(handle);
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle );
if ( !remote_database ) if ( !remote_database )
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiDatabaseExport not allowed during a custom action!\n"); WARN("MsiDatabaseExport not allowed during a custom action!\n");
return ERROR_SUCCESS; return ERROR_SUCCESS;
@ -2008,8 +2002,12 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle )
db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE );
if( !db ) if( !db )
{ {
MSIHANDLE remote_database = msi_get_remote(handle);
if ( !remote_database )
return MSIDBSTATE_ERROR;
WARN("MsiGetDatabaseState not allowed during a custom action!\n"); WARN("MsiGetDatabaseState not allowed during a custom action!\n");
return MSIDBSTATE_ERROR; return MSIDBSTATE_READ;
} }
if (db->mode != MSIDBOPEN_READONLY ) if (db->mode != MSIDBOPEN_READONLY )
@ -2019,116 +2017,26 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle )
return ret; return ret;
} }
typedef struct _msi_remote_database_impl { HRESULT __cdecl remote_DatabaseIsTablePersistent(MSIHANDLE db, LPCWSTR table, MSICONDITION *persistent)
IWineMsiRemoteDatabase IWineMsiRemoteDatabase_iface;
MSIHANDLE database;
LONG refs;
} msi_remote_database_impl;
static inline msi_remote_database_impl *impl_from_IWineMsiRemoteDatabase( IWineMsiRemoteDatabase *iface )
{ {
return CONTAINING_RECORD(iface, msi_remote_database_impl, IWineMsiRemoteDatabase_iface); *persistent = MsiDatabaseIsTablePersistentW(db, table);
}
static HRESULT WINAPI mrd_QueryInterface( IWineMsiRemoteDatabase *iface,
REFIID riid,LPVOID *ppobj)
{
if( IsEqualCLSID( riid, &IID_IUnknown ) ||
IsEqualCLSID( riid, &IID_IWineMsiRemoteDatabase ) )
{
IWineMsiRemoteDatabase_AddRef( iface );
*ppobj = iface;
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI mrd_AddRef( IWineMsiRemoteDatabase *iface )
{
msi_remote_database_impl* This = impl_from_IWineMsiRemoteDatabase( iface );
return InterlockedIncrement( &This->refs );
}
static ULONG WINAPI mrd_Release( IWineMsiRemoteDatabase *iface )
{
msi_remote_database_impl* This = impl_from_IWineMsiRemoteDatabase( iface );
ULONG r;
r = InterlockedDecrement( &This->refs );
if (r == 0)
{
MsiCloseHandle( This->database );
msi_free( This );
}
return r;
}
static HRESULT WINAPI mrd_IsTablePersistent( IWineMsiRemoteDatabase *iface,
LPCWSTR table, MSICONDITION *persistent )
{
msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface );
*persistent = MsiDatabaseIsTablePersistentW(This->database, table);
return S_OK; return S_OK;
} }
static HRESULT WINAPI mrd_GetPrimaryKeys( IWineMsiRemoteDatabase *iface, HRESULT __cdecl remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, MSIHANDLE *keys)
LPCWSTR table, MSIHANDLE *keys )
{ {
msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); UINT r = MsiDatabaseGetPrimaryKeysW(db, table, keys);
UINT r = MsiDatabaseGetPrimaryKeysW(This->database, table, keys);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrd_GetSummaryInformation( IWineMsiRemoteDatabase *iface, HRESULT __cdecl remote_DatabaseGetSummaryInformation(MSIHANDLE db, UINT updatecount, MSIHANDLE *suminfo)
UINT updatecount, MSIHANDLE *suminfo )
{ {
msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); UINT r = MsiGetSummaryInformationW(db, NULL, updatecount, suminfo);
UINT r = MsiGetSummaryInformationW(This->database, NULL, updatecount, suminfo);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrd_OpenView( IWineMsiRemoteDatabase *iface, HRESULT __cdecl remote_DatabaseOpenView(MSIHANDLE db, LPCWSTR query, MSIHANDLE *view)
LPCWSTR query, MSIHANDLE *view )
{ {
msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface ); UINT r = MsiDatabaseOpenViewW(db, query, view);
UINT r = MsiDatabaseOpenViewW(This->database, query, view);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrd_SetMsiHandle( IWineMsiRemoteDatabase *iface, MSIHANDLE handle )
{
msi_remote_database_impl* This = impl_from_IWineMsiRemoteDatabase( iface );
This->database = handle;
return S_OK;
}
static const IWineMsiRemoteDatabaseVtbl msi_remote_database_vtbl =
{
mrd_QueryInterface,
mrd_AddRef,
mrd_Release,
mrd_IsTablePersistent,
mrd_GetPrimaryKeys,
mrd_GetSummaryInformation,
mrd_OpenView,
mrd_SetMsiHandle,
};
HRESULT create_msi_remote_database( IUnknown *pOuter, LPVOID *ppObj )
{
msi_remote_database_impl *This;
This = msi_alloc( sizeof *This );
if (!This)
return E_OUTOFMEMORY;
This->IWineMsiRemoteDatabase_iface.lpVtbl = &msi_remote_database_vtbl;
This->database = 0;
This->refs = 1;
*ppObj = &This->IWineMsiRemoteDatabase_iface;
return S_OK;
}

View file

@ -4155,15 +4155,12 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE *phPreview )
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if (!db) if (!db)
{ {
IWineMsiRemoteDatabase *remote_database; MSIHANDLE remote_database = msi_get_remote( hdb );
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb );
if (!remote_database) if (!remote_database)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
*phPreview = 0; *phPreview = 0;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiEnableUIPreview not allowed during a custom action!\n"); WARN("MsiEnableUIPreview not allowed during a custom action!\n");
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;

View file

@ -34,7 +34,7 @@
#include "oleauto.h" #include "oleauto.h"
#include "msipriv.h" #include "msipriv.h"
#include "msiserver.h" #include "winemsi.h"
#include "wine/unicode.h" #include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi); WINE_DEFAULT_DEBUG_CHANNEL(msi);
@ -911,15 +911,13 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord,
if (!package) if (!package)
{ {
HRESULT hr; HRESULT hr;
IWineMsiRemotePackage *remote_package; MSIHANDLE remote;
BSTR value = NULL; BSTR value = NULL;
awstring wstr; awstring wstr;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if ((remote = msi_get_remote(hInstall)))
if (remote_package)
{ {
hr = IWineMsiRemotePackage_FormatRecord( remote_package, hRecord, hr = remote_FormatRecord(remote, hRecord, &value);
&value );
if (FAILED(hr)) if (FAILED(hr))
goto done; goto done;
@ -928,7 +926,6 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord,
r = msi_strcpy_to_awstring( value, SysStringLen(value), &wstr, sz ); r = msi_strcpy_to_awstring( value, SysStringLen(value), &wstr, sz );
done: done:
IWineMsiRemotePackage_Release( remote_package );
SysFreeString( value ); SysFreeString( value );
if (FAILED(hr)) if (FAILED(hr))

View file

@ -29,7 +29,9 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "msi.h" #include "msi.h"
#include "msiquery.h" #include "msiquery.h"
#include "msipriv.h" #include "msipriv.h"
#include "winemsi.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi); WINE_DEFAULT_DEBUG_CHANNEL(msi);
@ -58,7 +60,7 @@ typedef struct msi_handle_info_t
BOOL remote; BOOL remote;
union { union {
MSIOBJECTHDR *obj; MSIOBJECTHDR *obj;
IUnknown *unk; MSIHANDLE rem;
} u; } u;
DWORD dwThreadId; DWORD dwThreadId;
} msi_handle_info; } msi_handle_info;
@ -81,7 +83,7 @@ static MSIHANDLE alloc_handle_table_entry(void)
/* find a slot */ /* find a slot */
for(i=0; i<msihandletable_size; i++) for(i=0; i<msihandletable_size; i++)
if( !msihandletable[i].u.obj && !msihandletable[i].u.unk ) if( !msihandletable[i].u.obj && !msihandletable[i].u.rem )
break; break;
if( i==msihandletable_size ) if( i==msihandletable_size )
{ {
@ -130,7 +132,7 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj )
return ret; return ret;
} }
MSIHANDLE alloc_msi_remote_handle( IUnknown *unk ) MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote)
{ {
msi_handle_info *entry; msi_handle_info *entry;
MSIHANDLE ret; MSIHANDLE ret;
@ -141,15 +143,14 @@ MSIHANDLE alloc_msi_remote_handle( IUnknown *unk )
if (ret) if (ret)
{ {
entry = &msihandletable[ ret - 1 ]; entry = &msihandletable[ ret - 1 ];
IUnknown_AddRef( unk ); entry->u.rem = remote;
entry->u.unk = unk;
entry->dwThreadId = GetCurrentThreadId(); entry->dwThreadId = GetCurrentThreadId();
entry->remote = TRUE; entry->remote = TRUE;
} }
LeaveCriticalSection( &MSI_handle_cs ); LeaveCriticalSection( &MSI_handle_cs );
TRACE("%p -> %d\n", unk, ret); TRACE("%d -> %d\n", remote, ret);
return ret; return ret;
} }
@ -179,9 +180,9 @@ out:
return ret; return ret;
} }
IUnknown *msi_get_remote( MSIHANDLE handle ) MSIHANDLE msi_get_remote( MSIHANDLE handle )
{ {
IUnknown *unk = NULL; MSIHANDLE ret = 0;
EnterCriticalSection( &MSI_handle_cs ); EnterCriticalSection( &MSI_handle_cs );
handle--; handle--;
@ -189,14 +190,12 @@ IUnknown *msi_get_remote( MSIHANDLE handle )
goto out; goto out;
if( !msihandletable[handle].remote) if( !msihandletable[handle].remote)
goto out; goto out;
unk = msihandletable[handle].u.unk; ret = msihandletable[handle].u.rem;
if( unk )
IUnknown_AddRef( unk );
out: out:
LeaveCriticalSection( &MSI_handle_cs ); LeaveCriticalSection( &MSI_handle_cs );
return unk; return ret;
} }
void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy )
@ -285,7 +284,7 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
if (msihandletable[handle].remote) if (msihandletable[handle].remote)
{ {
IUnknown_Release( msihandletable[handle].u.unk ); remote_CloseHandle( msihandletable[handle].u.rem );
} }
else else
{ {
@ -344,3 +343,8 @@ UINT WINAPI MsiCloseAllHandles(void)
return n; return n;
} }
UINT __cdecl remote_CloseHandle(MSIHANDLE handle)
{
return MsiCloseHandle(handle);
}

View file

@ -34,7 +34,7 @@
#include "oleauto.h" #include "oleauto.h"
#include "msipriv.h" #include "msipriv.h"
#include "msiserver.h" #include "winemsi.h"
#include "wine/unicode.h" #include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi); WINE_DEFAULT_DEBUG_CHANNEL(msi);
@ -74,25 +74,20 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
BSTR action; BSTR action;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
action = SysAllocString( szAction ); action = SysAllocString( szAction );
if (!action) if (!action)
{
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_DoAction( remote_package, action ); hr = remote_DoAction(remote, action);
SysFreeString( action ); SysFreeString( action );
IWineMsiRemotePackage_Release( remote_package );
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -143,25 +138,20 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
BSTR table; BSTR table;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
table = SysAllocString( szTable ); table = SysAllocString( szTable );
if (!table) if (!table)
{
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_Sequence( remote_package, table, iSequenceMode ); hr = remote_Sequence(remote, table, iSequenceMode);
SysFreeString( table ); SysFreeString( table );
IWineMsiRemotePackage_Release( remote_package );
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -239,25 +229,21 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
IWineMsiRemotePackage *remote_package;
LPWSTR value = NULL; LPWSTR value = NULL;
BSTR folder; BSTR folder;
DWORD len; DWORD len;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
folder = SysAllocString( szFolder ); folder = SysAllocString( szFolder );
if (!folder) if (!folder)
{
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
len = 0; len = 0;
hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder, NULL, &len ); hr = remote_GetTargetPath(remote, folder, NULL, &len);
if (FAILED(hr)) if (FAILED(hr))
goto done; goto done;
@ -269,14 +255,13 @@ static UINT MSI_GetTargetPath( MSIHANDLE hInstall, LPCWSTR szFolder,
goto done; goto done;
} }
hr = IWineMsiRemotePackage_GetTargetPath( remote_package, folder, value, &len ); hr = remote_GetTargetPath(remote, folder, value, &len);
if (FAILED(hr)) if (FAILED(hr))
goto done; goto done;
r = msi_strcpy_to_awstring( value, len, szPathBuf, pcchPathBuf ); r = msi_strcpy_to_awstring( value, len, szPathBuf, pcchPathBuf );
done: done:
IWineMsiRemotePackage_Release( remote_package );
SysFreeString( folder ); SysFreeString( folder );
msi_free( value ); msi_free( value );
@ -409,24 +394,20 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
if (!package) if (!package)
{ {
HRESULT hr; HRESULT hr;
IWineMsiRemotePackage *remote_package;
LPWSTR value = NULL; LPWSTR value = NULL;
MSIHANDLE remote;
BSTR folder; BSTR folder;
DWORD len; DWORD len;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
folder = SysAllocString( szFolder ); folder = SysAllocString( szFolder );
if (!folder) if (!folder)
{
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
len = 0; len = 0;
hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, NULL, &len ); hr = remote_GetSourcePath(remote, folder, NULL, &len);
if (FAILED(hr)) if (FAILED(hr))
goto done; goto done;
@ -438,14 +419,13 @@ static UINT MSI_GetSourcePath( MSIHANDLE hInstall, LPCWSTR szFolder,
goto done; goto done;
} }
hr = IWineMsiRemotePackage_GetSourcePath( remote_package, folder, value, &len ); hr = remote_GetSourcePath(remote, folder, value, &len);
if (FAILED(hr)) if (FAILED(hr))
goto done; goto done;
r = msi_strcpy_to_awstring( value, len, szPathBuf, pcchPathBuf ); r = msi_strcpy_to_awstring( value, len, szPathBuf, pcchPathBuf );
done: done:
IWineMsiRemotePackage_Release( remote_package );
SysFreeString( folder ); SysFreeString( folder );
msi_free( value ); msi_free( value );
@ -616,10 +596,9 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder,
{ {
HRESULT hr; HRESULT hr;
BSTR folder, path; BSTR folder, path;
IWineMsiRemotePackage *remote_package; MSIHANDLE remote;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
folder = SysAllocString( szFolder ); folder = SysAllocString( szFolder );
@ -628,15 +607,13 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder,
{ {
SysFreeString(folder); SysFreeString(folder);
SysFreeString(path); SysFreeString(path);
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
hr = IWineMsiRemotePackage_SetTargetPath( remote_package, folder, path ); hr = remote_SetTargetPath(remote, folder, path);
SysFreeString(folder); SysFreeString(folder);
SysFreeString(path); SysFreeString(path);
IWineMsiRemotePackage_Release( remote_package );
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -697,16 +674,14 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package) if (!package)
{ {
MSIHANDLE remote;
BOOL ret; BOOL ret;
HRESULT hr; HRESULT hr;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return FALSE; return FALSE;
hr = IWineMsiRemotePackage_GetMode(remote_package, iRunMode, &ret); hr = remote_GetMode(remote, iRunMode, &ret);
IWineMsiRemotePackage_Release(remote_package);
if (hr == S_OK) if (hr == S_OK)
return ret; return ret;
@ -789,15 +764,13 @@ UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState)
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return FALSE; return FALSE;
hr = IWineMsiRemotePackage_SetMode( remote_package, iRunMode, fState ); hr = remote_SetMode(remote, iRunMode, fState);
IWineMsiRemotePackage_Release( remote_package );
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -980,25 +953,20 @@ UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
BSTR feature; BSTR feature;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
feature = SysAllocString(szFeature); feature = SysAllocString(szFeature);
if (!feature) if (!feature)
{
IWineMsiRemotePackage_Release(remote_package);
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_SetFeatureState(remote_package, feature, iState); hr = remote_SetFeatureState(remote, feature, iState);
SysFreeString(feature); SysFreeString(feature);
IWineMsiRemotePackage_Release(remote_package);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -1131,26 +1099,20 @@ UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
BSTR feature; BSTR feature;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
feature = SysAllocString(szFeature); feature = SysAllocString(szFeature);
if (!feature) if (!feature)
{
IWineMsiRemotePackage_Release(remote_package);
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_GetFeatureState(remote_package, feature, hr = remote_GetFeatureState(remote, feature, piInstalled, piAction);
piInstalled, piAction);
SysFreeString(feature); SysFreeString(feature);
IWineMsiRemotePackage_Release(remote_package);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -1263,26 +1225,20 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature,
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
BSTR feature; BSTR feature;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
feature = SysAllocString(szFeature); feature = SysAllocString(szFeature);
if (!feature) if (!feature)
{
IWineMsiRemotePackage_Release(remote_package);
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_GetFeatureCost(remote_package, feature, hr = remote_GetFeatureCost(remote, feature, iCostTree, iState, piCost);
iCostTree, iState, piCost);
SysFreeString(feature); SysFreeString(feature);
IWineMsiRemotePackage_Release(remote_package);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -1521,25 +1477,20 @@ UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent,
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
BSTR component; BSTR component;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
component = SysAllocString(szComponent); component = SysAllocString(szComponent);
if (!component) if (!component)
{
IWineMsiRemotePackage_Release(remote_package);
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_SetComponentState(remote_package, component, iState); hr = remote_SetComponentState(remote, component, iState);
SysFreeString(component); SysFreeString(component);
IWineMsiRemotePackage_Release(remote_package);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -1572,26 +1523,20 @@ UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent,
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
BSTR component; BSTR component;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
component = SysAllocString(szComponent); component = SysAllocString(szComponent);
if (!component) if (!component)
{
IWineMsiRemotePackage_Release(remote_package);
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_GetComponentState(remote_package, component, hr = remote_GetComponentState(remote, component, piInstalled, piAction);
piInstalled, piAction);
SysFreeString(component); SysFreeString(component);
IWineMsiRemotePackage_Release(remote_package);
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -1620,15 +1565,14 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall)
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
LANGID lang; LANGID lang;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
hr = IWineMsiRemotePackage_GetLanguage(remote_package, &lang); hr = remote_GetLanguage(remote, &lang);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
return lang; return lang;
@ -1677,16 +1621,13 @@ UINT WINAPI MsiSetInstallLevel(MSIHANDLE hInstall, int iInstallLevel)
package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE);
if (!package) if (!package)
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
hr = IWineMsiRemotePackage_SetInstallLevel(remote_package, iInstallLevel); hr = remote_SetInstallLevel(remote, iInstallLevel);
IWineMsiRemotePackage_Release(remote_package);
if (FAILED(hr)) if (FAILED(hr))
{ {

View file

@ -31,8 +31,6 @@
#include "msi.h" #include "msi.h"
#include "msidefs.h" #include "msidefs.h"
#include "msiquery.h" #include "msiquery.h"
#include "msipriv.h"
#include "msiserver.h"
#include "wincrypt.h" #include "wincrypt.h"
#include "winver.h" #include "winver.h"
#include "winuser.h" #include "winuser.h"
@ -42,6 +40,9 @@
#include "wintrust.h" #include "wintrust.h"
#include "softpub.h" #include "softpub.h"
#include "msipriv.h"
#include "winemsi.h"
#include "initguid.h" #include "initguid.h"
#include "msxml2.h" #include "msxml2.h"
@ -2004,20 +2005,18 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i
if (!drive || !buflen || !cost || !temp) return ERROR_INVALID_PARAMETER; if (!drive || !buflen || !cost || !temp) return ERROR_INVALID_PARAMETER;
if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ))) if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE )))
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
IWineMsiRemotePackage *remote_package;
BSTR bname = NULL; BSTR bname = NULL;
if (!(remote_package = (IWineMsiRemotePackage *)msi_get_remote( handle ))) if (!(remote = msi_get_remote(handle)))
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
if (component && !(bname = SysAllocString( component ))) if (component && !(bname = SysAllocString( component )))
{
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_EnumComponentCosts( remote_package, bname, index, state, drive, buflen, cost, temp ); hr = remote_EnumComponentCosts(remote, bname, index, state, drive, buflen, cost, temp);
IWineMsiRemotePackage_Release( remote_package );
SysFreeString( bname ); SysFreeString( bname );
if (FAILED(hr)) if (FAILED(hr))
{ {

View file

@ -166,7 +166,6 @@ static const IClassFactoryVtbl MsiCF_Vtbl =
}; };
static IClassFactoryImpl MsiServer_CF = { { &MsiCF_Vtbl }, create_msiserver }; static IClassFactoryImpl MsiServer_CF = { { &MsiCF_Vtbl }, create_msiserver };
static IClassFactoryImpl WineMsiCustomRemote_CF = { { &MsiCF_Vtbl }, create_msi_custom_remote };
/****************************************************************** /******************************************************************
* DllGetClassObject [MSI.@] * DllGetClassObject [MSI.@]
@ -181,12 +180,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return S_OK; return S_OK;
} }
if ( IsEqualCLSID (rclsid, &CLSID_WineMsiRemoteCustomAction) )
{
*ppv = &WineMsiCustomRemote_CF;
return S_OK;
}
if( IsEqualCLSID (rclsid, &CLSID_MsiServerMessage) || if( IsEqualCLSID (rclsid, &CLSID_MsiServerMessage) ||
IsEqualCLSID (rclsid, &CLSID_MsiServer) || IsEqualCLSID (rclsid, &CLSID_MsiServer) ||
IsEqualCLSID (rclsid, &CLSID_PSFactoryBuffer) || IsEqualCLSID (rclsid, &CLSID_PSFactoryBuffer) ||

View file

@ -734,15 +734,12 @@ typedef struct {
UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *) DECLSPEC_HIDDEN; UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *) DECLSPEC_HIDDEN;
/* msi server interface */ /* msi server interface */
extern HRESULT create_msi_custom_remote( IUnknown *pOuter, LPVOID *ppObj ) DECLSPEC_HIDDEN; extern MSIHANDLE msi_get_remote(MSIHANDLE handle) 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;
/* handle functions */ /* handle functions */
extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type) DECLSPEC_HIDDEN; extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type) DECLSPEC_HIDDEN;
extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * ) DECLSPEC_HIDDEN; extern MSIHANDLE alloc_msihandle( MSIOBJECTHDR * ) DECLSPEC_HIDDEN;
extern MSIHANDLE alloc_msi_remote_handle( IUnknown *unk ) DECLSPEC_HIDDEN; extern MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote) DECLSPEC_HIDDEN;
extern void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) DECLSPEC_HIDDEN; extern void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy ) DECLSPEC_HIDDEN;
extern void msiobj_addref(MSIOBJECTHDR *) DECLSPEC_HIDDEN; extern void msiobj_addref(MSIOBJECTHDR *) DECLSPEC_HIDDEN;
extern int msiobj_release(MSIOBJECTHDR *) DECLSPEC_HIDDEN; extern int msiobj_release(MSIOBJECTHDR *) DECLSPEC_HIDDEN;

View file

@ -31,11 +31,11 @@
#include "msiquery.h" #include "msiquery.h"
#include "objbase.h" #include "objbase.h"
#include "objidl.h" #include "objidl.h"
#include "msipriv.h"
#include "winnls.h" #include "winnls.h"
#include "msipriv.h"
#include "query.h" #include "query.h"
#include "msiserver.h" #include "winemsi.h"
#include "initguid.h" #include "initguid.h"
@ -250,15 +250,13 @@ UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb,
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db ) if( !db )
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); if (!(remote = msi_get_remote(hdb)))
if ( !remote_database )
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
hr = IWineMsiRemoteDatabase_OpenView( remote_database, szQuery, phView ); hr = remote_DatabaseOpenView(remote, szQuery, phView);
IWineMsiRemoteDatabase_Release( remote_database );
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -758,13 +756,11 @@ UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb,
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db ) if( !db )
{ {
IWineMsiRemoteDatabase *remote_database; MSIHANDLE remote;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); if (!(remote = msi_get_remote(hdb)))
if ( !remote_database )
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiDatabaseApplyTransform not allowed during a custom action!\n"); WARN("MsiDatabaseApplyTransform not allowed during a custom action!\n");
return ERROR_SUCCESS; return ERROR_SUCCESS;
@ -820,13 +816,11 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb )
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db ) if( !db )
{ {
IWineMsiRemoteDatabase *remote_database; MSIHANDLE remote;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); if (!(remote = msi_get_remote(hdb)))
if ( !remote_database )
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("not allowed during a custom action!\n"); WARN("not allowed during a custom action!\n");
return ERROR_SUCCESS; return ERROR_SUCCESS;
@ -946,15 +940,13 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW( MSIHANDLE hdb,
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db ) if( !db )
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb ); if (!(remote = msi_get_remote(hdb)))
if ( !remote_database )
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
hr = IWineMsiRemoteDatabase_GetPrimaryKeys( remote_database, table, phRec ); hr = remote_DatabaseGetPrimaryKeys(remote, table, phRec);
IWineMsiRemoteDatabase_Release( remote_database );
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -1033,15 +1025,12 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentW(
{ {
HRESULT hr; HRESULT hr;
MSICONDITION condition; MSICONDITION condition;
IWineMsiRemoteDatabase *remote_database; MSIHANDLE remote;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hDatabase ); if (!(remote = msi_get_remote(hDatabase)))
if ( !remote_database )
return MSICONDITION_ERROR; return MSICONDITION_ERROR;
hr = IWineMsiRemoteDatabase_IsTablePersistent( remote_database, hr = remote_DatabaseIsTablePersistent(remote, szTableName, &condition);
szTableName, &condition );
IWineMsiRemoteDatabase_Release( remote_database );
if (FAILED(hr)) if (FAILED(hr))
return MSICONDITION_ERROR; return MSICONDITION_ERROR;

View file

@ -27,70 +27,6 @@ import "wtypes.idl";
import "objidl.idl"; import "objidl.idl";
import "oaidl.idl"; import "oaidl.idl";
cpp_quote("#if 0")
typedef unsigned long MSIHANDLE;
typedef int INSTALLMESSAGE;
typedef int MSICONDITION;
typedef int MSIRUNMODE;
typedef int INSTALLSTATE;
cpp_quote("#endif")
[
uuid(7BDE2046-D03B-4ffc-B84C-A098F38CFF0B),
oleautomation,
object
]
interface IWineMsiRemoteDatabase : IUnknown
{
HRESULT IsTablePersistent( [in] LPCWSTR table, [out] MSICONDITION *persistent );
HRESULT GetPrimaryKeys( [in] LPCWSTR table, [out] MSIHANDLE *keys );
HRESULT GetSummaryInformation( [in] UINT updatecount, [out] MSIHANDLE *suminfo );
HRESULT OpenView( [in] LPCWSTR query, [out] MSIHANDLE *view );
HRESULT SetMsiHandle( [in] MSIHANDLE handle );
}
[
uuid(902B3592-9D08-4dfd-A593-D07C52546421),
oleautomation,
object
]
interface IWineMsiRemotePackage : IUnknown
{
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 );
HRESULT ProcessMessage( [in] INSTALLMESSAGE message, [in] MSIHANDLE record );
HRESULT DoAction( [in] BSTR action );
HRESULT Sequence( [in] BSTR table, [in] int sequence );
HRESULT GetTargetPath( [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
HRESULT SetTargetPath( [in] BSTR folder, [in] BSTR value );
HRESULT GetSourcePath( [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
HRESULT GetMode( [in] MSIRUNMODE mode, [out] BOOL *ret );
HRESULT SetMode( [in] MSIRUNMODE mode, [in] BOOL state );
HRESULT GetFeatureState( [in] BSTR feature, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
HRESULT SetFeatureState( [in] BSTR feature, [in] INSTALLSTATE state );
HRESULT GetComponentState( [in] BSTR component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
HRESULT SetComponentState( [in] BSTR component, [in] INSTALLSTATE state );
HRESULT GetLanguage( [out] LANGID *language );
HRESULT SetInstallLevel( [in] int level );
HRESULT FormatRecord( [in] MSIHANDLE record, [out] BSTR *value );
HRESULT EvaluateCondition( [in] BSTR condition );
HRESULT GetFeatureCost( [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost );
HRESULT EnumComponentCosts( [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state,
[out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp );
}
[
uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8),
oleautomation,
object
]
interface IWineMsiRemoteCustomAction : IUnknown
{
HRESULT GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] BSTR *dllname,
[out] BSTR *function, [out] IWineMsiRemotePackage **package );
}
[ [
uuid(000c101c-0000-0000-c000-000000000046), uuid(000c101c-0000-0000-c000-000000000046),
oleautomation, oleautomation,

View file

@ -45,7 +45,7 @@
#include "sddl.h" #include "sddl.h"
#include "msipriv.h" #include "msipriv.h"
#include "msiserver.h" #include "winemsi.h"
#include "resource.h" #include "resource.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi); WINE_DEFAULT_DEBUG_CHANNEL(msi);
@ -1466,13 +1466,11 @@ UINT MSI_OpenPackageW(LPCWSTR szPackage, MSIPACKAGE **pPackage)
db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE );
if( !db ) if( !db )
{ {
IWineMsiRemoteDatabase *remote_database; MSIHANDLE remote;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle ); if (!(remote = msi_get_remote(handle)))
if ( !remote_database )
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiOpenPackage not allowed during a custom action!\n"); WARN("MsiOpenPackage not allowed during a custom action!\n");
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
@ -1700,8 +1698,7 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
{ {
MSIPACKAGE *package; MSIPACKAGE *package;
MSIHANDLE handle = 0; MSIHANDLE handle = 0;
IUnknown *remote_unk; MSIHANDLE remote;
IWineMsiRemotePackage *remote_package;
TRACE("(%d)\n",hInstall); TRACE("(%d)\n",hInstall);
@ -1711,19 +1708,9 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
handle = alloc_msihandle( &package->db->hdr ); handle = alloc_msihandle( &package->db->hdr );
msiobj_release( &package->hdr ); msiobj_release( &package->hdr );
} }
else if ((remote_unk = msi_get_remote(hInstall))) else if ((remote = msi_get_remote(hInstall)))
{ {
if (IUnknown_QueryInterface(remote_unk, &IID_IWineMsiRemotePackage, remote_GetActiveDatabase(remote, &handle);
(LPVOID *)&remote_package) == S_OK)
{
IWineMsiRemotePackage_GetActiveDatabase(remote_package, &handle);
IWineMsiRemotePackage_Release(remote_package);
}
else
{
WARN("remote handle %d is not a package\n", hInstall);
}
IUnknown_Release(remote_unk);
} }
return handle; return handle;
@ -2074,16 +2061,13 @@ INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType,
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if( !package ) if( !package )
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
hr = IWineMsiRemotePackage_ProcessMessage( remote_package, eMessageType, hRecord ); hr = remote_ProcessMessage(remote, eMessageType, hRecord);
IWineMsiRemotePackage_Release( remote_package );
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -2223,12 +2207,11 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
if( !package ) if( !package )
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
BSTR name = NULL, value = NULL; BSTR name = NULL, value = NULL;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall ); if (!(remote = msi_get_remote(hInstall)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
name = SysAllocString( szName ); name = SysAllocString( szName );
@ -2237,15 +2220,13 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
{ {
SysFreeString( name ); SysFreeString( name );
SysFreeString( value ); SysFreeString( value );
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
hr = IWineMsiRemotePackage_SetProperty( remote_package, name, value ); hr = remote_SetProperty(remote, name, value);
SysFreeString( name ); SysFreeString( name );
SysFreeString( value ); SysFreeString( value );
IWineMsiRemotePackage_Release( remote_package );
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -2423,22 +2404,18 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name,
if (!package) if (!package)
{ {
HRESULT hr; HRESULT hr;
IWineMsiRemotePackage *remote_package;
LPWSTR value = NULL; LPWSTR value = NULL;
MSIHANDLE remote;
BSTR bname; BSTR bname;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( handle ); if (!(remote = msi_get_remote(handle)))
if (!remote_package)
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
bname = SysAllocString( name ); bname = SysAllocString( name );
if (!bname) if (!bname)
{
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_GetProperty( remote_package, bname, NULL, &len ); hr = remote_GetProperty(remote, bname, NULL, &len);
if (FAILED(hr)) if (FAILED(hr))
goto done; goto done;
@ -2450,7 +2427,7 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name,
goto done; goto done;
} }
hr = IWineMsiRemotePackage_GetProperty( remote_package, bname, value, &len ); hr = remote_GetProperty(remote, bname, value, &len);
if (FAILED(hr)) if (FAILED(hr))
goto done; goto done;
@ -2461,7 +2438,6 @@ static UINT MSI_GetProperty( MSIHANDLE handle, LPCWSTR name,
*pchValueBuf *= sizeof(WCHAR); *pchValueBuf *= sizeof(WCHAR);
done: done:
IWineMsiRemotePackage_Release(remote_package);
SysFreeString(bname); SysFreeString(bname);
msi_free(value); msi_free(value);
@ -2522,280 +2498,149 @@ UINT WINAPI MsiGetPropertyW( MSIHANDLE hInstall, LPCWSTR szName,
return MSI_GetProperty( hInstall, szName, &val, pchValueBuf ); return MSI_GetProperty( hInstall, szName, &val, pchValueBuf );
} }
typedef struct _msi_remote_package_impl { HRESULT __cdecl remote_GetActiveDatabase(MSIHANDLE hinst, MSIHANDLE *handle)
IWineMsiRemotePackage IWineMsiRemotePackage_iface;
MSIHANDLE package;
LONG refs;
} msi_remote_package_impl;
static inline msi_remote_package_impl *impl_from_IWineMsiRemotePackage( IWineMsiRemotePackage *iface )
{ {
return CONTAINING_RECORD(iface, msi_remote_package_impl, IWineMsiRemotePackage_iface); *handle = MsiGetActiveDatabase(hinst);
}
static HRESULT WINAPI mrp_QueryInterface( IWineMsiRemotePackage *iface,
REFIID riid,LPVOID *ppobj)
{
if( IsEqualCLSID( riid, &IID_IUnknown ) ||
IsEqualCLSID( riid, &IID_IWineMsiRemotePackage ) )
{
IWineMsiRemotePackage_AddRef( iface );
*ppobj = iface;
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI mrp_AddRef( IWineMsiRemotePackage *iface )
{
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface );
return InterlockedIncrement( &This->refs );
}
static ULONG WINAPI mrp_Release( IWineMsiRemotePackage *iface )
{
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface );
ULONG r;
r = InterlockedDecrement( &This->refs );
if (r == 0)
{
MsiCloseHandle( This->package );
msi_free( This );
}
return r;
}
static HRESULT WINAPI mrp_GetActiveDatabase( IWineMsiRemotePackage *iface, MSIHANDLE *handle )
{
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface );
IWineMsiRemoteDatabase *rdb = NULL;
HRESULT hr;
MSIHANDLE hdb;
hr = create_msi_remote_database( NULL, (LPVOID *)&rdb );
if (FAILED(hr) || !rdb)
{
ERR("Failed to create remote database\n");
return hr;
}
hdb = MsiGetActiveDatabase(This->package);
hr = IWineMsiRemoteDatabase_SetMsiHandle( rdb, hdb );
if (FAILED(hr))
{
ERR("Failed to set the database handle\n");
return hr;
}
*handle = alloc_msi_remote_handle( (IUnknown *)rdb );
return S_OK; return S_OK;
} }
static HRESULT WINAPI mrp_GetProperty( IWineMsiRemotePackage *iface, BSTR property, BSTR value, DWORD *size ) HRESULT __cdecl remote_GetProperty(MSIHANDLE hinst, BSTR property, BSTR value, DWORD *size)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiGetPropertyW(hinst, property, value, size);
UINT r = MsiGetPropertyW(This->package, property, value, size);
if (r != ERROR_SUCCESS) return HRESULT_FROM_WIN32(r); if (r != ERROR_SUCCESS) return HRESULT_FROM_WIN32(r);
return S_OK; return S_OK;
} }
static HRESULT WINAPI mrp_SetProperty( IWineMsiRemotePackage *iface, BSTR property, BSTR value ) HRESULT __cdecl remote_SetProperty(MSIHANDLE hinst, BSTR property, BSTR value)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiSetPropertyW(hinst, property, value);
UINT r = MsiSetPropertyW(This->package, property, value);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_ProcessMessage( IWineMsiRemotePackage *iface, INSTALLMESSAGE message, MSIHANDLE record ) HRESULT __cdecl remote_ProcessMessage(MSIHANDLE hinst, INSTALLMESSAGE message, MSIHANDLE record)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiProcessMessage(hinst, message, record);
UINT r = MsiProcessMessage(This->package, message, record);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_DoAction( IWineMsiRemotePackage *iface, BSTR action ) HRESULT __cdecl remote_DoAction(MSIHANDLE hinst, BSTR action)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiDoActionW(hinst, action);
UINT r = MsiDoActionW(This->package, action);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_Sequence( IWineMsiRemotePackage *iface, BSTR table, int sequence ) HRESULT __cdecl remote_Sequence(MSIHANDLE hinst, BSTR table, int sequence)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiSequenceW(hinst, table, sequence);
UINT r = MsiSequenceW(This->package, table, sequence);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_GetTargetPath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value, DWORD *size ) HRESULT __cdecl remote_GetTargetPath(MSIHANDLE hinst, BSTR folder, BSTR value, DWORD *size)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiGetTargetPathW(hinst, folder, value, size);
UINT r = MsiGetTargetPathW(This->package, folder, value, size);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_SetTargetPath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value) HRESULT __cdecl remote_SetTargetPath(MSIHANDLE hinst, BSTR folder, BSTR value)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiSetTargetPathW(hinst, folder, value);
UINT r = MsiSetTargetPathW(This->package, folder, value);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_GetSourcePath( IWineMsiRemotePackage *iface, BSTR folder, BSTR value, DWORD *size ) HRESULT __cdecl remote_GetSourcePath(MSIHANDLE hinst, BSTR folder, BSTR value, DWORD *size)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiGetSourcePathW(hinst, folder, value, size);
UINT r = MsiGetSourcePathW(This->package, folder, value, size);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_GetMode( IWineMsiRemotePackage *iface, MSIRUNMODE mode, BOOL *ret ) HRESULT __cdecl remote_GetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL *ret)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); *ret = MsiGetMode(hinst, mode);
*ret = MsiGetMode(This->package, mode);
return S_OK; return S_OK;
} }
static HRESULT WINAPI mrp_SetMode( IWineMsiRemotePackage *iface, MSIRUNMODE mode, BOOL state ) HRESULT __cdecl remote_SetMode(MSIHANDLE hinst, MSIRUNMODE mode, BOOL state)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiSetMode(hinst, mode, state);
UINT r = MsiSetMode(This->package, mode, state);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_GetFeatureState( IWineMsiRemotePackage *iface, BSTR feature, HRESULT __cdecl remote_GetFeatureState(MSIHANDLE hinst, BSTR feature,
INSTALLSTATE *installed, INSTALLSTATE *action ) INSTALLSTATE *installed, INSTALLSTATE *action)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiGetFeatureStateW(hinst, feature, installed, action);
UINT r = MsiGetFeatureStateW(This->package, feature, installed, action);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_SetFeatureState( IWineMsiRemotePackage *iface, BSTR feature, INSTALLSTATE state ) HRESULT __cdecl remote_SetFeatureState(MSIHANDLE hinst, BSTR feature, INSTALLSTATE state)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiSetFeatureStateW(hinst, feature, state);
UINT r = MsiSetFeatureStateW(This->package, feature, state);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_GetComponentState( IWineMsiRemotePackage *iface, BSTR component, HRESULT __cdecl remote_GetComponentState(MSIHANDLE hinst, BSTR component,
INSTALLSTATE *installed, INSTALLSTATE *action ) INSTALLSTATE *installed, INSTALLSTATE *action)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiGetComponentStateW(hinst, component, installed, action);
UINT r = MsiGetComponentStateW(This->package, component, installed, action);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_SetComponentState( IWineMsiRemotePackage *iface, BSTR component, INSTALLSTATE state ) HRESULT __cdecl remote_SetComponentState(MSIHANDLE hinst, BSTR component, INSTALLSTATE state)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiSetComponentStateW(hinst, component, state);
UINT r = MsiSetComponentStateW(This->package, component, state);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_GetLanguage( IWineMsiRemotePackage *iface, LANGID *language ) HRESULT __cdecl remote_GetLanguage(MSIHANDLE hinst, LANGID *language)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); *language = MsiGetLanguage(hinst);
*language = MsiGetLanguage(This->package);
return S_OK; return S_OK;
} }
static HRESULT WINAPI mrp_SetInstallLevel( IWineMsiRemotePackage *iface, int level ) HRESULT __cdecl remote_SetInstallLevel(MSIHANDLE hinst, int level)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiSetInstallLevel(hinst, level);
UINT r = MsiSetInstallLevel(This->package, level);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_FormatRecord( IWineMsiRemotePackage *iface, MSIHANDLE record, HRESULT __cdecl remote_FormatRecord(MSIHANDLE hinst, MSIHANDLE record,
BSTR *value) BSTR *value)
{ {
DWORD size = 0; DWORD size = 0;
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiFormatRecordW(hinst, record, NULL, &size);
UINT r = MsiFormatRecordW(This->package, record, NULL, &size);
if (r == ERROR_SUCCESS) if (r == ERROR_SUCCESS)
{ {
*value = SysAllocStringLen(NULL, size); *value = SysAllocStringLen(NULL, size);
if (!*value) if (!*value)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
size++; size++;
r = MsiFormatRecordW(This->package, record, *value, &size); r = MsiFormatRecordW(hinst, record, *value, &size);
} }
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_EvaluateCondition( IWineMsiRemotePackage *iface, BSTR condition ) HRESULT __cdecl remote_EvaluateCondition(MSIHANDLE hinst, BSTR condition)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiEvaluateConditionW(hinst, condition);
UINT r = MsiEvaluateConditionW(This->package, condition);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_GetFeatureCost( IWineMsiRemotePackage *iface, BSTR feature, HRESULT __cdecl remote_GetFeatureCost(MSIHANDLE hinst, BSTR feature,
INT cost_tree, INSTALLSTATE state, INT *cost ) INT cost_tree, INSTALLSTATE state, INT *cost)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiGetFeatureCostW(hinst, feature, cost_tree, state, cost);
UINT r = MsiGetFeatureCostW(This->package, feature, cost_tree, state, cost);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static HRESULT WINAPI mrp_EnumComponentCosts( IWineMsiRemotePackage *iface, BSTR component, HRESULT __cdecl remote_EnumComponentCosts(MSIHANDLE hinst, BSTR component,
DWORD index, INSTALLSTATE state, BSTR drive, DWORD index, INSTALLSTATE state, BSTR drive,
DWORD *buflen, INT *cost, INT *temp ) DWORD *buflen, INT *cost, INT *temp)
{ {
msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); UINT r = MsiEnumComponentCostsW(hinst, component, index, state, drive, buflen, cost, temp);
UINT r = MsiEnumComponentCostsW(This->package, component, index, state, drive, buflen, cost, temp);
return HRESULT_FROM_WIN32(r); return HRESULT_FROM_WIN32(r);
} }
static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
{
mrp_QueryInterface,
mrp_AddRef,
mrp_Release,
mrp_GetActiveDatabase,
mrp_GetProperty,
mrp_SetProperty,
mrp_ProcessMessage,
mrp_DoAction,
mrp_Sequence,
mrp_GetTargetPath,
mrp_SetTargetPath,
mrp_GetSourcePath,
mrp_GetMode,
mrp_SetMode,
mrp_GetFeatureState,
mrp_SetFeatureState,
mrp_GetComponentState,
mrp_SetComponentState,
mrp_GetLanguage,
mrp_SetInstallLevel,
mrp_FormatRecord,
mrp_EvaluateCondition,
mrp_GetFeatureCost,
mrp_EnumComponentCosts
};
HRESULT create_msi_remote_package( MSIHANDLE handle, IWineMsiRemotePackage **ppObj )
{
msi_remote_package_impl* This;
This = msi_alloc( sizeof *This );
if (!This)
return E_OUTOFMEMORY;
This->IWineMsiRemotePackage_iface.lpVtbl = &msi_remote_package_vtbl;
This->package = handle;
This->refs = 1;
*ppObj = &This->IWineMsiRemotePackage_iface;
return S_OK;
}
UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options, UINT msi_package_add_info(MSIPACKAGE *package, DWORD context, DWORD options,
LPCWSTR property, LPWSTR value) LPCWSTR property, LPWSTR value)
{ {

View file

@ -34,10 +34,11 @@
#include "msi.h" #include "msi.h"
#include "msiquery.h" #include "msiquery.h"
#include "msidefs.h" #include "msidefs.h"
#include "msipriv.h"
#include "objidl.h" #include "objidl.h"
#include "propvarutil.h" #include "propvarutil.h"
#include "msiserver.h"
#include "msipriv.h"
#include "winemsi.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi); WINE_DEFAULT_DEBUG_CHANNEL(msi);
@ -537,16 +538,13 @@ UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase,
db = msihandle2msiinfo( hDatabase, MSIHANDLETYPE_DATABASE ); db = msihandle2msiinfo( hDatabase, MSIHANDLETYPE_DATABASE );
if( !db ) if( !db )
{ {
MSIHANDLE remote;
HRESULT hr; HRESULT hr;
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hDatabase ); if (!(remote = msi_get_remote(hDatabase)))
if ( !remote_database )
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
hr = IWineMsiRemoteDatabase_GetSummaryInformation( remote_database, hr = remote_DatabaseGetSummaryInformation(remote, uiUpdateCount, pHandle);
uiUpdateCount, pHandle );
IWineMsiRemoteDatabase_Release( remote_database );
if (FAILED(hr)) if (FAILED(hr))
{ {

70
dll/win32/msi/winemsi.idl Normal file
View file

@ -0,0 +1,70 @@
/*
* Copyright (C) 2007 James Hawkins
* Copyright (C) 2018 Zebediah Figura
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#pragma makedep header
import "objidl.idl";
cpp_quote("#if 0")
typedef unsigned long MSIHANDLE;
typedef int INSTALLMESSAGE;
typedef int MSICONDITION;
typedef int MSIRUNMODE;
typedef int INSTALLSTATE;
cpp_quote("#endif")
cpp_quote("#include \"msiquery.h\"")
[
uuid(56D58B64-8780-4c22-A8BC-8B0B29E4A9F8)
]
interface IWineMsiRemote
{
HRESULT remote_DatabaseIsTablePersistent( [in] MSIHANDLE db, [in] LPCWSTR table, [out] MSICONDITION *persistent );
HRESULT remote_DatabaseGetPrimaryKeys( [in] MSIHANDLE db, [in] LPCWSTR table, [out] MSIHANDLE *keys );
HRESULT remote_DatabaseGetSummaryInformation( [in] MSIHANDLE db, [in] UINT updatecount, [out] MSIHANDLE *suminfo );
HRESULT remote_DatabaseOpenView( [in] MSIHANDLE db, [in] LPCWSTR query, [out] MSIHANDLE *view );
HRESULT remote_GetActiveDatabase( [in] MSIHANDLE hinst, [out] MSIHANDLE *handle );
HRESULT remote_GetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
HRESULT remote_SetProperty( [in] MSIHANDLE hinst, [in] BSTR property, [in] BSTR value );
HRESULT remote_ProcessMessage( [in] MSIHANDLE hinst, [in] INSTALLMESSAGE message, [in] MSIHANDLE record );
HRESULT remote_DoAction( [in] MSIHANDLE hinst, [in] BSTR action );
HRESULT remote_Sequence( [in] MSIHANDLE hinst, [in] BSTR table, [in] int sequence );
HRESULT remote_GetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
HRESULT remote_SetTargetPath( [in] MSIHANDLE hinst, [in] BSTR folder, [in] BSTR value );
HRESULT remote_GetSourcePath( [in] MSIHANDLE hinst, [in] BSTR folder, [out, size_is(*size)] BSTR value, [in, out] DWORD *size );
HRESULT remote_GetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [out] BOOL *ret );
HRESULT remote_SetMode( [in] MSIHANDLE hinst, [in] MSIRUNMODE mode, [in] BOOL state );
HRESULT remote_GetFeatureState( [in] MSIHANDLE hinst, [in] BSTR feature, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
HRESULT remote_SetFeatureState( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INSTALLSTATE state );
HRESULT remote_GetComponentState( [in] MSIHANDLE hinst, [in] BSTR component, [out] INSTALLSTATE *installed, [out] INSTALLSTATE *action );
HRESULT remote_SetComponentState( [in] MSIHANDLE hinst, [in] BSTR component, [in] INSTALLSTATE state );
HRESULT remote_GetLanguage( [in] MSIHANDLE hinst, [out] LANGID *language );
HRESULT remote_SetInstallLevel( [in] MSIHANDLE hinst, [in] int level );
HRESULT remote_FormatRecord( [in] MSIHANDLE hinst, [in] MSIHANDLE record, [out] BSTR *value );
HRESULT remote_EvaluateCondition( [in] MSIHANDLE hinst, [in] BSTR condition );
HRESULT remote_GetFeatureCost( [in] MSIHANDLE hinst, [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost );
HRESULT remote_EnumComponentCosts( [in] MSIHANDLE hinst, [in] BSTR component, [in] DWORD index, [in] INSTALLSTATE state,
[out, size_is(*buflen)] BSTR drive, [in, out] DWORD *buflen, [out] INT *cost, [out] INT *temp );
HRESULT remote_GetActionInfo( [in] LPCGUID guid, [out] INT *type, [out] BSTR *dllname,
[out] BSTR *function, [out] MSIHANDLE *package );
UINT remote_CloseHandle( [in] MSIHANDLE handle );
}