Misha Koshelev : msi: automation: Implement Session::EvaluateCondition.

Alexandre Julliard julliard at wine.codeweavers.com
Mon May 14 10:52:44 CDT 2007


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

Author: Misha Koshelev <mk144210 at bcm.edu>
Date:   Fri May 11 14:07:48 2007 -0500

msi: automation: Implement Session::EvaluateCondition.

---

 dlls/msi/automation.c        |    9 ++++++
 dlls/msi/msiserver.idl       |    9 ++++++
 dlls/msi/msiserver_dispids.h |    1 +
 dlls/msi/tests/automation.c  |   59 +++++++++++++++++------------------------
 4 files changed, 44 insertions(+), 34 deletions(-)

diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c
index 72b2e6b..56f163a 100644
--- a/dlls/msi/automation.c
+++ b/dlls/msi/automation.c
@@ -956,6 +956,15 @@ static HRESULT WINAPI SessionImpl_Invoke(
             }
             break;
 
+        case DISPID_SESSION_EVALUATECONDITION:
+            if (wFlags & DISPATCH_METHOD) {
+                hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr);
+                if (FAILED(hr)) return hr;
+                V_VT(pVarResult) = VT_I4;
+                V_I4(pVarResult) = MsiEvaluateConditionW(This->msiHandle, V_BSTR(&varg0));
+            }
+            break;
+
         case DISPID_SESSION_SETINSTALLLEVEL:
             hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
             if (FAILED(hr)) return hr;
diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl
index 84bf138..cd6621f 100644
--- a/dlls/msi/msiserver.idl
+++ b/dlls/msi/msiserver.idl
@@ -172,6 +172,13 @@ library WindowsInstaller
         msiRunModeCommit = 18
     } MsiRunMode;
 
+    typedef enum {
+        msiEvaluateConditionFalse = 0,
+        msiEvaluateConditionTrue = 1,
+        msiEvaluateConditionNone = 2,
+        msiEvaluateConditionError = 3
+    } _MsiEvaluateCondition;           /* Added underscore to avoid conflict with function name */
+
     [ uuid(000C109E-0000-0000-C000-000000000046) ]
     dispinterface Session
     {
@@ -197,6 +204,8 @@ library WindowsInstaller
             Database* Database();
         [id(DISPID_SESSION_DOACTION)]
             MsiDoActionStatus DoAction([in] BSTR Action);
+        [id(DISPID_SESSION_EVALUATECONDITION)]
+            _MsiEvaluateCondition EvaluateCondition([in] BSTR Expression);
         [id(DISPID_SESSION_FEATURECURRENTSTATE), propget]
             MsiInstallState FeatureCurrentState([in] BSTR Feature);
         [id(DISPID_SESSION_FEATUREREQUESTSTATE), propget]
diff --git a/dlls/msi/msiserver_dispids.h b/dlls/msi/msiserver_dispids.h
index 7aa01d4..e85f750 100644
--- a/dlls/msi/msiserver_dispids.h
+++ b/dlls/msi/msiserver_dispids.h
@@ -38,6 +38,7 @@
 #define DISPID_SESSION_MODE 4
 #define DISPID_SESSION_DATABASE 5
 #define DISPID_SESSION_DOACTION 8
+#define DISPID_SESSION_EVALUATECONDITION 10
 #define DISPID_SESSION_FEATURECURRENTSTATE 13
 #define DISPID_SESSION_FEATUREREQUESTSTATE 14
 #define DISPID_SESSION_SETINSTALLLEVEL 19
diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c
index 9d337f8..5538d09 100644
--- a/dlls/msi/tests/automation.c
+++ b/dlls/msi/tests/automation.c
@@ -1106,20 +1106,17 @@ static void test_Session(IDispatch *pSession)
     }
 
     /* Session::EvaluateCondition */
-    todo_wine
-    {
-        hr = Session_EvaluateCondition(pSession, NULL, &myint);
-        ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
-        ok(myint == MSICONDITION_NONE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
+    hr = Session_EvaluateCondition(pSession, NULL, &myint);
+    ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
+    ok(myint == MSICONDITION_NONE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
 
-        hr = Session_EvaluateCondition(pSession, szEmpty, &myint);
-        ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
-        ok(myint == MSICONDITION_NONE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
+    hr = Session_EvaluateCondition(pSession, szEmpty, &myint);
+    ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
+    ok(myint == MSICONDITION_NONE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
 
-        hr = Session_EvaluateCondition(pSession, szEquals, &myint);
-        ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
-        ok(myint == MSICONDITION_ERROR, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
-    }
+    hr = Session_EvaluateCondition(pSession, szEquals, &myint);
+    ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
+    ok(myint == MSICONDITION_ERROR, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
 
     /* Session::DoAction(CostInitialize) must occur before the next statements */
     hr = Session_DoAction(pSession, szCostInitialize, &myint);
@@ -1136,17 +1133,14 @@ static void test_Session(IDispatch *pSession)
     ok(myint == INSTALLSTATE_UNKNOWN, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
 
     /* Session::EvaluateCondition */
-    todo_wine
-    {
-        hr = Session_EvaluateCondition(pSession, szOneStateFalse, &myint);
-        ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
-        if (SUCCEEDED(hr))
-            ok(myint == MSICONDITION_FALSE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
-
-        hr = Session_EvaluateCondition(pSession, szOneStateTrue, &myint);
-        ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
-        ok(myint == MSICONDITION_TRUE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
-    }
+    hr = Session_EvaluateCondition(pSession, szOneStateFalse, &myint);
+    ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
+    if (SUCCEEDED(hr))
+        ok(myint == MSICONDITION_FALSE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
+
+    hr = Session_EvaluateCondition(pSession, szOneStateTrue, &myint);
+    ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
+    ok(myint == MSICONDITION_TRUE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
 
     /* Session::FeatureRequestState, put */
     hr = Session_FeatureRequestStatePut(pSession, szOne, INSTALLSTATE_ADVERTISED);
@@ -1156,17 +1150,14 @@ static void test_Session(IDispatch *pSession)
     ok(myint == INSTALLSTATE_ADVERTISED, "Feature request state was %d but expected %d\n", myint, INSTALLSTATE_ADVERTISED);
 
     /* Session::EvaluateCondition */
-    todo_wine
-    {
-        hr = Session_EvaluateCondition(pSession, szOneActionFalse, &myint);
-        ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
-        if (SUCCEEDED(hr))
-            ok(myint == MSICONDITION_FALSE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
-
-        hr = Session_EvaluateCondition(pSession, szOneActionTrue, &myint);
-        ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
-        ok(myint == MSICONDITION_TRUE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
-    }
+    hr = Session_EvaluateCondition(pSession, szOneActionFalse, &myint);
+    ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
+    if (SUCCEEDED(hr))
+        ok(myint == MSICONDITION_FALSE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
+
+    hr = Session_EvaluateCondition(pSession, szOneActionTrue, &myint);
+    ok(SUCCEEDED(hr), "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
+    ok(myint == MSICONDITION_TRUE, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
 }
 
 /* delete key and all its subkeys */




More information about the wine-cvs mailing list