Hans Leidekker : msi: Support remote calls to MsiEnumComponentCosts.

Alexandre Julliard julliard at winehq.org
Mon May 2 14:16:16 CDT 2011


Module: wine
Branch: master
Commit: cc517f2b3803e2cd0f197e5075e829e430d8b94b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cc517f2b3803e2cd0f197e5075e829e430d8b94b

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon May  2 16:02:40 2011 +0200

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 b5e4b13..d48d1d1 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 58c5b3c..aa81498 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 bad8ab3..2a82ca5 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 )




More information about the wine-cvs mailing list