msi: Properly map script function return values to MSI errors.

Hans Leidekker hans at codeweavers.com
Thu May 2 05:03:23 CDT 2013


Fixes http://bugs.winehq.org/show_bug.cgi?id=33500
---
 dlls/msi/script.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/dlls/msi/script.c b/dlls/msi/script.c
index 8d48a94..0fec716 100644
--- a/dlls/msi/script.c
+++ b/dlls/msi/script.c
@@ -273,6 +273,20 @@ static HRESULT create_activescriptsite(MsiActiveScriptSite **obj)
     return S_OK;
 }
 
+static UINT map_return_value(LONG val)
+{
+    switch (val)
+    {
+    case 0:
+    case IDOK:
+    case IDIGNORE:  return ERROR_SUCCESS;
+    case IDCANCEL:  return ERROR_INSTALL_USEREXIT;
+    case IDRETRY:   return ERROR_INSTALL_SUSPEND;
+    case IDABORT:
+    default:        return ERROR_INSTALL_FAILURE;
+    }
+}
+
 /*
  * Call a script.
  */
@@ -354,13 +368,10 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function
         hr = IDispatch_Invoke(pDispatch, dispid, &IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &dispparamsNoArgs, &var, NULL, NULL);
         if (FAILED(hr)) goto done;
 
-        /* Check return value, if it's not IDOK we failed */
         hr = VariantChangeType(&var, &var, 0, VT_I4);
         if (FAILED(hr)) goto done;
 
-        if (V_I4(&var) == IDOK)
-            ret = ERROR_SUCCESS;
-        else ret = ERROR_INSTALL_FAILURE;
+        ret = map_return_value(V_I4(&var));
 
         VariantClear(&var);
     } else {
-- 
1.7.10.4






More information about the wine-patches mailing list