Commit 4c8eec34 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

oleaut32: Add a test for the memory pointed to by a byref parameter being…

oleaut32: Add a test for the memory pointed to by a byref parameter being preserved through a remote IDispatch::Invoke call.
parent c73e2d5e
......@@ -587,6 +587,13 @@ static HRESULT WINAPI Widget_get_prop_uint(
return S_OK;
}
static HRESULT WINAPI Widget_ByRefUInt(
IWidget* iface, UINT *i)
{
*i = 42;
return S_OK;
}
static const struct IWidgetVtbl Widget_VTable =
{
Widget_QueryInterface,
......@@ -618,7 +625,8 @@ static const struct IWidgetVtbl Widget_VTable =
Widget_put_prop_with_lcid,
Widget_get_prop_with_lcid,
Widget_get_prop_int,
Widget_get_prop_uint
Widget_get_prop_uint,
Widget_ByRefUInt,
};
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject)
......@@ -935,6 +943,7 @@ static void test_typelibmarshal(void)
ITypeInfo *pTypeInfo;
MYSTRUCT mystruct;
MYSTRUCT mystructArray[5];
UINT uval;
ok(pKEW != NULL, "Widget creation failed\n");
......@@ -1342,6 +1351,25 @@ static void test_typelibmarshal(void)
ok(V_UI4(&varresult) == 42, "got %x\n", V_UI4(&varresult));
VariantClear(&varresult);
/* test byref marshalling */
uval = 666;
VariantInit(&vararg[0]);
V_VT(&vararg[0]) = VT_UI4|VT_BYREF;
V_UI4REF(&vararg[0]) = &uval;
dispparams.cNamedArgs = 0;
dispparams.cArgs = 1;
dispparams.rgvarg = vararg;
dispparams.rgdispidNamedArgs = NULL;
hr = IDispatch_Invoke(pDispatch, DISPID_TM_BYREF_UINT, &IID_NULL, LOCALE_NEUTRAL, DISPATCH_METHOD, &dispparams, &varresult, &excepinfo, NULL);
ok_ole_success(hr, ITypeInfo_Invoke);
ok(V_VT(&varresult) == VT_EMPTY, "varresult should be VT_EMPTY\n");
ok(V_VT(&vararg[0]) == (VT_UI4|VT_BYREF), "arg VT not unmarshalled correctly: %x\n", V_VT(&vararg[0]));
todo_wine
ok(V_UI4REF(&vararg[0]) == &uval, "Byref pointer not preserved: %p/%p\n", &uval, V_UI4REF(&vararg[0]));
ok(*V_UI4REF(&vararg[0]) == 42, "Expected 42 to be returned instead of %u\n", *V_UI4REF(&vararg[0]));
VariantClear(&varresult);
VariantClear(&vararg[0]);
IDispatch_Release(pDispatch);
IWidget_Release(pWidget);
......
......@@ -137,6 +137,9 @@ library TestTypelib
[id(DISPID_TM_PROP_UINT), propget]
HRESULT prop_uint([out,retval] UINT *i);
[id(DISPID_TM_BYREF_UINT)]
HRESULT ByRefUInt([in, out] UINT *i);
}
[
......
......@@ -37,5 +37,6 @@
#define DISPID_TM_PROP_WITH_LCID 18
#define DISPID_TM_PROP_INT 19
#define DISPID_TM_PROP_UINT 20
#define DISPID_TM_BYREF_UINT 21
#define DISPID_NOA_BSTRRET 1
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