Commit 54d17b95 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

oleaut32: Accept DISP_E_PARAMNOTFOUND for missing optional parameters in…

oleaut32: Accept DISP_E_PARAMNOTFOUND for missing optional parameters in ITypeInfo::Invoke implementation. Signed-off-by: 's avatarDmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 8fff6eeb
......@@ -2861,7 +2861,7 @@ static void test_typelibmarshal(void)
ok(!lstrcmpW(bstr, szCat), "IWidget_get_Name should have returned string \"Cat\" instead of %s\n", wine_dbgstr_w(bstr));
SysFreeString(bstr);
/* call DoSomething */
/* call DoSomething without optional arguments */
VariantInit(&vararg[0]);
VariantInit(&vararg[1]);
V_VT(&vararg[1]) = VT_R8;
......@@ -2876,6 +2876,43 @@ static void test_typelibmarshal(void)
ok(V_VT(&varresult) == VT_EMPTY, "varresult should be VT_EMPTY\n");
VariantClear(&varresult);
/* call DoSomething with optional argument set to VT_EMPTY */
VariantInit(&vararg[0]);
VariantInit(&vararg[1]);
VariantInit(&vararg[2]);
V_VT(&vararg[2]) = VT_R8;
V_R8(&vararg[2]) = 3.141;
dispparams.cNamedArgs = 0;
dispparams.cArgs = 3;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = vararg;
VariantInit(&varresult);
hr = IDispatch_Invoke(pDispatch, DISPID_TM_DOSOMETHING, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
ok_ole_success(hr, IDispatch_Invoke);
ok(V_VT(&varresult) == VT_EMPTY, "varresult should be VT_EMPTY\n");
VariantClear(&varresult);
/* call DoSomething with optional arguments set to VT_ERROR/DISP_E_PARAMNOTFOUND */
VariantInit(&vararg[0]);
VariantInit(&vararg[1]);
VariantInit(&vararg[2]);
VariantInit(&vararg[3]);
V_VT(&vararg[3]) = VT_R8;
V_R8(&vararg[3]) = 3.141;
V_VT(&vararg[1]) = VT_ERROR;
V_ERROR(&vararg[1]) = DISP_E_PARAMNOTFOUND;
V_VT(&vararg[0]) = VT_ERROR;
V_ERROR(&vararg[0]) = DISP_E_PARAMNOTFOUND;
dispparams.cNamedArgs = 0;
dispparams.cArgs = 4;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = vararg;
VariantInit(&varresult);
hr = IDispatch_Invoke(pDispatch, DISPID_TM_DOSOMETHING, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
ok_ole_success(hr, IDispatch_Invoke);
ok(V_VT(&varresult) == VT_EMPTY, "varresult should be VT_EMPTY\n");
VariantClear(&varresult);
/* call get_State */
dispparams.cNamedArgs = 0;
dispparams.cArgs = 0;
......
......@@ -7217,7 +7217,8 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
break;
}
}
else if (src_arg)
else if (src_arg && !((wParamFlags & PARAMFLAG_FOPT) &&
V_VT(src_arg) == VT_ERROR && V_ERROR(src_arg) == DISP_E_PARAMNOTFOUND))
{
TRACE("%s\n", debugstr_variant(src_arg));
......
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