From cc517f2b3803e2cd0f197e5075e829e430d8b94b Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 2 May 2011 16:02:40 +0200 Subject: [PATCH] msi: Support remote calls to MsiEnumComponentCosts. --- dlls/msi/msi.c | 28 +++++++++++++++++++++++++++- dlls/msi/msiserver.idl | 4 +++- dlls/msi/package.c | 10 ++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index b5e4b13701e..d48d1d140b3 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -32,6 +32,7 @@ #include "msidefs.h" #include "msiquery.h" #include "msipriv.h" +#include "msiserver.h" #include "wincrypt.h" #include "winver.h" #include "winuser.h" @@ -1839,7 +1840,32 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i state, drive, buflen, cost, temp); if (!drive || !buflen || !cost || !temp) return ERROR_INVALID_PARAMETER; - if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ))) return ERROR_INVALID_HANDLE; + if (!(package = msihandle2msiinfo( handle, MSIHANDLETYPE_PACKAGE ))) + { + HRESULT hr; + IWineMsiRemotePackage *remote_package; + BSTR bname; + + if (!(remote_package = (IWineMsiRemotePackage *)msi_get_remote( handle ))) + return ERROR_INVALID_HANDLE; + + bname = SysAllocString( component ); + if (!bname) + { + IWineMsiRemotePackage_Release( remote_package ); + return ERROR_OUTOFMEMORY; + } + hr = IWineMsiRemotePackage_EnumComponentCosts( remote_package, bname, index, state, drive, buflen, cost, temp ); + IWineMsiRemotePackage_Release( remote_package ); + SysFreeString( bname ); + if (FAILED(hr)) + { + if (HRESULT_FACILITY(hr) == FACILITY_WIN32) return HRESULT_CODE(hr); + return ERROR_FUNCTION_FAILED; + } + return ERROR_SUCCESS; + } + if (!msi_get_property_int( package->db, szCostingComplete, 0 )) { msiobj_release( &package->hdr ); diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl index 58c5b3cf99f..aa814982196 100644 --- a/dlls/msi/msiserver.idl +++ b/dlls/msi/msiserver.idl @@ -72,7 +72,9 @@ interface IWineMsiRemotePackage : IUnknown 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 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 ); } [ diff --git a/dlls/msi/package.c b/dlls/msi/package.c index bad8ab35501..2a82ca54258 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -2534,6 +2534,15 @@ static HRESULT WINAPI mrp_GetFeatureCost( IWineMsiRemotePackage *iface, BSTR fea return HRESULT_FROM_WIN32(r); } +static HRESULT WINAPI mrp_EnumComponentCosts( IWineMsiRemotePackage *iface, BSTR component, + DWORD index, INSTALLSTATE state, BSTR drive, + DWORD *buflen, INT *cost, INT *temp ) +{ + msi_remote_package_impl* This = impl_from_IWineMsiRemotePackage( iface ); + UINT r = MsiEnumComponentCostsW(This->package, component, index, state, drive, buflen, cost, temp); + return HRESULT_FROM_WIN32(r); +} + static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl = { mrp_QueryInterface, @@ -2560,6 +2569,7 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl = mrp_FormatRecord, mrp_EvaluateCondition, mrp_GetFeatureCost, + mrp_EnumComponentCosts }; HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj ) -- 2.11.4.GIT