Commit 8ff7238a authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

oleaut32: Allow named args to be combined with positional args in fnInvoke.

parent b6ef8a59
......@@ -603,6 +603,15 @@ static HRESULT WINAPI Widget_put_prop_opt_arg(
return S_OK;
}
static HRESULT WINAPI Widget_put_prop_req_arg(
IWidget* iface, INT req, INT i)
{
trace("put_prop_req_arg(%08x, %08x)\n", req, i);
ok(req == 0x5678, "got req=%08x\n", req);
ok(i == 0x1234, "got i=%08x\n", i);
return S_OK;
}
static const struct IWidgetVtbl Widget_VTable =
{
Widget_QueryInterface,
......@@ -637,6 +646,7 @@ static const struct IWidgetVtbl Widget_VTable =
Widget_get_prop_uint,
Widget_ByRefUInt,
Widget_put_prop_opt_arg,
Widget_put_prop_req_arg,
};
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject)
......@@ -1410,6 +1420,22 @@ static void test_typelibmarshal(void)
ok_ole_success(hr, ITypeInfo_Invoke);
VariantClear(&varresult);
/* test propput with required argument. */
VariantInit(&vararg[0]);
VariantInit(&vararg[1]);
V_VT(&vararg[0]) = VT_I4;
V_I4(&vararg[0]) = 0x1234;
V_VT(&vararg[1]) = VT_I4;
V_I4(&vararg[1]) = 0x5678;
dispparams.cNamedArgs = 1;
dispparams.rgdispidNamedArgs = &dispidNamed;
dispparams.cArgs = 2;
dispparams.rgvarg = vararg;
VariantInit(&varresult);
hr = IDispatch_Invoke(pDispatch, DISPID_TM_PROP_REQ_ARG, &IID_NULL, 0x40c, DISPATCH_PROPERTYPUT, &dispparams, &varresult, &excepinfo, NULL);
ok_ole_success(hr, ITypeInfo_Invoke);
VariantClear(&varresult);
IDispatch_Release(pDispatch);
IWidget_Release(pWidget);
......
......@@ -143,6 +143,9 @@ library TestTypelib
[id(DISPID_TM_PROP_OPT_ARG), propput]
HRESULT prop_opt_arg([in,optional] INT opt, [in] INT i);
[id(DISPID_TM_PROP_REQ_ARG), propput]
HRESULT prop_req_arg([in] INT req, [in] INT i);
}
[
......
......@@ -39,6 +39,7 @@
#define DISPID_TM_PROP_UINT 20
#define DISPID_TM_BYREF_UINT 21
#define DISPID_TM_PROP_OPT_ARG 22
#define DISPID_TM_PROP_REQ_ARG 23
#define DISPID_NOA_BSTRRET 1
#define DISPID_NOA_ERROR 2
......@@ -6102,10 +6102,11 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
continue;
}
src_arg = NULL;
if (cNamedArgs)
{
USHORT j;
src_arg = NULL;
for (j = 0; j < cNamedArgs; j++)
if (rgdispidNamedArgs[j] == i || (i == func_desc->cParams-1 && rgdispidNamedArgs[j] == DISPID_PROPERTYPUT))
{
......@@ -6113,9 +6114,10 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
break;
}
}
else
if (!src_arg && vargs_converted + cNamedArgs < pDispParams->cArgs)
{
src_arg = vargs_converted < pDispParams->cArgs ? &pDispParams->rgvarg[pDispParams->cArgs - 1 - vargs_converted] : NULL;
src_arg = &pDispParams->rgvarg[pDispParams->cArgs - 1 - vargs_converted];
vargs_converted++;
}
......
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