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

This commit is contained in:
Hans Leidekker 2013-05-02 12:03:23 +02:00 committed by Alexandre Julliard
parent 283db88d78
commit 1ed6bc2e02
1 changed files with 15 additions and 4 deletions

View File

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