Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/oleaut32/tests/tmarshal.c | 74 ++++++++++++++++++++++++++++++++ dlls/oleaut32/tests/tmarshal.idl | 4 ++ 2 files changed, 78 insertions(+)
diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index f2197425de..e3656d6dac 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -1248,6 +1248,56 @@ static HRESULT WINAPI Widget_variant(IWidget *iface, VARIANT in, VARIANT *out, V return S_OK; }
+static SAFEARRAY *make_safearray(ULONG len) +{ + SAFEARRAY *sa = SafeArrayCreateVector(VT_I4, 0, len); + int i, *data; + + SafeArrayAccessData(sa, (void **)&data); + for (i = 0; i < len; ++i) + data[i] = len + i; + SafeArrayUnaccessData(sa); + + return sa; +} + +static void check_safearray(SAFEARRAY *sa, LONG expect) +{ + LONG len, i, *data; + HRESULT hr; + + hr = SafeArrayGetUBound(sa, 1, &len); + len++; + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(len == expect, "Expected len %d, got %d.\n", expect, len); + + hr = SafeArrayAccessData(sa, (void **)&data); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + for (i = 0; i < len; ++i) + ok(data[i] == len + i, "Expected data %d at %d, got %d.\n", len + i, i, data[i]); + + SafeArrayUnaccessData(sa); +} + +static HRESULT WINAPI Widget_safearray(IWidget *iface, SAFEARRAY *in, SAFEARRAY **out, SAFEARRAY **in_ptr, SAFEARRAY **in_out) +{ + HRESULT hr; + + check_safearray(in, 3); + ok(!*out, "Got array %p.\n", *out); + check_safearray(*in_ptr, 7); + check_safearray(*in_out, 9); + + hr = SafeArrayDestroy(*in_out); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + *out = make_safearray(4); + *in_out = make_safearray(6); + + return S_OK; +} + static const struct IWidgetVtbl Widget_VTable = { Widget_QueryInterface, @@ -1297,6 +1347,7 @@ static const struct IWidgetVtbl Widget_VTable = Widget_iface_ptr, Widget_bstr, Widget_variant, + Widget_safearray, };
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject) @@ -2160,6 +2211,28 @@ static void test_marshal_variant(IWidget *widget, IDispatch *disp) ok(V_I1(&in_out) == 5, "Got wrong value %d.\n", V_I1(&in_out)); }
+static void test_marshal_safearray(IWidget *widget, IDispatch *disp) +{ + SAFEARRAY *in, *out, *in_ptr, *in_out; + HRESULT hr; + + in = make_safearray(3); + out = make_safearray(5); + in_ptr = make_safearray(7); + in_out = make_safearray(9); + hr = IWidget_safearray(widget, in, &out, &in_ptr, &in_out); + ok(hr == S_OK, "Got hr %#x.\n", hr); + check_safearray(in, 3); + check_safearray(out, 4); + check_safearray(in_ptr, 7); + check_safearray(in_out, 6); + + SafeArrayDestroy(in); + SafeArrayDestroy(out); + SafeArrayDestroy(in_ptr); + SafeArrayDestroy(in_out); +} + static void test_typelibmarshal(void) { static const WCHAR szCat[] = { 'C','a','t',0 }; @@ -2758,6 +2831,7 @@ todo_wine test_marshal_iface(pWidget, pDispatch); test_marshal_bstr(pWidget, pDispatch); test_marshal_variant(pWidget, pDispatch); + test_marshal_safearray(pWidget, pDispatch);
IDispatch_Release(pDispatch); IWidget_Release(pWidget); diff --git a/dlls/oleaut32/tests/tmarshal.idl b/dlls/oleaut32/tests/tmarshal.idl index 16d2f9d2d9..d630091f25 100644 --- a/dlls/oleaut32/tests/tmarshal.idl +++ b/dlls/oleaut32/tests/tmarshal.idl @@ -63,6 +63,7 @@ enum IWidget_dispids DISPID_TM_IFACE_PTR, DISPID_TM_BSTR, DISPID_TM_VARIANT, + DISPID_TM_SAFEARRAY, };
static const int DISPID_TM_NEG_RESTRICTED = -26; @@ -267,6 +268,9 @@ library TestTypelib
[id(DISPID_TM_VARIANT)] HRESULT variant([in] VARIANT in, [out] VARIANT *out, [in] VARIANT *in_ptr, [in, out] VARIANT *in_out); + + [id(DISPID_TM_SAFEARRAY)] + HRESULT safearray([in] SAFEARRAY(int) in, [out] SAFEARRAY(int) *out, [in] SAFEARRAY(int) *in_ptr, [in, out] SAFEARRAY(int) *in_out); }
[
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/oleaut32/tests/tmarshal.c | 153 ++++++++++++++++++++----------- dlls/oleaut32/tests/tmarshal.idl | 26 +++++- 2 files changed, 121 insertions(+), 58 deletions(-)
diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index e3656d6dac..7567a53ee3 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -49,16 +49,23 @@ static const WCHAR test_bstr2[] = {'t','e','s','t',0}; static const WCHAR test_bstr3[] = {'q','u','x',0}; static const WCHAR test_bstr4[] = {'a','b','c',0};
-const MYSTRUCT MYSTRUCT_BYVAL = {0x12345678, ULL_CONST(0xdeadbeef, 0x98765432), {0,1,2,3,4,5,6,7}}; -const MYSTRUCT MYSTRUCT_BYPTR = {0x91827364, ULL_CONST(0x88776655, 0x44332211), {0,1,2,3,4,5,6,7}}; -const MYSTRUCT MYSTRUCT_ARRAY[5] = { - {0x1a1b1c1d, ULL_CONST(0x1e1f1011, 0x12131415), {0,1,2,3,4,5,6,7}}, - {0x2a2b2c2d, ULL_CONST(0x2e2f2021, 0x22232425), {0,1,2,3,4,5,6,7}}, - {0x3a3b3c3d, ULL_CONST(0x3e3f3031, 0x32333435), {0,1,2,3,4,5,6,7}}, - {0x4a4b4c4d, ULL_CONST(0x4e4f4041, 0x42434445), {0,1,2,3,4,5,6,7}}, - {0x5a5b5c5d, ULL_CONST(0x5e5f5051, 0x52535455), {0,1,2,3,4,5,6,7}}, -}; - +static const MYSTRUCT test_mystruct1 = {0x12345678, ULL_CONST(0xdeadbeef, 0x98765432), {0,1,2,3,4,5,6,7}}; +static const MYSTRUCT test_mystruct2 = {0x91827364, ULL_CONST(0x88776655, 0x44332211), {3,6,1,4,0,1,3,0}}; +static const MYSTRUCT test_mystruct3 = {0x1a1b1c1d, ULL_CONST(0x1e1f1011, 0x12131415), {9,2,4,5,6,5,1,3}}; +static const MYSTRUCT test_mystruct4 = {0x2a2b2c2d, ULL_CONST(0x2e2f2021, 0x22232425), {0,4,6,7,3,6,7,4}}; +static const MYSTRUCT test_mystruct5 = {0x3a3b3c3d, ULL_CONST(0x3e3f3031, 0x32333435), {1,6,7,3,8,4,6,5}}; +static const MYSTRUCT test_mystruct6 = {0x4a4b4c4d, ULL_CONST(0x4e4f4041, 0x42434445), {3,6,5,3,4,8,0,9}}; +static const MYSTRUCT test_mystruct7 = {0x5a5b5c5d, ULL_CONST(0x5e5f5051, 0x52535455), {1,8,4,4,4,2,3,1}}; + +static const struct thin test_thin_struct = {-456, 78}; + +static const RECT test_rect1 = {1,2,3,4}; +static const RECT test_rect2 = {5,6,7,8}; +static const RECT test_rect3 = {9,10,11,12}; +static const RECT test_rect4 = {13,14,15,16}; +static const RECT test_rect5 = {17,18,19,20}; +static const RECT test_rect6 = {21,22,23,24}; +static const RECT test_rect7 = {25,26,27,28};
#define RELEASEMARSHALDATA WM_USER
@@ -810,41 +817,6 @@ static HRESULT WINAPI Widget_VarArg( return S_OK; }
- -static BOOL mystruct_uint_ordered(MYSTRUCT *mystruct) -{ - int i; - for (i = 0; i < ARRAY_SIZE(mystruct->uarr); i++) - if (mystruct->uarr[i] != i) - return FALSE; - return TRUE; -} - -static HRESULT WINAPI Widget_StructArgs( - IWidget * iface, - MYSTRUCT byval, - MYSTRUCT *byptr, - MYSTRUCT arr[5]) -{ - int i, diff = 0; - ok(byval.field1 == MYSTRUCT_BYVAL.field1 && - byval.field2 == MYSTRUCT_BYVAL.field2 && - mystruct_uint_ordered(&byval), - "Struct parameter passed by value corrupted\n"); - ok(byptr->field1 == MYSTRUCT_BYPTR.field1 && - byptr->field2 == MYSTRUCT_BYPTR.field2 && - mystruct_uint_ordered(byptr), - "Struct parameter passed by pointer corrupted\n"); - for (i = 0; i < 5; i++) - if (arr[i].field1 != MYSTRUCT_ARRAY[i].field1 || - arr[i].field2 != MYSTRUCT_ARRAY[i].field2 || - ! mystruct_uint_ordered(&arr[i])) - diff++; - ok(diff == 0, "Array of structs corrupted\n"); - return S_OK; -} - - static HRESULT WINAPI Widget_Error( IWidget __RPC_FAR * iface) { @@ -1298,6 +1270,46 @@ static HRESULT WINAPI Widget_safearray(IWidget *iface, SAFEARRAY *in, SAFEARRAY return S_OK; }
+static HRESULT WINAPI Widget_mystruct(IWidget *iface, MYSTRUCT in, MYSTRUCT *out, MYSTRUCT *in_ptr, MYSTRUCT *in_out) +{ + static const MYSTRUCT empty = {0}; + ok(!memcmp(&in, &test_mystruct1, sizeof(in)), "Structs didn't match.\n"); + ok(!memcmp(out, &empty, sizeof(*out)), "Structs didn't match.\n"); + ok(!memcmp(in_ptr, &test_mystruct3, sizeof(*in_ptr)), "Structs didn't match.\n"); + ok(!memcmp(in_out, &test_mystruct4, sizeof(*in_out)), "Structs didn't match.\n"); + + memcpy(out, &test_mystruct5, sizeof(*out)); + memcpy(in_ptr, &test_mystruct6, sizeof(*in_ptr)); + memcpy(in_out, &test_mystruct7, sizeof(*in_out)); + return S_OK; +} + +static HRESULT WINAPI Widget_mystruct_ptr_ptr(IWidget *iface, MYSTRUCT **in) +{ + ok(!memcmp(*in, &test_mystruct1, sizeof(**in)), "Structs didn't match.\n"); + return S_OK; +} + +static HRESULT WINAPI Widget_thin_struct(IWidget *iface, struct thin in) +{ + ok(!memcmp(&in, &test_thin_struct, sizeof(in)), "Structs didn't match.\n"); + return S_OK; +} + +static HRESULT WINAPI Widget_rect(IWidget *iface, RECT in, RECT *out, RECT *in_ptr, RECT *in_out) +{ + static const RECT empty = {0}; + ok(EqualRect(&in, &test_rect1), "Rects didn't match.\n"); + ok(EqualRect(out, &empty), "Rects didn't match.\n"); + ok(EqualRect(in_ptr, &test_rect3), "Rects didn't match.\n"); + ok(EqualRect(in_out, &test_rect4), "Rects didn't match.\n"); + + *out = test_rect5; + *in_ptr = test_rect6; + *in_out = test_rect7; + return S_OK; +} + static const struct IWidgetVtbl Widget_VTable = { Widget_QueryInterface, @@ -1323,7 +1335,6 @@ static const struct IWidgetVtbl Widget_VTable = Widget_VariantArrayPtr, Widget_VariantCArray, Widget_VarArg, - Widget_StructArgs, Widget_Error, Widget_CloneInterface, Widget_put_prop_with_lcid, @@ -1348,6 +1359,10 @@ static const struct IWidgetVtbl Widget_VTable = Widget_bstr, Widget_variant, Widget_safearray, + Widget_mystruct, + Widget_mystruct_ptr_ptr, + Widget_thin_struct, + Widget_rect, };
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject) @@ -2233,6 +2248,43 @@ static void test_marshal_safearray(IWidget *widget, IDispatch *disp) SafeArrayDestroy(in_out); }
+static void test_marshal_struct(IWidget *widget, IDispatch *disp) +{ + MYSTRUCT out, in_ptr, in_out, *in_ptr_ptr; + RECT rect_out, rect_in_ptr, rect_in_out; + HRESULT hr; + + memcpy(&out, &test_mystruct2, sizeof(MYSTRUCT)); + memcpy(&in_ptr, &test_mystruct3, sizeof(MYSTRUCT)); + memcpy(&in_out, &test_mystruct4, sizeof(MYSTRUCT)); + hr = IWidget_mystruct(widget, test_mystruct1, &out, &in_ptr, &in_out); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!memcmp(&out, &test_mystruct5, sizeof(MYSTRUCT)), "Structs didn't match.\n"); + ok(!memcmp(&in_ptr, &test_mystruct3, sizeof(MYSTRUCT)), "Structs didn't match.\n"); + ok(!memcmp(&in_out, &test_mystruct7, sizeof(MYSTRUCT)), "Structs didn't match.\n"); + + memcpy(&in_ptr, &test_mystruct1, sizeof(MYSTRUCT)); + in_ptr_ptr = &in_ptr; + hr = IWidget_mystruct_ptr_ptr(widget, &in_ptr_ptr); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* Make sure that "thin" structs (<=8 bytes) are handled correctly in x86-64. */ + + hr = IWidget_thin_struct(widget, test_thin_struct); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* Make sure we can handle an imported type. */ + + rect_out = test_rect2; + rect_in_ptr = test_rect3; + rect_in_out = test_rect4; + hr = IWidget_rect(widget, test_rect1, &rect_out, &rect_in_ptr, &rect_in_out); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(EqualRect(&rect_out, &test_rect5), "Rects didn't match.\n"); + ok(EqualRect(&rect_in_ptr, &test_rect3), "Rects didn't match.\n"); + ok(EqualRect(&rect_in_out, &test_rect7), "Rects didn't match.\n"); +} + static void test_typelibmarshal(void) { static const WCHAR szCat[] = { 'C','a','t',0 }; @@ -2254,8 +2306,6 @@ static void test_typelibmarshal(void) DWORD tid; BSTR bstr; ITypeInfo *pTypeInfo; - MYSTRUCT mystruct; - MYSTRUCT mystructArray[5]; UINT uval;
ok(pKEW != NULL, "Widget creation failed\n"); @@ -2412,12 +2462,6 @@ static void test_typelibmarshal(void) ok_ole_success(hr, IDispatch_Invoke); VariantClear(&varresult);
- /* call StructArgs (direct) */ - mystruct = MYSTRUCT_BYPTR; - memcpy(mystructArray, MYSTRUCT_ARRAY, sizeof(mystructArray)); - hr = IWidget_StructArgs(pWidget, MYSTRUCT_BYVAL, &mystruct, mystructArray); - ok_ole_success(hr, IWidget_StructArgs); - /* call Clone */ dispparams.cNamedArgs = 0; dispparams.cArgs = 0; @@ -2832,6 +2876,7 @@ todo_wine test_marshal_bstr(pWidget, pDispatch); test_marshal_variant(pWidget, pDispatch); test_marshal_safearray(pWidget, pDispatch); + test_marshal_struct(pWidget, pDispatch);
IDispatch_Release(pDispatch); IWidget_Release(pWidget); diff --git a/dlls/oleaut32/tests/tmarshal.idl b/dlls/oleaut32/tests/tmarshal.idl index d630091f25..d2ebc0b010 100644 --- a/dlls/oleaut32/tests/tmarshal.idl +++ b/dlls/oleaut32/tests/tmarshal.idl @@ -38,7 +38,6 @@ enum IWidget_dispids DISPID_TM_VARARRAYPTR, DISPID_TM_VARCARRAY, DISPID_TM_VARARG, - DISPID_TM_STRUCTARGS, DISPID_TM_ERROR, DISPID_TM_CLONEINTERFACE, DISPID_TM_TESTDUAL, @@ -64,6 +63,10 @@ enum IWidget_dispids DISPID_TM_BSTR, DISPID_TM_VARIANT, DISPID_TM_SAFEARRAY, + DISPID_TM_STRUCT, + DISPID_TM_STRUCT_PTR_PTR, + DISPID_TM_THIN_STRUCT, + DISPID_TM_RECT, };
static const int DISPID_TM_NEG_RESTRICTED = -26; @@ -193,9 +196,6 @@ library TestTypelib [vararg, id(DISPID_TM_VARARG)] HRESULT VarArg([in] int numexpect, [in] SAFEARRAY(VARIANT) values);
- [id(DISPID_TM_STRUCTARGS)] - HRESULT StructArgs([in] MYSTRUCT byval, [in] MYSTRUCT *byptr, [in] MYSTRUCT arr[5]); - [id(DISPID_TM_ERROR)] HRESULT Error();
@@ -271,6 +271,24 @@ library TestTypelib
[id(DISPID_TM_SAFEARRAY)] HRESULT safearray([in] SAFEARRAY(int) in, [out] SAFEARRAY(int) *out, [in] SAFEARRAY(int) *in_ptr, [in, out] SAFEARRAY(int) *in_out); + + [id(DISPID_TM_STRUCT)] + HRESULT mystruct([in] MYSTRUCT in, [out] MYSTRUCT *out, [in] MYSTRUCT *in_ptr, [in, out] MYSTRUCT *in_out); + + [id(DISPID_TM_STRUCT_PTR_PTR)] + HRESULT mystruct_ptr_ptr([in] MYSTRUCT **in); + + struct thin + { + short a; + char b; + }; + + [id(DISPID_TM_THIN_STRUCT)] + HRESULT thin_struct([in] struct thin in); + + [id(DISPID_TM_RECT)] + HRESULT rect([in] RECT in, [out] RECT *out, [in] RECT *in_ptr, [in, out] RECT *in_out); }
[
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=43776
Your paranoid android.
=== wvistau64 (task log) ===
Task errors: TestBot process got stuck or died unexpectedly The previous 1 run(s) terminated abnormally
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v2: remove tests that fail on Windows < 7.
dlls/oleaut32/tests/tmarshal.c | 164 +++++++++++++++++++------------ dlls/oleaut32/tests/tmarshal.idl | 22 +++-- 2 files changed, 116 insertions(+), 70 deletions(-)
diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index 7567a53ee3..ebd0f1406d 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -67,6 +67,13 @@ static const RECT test_rect5 = {17,18,19,20}; static const RECT test_rect6 = {21,22,23,24}; static const RECT test_rect7 = {25,26,27,28};
+static const array_t test_array1 = {1,2,3,4}; +static const array_t test_array2 = {5,6,7,8}; +static const array_t test_array3 = {9,10,11,12}; +static const array_t test_array4 = {13,14,15,16}; +static const array_t test_array5 = {17,18,19,20}; +static const array_t test_array6 = {21,22,23,24}; + #define RELEASEMARSHALDATA WM_USER
struct host_object_data @@ -727,14 +734,6 @@ static HRESULT WINAPI Widget_Value( return S_OK; }
-static HRESULT WINAPI Widget_Array( - IWidget * iface, - SAFEARRAY * values) -{ - trace("Array(%p)\n", values); - return S_OK; -} - static HRESULT WINAPI Widget_VariantArrayPtr( IWidget * iface, SAFEARRAY ** values) @@ -743,46 +742,6 @@ static HRESULT WINAPI Widget_VariantArrayPtr( return S_OK; }
-static HRESULT WINAPI Widget_VariantCArray( - IWidget * iface, - ULONG count, - VARIANT values[]) -{ - ULONG i; - - 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); - - if (pVarAdd) - { - VARIANT inc, res; - HRESULT hr; - - V_VT(&inc) = VT_I4; - V_I4(&inc) = 1; - for (i = 0; i < count; i++) { - VariantInit(&res); - hr = pVarAdd(&values[i], &inc, &res); - if (FAILED(hr)) { - ok(0, "VarAdd failed at %u with error 0x%x\n", i, hr); - return hr; - } - hr = VariantCopy(&values[i], &res); - if (FAILED(hr)) { - ok(0, "VariantCopy failed at %u with error 0x%x\n", i, hr); - return hr; - } - } - } - else - win_skip("VarAdd is not available\n"); - - return S_OK; -} - static HRESULT WINAPI Widget_VarArg( IWidget * iface, int numexpect, @@ -1310,6 +1269,51 @@ static HRESULT WINAPI Widget_rect(IWidget *iface, RECT in, RECT *out, RECT *in_p return S_OK; }
+static HRESULT WINAPI Widget_array(IWidget *iface, array_t in, array_t out, array_t in_out) +{ + static const array_t empty = {0}; + ok(!memcmp(in, test_array1, sizeof(array_t)), "Arrays didn't match.\n"); +todo_wine + ok(!memcmp(out, empty, sizeof(array_t)), "Arrays didn't match.\n"); + ok(!memcmp(in_out, test_array3, sizeof(array_t)), "Arrays didn't match.\n"); + + memcpy(in, test_array4, sizeof(array_t)); + memcpy(out, test_array5, sizeof(array_t)); + memcpy(in_out, test_array6, sizeof(array_t)); + + return S_OK; +} + +static HRESULT WINAPI Widget_variant_array(IWidget *iface, VARIANT in[2], VARIANT out[2], VARIANT in_out[2]) +{ + ok(V_VT(&in[0]) == VT_I4, "Got wrong type %u.\n", V_VT(&in[0])); + ok(V_I4(&in[0]) == 1, "Got wrong value %d.\n", V_I4(&in[0])); + ok(V_VT(&in[1]) == VT_I4, "Got wrong type %u.\n", V_VT(&in[1])); + ok(V_I4(&in[1]) == 2, "Got wrong value %d.\n", V_I4(&in[1])); + ok(V_VT(&out[0]) == VT_EMPTY, "Got wrong type %u.\n", V_VT(&out[0])); + ok(V_VT(&out[1]) == VT_EMPTY, "Got wrong type %u.\n", V_VT(&out[1])); + ok(V_VT(&in_out[0]) == VT_I4, "Got wrong type %u.\n", V_VT(&in_out[0])); + ok(V_I4(&in_out[0]) == 5, "Got wrong type %u.\n", V_VT(&in_out[0])); + ok(V_VT(&in_out[1]) == VT_I4, "Got wrong type %u.\n", V_VT(&in_out[1])); + ok(V_I4(&in_out[1]) == 6, "Got wrong type %u.\n", V_VT(&in_out[1])); + + V_VT(&in[0]) = VT_I1; V_I1(&in[0]) = 7; + V_VT(&in[1]) = VT_I1; V_I1(&in[1]) = 8; + V_VT(&out[0]) = VT_I1; V_I1(&out[0]) = 9; + V_VT(&out[1]) = VT_I1; V_I1(&out[1]) = 10; + V_VT(&in_out[0]) = VT_I1; V_I1(&in_out[0]) = 11; + V_VT(&in_out[1]) = VT_I1; V_I1(&in_out[1]) = 12; + + return S_OK; +} + +static HRESULT WINAPI Widget_mystruct_array(IWidget *iface, MYSTRUCT in[2]) +{ + ok(!memcmp(&in[0], &test_mystruct1, sizeof(MYSTRUCT)), "Structs didn't match.\n"); + ok(!memcmp(&in[1], &test_mystruct2, sizeof(MYSTRUCT)), "Structs didn't match.\n"); + return S_OK; +} + static const struct IWidgetVtbl Widget_VTable = { Widget_QueryInterface, @@ -1331,9 +1335,7 @@ static const struct IWidgetVtbl Widget_VTable = Widget_CloneDispatch, Widget_CloneCoclass, Widget_Value, - Widget_Array, Widget_VariantArrayPtr, - Widget_VariantCArray, Widget_VarArg, Widget_Error, Widget_CloneInterface, @@ -1363,6 +1365,9 @@ static const struct IWidgetVtbl Widget_VTable = Widget_mystruct_ptr_ptr, Widget_thin_struct, Widget_rect, + Widget_array, + Widget_variant_array, + Widget_mystruct_array, };
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject) @@ -2285,6 +2290,52 @@ static void test_marshal_struct(IWidget *widget, IDispatch *disp) ok(EqualRect(&rect_in_out, &test_rect7), "Rects didn't match.\n"); }
+static void test_marshal_array(IWidget *widget, IDispatch *disp) +{ + VARIANT var_in[2], var_out[2], var_in_out[2]; + array_t in, out, in_out; + MYSTRUCT struct_in[2]; + HRESULT hr; + + memcpy(in, test_array1, sizeof(array_t)); + memcpy(out, test_array2, sizeof(array_t)); + memcpy(in_out, test_array3, sizeof(array_t)); + hr = IWidget_array(widget, in, out, in_out); + ok(hr == S_OK, "Got hr %#x.\n", hr); +todo_wine + ok(!memcmp(&in, &test_array1, sizeof(array_t)), "Arrays didn't match.\n"); + ok(!memcmp(&out, &test_array5, sizeof(array_t)), "Arrays didn't match.\n"); + ok(!memcmp(&in_out, &test_array6, sizeof(array_t)), "Arrays didn't match.\n"); + + V_VT(&var_in[0]) = VT_I4; V_I4(&var_in[0]) = 1; + V_VT(&var_in[1]) = VT_I4; V_I4(&var_in[1]) = 2; + V_VT(&var_out[0]) = VT_I4; V_I4(&var_out[0]) = 3; + V_VT(&var_out[1]) = VT_I4; V_I4(&var_out[1]) = 4; + V_VT(&var_in_out[0]) = VT_I4; V_I4(&var_in_out[0]) = 5; + V_VT(&var_in_out[1]) = VT_I4; V_I4(&var_in_out[1]) = 6; + hr = IWidget_variant_array(widget, var_in, var_out, var_in_out); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(V_VT(&var_in[0]) == VT_I4, "Got wrong type %u.\n", V_VT(&var_in[0])); + ok(V_I4(&var_in[0]) == 1, "Got wrong value %d.\n", V_I4(&var_in[0])); + ok(V_VT(&var_in[1]) == VT_I4, "Got wrong type %u.\n", V_VT(&var_in[1])); + ok(V_I4(&var_in[1]) == 2, "Got wrong value %d.\n", V_I4(&var_in[1])); +todo_wine { + ok(V_VT(&var_out[0]) == VT_I1, "Got wrong type %u.\n", V_VT(&var_out[0])); + ok(V_I1(&var_out[0]) == 9, "Got wrong value %u.\n", V_VT(&var_out[0])); + ok(V_VT(&var_out[1]) == VT_I1, "Got wrong type %u.\n", V_VT(&var_out[1])); + ok(V_I1(&var_out[1]) == 10, "Got wrong value %u.\n", V_VT(&var_out[1])); + ok(V_VT(&var_in_out[0]) == VT_I1, "Got wrong type %u.\n", V_VT(&var_in_out[0])); + ok(V_I1(&var_in_out[0]) == 11, "Got wrong value %u.\n", V_VT(&var_in_out[0])); + ok(V_VT(&var_in_out[1]) == VT_I1, "Got wrong type %u.\n", V_VT(&var_in_out[1])); + ok(V_I1(&var_in_out[1]) == 12, "Got wrong value %u.\n", V_VT(&var_in_out[1])); +} + + memcpy(&struct_in[0], &test_mystruct1, sizeof(MYSTRUCT)); + memcpy(&struct_in[1], &test_mystruct2, sizeof(MYSTRUCT)); + hr = IWidget_mystruct_array(widget, struct_in); + ok(hr == S_OK, "Got hr %#x.\n", hr); +} + static void test_typelibmarshal(void) { static const WCHAR szCat[] = { 'C','a','t',0 }; @@ -2579,18 +2630,6 @@ static void test_typelibmarshal(void) ok(hr == DISP_E_TYPEMISMATCH || hr == DISP_E_BADVARTYPE, "expected DISP_E_TYPEMISMATCH, got %#x\n", hr); SysFreeString(V_BSTR(&vararg[0]));
- /* 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; @@ -2877,6 +2916,7 @@ todo_wine test_marshal_variant(pWidget, pDispatch); test_marshal_safearray(pWidget, pDispatch); test_marshal_struct(pWidget, pDispatch); + test_marshal_array(pWidget, pDispatch);
IDispatch_Release(pDispatch); IWidget_Release(pWidget); diff --git a/dlls/oleaut32/tests/tmarshal.idl b/dlls/oleaut32/tests/tmarshal.idl index d2ebc0b010..cce97cd977 100644 --- a/dlls/oleaut32/tests/tmarshal.idl +++ b/dlls/oleaut32/tests/tmarshal.idl @@ -34,9 +34,7 @@ enum IWidget_dispids DISPID_TM_CLONEDISPATCH, DISPID_TM_CLONECOCLASS, DISPID_TM_VALUE, - DISPID_TM_ARRAY, DISPID_TM_VARARRAYPTR, - DISPID_TM_VARCARRAY, DISPID_TM_VARARG, DISPID_TM_ERROR, DISPID_TM_CLONEINTERFACE, @@ -67,6 +65,9 @@ enum IWidget_dispids DISPID_TM_STRUCT_PTR_PTR, DISPID_TM_THIN_STRUCT, DISPID_TM_RECT, + DISPID_TM_ARRAY, + DISPID_TM_VARIANT_ARRAY, + DISPID_TM_STRUCT_ARRAY, };
static const int DISPID_TM_NEG_RESTRICTED = -26; @@ -184,15 +185,9 @@ library TestTypelib [propget, id(DISPID_VALUE)] HRESULT Value([in] VARIANT *value, [out, retval] VARIANT *retval);
- [id(DISPID_TM_ARRAY)] - HRESULT Array([in] SAFEARRAY(BSTR) values); - [id(DISPID_TM_VARARRAYPTR)] HRESULT VariantArrayPtr([in] SAFEARRAY(VARIANT) *values);
- [id(DISPID_TM_VARCARRAY)] - HRESULT VariantCArray([in] ULONG count, [in, out] VARIANT values[2]); - [vararg, id(DISPID_TM_VARARG)] HRESULT VarArg([in] int numexpect, [in] SAFEARRAY(VARIANT) values);
@@ -289,6 +284,17 @@ library TestTypelib
[id(DISPID_TM_RECT)] HRESULT rect([in] RECT in, [out] RECT *out, [in] RECT *in_ptr, [in, out] RECT *in_out); + + typedef int array_t[4]; + + [id(DISPID_TM_ARRAY)] + HRESULT array([in] array_t in, [out] array_t out, [in, out] array_t in_out); + + [id(DISPID_TM_VARIANT_ARRAY)] + HRESULT variant_array([in] VARIANT in[2], [out] VARIANT out[2], [in, out] VARIANT in_out[2]); + + [id(DISPID_TM_STRUCT_ARRAY)] + HRESULT mystruct_array([in] MYSTRUCT in[2]); }
[
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=43777
Your paranoid android.
=== debian9 (32 bit Wine report) ===
oleaut32: Unhandled exception: page fault on write access to 0x00000004 in 32-bit code (0x7bc4d8ee). typelib.c:5688: Test failed: got 0x00000000
Report errors: oleaut32:tmarshal crashed (c0000005)
=== debian9 (build log) ===
=== debian9 (32 bit WoW Wine report) ===
oleaut32: Unhandled exception: page fault on write access to 0x00000004 in 32-bit code (0x7bc4d8ee). typelib.c:5688: Test failed: got 0x00000000
Report errors: oleaut32:tmarshal crashed (c0000005)
=== debian9 (build log) ===
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/oleaut32/tests/tmarshal.c | 19 ++++++++++++++++++- dlls/oleaut32/tests/tmarshal.idl | 6 ++++++ 2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index ebd0f1406d..45f5232f12 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -1314,6 +1314,14 @@ static HRESULT WINAPI Widget_mystruct_array(IWidget *iface, MYSTRUCT in[2]) return S_OK; }
+static HRESULT WINAPI Widget_myint(IWidget *iface, myint_t val, myint_t *ptr, myint_t **ptr_ptr) +{ + ok(val == 123, "Got value %d.\n", val); + ok(*ptr == 456, "Got single ptr ref %d.\n", *ptr); + ok(**ptr_ptr == 789, "Got double ptr ref %d.\n", **ptr_ptr); + return S_OK; +} + static const struct IWidgetVtbl Widget_VTable = { Widget_QueryInterface, @@ -1368,6 +1376,7 @@ static const struct IWidgetVtbl Widget_VTable = Widget_array, Widget_variant_array, Widget_mystruct_array, + Widget_myint, };
static HRESULT WINAPI StaticWidget_QueryInterface(IStaticWidget *iface, REFIID riid, void **ppvObject) @@ -1689,7 +1698,7 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp)
signed char c; short s; - int i; + int i, i2, *pi; hyper h; unsigned char uc; unsigned short us; @@ -1763,6 +1772,14 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp) ok(f == (float)M_LN2, "Got float %f.\n", f); ok(d == M_LN10, "Got double %f.\n", d); ok(st == STATE_UNWIDGETIFIED, "Got state %u.\n", st); + + /* Test marshalling of public typedefs. */ + + i = 456; + i2 = 789; + pi = &i2; + hr = IWidget_myint(widget, 123, &i, &pi); + ok(hr == S_OK, "Got hr %#x.\n", hr); }
static void test_marshal_pointer(IWidget *widget, IDispatch *disp) diff --git a/dlls/oleaut32/tests/tmarshal.idl b/dlls/oleaut32/tests/tmarshal.idl index cce97cd977..6bf969cf09 100644 --- a/dlls/oleaut32/tests/tmarshal.idl +++ b/dlls/oleaut32/tests/tmarshal.idl @@ -68,6 +68,7 @@ enum IWidget_dispids DISPID_TM_ARRAY, DISPID_TM_VARIANT_ARRAY, DISPID_TM_STRUCT_ARRAY, + DISPID_TM_TYPEDEF, };
static const int DISPID_TM_NEG_RESTRICTED = -26; @@ -100,6 +101,8 @@ library TestTypelib UINT uarr[8]; } MYSTRUCT;
+ typedef [public] int myint_t; + coclass ApplicationObject2;
[ @@ -295,6 +298,9 @@ library TestTypelib
[id(DISPID_TM_STRUCT_ARRAY)] HRESULT mystruct_array([in] MYSTRUCT in[2]); + + [id(DISPID_TM_TYPEDEF)] + HRESULT myint([in] myint_t val, [in] myint_t *ptr, [in] myint_t **ptr_ptr); }
[
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=43778
Your paranoid android.
=== w864 (task log) ===
Task errors: TestBot process got stuck or died unexpectedly The previous 1 run(s) terminated abnormally
=== debian9 (32 bit Wine report) ===
oleaut32: Unhandled exception: page fault on write access to 0x00000004 in 32-bit code (0x7bc4d8ee). typelib.c:5688: Test failed: got 0x00000000
Report errors: oleaut32:tmarshal crashed (c0000005)
=== debian9 (build log) ===
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/oleaut32/tests/tmarshal.c | 17 +++++++++++++++++ dlls/oleaut32/tests/tmarshal.idl | 4 ++++ 2 files changed, 21 insertions(+)
diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index 45f5232f12..271c3f5045 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -981,6 +981,17 @@ static HRESULT WINAPI Widget_basetypes_out(IWidget *iface, signed char *c, short return S_OK; }
+static HRESULT WINAPI Widget_float_abi(IWidget *iface, float f, double d, int i, float f2, double d2) +{ + ok(f == 1.0f, "Got float %f.\n", f); + ok(d == 2.0, "Got double %f.\n", d); + ok(i == 3, "Got int %d.\n", i); + ok(f2 == 4.0f, "Got float %f.\n", f2); + ok(d2 == 5.0, "Got double %f.\n", d2); + + return S_OK; +} + static HRESULT WINAPI Widget_int_ptr(IWidget *iface, int *in, int *out, int *in_out) { ok(*in == 123, "Got [in] %d.\n", *in); @@ -1361,6 +1372,7 @@ static const struct IWidgetVtbl Widget_VTable = Widget_Coclass, Widget_basetypes_in, Widget_basetypes_out, + Widget_float_abi, Widget_int_ptr, Widget_int_ptr_ptr, Widget_iface_in, @@ -1780,6 +1792,11 @@ static void test_marshal_basetypes(IWidget *widget, IDispatch *disp) pi = &i2; hr = IWidget_myint(widget, 123, &i, &pi); ok(hr == S_OK, "Got hr %#x.\n", hr); + + /* Test that different float ABIs are correctly handled. */ + + hr = IWidget_float_abi(widget, 1.0f, 2.0, 3, 4.0f, 5.0); + ok(hr == S_OK, "Got hr %#x.\n", hr); }
static void test_marshal_pointer(IWidget *widget, IDispatch *disp) diff --git a/dlls/oleaut32/tests/tmarshal.idl b/dlls/oleaut32/tests/tmarshal.idl index 6bf969cf09..543d229ce2 100644 --- a/dlls/oleaut32/tests/tmarshal.idl +++ b/dlls/oleaut32/tests/tmarshal.idl @@ -53,6 +53,7 @@ enum IWidget_dispids
DISPID_TM_BASETYPES_IN, DISPID_TM_BASETYPES_OUT, + DISPID_TM_FLOAT_ABI, DISPID_TM_INT_PTR, DISPID_TM_INT_PTR_PTR, DISPID_TM_IFACE_IN, @@ -246,6 +247,9 @@ library TestTypelib [out] unsigned char *uc, [out] unsigned short *us, [out] unsigned int *ui, [out] unsigned hyper *uh, [out] float *f, [out] double *d, [out] STATE *st);
+ [id(DISPID_TM_FLOAT_ABI)] + HRESULT float_abi([in] float f, [in] double d, [in] int i, [in] float f2, [in] double d2); + [id(DISPID_TM_INT_PTR)] HRESULT int_ptr([in] int *in, [out] int *out, [in, out] int *in_out);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=43779
Your paranoid android.
=== debian9 (32 bit Wine report) ===
oleaut32: Unhandled exception: page fault on write access to 0x00000004 in 32-bit code (0x7bc4d8ee). typelib.c:5688: Test failed: got 0x00000000
Report errors: oleaut32:tmarshal crashed (c0000005)
=== debian9 (build log) ===
=== debian9 (32 bit WoW Wine report) ===
oleaut32: Unhandled exception: page fault on write access to 0x00000004 in 32-bit code (0x7bc4d8ee). typelib.c:5688: Test failed: got 0x00000000
Report errors: oleaut32:tmarshal crashed (c0000005)
=== debian9 (build log) ===