34#define ok_bstr(bstr, expected, format) \
36 WideCharToMultiByte(CP_ACP, 0, bstr, -1, temp_str, MAX_PATH, NULL, NULL); \
37 if (lstrcmpA(temp_str, expected) != 0) \
38 ok(0, format, expected, temp_str); \
41#define INIT_DISPPARAMS(dp, args, named_args, num_args, num_named_args) \
43 dp.rgdispidNamedArgs = named_args; \
44 dp.cArgs = num_args; \
45 dp.cNamedArgs = num_named_args; \
52#define INIT_VARARG(vararg) \
53 VariantInit(&vararg[0]); \
54 V_VT(&vararg[0]) = VT_I2; \
55 V_I2(&vararg[0]) = 42; \
56 VariantInit(&vararg[1]); \
57 V_VT(&vararg[1]) = VT_I4; \
58 V_I4(&vararg[1]) = 1234567890; \
59 VariantInit(&vararg[2]); \
60 V_VT(&vararg[2]) = VT_BSTR; \
61 V_BSTR(&vararg[2]) = SysAllocString(szSunshine);
64#define CLEAR_VARARG(vararg) \
65 VariantClear(&vararg[0]); \
66 VariantClear(&vararg[1]); \
67 VariantClear(&vararg[2]);
72 DISPPARAMS dispparams;
75 unsigned int err_index;
84 err_index = 0xdeadbeef;
87 "Expected DISP_E_PARAMNOTFOUND, got %08x\n",
hr);
89 "Expected VT_EMPTY, got %08x\n",
V_VT(&
result));
90 ok(err_index == 0xdeadbeef,
91 "Expected err_index to be unchanged, got %d\n", err_index);
96 err_index = 0xdeadbeef;
99 "Expected DISP_E_PARAMNOTFOUND, got %08x\n",
hr);
101 "Expected VT_EMPTY, got %08x\n",
V_VT(&
result));
102 ok(err_index == 0xdeadbeef,
103 "Expected err_index to be unchanged, got %d\n", err_index);
107 err_index = 0xdeadbeef;
110 "Expected DISP_E_PARAMNOTFOUND, got %08x\n",
hr);
111 ok(err_index == 0xdeadbeef,
112 "Expected err_index to be unchanged, got %d\n", err_index);
119 "Expected DISP_E_PARAMNOTFOUND, got %08x\n",
hr);
121 "Expected VT_EMPTY, got %08x\n",
V_VT(&
result));
126 err_index = 0xdeadbeef;
130 "Expected VT_EMPTY, got %08x\n",
V_VT(&
result));
131 ok(err_index == 0,
"Expected 0, got %d\n", err_index);
146 err_index = 0xdeadbeef;
148 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
151 ok(err_index == 0xdeadbeef,
152 "Expected err_index to be unchanged, got %d\n", err_index);
157 err_index = 0xdeadbeef;
159 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
162 "Expected 1234567890, got %d\n",
V_I4(&
result));
163 ok(err_index == 0xdeadbeef,
164 "Expected err_index to be unchanged, got %d\n", err_index);
169 err_index = 0xdeadbeef;
171 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
174 ok(err_index == 0xdeadbeef,
175 "Expected err_index to be unchanged, got %d\n", err_index);
181 err_index = 0xdeadbeef;
184 "Expected DISP_E_PARAMNOTFOUND, got %08x\n",
hr);
186 "Expected VT_EMPTY, got %08x\n",
V_VT(&
result));
187 ok(err_index == 0xdeadbeef,
188 "Expected err_index to be unchanged, got %d\n", err_index);
192 err_index = 0xdeadbeef;
195 ok(err_index == 0,
"Expected 0, got %d\n", err_index);
201 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
208 err_index = 0xdeadbeef;
210 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
213 ok(err_index == 0xdeadbeef,
214 "Expected err_index to be unchanged, got %d\n", err_index);
219 err_index = 0xdeadbeef;
221 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
224 ok(err_index == 0xdeadbeef,
225 "Expected err_index to be unchanged, got %d\n", err_index);
231 err_index = 0xdeadbeef;
235 "Expected VT_EMPTY, got %08x\n",
V_VT(&
result));
236 ok(err_index == 1,
"Expected 1, got %d\n", err_index);
241 err_index = 0xdeadbeef;
244 "Expected DISP_E_TYPEMISMATCH, got %08x\n",
hr);
246 "Expected VT_EMPTY, got %08x\n",
V_VT(&
result));
247 ok(err_index == 2,
"Expected 2, got %d\n", err_index);
252 err_index = 0xdeadbeef;
256 "Expected VT_EMPTY, got %08x\n",
V_VT(&
result));
257 ok(err_index == 0,
"Expected 0, got %d\n", err_index);
265 err_index = 0xdeadbeef;
267 ok(
hr ==
S_OK,
"Expected S_OK, got %08x\n",
hr);
269 ok(err_index == 0xdeadbeef,
"Expected 0xdeadbeef, got %d\n", err_index);
308 static const WCHAR stdole2W[] = {
's',
't',
'd',
'o',
'l',
'e',
'2',
'.',
't',
'l',
'b',0};
324 ITypeLib_Release(tl);
334 IUnknown_Release(unk);
336 ITypeInfo_Release(ti);
void dispatch(HANDLE hStopEvent)
HRESULT WINAPI DispGetParam(DISPPARAMS *pdispparams, UINT position, VARTYPE vtTarg, VARIANT *pvarResult, UINT *puArgErr)
HRESULT WINAPI CreateStdDispatch(IUnknown *punkOuter, void *pvThis, ITypeInfo *ptinfo, IUnknown **stddisp)
HRESULT WINAPI LoadTypeLib(const OLECHAR *szFile, ITypeLib **pptLib)
static const IUnknownVtbl unkvtbl
#define INIT_DISPPARAMS(dp, args, named_args, num_args, num_named_args)
static CHAR temp_str[MAX_PATH]
static const WCHAR szSunshine[]
static ULONG WINAPI unk_Release(IUnknown *iface)
static void test_DispGetParam(void)
#define INIT_VARARG(vararg)
static ULONG WINAPI unk_AddRef(IUnknown *iface)
#define ok_bstr(bstr, expected, format)
static void test_CreateStdDispatch(void)
#define CLEAR_VARARG(vararg)
static HRESULT WINAPI unk_QI(IUnknown *iface, REFIID riid, void **obj)
#define IsEqualIID(riid1, riid2)
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
void WINAPI VariantInit(VARIANTARG *pVarg)
#define DISP_E_PARAMNOTFOUND
#define DISP_E_BADVARTYPE
#define DISP_E_TYPEMISMATCH