Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/oleaut32/tests/tmarshal.c | 39 +++++++++++++++++++++++++++++++++- dlls/oleaut32/typelib.c | 3 ++- 2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index 756cca844d..0b6776b40a 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -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; diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index f32bed35f4..f17a9267b7 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -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));