oleaut32-ITypeInfo_fnInvoke: Update patchset and add tests.

This commit is contained in:
Sebastian Lackner 2017-01-08 20:18:10 +01:00
parent 252ee012a2
commit ddd669c75b
3 changed files with 88 additions and 30 deletions

View File

@ -0,0 +1,85 @@
From e15e0e44bc4ca7ae8deb3b923d3566855a3acc19 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Fri, 6 Jan 2017 14:40:52 +0800
Subject: oleaut32: Accept DISP_E_PARAMNOTFOUND for missing optional parameters
in ITypeInfo::Invoke implementation. (v3)
---
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 d2b8dc92d66..eb42d16e1c0 100644
--- a/dlls/oleaut32/tests/tmarshal.c
+++ b/dlls/oleaut32/tests/tmarshal.c
@@ -1363,7 +1363,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;
@@ -1378,6 +1378,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 4fdfbeb5442..c0f9937d57b 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -7026,7 +7026,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));
--
2.11.0

View File

@ -1,27 +0,0 @@
From 3b9f7f03dbf5a8b1483cf0fda5e9c8e7fc762685 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 13 Dec 2016 18:30:45 +0800
Subject: oleaut32: Gracefully handle a failure to convert an optional param in
typelib's Invoke implementation. (v2)
---
dlls/oleaut32/typelib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 4fdfbeb..c0f9937 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -7026,7 +7026,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));
--
2.9.0

View File

@ -5894,12 +5894,12 @@ fi
# | * [#41488] Accept DISP_E_PARAMNOTFOUND for missing optional param in typelib implementation
# |
# | Modified files:
# | * dlls/oleaut32/typelib.c
# | * dlls/oleaut32/tests/tmarshal.c, dlls/oleaut32/typelib.c
# |
if test "$enable_oleaut32_ITypeInfo_fnInvoke" -eq 1; then
patch_apply oleaut32-ITypeInfo_fnInvoke/0001-oleaut32-Gracefully-handle-a-failure-to-convert-an-o.patch
patch_apply oleaut32-ITypeInfo_fnInvoke/0001-oleaut32-Accept-DISP_E_PARAMNOTFOUND-for-missing-opt.patch
(
echo '+ { "Dmitry Timoshkov", "oleaut32: Gracefully handle a failure to convert an optional param in typelib'\''s Invoke implementation.", 2 },';
echo '+ { "Dmitry Timoshkov", "oleaut32: Accept DISP_E_PARAMNOTFOUND for missing optional parameters in ITypeInfo::Invoke implementation.", 3 },';
) >> "$patchlist"
fi