oleaut32: Add tmarshal test with variant array and fix variant marshalled size calculation.
This commit is contained in:
parent
55a6db8912
commit
74a3d9ee5e
|
@ -475,6 +475,40 @@ static HRESULT WINAPI Widget_VariantArrayPtr(
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI Widget_VariantCArray(
|
||||
IWidget * iface,
|
||||
ULONG count,
|
||||
VARIANT values[])
|
||||
{
|
||||
ULONG i;
|
||||
VARIANT inc, res;
|
||||
HRESULT hr;
|
||||
|
||||
trace("VariantCArray(%u,%p)\n", count, values);
|
||||
|
||||
ok(count == 2, "count is %d\n", count);
|
||||
for (i = 0; i < count; i++)
|
||||
ok(V_VT(&values[i]) == VT_I4, "values[%d] is not VT_I4\n", i);
|
||||
|
||||
V_VT(&inc) = VT_I4;
|
||||
V_I4(&inc) = 1;
|
||||
for (i = 0; i < count; i++) {
|
||||
VariantInit(&res);
|
||||
hr = VarAdd(&values[i], &inc, &res);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
ok(0, "VarAdd failed at %u with error 0x%x\n", i, hr);
|
||||
return hr;
|
||||
}
|
||||
hr = VariantCopy(&values[i], &res);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
ok(0, "VariantCopy failed at %u with error 0x%x\n", i, hr);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI Widget_Variant(
|
||||
IWidget __RPC_FAR * iface,
|
||||
VARIANT var)
|
||||
|
@ -640,6 +674,7 @@ static const struct IWidgetVtbl Widget_VTable =
|
|||
Widget_Value,
|
||||
Widget_Array,
|
||||
Widget_VariantArrayPtr,
|
||||
Widget_VariantCArray,
|
||||
Widget_Variant,
|
||||
Widget_VarArg,
|
||||
Widget_StructArgs,
|
||||
|
@ -1230,6 +1265,18 @@ static void test_typelibmarshal(void)
|
|||
ok_ole_success(hr, IDispatch_Invoke);
|
||||
VariantClear(&varresult);
|
||||
|
||||
/* call VariantCArray - test marshaling of variant arrays */
|
||||
V_VT(&vararg[0]) = VT_I4;
|
||||
V_I4(&vararg[0]) = 1;
|
||||
V_VT(&vararg[1]) = VT_I4;
|
||||
V_I4(&vararg[1]) = 2;
|
||||
hr = IWidget_VariantCArray(pWidget, 2, vararg);
|
||||
ok_ole_success(hr, IWidget_VariantCArray);
|
||||
todo_wine
|
||||
ok(V_VT(&vararg[0]) == VT_I4 && V_I4(&vararg[0]) == 2, "vararg[0] = %d[%d]\n", V_VT(&vararg[0]), V_I4(&vararg[0]));
|
||||
todo_wine
|
||||
ok(V_VT(&vararg[1]) == VT_I4 && V_I4(&vararg[1]) == 3, "vararg[1] = %d[%d]\n", V_VT(&vararg[1]), V_I4(&vararg[1]));
|
||||
|
||||
/* call VarArg */
|
||||
VariantInit(&vararg[3]);
|
||||
V_VT(&vararg[3]) = VT_I4;
|
||||
|
|
|
@ -111,6 +111,9 @@ library TestTypelib
|
|||
[id(DISPID_TM_VARARRAYPTR)]
|
||||
HRESULT VariantArrayPtr([in] SAFEARRAY(VARIANT) *values);
|
||||
|
||||
[id(DISPID_TM_VARCARRAY)]
|
||||
HRESULT VariantCArray([in] ULONG count, [in, out] VARIANT values[2]);
|
||||
|
||||
[id(DISPID_TM_VARIANT)]
|
||||
HRESULT Variant([in] VARIANT var);
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#define DISPID_TM_BYREF_UINT 21
|
||||
#define DISPID_TM_PROP_OPT_ARG 22
|
||||
#define DISPID_TM_PROP_REQ_ARG 23
|
||||
#define DISPID_TM_VARCARRAY 24
|
||||
|
||||
#define DISPID_NOA_BSTRRET 1
|
||||
#define DISPID_NOA_ERROR 2
|
||||
|
|
|
@ -597,7 +597,7 @@ _xsize(const TYPEDESC *td, ITypeInfo *tinfo) {
|
|||
case VT_CY:
|
||||
return sizeof(CY);
|
||||
case VT_VARIANT:
|
||||
return sizeof(VARIANT)+3; /* FIXME: why the +3? */
|
||||
return sizeof(VARIANT);
|
||||
case VT_CARRAY: {
|
||||
int i, arrsize = 1;
|
||||
const ARRAYDESC *adesc = td->u.lpadesc;
|
||||
|
|
Loading…
Reference in New Issue