Rob Shearman : oleaut32: Add a test for the memory pointed to by a byref parameter being preserved through a remote IDispatch ::Invoke call.
Alexandre Julliard
julliard at winehq.org
Tue Nov 17 09:28:21 CST 2009
Module: wine
Branch: master
Commit: 4c8eec346d0c874a66e4b405d29ad085101676d0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4c8eec346d0c874a66e4b405d29ad085101676d0
Author: Rob Shearman <robertshearman at gmail.com>
Date: Tue Nov 17 13:42:37 2009 +0000
oleaut32: Add a test for the memory pointed to by a byref parameter being preserved through a remote IDispatch::Invoke call.
---
dlls/oleaut32/tests/tmarshal.c | 30 +++++++++++++++++++++++++++++-
dlls/oleaut32/tests/tmarshal.idl | 3 +++
dlls/oleaut32/tests/tmarshal_dispids.h | 1 +
3 files changed, 33 insertions(+), 1 deletions(-)
diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c
index c9ea77d..ba28892 100644
--- a/dlls/oleaut32/tests/tmarshal.c
+++ b/dlls/oleaut32/tests/tmarshal.c
@@ -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);
diff --git a/dlls/oleaut32/tests/tmarshal.idl b/dlls/oleaut32/tests/tmarshal.idl
index 71d53cf..41079d0 100644
--- a/dlls/oleaut32/tests/tmarshal.idl
+++ b/dlls/oleaut32/tests/tmarshal.idl
@@ -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);
}
[
diff --git a/dlls/oleaut32/tests/tmarshal_dispids.h b/dlls/oleaut32/tests/tmarshal_dispids.h
index 08d7736..1cfd87b 100644
--- a/dlls/oleaut32/tests/tmarshal_dispids.h
+++ b/dlls/oleaut32/tests/tmarshal_dispids.h
@@ -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
More information about the wine-cvs
mailing list