msi: The second parameter to Installer.OpenPackage is optional, so set a default value of 0 if the parameter is not provided.

This commit is contained in:
James Hawkins 2009-12-04 17:17:12 -08:00 committed by Alexandre Julliard
parent 1ff6c08621
commit 25ab693008
2 changed files with 15 additions and 6 deletions

View File

@ -1591,11 +1591,20 @@ static HRESULT WINAPI InstallerImpl_Invoke(
return DISP_E_TYPEMISMATCH; return DISP_E_TYPEMISMATCH;
hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr); hr = DispGetParam(pDispParams, 0, VT_BSTR, &varg0, puArgErr);
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
hr = DispGetParam(pDispParams, 1, VT_I4, &varg1, puArgErr); if (pDispParams->cArgs == 2)
if (FAILED(hr))
{ {
VariantClear(&varg0); hr = DispGetParam(pDispParams, 1, VT_I4, &varg1, puArgErr);
return hr; if (FAILED(hr))
{
VariantClear(&varg0);
return hr;
}
}
else
{
VariantInit(&varg1);
V_VT(&varg1) = VT_I4;
V_I4(&varg1) = 0;
} }
V_VT(pVarResult) = VT_DISPATCH; V_VT(pVarResult) = VT_DISPATCH;
if ((ret = MsiOpenPackageExW(V_BSTR(&varg0), V_I4(&varg1), &msiHandle)) == ERROR_SUCCESS) if ((ret = MsiOpenPackageExW(V_BSTR(&varg0), V_I4(&varg1), &msiHandle)) == ERROR_SUCCESS)

View File

@ -721,7 +721,7 @@ static void test_dispatch(void)
V_VT(&vararg[0]) = VT_BSTR; V_VT(&vararg[0]) = VT_BSTR;
V_BSTR(&vararg[0]) = SysAllocString(szMsifile); V_BSTR(&vararg[0]) = SysAllocString(szMsifile);
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL); hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr); todo_wine ok(hr == DISP_E_EXCEPTION, "IDispatch::Invoke returned 0x%08x\n", hr);
ok_exception(hr, szOpenPackageException); ok_exception(hr, szOpenPackageException);
VariantClear(&vararg[0]); VariantClear(&vararg[0]);
@ -733,7 +733,7 @@ static void test_dispatch(void)
V_VT(&vararg[0]) = VT_BSTR; V_VT(&vararg[0]) = VT_BSTR;
V_BSTR(&vararg[0]) = SysAllocString(path); V_BSTR(&vararg[0]) = SysAllocString(path);
hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL); hr = IDispatch_Invoke(pInstaller, dispid, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
todo_wine ok(hr == S_OK, "IDispatch::Invoke returned 0x%08x\n", hr); ok(hr == S_OK, "IDispatch::Invoke returned 0x%08x\n", hr);
VariantClear(&vararg[0]); VariantClear(&vararg[0]);
VariantClear(&varresult); VariantClear(&varresult);