msi [4/5]: Handle remote calls to MsiEvaluateCondition

James Hawkins truiken at gmail.com
Thu Jul 5 19:53:03 CDT 2007


Hi,

Changelog:
* 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(-)

-- 
James Hawkins
-------------- next part --------------
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 <stdlib.h>
 #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 MsiEvaluateCondition
     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 : IUnkno
     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( IWineMs
     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 m
     mrp_GetLanguage,
     mrp_SetInstallLevel,
     mrp_FormatRecord,
+    mrp_EvaluateCondition,
 };
 
 HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj )
-- 
1.4.1


More information about the wine-patches mailing list