36#define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)
40 ok_(__FILE__,
line)(!
ref,
"Got outstanding refcount %d.\n",
ref);
43#define release_iface(a) release_iface_(__LINE__, a)
46#define ULL_CONST(dw1, dw2) ((((ULONGLONG)dw1) << 32) | (ULONGLONG)dw2)
53static const MYSTRUCT
test_mystruct1 = {0x12345678,
ULL_CONST(0xdeadbeef, 0x98765432), {0,1,2,3,4,5,6,7}};
54static const MYSTRUCT
test_mystruct2 = {0x91827364,
ULL_CONST(0x88776655, 0x44332211), {3,6,1,4,0,1,3,0}};
55static const MYSTRUCT
test_mystruct3 = {0x1a1b1c1d,
ULL_CONST(0x1e1f1011, 0x12131415), {9,2,4,5,6,5,1,3}};
56static const MYSTRUCT
test_mystruct4 = {0x2a2b2c2d,
ULL_CONST(0x2e2f2021, 0x22232425), {0,4,6,7,3,6,7,4}};
57static const MYSTRUCT
test_mystruct5 = {0x3a3b3c3d,
ULL_CONST(0x3e3f3031, 0x32333435), {1,6,7,3,8,4,6,5}};
58static const MYSTRUCT
test_mystruct6 = {0x4a4b4c4d,
ULL_CONST(0x4e4f4041, 0x42434445), {3,6,5,3,4,8,0,9}};
59static const MYSTRUCT
test_mystruct7 = {0x5a5b5c5d,
ULL_CONST(0x5e5f5051, 0x52535455), {1,8,4,4,4,2,3,1}};
78#define RELEASEMARSHALDATA WM_USER
102 if (prev_filter) IMessageFilter_Release(prev_filter);
118 trace(
"releasing marshal data\n");
186 ok(0,
"unexpected call\n");
203 trace(
"add connection\n");
205 ok(extconn == EXTCONN_STRONG,
"extconn = %d\n", extconn);
213 trace(
"release connection\n");
215 ok(extconn == EXTCONN_STRONG,
"extconn = %d\n", extconn);
281 ok(0,
"unexpected call\n");
287 ok(0,
"unexpected call\n");
294 ok(0,
"unexpected call\n");
299 WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
302 ok(0,
"unexpected call\n");
308 ok(0,
"unexpected call\n");
340 trace(
"QI external connection\n");
361 ok(0,
"unexpected call\n");
367 ok(0,
"unexpected call\n");
374 ok(0,
"unexpected call\n");
379 WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo,
382 ok(0,
"unexpected call\n");
417 ISomethingFromDispatch_AddRef(iface);
442 ok(0,
"unexpected call\n");
449 ok(
index == 0xdeadbeef,
"Got unexpected index %#x.\n",
index);
456 ok(0,
"unexpected call\n");
463 ok(0,
"unexpected call\n");
489 return &
obj->ISomethingFromDispatch_iface;
518 ICoclass1_AddRef(iface);
523 *
out = &
obj->ICoclass2_iface;
524 ICoclass2_AddRef(*
out);
549 ok(0,
"unexpected call\n");
556 ok(
index == 0xdeadbeef,
"Got unexpected index %#x.\n",
index);
563 ok(0,
"unexpected call\n");
570 ok(0,
"unexpected call\n");
582 return ICoclass1_QueryInterface(&
obj->ICoclass1_iface, iid,
out);
588 return ICoclass1_AddRef(&
obj->ICoclass1_iface);
594 return ICoclass1_Release(&
obj->ICoclass1_iface);
599 ok(0,
"unexpected call\n");
606 ok(
index == 0xdeadbeef,
"Got unexpected index %#x.\n",
index);
613 ok(0,
"unexpected call\n");
620 ok(0,
"unexpected call\n");
683 IWidget_AddRef(iface);
709 IUnknown_Release(
This->pDispatchUnknown);
712 trace(
"Widget destroyed!\n");
727 hr = IDispatch_GetTypeInfoCount(pDispatch, pctinfo);
728 IDispatch_Release(pDispatch);
744 hr = IDispatch_GetTypeInfo(pDispatch, iTInfo, lcid, ppTInfo);
745 IDispatch_Release(pDispatch);
763 hr = IDispatch_GetIDsOfNames(pDispatch,
riid, rgszNames, cNames, lcid, rgDispId);
764 IDispatch_Release(pDispatch);
785 hr = IDispatch_Invoke(pDispatch, dispIdMember,
riid, lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
786 IDispatch_Release(pDispatch);
803 static const WCHAR szCat[] = {
'C',
'a',
't',0 };
804 trace(
"get_Name()\n");
816 static const WCHAR szString[] = {
'S',
't',
'r',
'i',
'n',
'g',0 };
817 trace(
"DoSomething()\n");
821 ok(
V_VT(opt) ==
VT_ERROR,
"V_VT(opt) should be VT_ERROR instead of 0x%x\n",
V_VT(opt));
832 trace(
"get_State() = STATE_WIDGETIFIED\n");
833 *
state = STATE_WIDGETIFIED;
867 trace(
"GetOleColor() = 0x8000000f\n");
884 trace(
"CloneDispatch()\n");
890 ApplicationObject2 **ppVal)
892 trace(
"CloneCoclass()\n");
922 LONG lbound, ubound,
i;
929 ok(
hr ==
S_OK,
"SafeArrayGetLBound failed with %x\n",
hr);
930 ok(lbound == 0,
"SafeArrayGetLBound returned %d\n", lbound);
933 ok(
hr ==
S_OK,
"SafeArrayGetUBound failed with %x\n",
hr);
934 ok(ubound == numexpect-1,
"SafeArrayGetUBound returned %d, but expected %d\n", ubound, numexpect-1);
937 ok(
hr ==
S_OK,
"SafeArrayAccessData failed with %x\n",
hr);
939 for (
i=0;
i<=ubound-lbound;
i++)
946 ok(
hr ==
S_OK,
"SafeArrayUnaccessData failed with %x\n",
hr);
960 ISomethingFromDispatch **ppVal)
962 trace(
"CloneInterface()\n");
970 trace(
"put_prop_with_lcid(%08x, %x)\n", lcid,
i);
972 ok(
i == 0xcafe,
"got %08x\n",
i);
979 trace(
"get_prop_with_lcid(%08x, %p)\n", lcid,
i);
986 IWidget* iface,
INT *
i)
988 trace(
"get_prop_int(%p)\n",
i);
994 IWidget* iface,
UINT *
i)
996 trace(
"get_prop_uint(%p)\n",
i);
1002 IWidget* iface,
UINT *
i)
1009 IWidget* iface,
INT opt,
INT i)
1011 trace(
"put_prop_opt_arg(%08x, %08x)\n", opt,
i);
1013 ok(
i == 0xcafe,
"got i=%08x\n",
i);
1018 IWidget* iface,
INT req,
INT i)
1020 trace(
"put_prop_req_arg(%08x, %08x)\n", req,
i);
1021 ok(req == 0x5678,
"got req=%08x\n", req);
1022 ok(
i == 0x1234,
"got i=%08x\n",
i);
1028 trace(
"restrict\n");
1035 trace(
"neg_restrict\n");
1043 static const WCHAR catW[] = {
'C',
'a',
't',0 };
1044 static const WCHAR supermanW[] = {
'S',
'u',
'p',
'e',
'r',
'm',
'a',
'n',0 };
1055 ok(
hr ==
S_OK,
"SafeArrayGetLBound error %#x\n",
hr);
1056 ok(bound == 0,
"expected 0, got %d\n", bound);
1059 ok(
hr ==
S_OK,
"SafeArrayGetUBound error %#x\n",
hr);
1060 ok(bound == 0,
"expected 0, got %d\n", bound);
1063 ok(
hr ==
S_OK,
"SafeArrayAccessData failed with %x\n",
hr);
1070 ok(
hr ==
S_OK,
"SafeArrayUnaccessData error %#x\n",
hr);
1078 static const WCHAR catW[] = {
'C',
'a',
't',0 };
1079 static const WCHAR supermanW[] = {
'S',
'u',
'p',
'e',
'r',
'm',
'a',
'n',0 };
1090 ok(
hr ==
S_OK,
"SafeArrayGetLBound error %#x\n",
hr);
1091 ok(bound == 0,
"expected 0, got %d\n", bound);
1094 ok(
hr ==
S_OK,
"SafeArrayGetUBound error %#x\n",
hr);
1095 ok(bound == 0,
"expected 0, got %d\n", bound);
1098 ok(
hr ==
S_OK,
"SafeArrayAccessData error %#x\n",
hr);
1105 ok(
hr ==
S_OK,
"SafeArrayUnaccessData error %#x\n",
hr);
1114 ok(
c == 5,
"Got char %d.\n",
c);
1115 ok(
s == -123,
"Got short %d.\n",
s);
1116 ok(
i == -100000,
"Got int %d.\n",
i);
1118 ok(uc == 0,
"Got unsigned char %u.\n", uc);
1119 ok(
us == 456,
"Got unsigned short %u.\n",
us);
1120 ok(
ui == 0xdeadbeef,
"Got unsigned int %i.\n",
ui);
1122 ok(
f == (
float)
M_PI,
"Got float %f.\n",
f);
1123 ok(
d == M_E,
"Got double %f.\n",
d);
1124 ok(st == STATE_WIDGETIFIED,
"Got state %u.\n", st);
1130 unsigned char *uc,
unsigned short *
us,
unsigned int *
ui,
MIDL_uhyper *uh,
1131 float *
f,
double *
d,
STATE *st)
1143 *st = STATE_UNWIDGETIFIED;
1150 ok(
f == 1.0f,
"Got float %f.\n",
f);
1151 ok(
d == 2.0,
"Got double %f.\n",
d);
1152 ok(
i == 3,
"Got int %d.\n",
i);
1153 ok(
f2 == 4.0f,
"Got float %f.\n",
f2);
1154 ok(d2 == 5.0,
"Got double %f.\n", d2);
1161 ok(*
in == 123,
"Got [in] %d.\n", *
in);
1163 ok(*
out == 456,
"Got [out] %d.\n", *
out);
1165 ok(!*
out,
"Got [out] %d.\n", *
out);
1166 ok(*in_out == 789,
"Got [in, out] %d.\n", *in_out);
1177 ok(!*
out,
"Got [out] %p.\n", *
out);
1180 ok(!*
in,
"Got [in] %p.\n", *
in);
1181 ok(!*in_out,
"Got [in, out] %p.\n", *in_out);
1185 ok(!*
in,
"Got [in] %p.\n", *
in);
1186 ok(!*in_out,
"Got [in, out] %p.\n", *in_out);
1195 ok(**
in == 123,
"Got [in] %d.\n", **
in);
1196 ok(**in_out == 789,
"Got [in, out] %d.\n", **in_out);
1204 ok(**in_out == 789,
"Got [in, out] %d.\n", **in_out);
1214 ISomethingFromDispatch *sfd2;
1218 hr = IUnknown_QueryInterface(unk, &IID_ISomethingFromDispatch, (
void **)&sfd2);
1220 ISomethingFromDispatch_Release(sfd2);
1222 hr = IDispatch_GetTypeInfo(disp, 0xdeadbeef, 0, &
typeinfo);
1223 ok(
hr == 0xbeefdead,
"Got hr %#x.\n",
hr);
1225 hr = ISomethingFromDispatch_anotherfn(sfd);
1226 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
1235 ok(!unk,
"Got iface %p.\n", unk);
1236 ok(!disp,
"Got iface %p.\n", disp);
1237 ok(!sfd,
"Got iface %p.\n", sfd);
1244 ok(!*unk,
"Got iface %p.\n", *unk);
1245 ok(!*disp,
"Got iface %p.\n", *disp);
1246 ok(!*sfd,
"Got iface %p.\n", *sfd);
1258 ISomethingFromDispatch **
out, ISomethingFromDispatch **in_out)
1262 ok(!*
out,
"Got [out] %p.\n", *
out);
1265 hr = ISomethingFromDispatch_anotherfn(*
in);
1266 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
1267 hr = ISomethingFromDispatch_anotherfn(*in_out);
1268 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
1274 ISomethingFromDispatch_Release(*in_out);
1279 ok(!*
in,
"Got [in] %p.\n", *
in);
1280 ok(!*in_out,
"Got [in, out] %p.\n", *in_out);
1285 hr = ISomethingFromDispatch_anotherfn(*in_out);
1286 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
1287 ISomethingFromDispatch_Release(*in_out);
1303 ok(!*
out,
"Got unexpected output %p.\n", *
out);
1312 in[1] = (*in_ptr)[1] = (*in_out)[1] =
'X';
1337 ok(
V_I4(in_ptr) == -1,
"Got wrong value %d.\n",
V_I4(in_ptr));
1360 for (
i = 0;
i <
len; ++
i)
1380 for (
i = 0;
i <
len; ++
i)
1391 ok(!*
out,
"Got array %p.\n", *
out);
1406 static const MYSTRUCT
empty = {0};
1448 ok(
in.c == 98,
"Got char %d.\n",
in.c);
1449 ok(
in.i == 76543,
"Got int %d.\n",
in.i);
1450 ok(*
in.pi == 2,
"Got int pointer %d.\n", *
in.pi);
1451 ok(**
in.ppi == 10,
"Got int double pointer %d.\n", **
in.ppi);
1452 hr = ISomethingFromDispatch_anotherfn(
in.iface);
1453 ok(
hr == 0x01234567,
"Got wrong hr %#x.\n",
hr);
1454 hr = ISomethingFromDispatch_anotherfn(*
in.iface_ptr);
1455 ok(
hr == 0x01234567,
"Got wrong hr %#x.\n",
hr);
1458 ok(
V_I4(&
in.var) == 123,
"Got wrong value %d.\n",
V_I4(&
in.var));
1461 ok(
in.myint == 456,
"Got int %d.\n",
in.myint);
1468 static const array_t
empty = {0};
1488 ok(
V_VT(&in_out[0]) ==
VT_I4,
"Got wrong type %u.\n",
V_VT(&in_out[0]));
1489 ok(
V_I4(&in_out[0]) == 5,
"Got wrong type %u.\n",
V_VT(&in_out[0]));
1512 ok(
val == 123,
"Got value %d.\n",
val);
1513 ok(*
ptr == 456,
"Got single ptr ref %d.\n", *
ptr);
1514 ok(**ptr_ptr == 789,
"Got double ptr ref %d.\n", **ptr_ptr);
1522 hr = ICoclass1_test((ICoclass1 *)class1);
1523 ok(
hr == 1,
"Got hr %#x.\n",
hr);
1525 hr = ICoclass2_test((ICoclass2 *)class2);
1526 ok(
hr == 2,
"Got hr %#x.\n",
hr);
1528 hr = ICoclass1_test((ICoclass1 *)class3);
1529 ok(
hr == 1,
"Got hr %#x.\n",
hr);
1539 ok(!*
out,
"Got [out] %p.\n", *
out);
1542 hr = ICoclass1_test((ICoclass1 *)*
in);
1543 ok(
hr == 1,
"Got hr %#x.\n",
hr);
1544 hr = ICoclass1_test((ICoclass1 *)*in_out);
1545 ok(
hr == 1,
"Got hr %#x.\n",
hr);
1551 *
out = (Coclass1 *)&
obj->ICoclass1_iface;
1553 ICoclass1_Release((ICoclass1 *)*in_out);
1555 *in_out = (Coclass1 *)&
obj->ICoclass1_iface;
1559 ok(!*in_out,
"Got [in, out] %p.\n", *in_out);
1561 *in_out = (Coclass1 *)&
obj->ICoclass1_iface;
1565 hr = ICoclass1_test((ICoclass1 *)*in_out);
1566 ok(
hr == 1,
"Got hr %#x.\n",
hr);
1567 ICoclass1_Release((ICoclass1 *)*in_out);
1638 IStaticWidget_AddRef(iface);
1659 ok(0,
"unexpected call\n");
1666 ok(0,
"unexpected call\n");
1673 ok(0,
"unexpected call\n");
1681 ok(0,
"unexpected call\n");
1687 trace(
"TestDual()\n");
1694 trace(
"TestSecondIface()\n");
1754 hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib,
riid, &pTypeInfo);
1755 ITypeLib_Release(pTypeLib);
1779 &
This->pDispatchUnknown);
1781 ITypeInfo_Release(pTypeInfo);
1784 return &
This->IWidget_iface;
1793 IKindaEnumWidget *iface,
1799 IKindaEnumWidget_AddRef(iface);
1811 IKindaEnumWidget *iface)
1819 IKindaEnumWidget *iface)
1827 trace(
"KindaEnumWidget destroyed!\n");
1834 IKindaEnumWidget *iface,
1845 IKindaEnumWidget *iface,
1852 IKindaEnumWidget *iface)
1858 IKindaEnumWidget *iface,
1883 return &
This->IKindaEnumWidget_iface;
1890 *(INonOleAutomation **)
ppv = iface;
1909 static const WCHAR wszTestString[] = {
'T',
'h',
'i',
's',
' ',
'i',
's',
' ',
'a',
' ',
't',
'e',
's',
't',
' ',
's',
't',
'r',
'i',
'n',
'g',0};
1937 hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, &IID_INonOleAutomation, &pTypeInfo);
1939 ITypeLib_Release(pTypeLib);
1978 hr = IWidget_basetypes_in(widget, 5, -123, -100000, (
LONGLONG)-100000 * 1000000, 0, 456,
1979 0xdeadbeef, (
ULONGLONG)1234567890 * 9876543210,
M_PI, M_E, STATE_WIDGETIFIED);
1982 c =
s =
i =
h = uc =
us =
ui = uh =
f =
d = st = 0;
1998 ok(
c == 10,
"Got char %d.\n",
c);
1999 ok(
s == -321,
"Got short %d.\n",
s);
2000 ok(
i == -200000,
"Got int %d.\n",
i);
2002 ok(uc == 254,
"Got unsigned char %u.\n", uc);
2003 ok(
us == 256,
"Got unsigned short %u.\n",
us);
2004 ok(
ui == 0xf00dfade,
"Got unsigned int %i.\n",
ui);
2007 ok(
f == (
float)M_LN2,
"Got float %f.\n",
f);
2008 ok(
d == M_LN10,
"Got double %f.\n",
d);
2009 ok(st == STATE_UNWIDGETIFIED,
"Got state %u.\n", st);
2011 c =
s =
i =
h = uc =
us =
ui = uh =
f =
d = st = 0;
2013 hr = IWidget_basetypes_out(widget, &
c, &
s, &
i, &
h, &uc, &
us, &
ui, &uh, &
f, &
d, &st);
2015 ok(
c == 10,
"Got char %d.\n",
c);
2016 ok(
s == -321,
"Got short %d.\n",
s);
2017 ok(
i == -200000,
"Got int %d.\n",
i);
2019 ok(uc == 254,
"Got unsigned char %u.\n", uc);
2020 ok(
us == 256,
"Got unsigned short %u.\n",
us);
2021 ok(
ui == 0xf00dfade,
"Got unsigned int %i.\n",
ui);
2024 ok(
f == (
float)M_LN2,
"Got float %f.\n",
f);
2025 ok(
d == M_LN10,
"Got double %f.\n",
d);
2026 ok(st == STATE_UNWIDGETIFIED,
"Got state %u.\n", st);
2033 hr = IWidget_myint(widget, 123, &
i, &
pi);
2038 hr = IWidget_float_abi(widget, 1.0f, 2.0, 3, 4.0f, 5.0);
2046 int in,
out, in_out, *in_ptr, *out_ptr, *in_out_ptr;
2060 ok(
in == 987,
"Got [in] %d.\n",
in);
2061 ok(
out == 654,
"Got [out] %d.\n",
out);
2062 ok(in_out == 321,
"Got [in, out] %d.\n", in_out);
2069 hr = IWidget_int_ptr(widget, &
in, &
out, &in_out);
2071 ok(
in == 123,
"Got [in] %d.\n",
in);
2072 ok(
out == 654,
"Got [out] %d.\n",
out);
2073 ok(in_out == 321,
"Got [in, out] %d.\n", in_out);
2076 hr = IWidget_int_ptr(widget,
NULL, &
out, &in_out);
2078 ok(!
out,
"[out] parameter should have been cleared.\n");
2079 ok(in_out == -1,
"[in, out] parameter should not have been cleared.\n");
2082 hr = IWidget_int_ptr(widget, &
in,
NULL, &in_out);
2084 ok(
in == -1,
"[in] parameter should not have been cleared.\n");
2085 ok(in_out == -1,
"[in, out] parameter should not have been cleared.\n");
2090 ok(
in == -1,
"[in] parameter should not have been cleared.\n");
2091 ok(!
out,
"[out] parameter should have been cleared.\n");
2097 in_ptr = out_ptr = in_out_ptr =
NULL;
2098 hr = IWidget_int_ptr_ptr(widget, &in_ptr, &out_ptr, &in_out_ptr);
2100 ok(!in_ptr,
"Got [in] %p.\n", in_ptr);
2101 ok(!out_ptr,
"Got [out] %p.\n", out_ptr);
2102 ok(!in_out_ptr,
"Got [in, out] %p.\n", in_out_ptr);
2105 hr = IWidget_int_ptr_ptr(widget, &in_ptr, &out_ptr, &in_out_ptr);
2107 ok(*out_ptr == 654,
"Got [out] %d.\n", *out_ptr);
2108 ok(*in_out_ptr == 321,
"Got [in, out] %d.\n", *in_out_ptr);
2118 in_out_ptr = &in_out;
2119 hr = IWidget_int_ptr_ptr(widget, &in_ptr, &out_ptr, &in_out_ptr);
2121 ok(out_ptr != &
out,
"[out] ptr should have changed.\n");
2122 ok(in_out_ptr == &in_out,
"[in, out] ptr should not have changed.\n");
2123 ok(*out_ptr == 654,
"Got [out] %d.\n", *out_ptr);
2124 ok(*in_out_ptr == 321,
"Got [in, out] %d.\n", *in_out_ptr);
2127 in_ptr = out_ptr =
NULL;
2129 in_out_ptr = &in_out;
2130 hr = IWidget_int_ptr_ptr(widget, &in_ptr, &out_ptr, &in_out_ptr);
2132 ok(!in_out_ptr,
"Got [in, out] %p.\n", in_out_ptr);
2135 in_out_ptr = &in_out;
2136 hr = IWidget_int_ptr_ptr(widget,
NULL, &out_ptr, &in_out_ptr);
2138 ok(!out_ptr,
"[out] parameter should have been cleared.\n");
2139 ok(in_out_ptr == &in_out,
"[in, out] parameter should not have been cleared.\n");
2142 in_out_ptr = &in_out;
2143 hr = IWidget_int_ptr_ptr(widget, &in_ptr,
NULL, &in_out_ptr);
2145 ok(in_ptr == &
in,
"[in] parameter should not have been cleared.\n");
2146 ok(in_out_ptr == &in_out,
"[in, out] parameter should not have been cleared.\n");
2150 hr = IWidget_int_ptr_ptr(widget, &in_ptr, &out_ptr,
NULL);
2152 ok(in_ptr == &
in,
"[in] parameter should not have been cleared.\n");
2153 ok(!out_ptr,
"[out] parameter should have been cleared.\n");
2160 ISomethingFromDispatch *sfd1, *sfd2, *sfd3, *proxy_sfd, *sfd_in, *sfd_out, *sfd_in_out;
2169 hr = IWidget_iface_in(widget, (
IUnknown *)sfd1,
2181 proxy_unk = (
IUnknown *)0xdeadbeef;
2183 proxy_sfd = (ISomethingFromDispatch *)0xdeadbeef;
2184 hr = IWidget_iface_out(widget, &proxy_unk, &proxy_disp, &proxy_sfd);
2192 hr = IWidget_iface_out(widget, &proxy_unk, &proxy_disp, &proxy_sfd);
2194 ok(!proxy_unk,
"Got unexpected proxy %p.\n", proxy_unk);
2195 ok(!proxy_disp,
"Got unexpected proxy %p.\n", proxy_disp);
2196 ok(!proxy_sfd,
"Got unexpected proxy %p.\n", proxy_sfd);
2202 hr = IWidget_iface_ptr(widget, &sfd_in, &sfd_out, &sfd_in_out);
2204 ok(sfd_in == sfd1,
"[in] parameter should not have changed.\n");
2205 ok(!sfd_out,
"[out] parameter should have been cleared.\n");
2206 ok(sfd_in_out == sfd3,
"[in, out] parameter should not have changed.\n");
2214 ISomethingFromDispatch_AddRef(sfd_in_out);
2215 hr = IWidget_iface_ptr(widget, &sfd_in, &sfd_out, &sfd_in_out);
2217 hr = ISomethingFromDispatch_anotherfn(sfd_out);
2218 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
2219 ok(sfd_in_out != sfd3,
"[in, out] parameter should have changed.\n");
2220 hr = ISomethingFromDispatch_anotherfn(sfd_in_out);
2221 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
2228 sfd_in = sfd_out = sfd_in_out =
NULL;
2229 hr = IWidget_iface_ptr(widget, &sfd_in, &sfd_out, &sfd_in_out);
2231 ok(!sfd_out,
"[out] parameter should not have been set.\n");
2232 hr = ISomethingFromDispatch_anotherfn(sfd_in_out);
2233 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
2237 sfd_in = sfd_out =
NULL;
2239 ISomethingFromDispatch_AddRef(sfd_in_out);
2240 hr = IWidget_iface_ptr(widget, &sfd_in, &sfd_out, &sfd_in_out);
2242 ok(!sfd_in_out,
"Got [in, out] %p.\n", sfd_in_out);
2280 proxy_unk = proxy_unk2 =
NULL;
2290 hr = IUnknown_QueryInterface(proxy_unk2, &IID_ISomethingFromDispatch, (
void **)&proxy_sfd);
2293 ISomethingFromDispatch_Release(proxy_sfd);
2300 proxy_unk = proxy_unk2 =
NULL;
2306 ok(!proxy_unk,
"Got unexpected proxy %p.\n", proxy_unk);
2307 ok(!proxy_disp,
"Got unexpected proxy %p.\n", proxy_disp);
2308 ok(!proxy_unk2,
"Got unexpected proxy %p.\n", proxy_unk2);
2323 ok(
unk_in == (
IUnknown *)sfd1,
"[in] parameter should not have changed.\n");
2324 ok(!
unk_out,
"[out] parameter should have been cleared.\n");
2325 ok(unk_in_out == (
IUnknown *)sfd3,
"[in, out] parameter should not have changed.\n");
2335 IUnknown_AddRef(unk_in_out);
2342 hr = IUnknown_QueryInterface(
unk_out, &IID_ISomethingFromDispatch, (
void **)&sfd_out);
2344 hr = ISomethingFromDispatch_anotherfn(sfd_out);
2345 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
2346 ISomethingFromDispatch_Release(sfd_out);
2348 ok(unk_in_out != (
IUnknown *)sfd3,
"[in, out] parameter should have changed.\n");
2349 hr = IUnknown_QueryInterface(unk_in_out, &IID_ISomethingFromDispatch, (
void **)&sfd_in_out);
2351 hr = ISomethingFromDispatch_anotherfn(sfd_in_out);
2352 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
2353 ISomethingFromDispatch_Release(sfd_in_out);
2369 ok(!
unk_out,
"[out] parameter should not have been set.\n");
2371 hr = IUnknown_QueryInterface(unk_in_out, &IID_ISomethingFromDispatch, (
void **)&sfd_in_out);
2373 hr = ISomethingFromDispatch_anotherfn(sfd_in_out);
2374 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
2375 ISomethingFromDispatch_Release(sfd_in_out);
2384 IUnknown_AddRef(unk_in_out);
2389 ok(!unk_in_out,
"[in, out] parameter should have been cleared.\n");
2415 ok(
in[1] ==
test_bstr1[1],
"[in] parameter should not be changed.\n");
2416 ok(in_ptr[1] ==
'X',
"[in] pointer should be changed.\n");
2417 ok(in_out[1] ==
'X',
"[in, out] parameter should be changed.\n");
2427 hr = IWidget_bstr(widget,
in, &
out, &in_ptr, &in_out);
2429 ok(
in[1] ==
test_bstr1[1],
"[in] parameter should not be changed.\n");
2430 ok(in_ptr[1] ==
test_bstr2[1],
"[in] pointer should not be changed.\n");
2431 ok(in_out[1] ==
'X',
"[in, out] parameter should be changed.\n");
2442 hr = IWidget_bstr(widget,
NULL, &
out, &in_ptr, &in_out);
2464 V_CY(&
arg[3]).Lo = 0xdeadbeef;
2476 ok(
V_I2(&in_ptr) == 4,
"Got wrong value %d.\n",
V_I1(&in_ptr));
2478 ok(
V_I1(&in_out) == 5,
"Got wrong value %d.\n",
V_I1(&in_out));
2487 hr = IWidget_variant(widget,
arg[3], &
out, &in_ptr, &in_out);
2493 ok(
V_I2(&in_ptr) == -1,
"Got wrong value %d.\n",
V_I1(&in_ptr));
2495 ok(
V_I1(&in_out) == 5,
"Got wrong value %d.\n",
V_I1(&in_out));
2507 hr = IWidget_safearray(widget,
in, &
out, &in_ptr, &in_out);
2524 MYSTRUCT
out, in_ptr, in_out, *in_ptr_ptr;
2525 RECT rect_out, rect_in_ptr, rect_in_out;
2526 ISomethingFromDispatch *sfd;
2528 int i, i2, *
pi = &i2;
2541 in_ptr_ptr = &in_ptr;
2542 hr = IWidget_mystruct_ptr_ptr(widget, &in_ptr_ptr);
2555 hr = IWidget_rect(widget,
test_rect1, &rect_out, &rect_in_ptr, &rect_in_out);
2577 hr = IWidget_complex_struct(widget,
complex);
2583 VARIANT var_in[2], var_out[2], var_in_out[2];
2584 ISomethingFromDispatch *proxy_sfd;
2585 array_t
in,
out, in_out;
2586 MYSTRUCT struct_in[2];
2593 hr = IWidget_array(widget,
in,
out, in_out);
2605 hr = IWidget_variant_array(widget, var_in, var_out, var_in_out);
2607 ok(
V_VT(&var_in[0]) ==
VT_I4,
"Got wrong type %u.\n",
V_VT(&var_in[0]));
2608 ok(
V_I4(&var_in[0]) == 1,
"Got wrong value %d.\n",
V_I4(&var_in[0]));
2611 ok(
i == 2,
"Got wrong value %d.\n",
i);
2612 ok(
V_VT(&var_out[0]) ==
VT_I1,
"Got wrong type %u.\n",
V_VT(&var_out[0]));
2613 ok(
V_I1(&var_out[0]) == 9,
"Got wrong value %u.\n",
V_VT(&var_out[0]));
2616 ok(
V_VT(&var_in_out[0]) ==
VT_I1,
"Got wrong type %u.\n",
V_VT(&var_in_out[0]));
2617 ok(
V_I1(&var_in_out[0]) == 11,
"Got wrong value %u.\n",
V_VT(&var_in_out[0]));
2619 hr = IUnknown_QueryInterface(
V_UNKNOWN(&var_in_out[1]), &IID_ISomethingFromDispatch, (
void **)&proxy_sfd);
2621 hr = ISomethingFromDispatch_anotherfn(proxy_sfd);
2622 ok(
hr == 0x01234567,
"Got hr %#x.\n",
hr);
2623 ISomethingFromDispatch_Release(proxy_sfd);
2628 hr = IWidget_mystruct_array(widget, struct_in);
2638 ICoclass1 *
in, *
out, *in_out;
2664 hr = IWidget_Coclass_ptr(widget, (Coclass1 **)&
in, (Coclass1 **)&
out, (Coclass1 **)&in_out);
2667 ok(!
out,
"[out] parameter should have been cleared.\n");
2668 ok(in_out == &class3->
ICoclass1_iface,
"[in, out] parameter should not have changed.\n");
2678 ICoclass1_AddRef(in_out);
2679 hr = IWidget_Coclass_ptr(widget, (Coclass1 **)&
in,
2680 (Coclass1 **)&
out, (Coclass1 **)&in_out);
2682 hr = ICoclass1_test(
out);
2683 ok(
hr == 1,
"Got hr %#x.\n",
hr);
2684 ok(in_out != &class3->
ICoclass1_iface,
"[in, out] parameter should have changed.\n");
2685 hr = ICoclass1_test(in_out);
2686 ok(
hr == 1,
"Got hr %#x.\n",
hr);
2694 hr = IWidget_Coclass_ptr(widget, (Coclass1 **)&
in,
2695 (Coclass1 **)&
out, (Coclass1 **)&in_out);
2697 hr = ICoclass1_test(in_out);
2698 ok(
hr == 1,
"Got hr %#x.\n",
hr);
2705 hr = IWidget_Coclass_ptr(widget, (Coclass1 **)&
in,
2706 (Coclass1 **)&
out, (Coclass1 **)&in_out);
2708 ok(!in_out,
"Got [in, out] %p.\n", in_out);
2756 ok(!
unk_out,
"[out] parameter should have been cleared.\n");
2767 IUnknown_AddRef(unk_in_out);
2774 hr = IUnknown_QueryInterface(
unk_out, &IID_ICoclass1, (
void **)&
out);
2776 hr = ICoclass1_test(
out);
2777 ok(
hr == 1,
"Got hr %#x.\n",
hr);
2778 ICoclass1_Release(
out);
2781 hr = IUnknown_QueryInterface(unk_in_out, &IID_ICoclass1, (
void **)&in_out);
2783 hr = ICoclass1_test(in_out);
2784 ok(
hr == 1,
"Got hr %#x.\n",
hr);
2785 ICoclass1_Release(in_out);
2801 ok(!
unk_out,
"[out] parameter should not have been set.\n");
2803 hr = IUnknown_QueryInterface(unk_in_out, &IID_ICoclass1, (
void **)&in_out);
2805 hr = ICoclass1_test(in_out);
2806 ok(
hr == 1,
"Got hr %#x.\n",
hr);
2807 ICoclass1_Release(in_out);
2816 IUnknown_AddRef(unk_in_out);
2822 ok(!unk_in_out,
"[in, out] parameter should have been cleared.\n");
2830 static const WCHAR szCat[] = {
'C',
'a',
't',0 };
2831 static const WCHAR szTestTest[] = {
'T',
'e',
's',
't',
'T',
'e',
's',
't',0 };
2832 static const WCHAR szSuperman[] = {
'S',
'u',
'p',
'e',
'r',
'm',
'a',
'n',0 };
2841 DISPID dispidNamed = DISPID_PROPERTYPUT;
2842 DISPPARAMS dispparams;
2851 ok(pKEW !=
NULL,
"Widget creation failed\n");
2856 IKindaEnumWidget_Release(pKEW);
2858 IStream_Seek(pStream,
ullZero, STREAM_SEEK_SET,
NULL);
2861 IStream_Release(pStream);
2868 hr = IKindaEnumWidget_Next(pKEW, &pWidget);
2871 IKindaEnumWidget_Release(pKEW);
2874 hr = IWidget_GetTypeInfoCount(pWidget, &uval);
2876 hr = IWidget_GetTypeInfoCount(pWidget, &uval);
2879 hr = IWidget_QueryInterface(pWidget, &
IID_IDispatch, (
void **)&pDispatch);
2884 dispparams.cNamedArgs = 1;
2885 dispparams.rgdispidNamedArgs = &dispidNamed;
2886 dispparams.cArgs = 1;
2887 dispparams.rgvarg = vararg;
2892 "EXCEPINFO differs from expected: wCode = 0x%x, scode = 0x%08x\n",
2898 hr = IWidget_put_Name(pWidget, bstr);
2903 dispparams.cNamedArgs = 0;
2904 dispparams.rgdispidNamedArgs =
NULL;
2905 dispparams.cArgs = 0;
2906 dispparams.rgvarg =
NULL;
2911 "EXCEPINFO differs from expected: wCode = 0x%x, scode = 0x%08x\n",
2917 bstr = (
void *)0xdeadbeef;
2918 hr = IWidget_get_Name(pWidget, &bstr);
2920 ok(!
lstrcmpW(bstr, szCat),
"IWidget_get_Name should have returned string \"Cat\" instead of %s\n",
wine_dbgstr_w(bstr));
2927 V_R8(&vararg[1]) = 3.141;
2928 dispparams.cNamedArgs = 0;
2929 dispparams.cArgs = 2;
2930 dispparams.rgdispidNamedArgs =
NULL;
2931 dispparams.rgvarg = vararg;
2935 ok(
V_VT(&varresult) ==
VT_EMPTY,
"varresult should be VT_EMPTY\n");
2943 V_R8(&vararg[2]) = 3.141;
2944 dispparams.cNamedArgs = 0;
2945 dispparams.cArgs = 3;
2946 dispparams.rgdispidNamedArgs =
NULL;
2947 dispparams.rgvarg = vararg;
2951 ok(
V_VT(&varresult) ==
VT_EMPTY,
"varresult should be VT_EMPTY\n");
2960 V_R8(&vararg[3]) = 3.141;
2965 dispparams.cNamedArgs = 0;
2966 dispparams.cArgs = 4;
2967 dispparams.rgdispidNamedArgs =
NULL;
2968 dispparams.rgvarg = vararg;
2972 ok(
V_VT(&varresult) ==
VT_EMPTY,
"varresult should be VT_EMPTY\n");
2976 dispparams.cNamedArgs = 0;
2977 dispparams.cArgs = 0;
2978 dispparams.rgdispidNamedArgs =
NULL;
2979 dispparams.rgvarg =
NULL;
2982 ok((
V_VT(&varresult) ==
VT_I4) && (
V_I4(&varresult) == STATE_WIDGETIFIED),
"Return val mismatch\n");
2985 hr = IWidget_get_State(pWidget, &the_state);
2987 ok(the_state == STATE_WIDGETIFIED,
"should have returned WIDGET_WIDGETIFIED instead of %d\n", the_state);
2990 the_state = STATE_WIDGETIFIED;
2993 V_I4REF(&vararg[0]) = (
int *)&the_state;
2994 dispparams.cNamedArgs = 1;
2995 dispparams.cArgs = 1;
2996 dispparams.rgdispidNamedArgs = &dispidNamed;
2997 dispparams.rgvarg = vararg;
3006 dispparams.cNamedArgs = 0;
3007 dispparams.cArgs = 1;
3008 dispparams.rgdispidNamedArgs =
NULL;
3009 dispparams.rgvarg = vararg;
3013 ok(
V_VT(&varresult) ==
VT_BSTR,
"Return value should be of type BSTR instead of %d\n",
V_VT(&varresult));
3021 V_I4(&vararg[0]) = 0x80000005;
3022 dispparams.cNamedArgs = 0;
3023 dispparams.cArgs = 1;
3024 dispparams.rgdispidNamedArgs =
NULL;
3025 dispparams.rgvarg = vararg;
3030 dispparams.cNamedArgs = 0;
3031 dispparams.cArgs = 0;
3032 dispparams.rgdispidNamedArgs =
NULL;
3033 dispparams.rgvarg =
NULL;
3040 dispparams.cNamedArgs = 0;
3041 dispparams.cArgs = 0;
3042 dispparams.rgdispidNamedArgs =
NULL;
3043 dispparams.rgvarg =
NULL;
3051 dispparams.cNamedArgs = 0;
3052 dispparams.cArgs = 0;
3053 dispparams.rgdispidNamedArgs =
NULL;
3054 dispparams.rgvarg =
NULL;
3063 V_I2(&vararg[0]) = 1;
3064 dispparams.cNamedArgs = 0;
3065 dispparams.rgdispidNamedArgs =
NULL;
3066 dispparams.cArgs = 1;
3067 dispparams.rgvarg = vararg;
3073 "EXCEPINFO differs from expected: wCode = 0x%x, scode = 0x%08x\n",
3076 ok(
V_VT(&varresult) ==
VT_I2,
"V_VT(&varresult) was %d instead of VT_I2\n",
V_VT(&varresult));
3077 ok(
V_I2(&varresult) == 1234,
"V_I2(&varresult) was %d instead of 1234\n",
V_I2(&varresult));
3081 dispparams.cNamedArgs = 0;
3082 dispparams.cArgs = 0;
3083 dispparams.rgdispidNamedArgs =
NULL;
3084 dispparams.rgvarg =
NULL;
3090 "EXCEPINFO differs from expected: wCode = 0x%x, scode = 0x%08x\n",
3093 ok(
V_VT(&varresult) ==
VT_DISPATCH,
"V_VT(&varresult) was %d instead of VT_DISPATCH\n",
V_VT(&varresult));
3094 ok(
V_DISPATCH(&varresult) !=
NULL,
"expected V_DISPATCH(&varresult) != NULL\n");
3100 V_I2(&vararg[1]) = 1;
3101 dispparams.cNamedArgs = 0;
3102 dispparams.rgdispidNamedArgs =
NULL;
3103 dispparams.cArgs = 1;
3104 dispparams.rgvarg = vararg;
3110 "EXCEPINFO differs from expected: wCode = 0x%x, scode = 0x%08x\n",
3113 ok(
V_VT(&varresult) ==
VT_I2,
"V_VT(&varresult) was %d instead of VT_I2\n",
V_VT(&varresult));
3114 ok(
V_I2(&varresult) == 1234,
"V_I2(&varresult) was %d instead of 1234\n",
V_I2(&varresult));
3121 dispparams.cNamedArgs = 0;
3122 dispparams.cArgs = 1;
3123 dispparams.rgdispidNamedArgs =
NULL;
3124 dispparams.rgvarg = vararg;
3133 dispparams.cNamedArgs = 0;
3134 dispparams.cArgs = 1;
3135 dispparams.rgdispidNamedArgs =
NULL;
3136 dispparams.rgvarg = vararg;
3144 V_I4(&vararg[3]) = 3;
3147 V_I4(&vararg[2]) = 0;
3150 V_I4(&vararg[1]) = 1;
3153 V_I4(&vararg[0]) = 2;
3154 dispparams.cNamedArgs = 0;
3155 dispparams.cArgs = 4;
3156 dispparams.rgdispidNamedArgs =
NULL;
3157 dispparams.rgvarg = vararg;
3163 dispparams.cNamedArgs = 1;
3164 dispparams.rgdispidNamedArgs = &dispidNamed;
3167 dispidNamed = DISPID_PROPERTYPUT;
3176 dispparams.cNamedArgs = 0;
3177 dispparams.cArgs = 2;
3178 dispparams.rgdispidNamedArgs =
NULL;
3179 dispparams.rgvarg = vararg;
3192 dispparams.cNamedArgs = 0;
3193 dispparams.cArgs = 2;
3194 dispparams.rgdispidNamedArgs =
NULL;
3195 dispparams.rgvarg = vararg;
3202 dispparams.cNamedArgs = 0;
3203 dispparams.cArgs = 0;
3204 dispparams.rgdispidNamedArgs =
NULL;
3205 dispparams.rgvarg =
NULL;
3208 ok(
hr ==
DISP_E_EXCEPTION,
"IDispatch_Invoke should have returned DISP_E_EXCEPTION instead of 0x%08x\n",
hr);
3210 "EXCEPINFO differs from expected: wCode = 0x%x, scode = 0x%08x\n",
3216 dispparams.cNamedArgs = 0;
3217 dispparams.cArgs = 0;
3218 dispparams.rgdispidNamedArgs =
NULL;
3219 dispparams.rgvarg =
NULL;
3223 ok(
V_VT(&varresult) ==
VT_BSTR,
"V_VT(&varresult) should be VT_BSTR instead of %d\n",
V_VT(&varresult));
3224 ok(
V_BSTR(&varresult) !=
NULL,
"V_BSTR(&varresult) should not be NULL\n");
3228 dispparams.cNamedArgs = 0;
3229 dispparams.cArgs = 0;
3230 dispparams.rgdispidNamedArgs =
NULL;
3231 dispparams.rgvarg =
NULL;
3233 ok(
hr ==
DISP_E_EXCEPTION,
"ITypeInfo_Invoke should have returned DISP_E_EXCEPTION instead of 0x%08x\n",
hr);
3234 ok(
V_VT(&varresult) ==
VT_EMPTY,
"V_VT(&varresult) should be VT_EMPTY instead of %d\n",
V_VT(&varresult));
3236 "EXCEPINFO differs from expected: wCode = 0x%x, scode = 0x%08x\n",
3240 ITypeInfo_Release(pTypeInfo);
3244 dispparams.cNamedArgs = 0;
3245 dispparams.rgdispidNamedArgs =
NULL;
3246 dispparams.cArgs = 1;
3247 dispparams.rgvarg = vararg;
3257 dispparams.cNamedArgs = 1;
3258 dispparams.rgdispidNamedArgs = &dispidNamed;
3259 dispparams.cArgs = 1;
3260 dispparams.rgvarg = vararg;
3270 dispparams.cNamedArgs = 1;
3271 dispparams.rgdispidNamedArgs = &dispidNamed;
3272 dispparams.cArgs = 1;
3273 dispparams.rgvarg = vararg;
3276 ok(
hr ==
DISP_E_BADVARTYPE,
"IDispatch_Invoke should have returned DISP_E_BADVARTYPE instead of 0x%08x\n",
hr);
3280 dispparams.cNamedArgs = 0;
3281 dispparams.rgdispidNamedArgs =
NULL;
3282 dispparams.cArgs = 0;
3283 dispparams.rgvarg =
NULL;
3294 V_I4(&vararg[1]) = 1;
3295 dispparams.cNamedArgs = 0;
3296 dispparams.cArgs = 2;
3297 dispparams.rgdispidNamedArgs =
NULL;
3298 dispparams.rgvarg = vararg;
3308 V_I4(&vararg[0]) = 0xcafe;
3309 dispparams.cNamedArgs = 1;
3310 dispparams.rgdispidNamedArgs = &dispidNamed;
3311 dispparams.cArgs = 1;
3312 dispparams.rgvarg = vararg;
3319 dispparams.cNamedArgs = 0;
3320 dispparams.cArgs = 0;
3321 dispparams.rgvarg =
NULL;
3322 dispparams.rgdispidNamedArgs =
NULL;
3326 ok(
V_I4(&varresult) == 0x409,
"got %x\n",
V_I4(&varresult));
3330 dispparams.cNamedArgs = 0;
3331 dispparams.cArgs = 0;
3332 dispparams.rgvarg =
NULL;
3333 dispparams.rgdispidNamedArgs =
NULL;
3337 ok(
V_I4(&varresult) == -13,
"got %x\n",
V_I4(&varresult));
3341 dispparams.cNamedArgs = 0;
3342 dispparams.cArgs = 0;
3343 dispparams.rgvarg =
NULL;
3344 dispparams.rgdispidNamedArgs =
NULL;
3348 ok(
V_UI4(&varresult) == 42,
"got %x\n",
V_UI4(&varresult));
3356 dispparams.cNamedArgs = 0;
3357 dispparams.cArgs = 1;
3358 dispparams.rgvarg = vararg;
3359 dispparams.rgdispidNamedArgs =
NULL;