Commit 014b96ef authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

msi: Added Session::Message implementation.

parent 2be93ce6
......@@ -1388,6 +1388,20 @@ static HRESULT WINAPI SessionImpl_Invoke(
else return DISP_E_MEMBERNOTFOUND;
break;
case DISPID_SESSION_MESSAGE:
if(!(wFlags & DISPATCH_METHOD))
return DISP_E_MEMBERNOTFOUND;
hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
if (FAILED(hr)) return hr;
hr = DispGetParam(pDispParams, 1, VT_DISPATCH, &varg1, puArgErr);
if (FAILED(hr)) return hr;
V_VT(pVarResult) = VT_I4;
V_I4(pVarResult) =
MsiProcessMessage(This->msiHandle, V_I4(&varg0), ((AutomationObject *)V_DISPATCH(&varg1))->msiHandle);
break;
case DISPID_SESSION_SETINSTALLLEVEL:
if (wFlags & DISPATCH_METHOD) {
hr = DispGetParam(pDispParams, 0, VT_I4, &varg0, puArgErr);
......
......@@ -325,6 +325,42 @@ library WindowsInstaller
msiEvaluateConditionError = 3
} _MsiEvaluateCondition; /* Added underscore to avoid conflict with function name */
typedef enum {
msiMessageStatusError = -1,
msiMessageStatusNone = 0,
msiMessageStatusOk = 1,
msiMessageStatusCancel = 2,
msiMessageStatusAbort = 3,
msiMessageStatusRetry = 4,
msiMessageStatusIgnore = 5,
msiMessageStatusYes = 6,
msiMessageStatusNo = 7
} MsiMessageStatus;
typedef enum {
msiMessageTypeFatalExit = 0,
msiMessageTypeError = 0x01000000,
msiMessageTypeWarning = 0x02000000,
msiMessageTypeUser = 0x03000000,
msiMessageTypeInfo = 0x04000000,
msiMessageTypeFilesInUse = 0x05000000,
msiMessageTypeResolveSource = 0x06000000,
msiMessageTypeOutOfDiskSpace = 0x07000000,
msiMessageTypeActionStart = 0x08000000,
msiMessageTypeActionData = 0x09000000,
msiMessageTypeProgress = 0x0a000000,
msiMessageTypeCommonData = 0x0b000000,
msiMessageTypeOk = 0,
msiMessageTypeOkCancel = 1,
msiMessageTypeAbortRetryIgnore = 2,
msiMessageTypeYesNoCancel = 3,
msiMessageTypeYesNo = 4,
msiMessageTypeRetryCancel = 5,
msiMessageTypeDefault1 = 0,
msiMessageTypeDefault2 = 256,
msiMessageTypeDefault3 = 512
} MsiMessageType;
[ uuid(000C109E-0000-0000-C000-000000000046) ]
dispinterface Session
{
......@@ -352,6 +388,10 @@ library WindowsInstaller
MsiDoActionStatus DoAction([in] BSTR Action);
[id(DISPID_SESSION_EVALUATECONDITION)]
_MsiEvaluateCondition EvaluateCondition([in] BSTR Expression);
[id(DISPID_SESSION_MESSAGE)]
MsiMessageStatus Message(
[in] MsiMessageType Kind,
[in] Record *Record);
[id(DISPID_SESSION_FEATURECURRENTSTATE), propget]
MsiInstallState FeatureCurrentState([in] BSTR Feature);
[id(DISPID_SESSION_FEATUREREQUESTSTATE), propget]
......
......@@ -51,6 +51,7 @@
#define DISPID_SESSION_DATABASE 5
#define DISPID_SESSION_DOACTION 8
#define DISPID_SESSION_EVALUATECONDITION 10
#define DISPID_SESSION_MESSAGE 12
#define DISPID_SESSION_FEATURECURRENTSTATE 13
#define DISPID_SESSION_FEATUREREQUESTSTATE 14
#define DISPID_SESSION_SETINSTALLLEVEL 19
......
......@@ -1075,6 +1075,27 @@ static HRESULT Session_EvaluateCondition(IDispatch *pSession, LPCWSTR szConditio
return hr;
}
static HRESULT Session_Message(IDispatch *pSession, long kind, IDispatch *record, int *ret)
{
VARIANT varresult;
VARIANTARG vararg[2];
DISPPARAMS dispparams = {vararg, NULL, sizeof(vararg)/sizeof(VARIANTARG), 0};
HRESULT hr;
VariantInit(&varresult);
V_VT(vararg) = VT_DISPATCH;
V_DISPATCH(vararg) = record;
V_VT(vararg+1) = VT_I4;
V_I4(vararg+1) = kind;
hr = invoke(pSession, "Message", DISPATCH_METHOD, &dispparams, &varresult, VT_I4);
ok(V_VT(&varresult) == VT_I4, "V_VT(varresult) = %d\n", V_VT(&varresult));
*ret = V_I4(&varresult);
return hr;
}
static HRESULT Session_SetInstallLevel(IDispatch *pSession, long iInstallLevel)
{
VARIANT varresult;
......@@ -1649,7 +1670,7 @@ static void test_Session(IDispatch *pSession)
UINT len;
BOOL bool;
int myint;
IDispatch *pDatabase = NULL, *pInst = NULL;
IDispatch *pDatabase = NULL, *pInst = NULL, *record = NULL;
HRESULT hr;
/* Session::Installer */
......@@ -1746,6 +1767,13 @@ static void test_Session(IDispatch *pSession)
ok(hr == S_OK, "Session_FeatureCurrentState failed, hresult 0x%08x\n", hr);
ok(myint == INSTALLSTATE_UNKNOWN, "Feature current state was %d but expected %d\n", myint, INSTALLSTATE_UNKNOWN);
/* Session::Message */
hr = Installer_CreateRecord(0, &record);
ok(hr == S_OK, "Installer_CreateRecord failed: %08x\n", hr);
hr = Session_Message(pSession, INSTALLMESSAGE_INFO, record, &myint);
ok(hr == S_OK, "Session_Message failed: %08x\n", hr);
ok(myint == 0, "Session_Message returned %x\n", myint);
/* Session::EvaluateCondition */
hr = Session_EvaluateCondition(pSession, szOneStateFalse, &myint);
ok(hr == S_OK, "Session_EvaluateCondition failed, hresult 0x%08x\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment