Commit 8bfb4e8b authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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

parent b9b45981
......@@ -44,7 +44,9 @@ C_SRCS = \
upgrade.c \
where.c
IDL_SRCS = msiserver.idl
IDL_SRCS = \
msiserver.idl \
winemsi.idl
BISON_SRCS = \
cond.y \
......
......@@ -37,7 +37,7 @@
#include "oleauto.h"
#include "msipriv.h"
#include "msiserver.h"
#include "winemsi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/list.h"
......@@ -850,25 +850,20 @@ MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szConditi
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
if( !package )
{
MSIHANDLE remote;
HRESULT hr;
BSTR condition;
IWineMsiRemotePackage *remote_package;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
if (!remote_package)
if (!(remote = msi_get_remote(hInstall)))
return MSICONDITION_ERROR;
condition = SysAllocString( szCondition );
if (!condition)
{
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_EvaluateCondition( remote_package, condition );
hr = remote_EvaluateCondition(remote, condition);
SysFreeString( condition );
IWineMsiRemotePackage_Release( remote_package );
if (FAILED(hr))
{
......
......@@ -33,7 +33,7 @@
#include "oleauto.h"
#include "msipriv.h"
#include "msiserver.h"
#include "winemsi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/exception.h"
......@@ -490,40 +490,6 @@ static void handle_msi_break( LPCWSTR target )
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__
extern UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE handle );
__ASM_GLOBAL_FUNC( CUSTOMPROC_wrapper,
......@@ -550,17 +516,17 @@ static inline UINT CUSTOMPROC_wrapper( MsiCustomActionEntryPoint proc, MSIHANDLE
static DWORD ACTION_CallDllFunction( const GUID *guid )
{
MsiCustomActionEntryPoint fn;
MSIHANDLE remote_package = 0;
MSIHANDLE hPackage;
HANDLE hModule;
LPSTR proc;
UINT r = ERROR_FUNCTION_FAILED;
BSTR dll = NULL, function = NULL;
INT type;
IWineMsiRemotePackage *remote_package = NULL;
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)
return r;
......@@ -576,7 +542,7 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
msi_free( proc );
if (fn)
{
hPackage = alloc_msi_remote_handle( (IUnknown *)remote_package );
hPackage = alloc_msi_remote_handle( remote_package );
if (hPackage)
{
TRACE("calling %s\n", debugstr_w( function ) );
......@@ -597,14 +563,14 @@ static DWORD ACTION_CallDllFunction( const GUID *guid )
MsiCloseHandle( hPackage );
}
else
ERR("failed to create handle for %p\n", remote_package );
ERR("failed to create handle for %x\n", remote_package );
}
else
ERR("GetProcAddress(%s) failed\n", debugstr_w( function ) );
FreeLibrary(hModule);
IWineMsiRemotePackage_Release( remote_package );
MsiCloseHandle(hPackage);
SysFreeString( dll );
SysFreeString( function );
......@@ -1383,50 +1349,8 @@ void ACTION_FinishCustomActions(const MSIPACKAGE* package)
LeaveCriticalSection( &msi_custom_action_cs );
}
typedef struct _msi_custom_remote_impl {
IWineMsiRemoteCustomAction IWineMsiRemoteCustomAction_iface;
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 )
HRESULT __cdecl remote_GetActionInfo( const GUID *custom_action_guid,
INT *type, BSTR *dll, BSTR *func, MSIHANDLE *remote_package )
{
msi_custom_action_info *info;
MSIHANDLE handle;
......@@ -1441,29 +1365,6 @@ static HRESULT WINAPI mcr_GetActionInfo( IWineMsiRemoteCustomAction *iface, LPCG
*func = SysAllocString( info->target );
release_custom_action_data( info );
return create_msi_remote_package( handle, remote_package );
}
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;
*remote_package = handle;
return S_OK;
}
......@@ -873,13 +873,10 @@ UINT WINAPI MsiDatabaseImportW(MSIHANDLE handle, LPCWSTR szFolder, LPCWSTR szFil
db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE );
if( !db )
{
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle );
MSIHANDLE remote_database = msi_get_remote( handle );
if ( !remote_database )
return ERROR_INVALID_HANDLE;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiDatabaseImport not allowed during a custom action!\n");
return ERROR_SUCCESS;
......@@ -1094,13 +1091,10 @@ UINT WINAPI MsiDatabaseExportW( MSIHANDLE handle, LPCWSTR szTable,
db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE );
if( !db )
{
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle );
MSIHANDLE remote_database = msi_get_remote(handle);
if ( !remote_database )
return ERROR_INVALID_HANDLE;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiDatabaseExport not allowed during a custom action!\n");
return ERROR_SUCCESS;
......@@ -1896,13 +1890,10 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle )
db = msihandle2msiinfo( handle, MSIHANDLETYPE_DATABASE );
if( !db )
{
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( handle );
MSIHANDLE remote_database = msi_get_remote(handle);
if ( !remote_database )
return MSIDBSTATE_ERROR;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiGetDatabaseState not allowed during a custom action!\n");
return MSIDBSTATE_READ;
......@@ -1915,116 +1906,26 @@ MSIDBSTATE WINAPI MsiGetDatabaseState( MSIHANDLE handle )
return ret;
}
typedef struct _msi_remote_database_impl {
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);
}
static HRESULT WINAPI mrd_QueryInterface( IWineMsiRemoteDatabase *iface,
REFIID riid,LPVOID *ppobj)
HRESULT __cdecl remote_DatabaseIsTablePersistent(MSIHANDLE db, LPCWSTR table, MSICONDITION *persistent)
{
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);
*persistent = MsiDatabaseIsTablePersistentW(db, table);
return S_OK;
}
static HRESULT WINAPI mrd_GetPrimaryKeys( IWineMsiRemoteDatabase *iface,
LPCWSTR table, MSIHANDLE *keys )
HRESULT __cdecl remote_DatabaseGetPrimaryKeys(MSIHANDLE db, LPCWSTR table, MSIHANDLE *keys)
{
msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface );
UINT r = MsiDatabaseGetPrimaryKeysW(This->database, table, keys);
UINT r = MsiDatabaseGetPrimaryKeysW(db, table, keys);
return HRESULT_FROM_WIN32(r);
}
static HRESULT WINAPI mrd_GetSummaryInformation( IWineMsiRemoteDatabase *iface,
UINT updatecount, MSIHANDLE *suminfo )
HRESULT __cdecl remote_DatabaseGetSummaryInformation(MSIHANDLE db, UINT updatecount, MSIHANDLE *suminfo)
{
msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface );
UINT r = MsiGetSummaryInformationW(This->database, NULL, updatecount, suminfo);
UINT r = MsiGetSummaryInformationW(db, NULL, updatecount, suminfo);
return HRESULT_FROM_WIN32(r);
}
static HRESULT WINAPI mrd_OpenView( IWineMsiRemoteDatabase *iface,
LPCWSTR query, MSIHANDLE *view )
HRESULT __cdecl remote_DatabaseOpenView(MSIHANDLE db, LPCWSTR query, MSIHANDLE *view)
{
msi_remote_database_impl *This = impl_from_IWineMsiRemoteDatabase( iface );
UINT r = MsiDatabaseOpenViewW(This->database, query, view);
UINT r = MsiDatabaseOpenViewW(db, query, view);
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;
}
......@@ -4138,15 +4138,12 @@ UINT WINAPI MsiEnableUIPreview( MSIHANDLE hdb, MSIHANDLE *phPreview )
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if (!db)
{
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb );
MSIHANDLE remote_database = msi_get_remote( hdb );
if (!remote_database)
return ERROR_INVALID_HANDLE;
*phPreview = 0;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiEnableUIPreview not allowed during a custom action!\n");
return ERROR_FUNCTION_FAILED;
......
......@@ -34,7 +34,7 @@
#include "oleauto.h"
#include "msipriv.h"
#include "msiserver.h"
#include "winemsi.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
......@@ -911,15 +911,13 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord,
if (!package)
{
HRESULT hr;
IWineMsiRemotePackage *remote_package;
MSIHANDLE remote;
BSTR value = NULL;
awstring wstr;
remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
if (remote_package)
if ((remote = msi_get_remote(hInstall)))
{
hr = IWineMsiRemotePackage_FormatRecord( remote_package, hRecord,
&value );
hr = remote_FormatRecord(remote, hRecord, &value);
if (FAILED(hr))
goto done;
......@@ -928,7 +926,6 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord,
r = msi_strcpy_to_awstring( value, SysStringLen(value), &wstr, sz );
done:
IWineMsiRemotePackage_Release( remote_package );
SysFreeString( value );
if (FAILED(hr))
......
......@@ -29,7 +29,9 @@
#include "wine/debug.h"
#include "msi.h"
#include "msiquery.h"
#include "msipriv.h"
#include "winemsi.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
......@@ -58,7 +60,7 @@ typedef struct msi_handle_info_t
BOOL remote;
union {
MSIOBJECTHDR *obj;
IUnknown *unk;
MSIHANDLE rem;
} u;
DWORD dwThreadId;
} msi_handle_info;
......@@ -81,7 +83,7 @@ static MSIHANDLE alloc_handle_table_entry(void)
/* find a slot */
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;
if( i==msihandletable_size )
{
......@@ -130,7 +132,7 @@ MSIHANDLE alloc_msihandle( MSIOBJECTHDR *obj )
return ret;
}
MSIHANDLE alloc_msi_remote_handle( IUnknown *unk )
MSIHANDLE alloc_msi_remote_handle(MSIHANDLE remote)
{
msi_handle_info *entry;
MSIHANDLE ret;
......@@ -141,15 +143,14 @@ MSIHANDLE alloc_msi_remote_handle( IUnknown *unk )
if (ret)
{
entry = &msihandletable[ ret - 1 ];
IUnknown_AddRef( unk );
entry->u.unk = unk;
entry->u.rem = remote;
entry->dwThreadId = GetCurrentThreadId();
entry->remote = TRUE;
}
LeaveCriticalSection( &MSI_handle_cs );
TRACE("%p -> %d\n", unk, ret);
TRACE("%d -> %d\n", remote, ret);
return ret;
}
......@@ -179,9 +180,9 @@ out:
return ret;
}
IUnknown *msi_get_remote( MSIHANDLE handle )
MSIHANDLE msi_get_remote( MSIHANDLE handle )
{
IUnknown *unk = NULL;
MSIHANDLE ret = 0;
EnterCriticalSection( &MSI_handle_cs );
handle--;
......@@ -189,14 +190,12 @@ IUnknown *msi_get_remote( MSIHANDLE handle )
goto out;
if( !msihandletable[handle].remote)
goto out;
unk = msihandletable[handle].u.unk;
if( unk )
IUnknown_AddRef( unk );
ret = msihandletable[handle].u.rem;
out:
LeaveCriticalSection( &MSI_handle_cs );
return unk;
return ret;
}
void *alloc_msiobject(UINT type, UINT size, msihandledestructor destroy )
......@@ -285,7 +284,7 @@ UINT WINAPI MsiCloseHandle(MSIHANDLE handle)
if (msihandletable[handle].remote)
{
IUnknown_Release( msihandletable[handle].u.unk );
remote_CloseHandle( msihandletable[handle].u.rem );
}
else
{
......@@ -344,3 +343,8 @@ UINT WINAPI MsiCloseAllHandles(void)
return n;
}
UINT __cdecl remote_CloseHandle(MSIHANDLE handle)
{
return MsiCloseHandle(handle);
}
......@@ -31,8 +31,6 @@
#include "msi.h"
#include "msidefs.h"
#include "msiquery.h"
#include "msipriv.h"
#include "msiserver.h"
#include "wincrypt.h"
#include "winver.h"
#include "winuser.h"
......@@ -42,6 +40,9 @@
#include "wintrust.h"
#include "softpub.h"
#include "msipriv.h"
#include "winemsi.h"
#include "initguid.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 (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE )))
{
MSIHANDLE remote;
HRESULT hr;
IWineMsiRemotePackage *remote_package;
BSTR bname = NULL;
if (!(remote_package = (IWineMsiRemotePackage *)msi_get_remote( handle )))
if (!(remote = msi_get_remote(handle)))
return ERROR_INVALID_HANDLE;
if (component && !(bname = SysAllocString( component )))
{
IWineMsiRemotePackage_Release( remote_package );
return ERROR_OUTOFMEMORY;
}
hr = IWineMsiRemotePackage_EnumComponentCosts( remote_package, bname, index, state, drive, buflen, cost, temp );
IWineMsiRemotePackage_Release( remote_package );
hr = remote_EnumComponentCosts(remote, bname, index, state, drive, buflen, cost, temp);
SysFreeString( bname );
if (FAILED(hr))
{
......
......@@ -166,7 +166,6 @@ static const IClassFactoryVtbl MsiCF_Vtbl =
};
static IClassFactoryImpl MsiServer_CF = { { &MsiCF_Vtbl }, create_msiserver };
static IClassFactoryImpl WineMsiCustomRemote_CF = { { &MsiCF_Vtbl }, create_msi_custom_remote };
/******************************************************************
* DllGetClassObject [MSI.@]
......@@ -181,12 +180,6 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return S_OK;
}
if ( IsEqualCLSID (rclsid, &CLSID_WineMsiRemoteCustomAction) )
{
*ppv = &WineMsiCustomRemote_CF;
return S_OK;
}
if( IsEqualCLSID (rclsid, &CLSID_MsiServerMessage) ||
IsEqualCLSID (rclsid, &CLSID_MsiServer) ||
IsEqualCLSID (rclsid, &CLSID_PSFactoryBuffer) ||
......
......@@ -734,15 +734,12 @@ typedef struct {
UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *) DECLSPEC_HIDDEN;
/* msi server interface */
extern HRESULT create_msi_custom_remote( 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;
extern MSIHANDLE msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN;
/* handle functions */
extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type) 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 msiobj_addref(MSIOBJECTHDR *) DECLSPEC_HIDDEN;
extern int msiobj_release(MSIOBJECTHDR *) DECLSPEC_HIDDEN;
......
......@@ -31,11 +31,11 @@
#include "msiquery.h"
#include "objbase.h"
#include "objidl.h"
#include "msipriv.h"
#include "winnls.h"
#include "msipriv.h"
#include "query.h"
#include "msiserver.h"
#include "winemsi.h"
#include "initguid.h"
......@@ -250,15 +250,13 @@ UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb,
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db )
{
MSIHANDLE remote;
HRESULT hr;
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb );
if ( !remote_database )
if (!(remote = msi_get_remote(hdb)))
return ERROR_INVALID_HANDLE;
hr = IWineMsiRemoteDatabase_OpenView( remote_database, szQuery, phView );
IWineMsiRemoteDatabase_Release( remote_database );
hr = remote_DatabaseOpenView(remote, szQuery, phView);
if (FAILED(hr))
{
......@@ -758,13 +756,11 @@ UINT WINAPI MsiDatabaseApplyTransformW( MSIHANDLE hdb,
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db )
{
IWineMsiRemoteDatabase *remote_database;
MSIHANDLE remote;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb );
if ( !remote_database )
if (!(remote = msi_get_remote(hdb)))
return ERROR_INVALID_HANDLE;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("MsiDatabaseApplyTransform not allowed during a custom action!\n");
return ERROR_SUCCESS;
......@@ -820,13 +816,11 @@ UINT WINAPI MsiDatabaseCommit( MSIHANDLE hdb )
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db )
{
IWineMsiRemoteDatabase *remote_database;
MSIHANDLE remote;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb );
if ( !remote_database )
if (!(remote = msi_get_remote(hdb)))
return ERROR_INVALID_HANDLE;
IWineMsiRemoteDatabase_Release( remote_database );
WARN("not allowed during a custom action!\n");
return ERROR_SUCCESS;
......@@ -946,15 +940,13 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW( MSIHANDLE hdb,
db = msihandle2msiinfo( hdb, MSIHANDLETYPE_DATABASE );
if( !db )
{
MSIHANDLE remote;
HRESULT hr;
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hdb );
if ( !remote_database )
if (!(remote = msi_get_remote(hdb)))
return ERROR_INVALID_HANDLE;
hr = IWineMsiRemoteDatabase_GetPrimaryKeys( remote_database, table, phRec );
IWineMsiRemoteDatabase_Release( remote_database );
hr = remote_DatabaseGetPrimaryKeys(remote, table, phRec);
if (FAILED(hr))
{
......@@ -1033,15 +1025,12 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentW(
{
HRESULT hr;
MSICONDITION condition;
IWineMsiRemoteDatabase *remote_database;
MSIHANDLE remote;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hDatabase );
if ( !remote_database )
if (!(remote = msi_get_remote(hDatabase)))
return MSICONDITION_ERROR;
hr = IWineMsiRemoteDatabase_IsTablePersistent( remote_database,
szTableName, &condition );
IWineMsiRemoteDatabase_Release( remote_database );
hr = remote_DatabaseIsTablePersistent(remote, szTableName, &condition);
if (FAILED(hr))
return MSICONDITION_ERROR;
......
......@@ -27,70 +27,6 @@ import "wtypes.idl";
import "objidl.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),
oleautomation,
......
......@@ -33,10 +33,11 @@
#include "msi.h"
#include "msiquery.h"
#include "msidefs.h"
#include "msipriv.h"
#include "objidl.h"
#include "propvarutil.h"
#include "msiserver.h"
#include "msipriv.h"
#include "winemsi.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
......@@ -522,16 +523,13 @@ UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase,
db = msihandle2msiinfo( hDatabase, MSIHANDLETYPE_DATABASE );
if( !db )
{
MSIHANDLE remote;
HRESULT hr;
IWineMsiRemoteDatabase *remote_database;
remote_database = (IWineMsiRemoteDatabase *)msi_get_remote( hDatabase );
if ( !remote_database )
if (!(remote = msi_get_remote(hDatabase)))
return ERROR_INVALID_HANDLE;
hr = IWineMsiRemoteDatabase_GetSummaryInformation( remote_database,
uiUpdateCount, pHandle );
IWineMsiRemoteDatabase_Release( remote_database );
hr = remote_DatabaseGetSummaryInformation(remote, uiUpdateCount, pHandle);
if (FAILED(hr))
{
......
/*
* 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 );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment