msi: automation: Implement Session::EvaluateCondition.

oldstable
Misha Koshelev 2007-05-11 14:07:48 -05:00 committed by Alexandre Julliard
parent 75222d7452
commit 2d8c2ce6d6
4 changed files with 42 additions and 32 deletions

View File

@ -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;

View File

@ -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]

View File

@ -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

View File

@ -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, 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, 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, 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, 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 */