Jacek Caban : msi: Added Session::Message implementation.

Alexandre Julliard julliard at winehq.org
Thu Jul 17 06:37:51 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jul 16 18:47:08 2008 +0200

msi: Added Session::Message implementation.

---

 dlls/msi/automation.c        |   14 ++++++++++++++
 dlls/msi/msiserver.idl       |   40 ++++++++++++++++++++++++++++++++++++++++
 dlls/msi/msiserver_dispids.h |    1 +
 dlls/msi/tests/automation.c  |   30 +++++++++++++++++++++++++++++-
 4 files changed, 84 insertions(+), 1 deletions(-)

diff --git a/dlls/msi/automation.c b/dlls/msi/automation.c
index e919b0d..c15126a 100644
--- a/dlls/msi/automation.c
+++ b/dlls/msi/automation.c
@@ -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);
diff --git a/dlls/msi/msiserver.idl b/dlls/msi/msiserver.idl
index 37aa91e..ac442db 100644
--- a/dlls/msi/msiserver.idl
+++ b/dlls/msi/msiserver.idl
@@ -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]
diff --git a/dlls/msi/msiserver_dispids.h b/dlls/msi/msiserver_dispids.h
index 3a58f6a..e6078fd 100644
--- a/dlls/msi/msiserver_dispids.h
+++ b/dlls/msi/msiserver_dispids.h
@@ -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
diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c
index 2c741e8..683de7a 100644
--- a/dlls/msi/tests/automation.c
+++ b/dlls/msi/tests/automation.c
@@ -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);




More information about the wine-cvs mailing list