James Hawkins : msi: Handle remote calls to MsiEvaluateCondition.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 6 12:59:05 CDT 2007


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

Author: James Hawkins <truiken at gmail.com>
Date:   Thu Jul  5 17:53:03 2007 -0700

msi: Handle remote calls to MsiEvaluateCondition.

---

 dlls/msi/cond.y        |   46 +++++++++++++++++++++++++++++++++++++++++-----
 dlls/msi/msiserver.idl |    1 +
 dlls/msi/package.c     |    8 ++++++++
 3 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/dlls/msi/cond.y b/dlls/msi/cond.y
index ee42ede..8612ffe 100644
--- a/dlls/msi/cond.y
+++ b/dlls/msi/cond.y
@@ -20,6 +20,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#define COBJMACROS
+
 #include "config.h"
 
 #include <stdarg.h>
@@ -29,12 +31,15 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
-#include "wine/debug.h"
-#include "wine/unicode.h"
-
 #include "msi.h"
 #include "msiquery.h"
+#include "objbase.h"
+#include "oleauto.h"
+
 #include "msipriv.h"
+#include "msiserver.h"
+#include "wine/debug.h"
+#include "wine/unicode.h"
 
 #define YYLEX_PARAM info
 #define YYPARSE_PARAM info
@@ -742,8 +747,39 @@ MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szConditi
     UINT ret;
 
     package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
-    if( !package)
-        return MSICONDITION_ERROR;
+    if( !package )
+    {
+        HRESULT hr;
+        BSTR condition;
+        IWineMsiRemotePackage *remote_package;
+
+        remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
+        if (!remote_package)
+            return MSICONDITION_ERROR;
+
+        condition = SysAllocString( szCondition );
+        if (!condition)
+        {
+            IWineMsiRemotePackage_Release( remote_package );
+            return ERROR_OUTOFMEMORY;
+        }
+
+        hr = IWineMsiRemotePackage_EvaluateCondition( remote_package, condition );
+
+        SysFreeString( condition );
+        IWineMsiRemotePackage_Release( remote_package );
+
+        if (FAILED(hr))
+        {
+            if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
+                return HRESULT_CODE(hr);
+
+            return ERROR_FUNCTION_FAILED;
+        }
+
+        return ERROR_SUCCESS;
+    }
+
     ret = MSI_EvaluateConditionW( package, szCondition );
     msiobj_release( &package->hdr );
     return ret;
diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl
index e293b10..1b162be 100644
--- a/dlls/msi/msiserver.idl
+++ b/dlls/msi/msiserver.idl
@@ -56,6 +56,7 @@ interface IWineMsiRemotePackage : IUnknown
     HRESULT GetLanguage( [out] LANGID *language );
     HRESULT SetInstallLevel( [in] int level );
     HRESULT FormatRecord( [in] MSIHANDLE record, [out] BSTR value, [out] DWORD *size );
+    HRESULT EvaluateCondition( [in] BSTR condition );
 }
 
 [
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index f68be84..f3d6130 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -1692,6 +1692,13 @@ HRESULT WINAPI mrp_FormatRecord( IWineMsiRemotePackage *iface, MSIHANDLE record,
     return HRESULT_FROM_WIN32(r);
 }
 
+HRESULT WINAPI mrp_EvaluateCondition( IWineMsiRemotePackage *iface, BSTR condition )
+{
+    msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface );
+    UINT r = MsiEvaluateConditionW(This->package, (LPWSTR)condition);
+    return HRESULT_FROM_WIN32(r);
+}
+
 static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
 {
     mrp_QueryInterface,
@@ -1715,6 +1722,7 @@ static const IWineMsiRemotePackageVtbl msi_remote_package_vtbl =
     mrp_GetLanguage,
     mrp_SetInstallLevel,
     mrp_FormatRecord,
+    mrp_EvaluateCondition,
 };
 
 HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )




More information about the wine-cvs mailing list