Commit 1ed6bc2e authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

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

parent 283db88d
...@@ -273,6 +273,20 @@ static HRESULT create_activescriptsite(MsiActiveScriptSite **obj) ...@@ -273,6 +273,20 @@ static HRESULT create_activescriptsite(MsiActiveScriptSite **obj)
return S_OK; 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. * Call a script.
*/ */
...@@ -354,13 +368,10 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function ...@@ -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); hr = IDispatch_Invoke(pDispatch, dispid, &IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &dispparamsNoArgs, &var, NULL, NULL);
if (FAILED(hr)) goto done; if (FAILED(hr)) goto done;
/* Check return value, if it's not IDOK we failed */
hr = VariantChangeType(&var, &var, 0, VT_I4); hr = VariantChangeType(&var, &var, 0, VT_I4);
if (FAILED(hr)) goto done; if (FAILED(hr)) goto done;
if (V_I4(&var) == IDOK) ret = map_return_value(V_I4(&var));
ret = ERROR_SUCCESS;
else ret = ERROR_INSTALL_FAILURE;
VariantClear(&var); VariantClear(&var);
} else { } else {
......
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