oleaut32: Always use DISPID_PROPERTYPUT to fill in the last argument.

This commit is contained in:
Vincent Povirk 2010-03-16 13:32:57 -05:00 committed by Alexandre Julliard
parent 33b45cf98d
commit 5893f3227c
4 changed files with 28 additions and 4 deletions

View File

@ -594,6 +594,15 @@ static HRESULT WINAPI Widget_ByRefUInt(
return S_OK;
}
static HRESULT WINAPI Widget_put_prop_opt_arg(
IWidget* iface, INT opt, INT i)
{
trace("put_prop_opt_arg(%08x, %08x)\n", opt, i);
todo_wine ok(opt == 0, "got opt=%08x\n", opt);
ok(i == 0xcafe, "got i=%08x\n", i);
return S_OK;
}
static const struct IWidgetVtbl Widget_VTable =
{
Widget_QueryInterface,
@ -627,6 +636,7 @@ static const struct IWidgetVtbl Widget_VTable =
Widget_get_prop_int,
Widget_get_prop_uint,
Widget_ByRefUInt,
Widget_put_prop_opt_arg,
};
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject)
@ -1387,6 +1397,19 @@ static void test_typelibmarshal(void)
VariantClear(&varresult);
VariantClear(&vararg[0]);
/* test propput with optional argument. */
VariantInit(&vararg[0]);
V_VT(&vararg[0]) = VT_I4;
V_I4(&vararg[0]) = 0xcafe;
dispparams.cNamedArgs = 1;
dispparams.rgdispidNamedArgs = &dispidNamed;
dispparams.cArgs = 1;
dispparams.rgvarg = vararg;
VariantInit(&varresult);
hr = IDispatch_Invoke(pDispatch, DISPID_TM_PROP_OPT_ARG, &IID_NULL, 0x40c, DISPATCH_PROPERTYPUT, &dispparams, &varresult, &excepinfo, NULL);
ok_ole_success(hr, ITypeInfo_Invoke);
VariantClear(&varresult);
IDispatch_Release(pDispatch);
IWidget_Release(pWidget);

View File

@ -140,6 +140,9 @@ library TestTypelib
[id(DISPID_TM_BYREF_UINT)]
HRESULT ByRefUInt([in, out] UINT *i);
[id(DISPID_TM_PROP_OPT_ARG), propput]
HRESULT prop_opt_arg([in,optional] INT opt, [in] INT i);
}
[

View File

@ -38,6 +38,7 @@
#define DISPID_TM_PROP_INT 19
#define DISPID_TM_PROP_UINT 20
#define DISPID_TM_BYREF_UINT 21
#define DISPID_TM_PROP_OPT_ARG 22
#define DISPID_NOA_BSTRRET 1
#define DISPID_NOA_ERROR 2

View File

@ -6065,9 +6065,6 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
hres = DISP_E_PARAMNOTFOUND;
goto func_fail;
}
/* ignore the DISPID_PROPERTYPUT named argument from now on */
cNamedArgs--;
rgdispidNamedArgs++;
}
if (func_desc->cParamsOpt < 0 && cNamedArgs)
@ -6105,7 +6102,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
USHORT j;
src_arg = NULL;
for (j = 0; j < cNamedArgs; j++)
if (rgdispidNamedArgs[j] == i)
if (rgdispidNamedArgs[j] == i || (i == func_desc->cParams-1 && rgdispidNamedArgs[j] == DISPID_PROPERTYPUT))
{
src_arg = &pDispParams->rgvarg[j];
break;