2 * ITypeLib and ITypeInfo test
4 * Copyright 2004 Jacek Caban
5 * Copyright 2006 Dmitry Timoshkov
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include <wine/test.h>
40 #define expect_eq(expr, value, type, format) { type _ret = (expr); ok((value) == _ret, #expr " expected " format " got " format "\n", value, _ret); }
41 #define expect_int(expr, value) expect_eq(expr, (int)(value), int, "%d")
42 #define expect_hex(expr, value) expect_eq(expr, (int)(value), int, "0x%x")
43 #define expect_null(expr) expect_eq(expr, NULL, const void *, "%p")
44 #define expect_guid(expected, guid) { ok(IsEqualGUID(expected, guid), "got wrong guid\n"); }
46 #define expect_wstr_acpval(expr, value) \
49 expect_eq(!WideCharToMultiByte(CP_ACP, 0, (expr), -1, buf, 260, NULL, NULL), 0, int, "%d"); \
50 ok(strcmp(value, buf) == 0, #expr " expected \"%s\" got \"%s\"\n", value, buf); \
53 #define ole_expect(expr, expect) { \
55 ok(r == (expect), #expr " returned %x, expected %s (%x)\n", r, #expect, expect); \
58 #define ole_check(expr) ole_expect(expr, S_OK);
60 #define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)
64 #elif defined __x86_64__
70 static HRESULT
WINAPI (*pRegisterTypeLibForUser
)(ITypeLib
*,OLECHAR
*,OLECHAR
*);
71 static HRESULT
WINAPI (*pUnRegisterTypeLibForUser
)(REFGUID
,WORD
,WORD
,LCID
,SYSKIND
);
73 static BOOL (WINAPI
*pActivateActCtx
)(HANDLE
,ULONG_PTR
*);
74 static HANDLE (WINAPI
*pCreateActCtxW
)(PCACTCTXW
);
75 static BOOL (WINAPI
*pDeactivateActCtx
)(DWORD
,ULONG_PTR
);
76 static VOID (WINAPI
*pReleaseActCtx
)(HANDLE
);
77 static BOOL (WINAPI
*pIsWow64Process
)(HANDLE
,LPBOOL
);
78 static LONG (WINAPI
*pRegDeleteKeyExW
)(HKEY
,LPCWSTR
,REGSAM
,DWORD
);
80 static const WCHAR wszStdOle2
[] = {'s','t','d','o','l','e','2','.','t','l','b',0};
81 static WCHAR wszGUID
[] = {'G','U','I','D',0};
82 static WCHAR wszguid
[] = {'g','u','i','d',0};
84 static const BOOL is_win64
= sizeof(void *) > sizeof(int);
86 static HRESULT WINAPI
invoketest_QueryInterface(IInvokeTest
*iface
, REFIID riid
, void **ret
)
88 if (IsEqualIID(riid
, &IID_IUnknown
) ||
89 IsEqualIID(riid
, &IID_IDispatch
) ||
90 IsEqualIID(riid
, &IID_IInvokeTest
))
99 static ULONG WINAPI
invoketest_AddRef(IInvokeTest
*iface
)
104 static ULONG WINAPI
invoketest_Release(IInvokeTest
*iface
)
109 static HRESULT WINAPI
invoketest_GetTypeInfoCount(IInvokeTest
*iface
, UINT
*cnt
)
111 ok(0, "unexpected call\n");
116 static HRESULT WINAPI
invoketest_GetTypeInfo(IInvokeTest
*iface
, UINT index
, LCID lcid
, ITypeInfo
**ti
)
118 ok(0, "unexpected call\n");
122 static HRESULT WINAPI
invoketest_GetIDsOfNames(IInvokeTest
*iface
, REFIID riid
, LPOLESTR
*names
,
123 UINT cnt
, LCID lcid
, DISPID
*dispid
)
125 ok(0, "unexpected call\n");
129 static HRESULT WINAPI
invoketest_Invoke(IInvokeTest
*iface
, DISPID dispid
, REFIID riid
,
130 LCID lcid
, WORD flags
, DISPPARAMS
*dispparams
, VARIANT
*res
, EXCEPINFO
*ei
, UINT
*argerr
)
132 ok(0, "unexpected call\n");
136 static LONG WINAPI
invoketest_get_test(IInvokeTest
*iface
, LONG i
)
141 static LONG WINAPI
invoketest_putref_testprop(IInvokeTest
*iface
, LONG
*i
)
146 static LONG WINAPI
invoketest_putref_testprop2(IInvokeTest
*iface
, IUnknown
*i
)
151 static const IInvokeTestVtbl invoketestvtbl
= {
152 invoketest_QueryInterface
,
155 invoketest_GetTypeInfoCount
,
156 invoketest_GetTypeInfo
,
157 invoketest_GetIDsOfNames
,
160 invoketest_putref_testprop
,
161 invoketest_putref_testprop2
164 static IInvokeTest invoketest
= { &invoketestvtbl
};
166 static void init_function_pointers(void)
168 HMODULE hmod
= GetModuleHandleA("oleaut32.dll");
169 HMODULE hk32
= GetModuleHandleA("kernel32.dll");
170 HMODULE hadv
= GetModuleHandleA("advapi32.dll");
172 pRegisterTypeLibForUser
= (void *)GetProcAddress(hmod
, "RegisterTypeLibForUser");
173 pUnRegisterTypeLibForUser
= (void *)GetProcAddress(hmod
, "UnRegisterTypeLibForUser");
174 pActivateActCtx
= (void *)GetProcAddress(hk32
, "ActivateActCtx");
175 pCreateActCtxW
= (void *)GetProcAddress(hk32
, "CreateActCtxW");
176 pDeactivateActCtx
= (void *)GetProcAddress(hk32
, "DeactivateActCtx");
177 pReleaseActCtx
= (void *)GetProcAddress(hk32
, "ReleaseActCtx");
178 pIsWow64Process
= (void *)GetProcAddress(hk32
, "IsWow64Process");
179 pRegDeleteKeyExW
= (void*)GetProcAddress(hadv
, "RegDeleteKeyExW");
182 static void ref_count_test(LPCWSTR type_lib
)
185 ITypeInfo
*iti1
, *iti2
;
189 trace("Loading type library\n");
190 hRes
= LoadTypeLib(type_lib
, &iface
);
191 ok(hRes
== S_OK
, "Could not load type library\n");
195 hRes
= ITypeLib_GetTypeInfo(iface
, 1, &iti1
);
196 ok(hRes
== S_OK
, "ITypeLib_GetTypeInfo failed on index = 1\n");
197 ok(ref_count
=ITypeLib_Release(iface
) > 0, "ITypeLib destroyed while ITypeInfo has back pointer\n");
201 hRes
= ITypeLib_GetTypeInfo(iface
, 1, &iti2
);
202 ok(hRes
== S_OK
, "ITypeLib_GetTypeInfo failed on index = 1\n");
203 ok(iti1
== iti2
, "ITypeLib_GetTypeInfo returned different pointers for same indexes\n");
205 ITypeLib_AddRef(iface
);
206 ITypeInfo_Release(iti2
);
207 ITypeInfo_Release(iti1
);
208 ok(ITypeLib_Release(iface
) == 0, "ITypeLib should be destroyed here.\n");
211 static void test_TypeComp(void)
214 ITypeComp
*pTypeComp
;
219 ITypeInfo
*pTypeInfo
;
220 ITypeInfo
*pFontTypeInfo
;
221 ITypeComp
*pTypeComp_tmp
;
222 static WCHAR wszStdFunctions
[] = {'S','t','d','F','u','n','c','t','i','o','n','s',0};
223 static WCHAR wszSavePicture
[] = {'S','a','v','e','P','i','c','t','u','r','e',0};
224 static WCHAR wszOLE_TRISTATE
[] = {'O','L','E','_','T','R','I','S','T','A','T','E',0};
225 static WCHAR wszUnchecked
[] = {'U','n','c','h','e','c','k','e','d',0};
226 static WCHAR wszIUnknown
[] = {'I','U','n','k','n','o','w','n',0};
227 static WCHAR wszFont
[] = {'F','o','n','t',0};
228 static WCHAR wszStdPicture
[] = {'S','t','d','P','i','c','t','u','r','e',0};
229 static WCHAR wszOLE_COLOR
[] = {'O','L','E','_','C','O','L','O','R',0};
230 static WCHAR wszClone
[] = {'C','l','o','n','e',0};
231 static WCHAR wszclone
[] = {'c','l','o','n','e',0};
232 static WCHAR wszJunk
[] = {'J','u','n','k',0};
233 static WCHAR wszAddRef
[] = {'A','d','d','R','e','f',0};
235 hr
= LoadTypeLib(wszStdOle2
, &pTypeLib
);
236 ok_ole_success(hr
, LoadTypeLib
);
238 hr
= ITypeLib_GetTypeComp(pTypeLib
, &pTypeComp
);
239 ok_ole_success(hr
, ITypeLib_GetTypeComp
);
241 /* test getting a TKIND_MODULE */
242 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszStdFunctions
);
243 hr
= ITypeComp_Bind(pTypeComp
, wszStdFunctions
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
244 ok_ole_success(hr
, ITypeComp_Bind
);
246 ok(desckind
== DESCKIND_TYPECOMP
,
247 "desckind should have been DESCKIND_TYPECOMP instead of %d\n",
249 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
251 ITypeComp_Release(bindptr
.lptcomp
);
253 /* test getting a TKIND_MODULE with INVOKE_PROPERTYGET */
254 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszStdFunctions
);
255 hr
= ITypeComp_Bind(pTypeComp
, wszStdFunctions
, ulHash
, INVOKE_PROPERTYGET
, &pTypeInfo
, &desckind
, &bindptr
);
256 ok_ole_success(hr
, ITypeComp_Bind
);
258 ok(desckind
== DESCKIND_TYPECOMP
,
259 "desckind should have been DESCKIND_TYPECOMP instead of %d\n",
261 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
262 ITypeComp_Release(bindptr
.lptcomp
);
264 /* test getting a function within a TKIND_MODULE */
265 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszSavePicture
);
266 hr
= ITypeComp_Bind(pTypeComp
, wszSavePicture
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
267 ok_ole_success(hr
, ITypeComp_Bind
);
269 ok(desckind
== DESCKIND_FUNCDESC
,
270 "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
272 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr.lpfuncdesc should not have been set to NULL\n");
273 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
274 ITypeInfo_Release(pTypeInfo
);
276 /* test getting a function within a TKIND_MODULE with INVOKE_PROPERTYGET */
277 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszSavePicture
);
278 hr
= ITypeComp_Bind(pTypeComp
, wszSavePicture
, ulHash
, INVOKE_PROPERTYGET
, &pTypeInfo
, &desckind
, &bindptr
);
279 ok(hr
== TYPE_E_TYPEMISMATCH
,
280 "ITypeComp_Bind should have failed with TYPE_E_TYPEMISMATCH instead of 0x%08x\n",
283 ok(desckind
== DESCKIND_NONE
,
284 "desckind should have been DESCKIND_NONE instead of %d\n",
286 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
287 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
289 /* test getting a TKIND_ENUM */
290 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszOLE_TRISTATE
);
291 hr
= ITypeComp_Bind(pTypeComp
, wszOLE_TRISTATE
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
292 ok_ole_success(hr
, ITypeComp_Bind
);
294 ok(desckind
== DESCKIND_TYPECOMP
,
295 "desckind should have been DESCKIND_TYPECOMP instead of %d\n",
297 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
299 ITypeComp_Release(bindptr
.lptcomp
);
301 /* test getting a value within a TKIND_ENUM */
302 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszUnchecked
);
303 hr
= ITypeComp_Bind(pTypeComp
, wszUnchecked
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
304 ok_ole_success(hr
, ITypeComp_Bind
);
306 ok(desckind
== DESCKIND_VARDESC
,
307 "desckind should have been DESCKIND_VARDESC instead of %d\n",
309 ITypeInfo_ReleaseVarDesc(pTypeInfo
, bindptr
.lpvardesc
);
310 ITypeInfo_Release(pTypeInfo
);
312 /* test getting a TKIND_INTERFACE */
313 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszIUnknown
);
314 hr
= ITypeComp_Bind(pTypeComp
, wszIUnknown
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
315 ok_ole_success(hr
, ITypeComp_Bind
);
317 ok(desckind
== DESCKIND_NONE
,
318 "desckind should have been DESCKIND_NONE instead of %d\n",
320 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
321 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
323 /* test getting a TKIND_DISPATCH */
324 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszFont
);
325 hr
= ITypeComp_Bind(pTypeComp
, wszFont
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
326 ok_ole_success(hr
, ITypeComp_Bind
);
328 ok(desckind
== DESCKIND_NONE
,
329 "desckind should have been DESCKIND_NONE instead of %d\n",
331 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
332 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
334 /* test getting a TKIND_RECORD/TKIND_ALIAS */
335 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
336 hr
= ITypeComp_Bind(pTypeComp
, wszGUID
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
337 ok_ole_success(hr
, ITypeComp_Bind
);
339 ok(desckind
== DESCKIND_NONE
,
340 "desckind should have been DESCKIND_NONE instead of %d\n",
342 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
343 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
345 /* test getting a TKIND_ALIAS */
346 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszOLE_COLOR
);
347 hr
= ITypeComp_Bind(pTypeComp
, wszOLE_COLOR
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
348 ok_ole_success(hr
, ITypeComp_Bind
);
350 ok(desckind
== DESCKIND_NONE
,
351 "desckind should have been DESCKIND_NONE instead of %d\n",
353 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
354 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
356 /* test getting a TKIND_COCLASS */
357 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszStdPicture
);
358 hr
= ITypeComp_Bind(pTypeComp
, wszStdPicture
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
359 ok_ole_success(hr
, ITypeComp_Bind
);
361 ok(desckind
== DESCKIND_NONE
,
362 "desckind should have been DESCKIND_NONE instead of %d\n",
364 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
365 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
367 /* test basic BindType argument handling */
368 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
369 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, NULL
, NULL
);
370 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
372 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
373 pTypeInfo
= (void*)0xdeadbeef;
374 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, &pTypeInfo
, NULL
);
375 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
376 ok(pTypeInfo
== (void*)0xdeadbeef, "Got %p\n", pTypeInfo
);
378 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
379 pTypeComp_tmp
= (void*)0xdeadbeef;
380 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, NULL
, &pTypeComp_tmp
);
381 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
382 ok(pTypeComp_tmp
== (void*)0xdeadbeef, "Got %p\n", pTypeComp_tmp
);
384 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
385 pTypeComp_tmp
= (void*)0xdeadbeef;
386 pTypeInfo
= (void*)0xdeadbeef;
387 hr
= ITypeComp_BindType(pTypeComp
, NULL
, ulHash
, &pTypeInfo
, &pTypeComp_tmp
);
388 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
389 ok(pTypeInfo
== (void*)0xdeadbeef, "Got %p\n", pTypeInfo
);
390 ok(pTypeComp_tmp
== (void*)0xdeadbeef, "Got %p\n", pTypeComp_tmp
);
392 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
393 pTypeComp_tmp
= (void*)0xdeadbeef;
394 pTypeInfo
= (void*)0xdeadbeef;
395 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, &pTypeInfo
, &pTypeComp_tmp
);
396 ok_ole_success(hr
, ITypeComp_BindType
);
397 ok(pTypeInfo
!= NULL
, "Got NULL pTypeInfo\n");
398 todo_wine
ok(pTypeComp_tmp
== NULL
, "Got pTypeComp_tmp %p\n", pTypeComp_tmp
);
399 ITypeInfo_Release(pTypeInfo
);
400 if(pTypeComp_tmp
) ITypeComp_Release(pTypeComp_tmp
); /* fixme */
402 /* test BindType case-insensitivity */
403 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszguid
);
404 pTypeComp_tmp
= (void*)0xdeadbeef;
405 pTypeInfo
= (void*)0xdeadbeef;
406 hr
= ITypeComp_BindType(pTypeComp
, wszguid
, ulHash
, &pTypeInfo
, &pTypeComp_tmp
);
407 ok_ole_success(hr
, ITypeComp_BindType
);
408 ok(pTypeInfo
!= NULL
, "Got NULL pTypeInfo\n");
409 todo_wine
ok(pTypeComp_tmp
== NULL
, "Got pTypeComp_tmp %p\n", pTypeComp_tmp
);
410 ITypeInfo_Release(pTypeInfo
);
411 if(pTypeComp_tmp
) ITypeComp_Release(pTypeComp_tmp
); /* fixme */
413 ITypeComp_Release(pTypeComp
);
415 /* tests for ITypeComp on an interface */
416 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IFont
, &pFontTypeInfo
);
417 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
419 hr
= ITypeInfo_GetTypeComp(pFontTypeInfo
, &pTypeComp
);
420 ok_ole_success(hr
, ITypeLib_GetTypeComp
);
422 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszClone
);
423 hr
= ITypeComp_Bind(pTypeComp
, wszClone
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
424 ok_ole_success(hr
, ITypeComp_Bind
);
426 ok(desckind
== DESCKIND_FUNCDESC
,
427 "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
429 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr.lpfuncdesc should not have been set to NULL\n");
430 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
431 ITypeInfo_Release(pTypeInfo
);
433 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszClone
);
434 hr
= ITypeComp_Bind(pTypeComp
, wszClone
, ulHash
, INVOKE_PROPERTYGET
, &pTypeInfo
, &desckind
, &bindptr
);
435 ok(hr
== TYPE_E_TYPEMISMATCH
, "ITypeComp_Bind should have failed with TYPE_E_TYPEMISMATCH instead of 0x%08x\n", hr
);
437 ok(desckind
== DESCKIND_NONE
,
438 "desckind should have been DESCKIND_NONE instead of %d\n",
440 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
441 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
443 /* tests that the compare is case-insensitive */
444 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszclone
);
445 hr
= ITypeComp_Bind(pTypeComp
, wszclone
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
446 ok_ole_success(hr
, ITypeComp_Bind
);
448 ok(desckind
== DESCKIND_FUNCDESC
,
449 "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
451 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr.lpfuncdesc should not have been set to NULL\n");
452 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
453 ITypeInfo_Release(pTypeInfo
);
455 /* tests nonexistent members */
456 desckind
= 0xdeadbeef;
457 bindptr
.lptcomp
= (ITypeComp
*)0xdeadbeef;
458 pTypeInfo
= (ITypeInfo
*)0xdeadbeef;
459 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszJunk
);
460 hr
= ITypeComp_Bind(pTypeComp
, wszJunk
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
461 ok_ole_success(hr
, ITypeComp_Bind
);
462 ok(desckind
== DESCKIND_NONE
, "desckind should have been DESCKIND_NONE, was: %d\n", desckind
);
463 ok(pTypeInfo
== NULL
, "pTypeInfo should have been NULL, was: %p\n", pTypeInfo
);
464 ok(bindptr
.lptcomp
== NULL
, "bindptr should have been NULL, was: %p\n", bindptr
.lptcomp
);
466 /* tests inherited members */
467 desckind
= 0xdeadbeef;
468 bindptr
.lpfuncdesc
= NULL
;
470 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszAddRef
);
471 hr
= ITypeComp_Bind(pTypeComp
, wszAddRef
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
472 ok_ole_success(hr
, ITypeComp_Bind
);
473 ok(desckind
== DESCKIND_FUNCDESC
, "desckind should have been DESCKIND_FUNCDESC, was: %d\n", desckind
);
474 ok(pTypeInfo
!= NULL
, "pTypeInfo should not have been NULL, was: %p\n", pTypeInfo
);
475 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr should not have been NULL, was: %p\n", bindptr
.lpfuncdesc
);
476 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
477 ITypeInfo_Release(pTypeInfo
);
479 ITypeComp_Release(pTypeComp
);
480 ITypeInfo_Release(pFontTypeInfo
);
481 ITypeLib_Release(pTypeLib
);
484 static void test_CreateDispTypeInfo(void)
486 ITypeInfo
*pTypeInfo
, *pTI2
;
488 INTERFACEDATA ifdata
;
489 METHODDATA methdata
[4];
497 static WCHAR func1
[] = {'f','u','n','c','1',0};
498 static const WCHAR func2
[] = {'f','u','n','c','2',0};
499 static const WCHAR func3
[] = {'f','u','n','c','3',0};
500 static const WCHAR parm1
[] = {'p','a','r','m','1',0};
501 static const WCHAR parm2
[] = {'p','a','r','m','2',0};
502 OLECHAR
*name
= func1
;
504 ifdata
.pmethdata
= methdata
;
505 ifdata
.cMembers
= sizeof(methdata
) / sizeof(methdata
[0]);
507 methdata
[0].szName
= SysAllocString(func1
);
508 methdata
[0].ppdata
= parms1
;
509 methdata
[0].dispid
= 0x123;
510 methdata
[0].iMeth
= 0;
511 methdata
[0].cc
= CC_STDCALL
;
512 methdata
[0].cArgs
= 2;
513 methdata
[0].wFlags
= DISPATCH_METHOD
;
514 methdata
[0].vtReturn
= VT_HRESULT
;
515 parms1
[0].szName
= SysAllocString(parm1
);
516 parms1
[0].vt
= VT_I4
;
517 parms1
[1].szName
= SysAllocString(parm2
);
518 parms1
[1].vt
= VT_BSTR
;
520 methdata
[1].szName
= SysAllocString(func2
);
521 methdata
[1].ppdata
= NULL
;
522 methdata
[1].dispid
= 0x124;
523 methdata
[1].iMeth
= 1;
524 methdata
[1].cc
= CC_STDCALL
;
525 methdata
[1].cArgs
= 0;
526 methdata
[1].wFlags
= DISPATCH_PROPERTYGET
;
527 methdata
[1].vtReturn
= VT_I4
;
529 methdata
[2].szName
= SysAllocString(func3
);
530 methdata
[2].ppdata
= parms3
;
531 methdata
[2].dispid
= 0x125;
532 methdata
[2].iMeth
= 3;
533 methdata
[2].cc
= CC_STDCALL
;
534 methdata
[2].cArgs
= 1;
535 methdata
[2].wFlags
= DISPATCH_PROPERTYPUT
;
536 methdata
[2].vtReturn
= VT_HRESULT
;
537 parms3
[0].szName
= SysAllocString(parm1
);
538 parms3
[0].vt
= VT_I4
;
540 methdata
[3].szName
= SysAllocString(func3
);
541 methdata
[3].ppdata
= NULL
;
542 methdata
[3].dispid
= 0x125;
543 methdata
[3].iMeth
= 4;
544 methdata
[3].cc
= CC_STDCALL
;
545 methdata
[3].cArgs
= 0;
546 methdata
[3].wFlags
= DISPATCH_PROPERTYGET
;
547 methdata
[3].vtReturn
= VT_I4
;
549 hr
= CreateDispTypeInfo(&ifdata
, LOCALE_NEUTRAL
, &pTypeInfo
);
550 ok(hr
== S_OK
, "hr %08x\n", hr
);
552 hr
= ITypeInfo_GetTypeAttr(pTypeInfo
, &pTypeAttr
);
553 ok(hr
== S_OK
, "hr %08x\n", hr
);
555 ok(pTypeAttr
->typekind
== TKIND_COCLASS
, "typekind %0x\n", pTypeAttr
->typekind
);
556 ok(pTypeAttr
->cImplTypes
== 1, "cImplTypes %d\n", pTypeAttr
->cImplTypes
);
557 ok(pTypeAttr
->cFuncs
== 0, "cFuncs %d\n", pTypeAttr
->cFuncs
);
558 ok(pTypeAttr
->wTypeFlags
== 0, "wTypeFlags %04x\n", pTypeAttr
->cFuncs
);
559 ITypeInfo_ReleaseTypeAttr(pTypeInfo
, pTypeAttr
);
561 hr
= ITypeInfo_GetRefTypeOfImplType(pTypeInfo
, 0, &href
);
562 ok(hr
== S_OK
, "hr %08x\n", hr
);
563 ok(href
== 0, "href = 0x%x\n", href
);
564 hr
= ITypeInfo_GetRefTypeInfo(pTypeInfo
, href
, &pTI2
);
565 ok(hr
== S_OK
, "hr %08x\n", hr
);
566 hr
= ITypeInfo_GetTypeAttr(pTI2
, &pTypeAttr
);
567 ok(hr
== S_OK
, "hr %08x\n", hr
);
568 ok(pTypeAttr
->typekind
== TKIND_INTERFACE
, "typekind %0x\n", pTypeAttr
->typekind
);
569 ok(pTypeAttr
->cFuncs
== 4, "cFuncs %d\n", pTypeAttr
->cFuncs
);
570 ok(IsEqualGUID(&pTypeAttr
->guid
, &GUID_NULL
), "guid {%08x-...}\n", pTypeAttr
->guid
.Data1
);
571 ok(pTypeAttr
->wTypeFlags
== 0, "typeflags %08x\n", pTypeAttr
->wTypeFlags
);
573 ITypeInfo_ReleaseTypeAttr(pTI2
, pTypeAttr
);
575 hr
= ITypeInfo_GetFuncDesc(pTI2
, 0, &pFuncDesc
);
576 ok(hr
== S_OK
, "hr %08x\n", hr
);
577 ok(pFuncDesc
->memid
== 0x123, "memid %x\n", pFuncDesc
->memid
);
578 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
579 ok(pFuncDesc
->invkind
== methdata
[0].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
580 ok(pFuncDesc
->callconv
== methdata
[0].cc
, "callconv %d\n", pFuncDesc
->callconv
);
581 ok(pFuncDesc
->cParams
== methdata
[0].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
582 ok(pFuncDesc
->oVft
== 0, "oVft %d\n", pFuncDesc
->oVft
);
583 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
584 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_HRESULT
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
585 ok(pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
== VT_I4
, "parm 0 vt %x\n", pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
);
586 ok(U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
== PARAMFLAG_NONE
, "parm 0 flags %x\n", U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
);
588 ok(pFuncDesc
->lprgelemdescParam
[1].tdesc
.vt
== VT_BSTR
, "parm 1 vt %x\n", pFuncDesc
->lprgelemdescParam
[1].tdesc
.vt
);
589 ok(U(pFuncDesc
->lprgelemdescParam
[1]).paramdesc
.wParamFlags
== PARAMFLAG_NONE
, "parm 1 flags %x\n", U(pFuncDesc
->lprgelemdescParam
[1]).paramdesc
.wParamFlags
);
590 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
592 hr
= ITypeInfo_GetFuncDesc(pTI2
, 1, &pFuncDesc
);
593 ok(hr
== S_OK
, "hr %08x\n", hr
);
594 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
595 ok(pFuncDesc
->invkind
== methdata
[1].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
596 ok(pFuncDesc
->callconv
== methdata
[1].cc
, "callconv %d\n", pFuncDesc
->callconv
);
597 ok(pFuncDesc
->cParams
== methdata
[1].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
598 ok(pFuncDesc
->oVft
== sizeof(void *), "oVft %d\n", pFuncDesc
->oVft
);
599 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
600 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_I4
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
601 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
603 hr
= ITypeInfo_GetFuncDesc(pTI2
, 2, &pFuncDesc
);
604 ok(hr
== S_OK
, "hr %08x\n", hr
);
605 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
606 ok(pFuncDesc
->invkind
== methdata
[2].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
607 ok(pFuncDesc
->callconv
== methdata
[2].cc
, "callconv %d\n", pFuncDesc
->callconv
);
608 ok(pFuncDesc
->cParams
== methdata
[2].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
609 ok(pFuncDesc
->oVft
== 3 * sizeof(void *), "oVft %d\n", pFuncDesc
->oVft
);
610 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
611 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_HRESULT
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
612 ok(pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
== VT_I4
, "parm 0 vt %x\n", pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
);
613 ok(U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
== PARAMFLAG_NONE
, "parm 0 flags %x\n", U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
);
614 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
616 hr
= ITypeInfo_GetFuncDesc(pTI2
, 3, &pFuncDesc
);
617 ok(hr
== S_OK
, "hr %08x\n", hr
);
618 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
619 ok(pFuncDesc
->invkind
== methdata
[3].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
620 ok(pFuncDesc
->callconv
== methdata
[3].cc
, "callconv %d\n", pFuncDesc
->callconv
);
621 ok(pFuncDesc
->cParams
== methdata
[3].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
622 ok(pFuncDesc
->oVft
== 4 * sizeof(void *), "oVft %d\n", pFuncDesc
->oVft
);
623 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
624 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_I4
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
625 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
627 /* test GetIDsOfNames on a coclass to see if it searches its interfaces */
628 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &name
, 1, &memid
);
629 ok(hr
== S_OK
, "hr 0x%08x\n", hr
);
630 ok(memid
== 0x123, "memid 0x%08x\n", memid
);
632 ITypeInfo_Release(pTI2
);
633 ITypeInfo_Release(pTypeInfo
);
635 SysFreeString(parms1
[0].szName
);
636 SysFreeString(parms1
[1].szName
);
637 SysFreeString(parms3
[0].szName
);
638 SysFreeString(methdata
[0].szName
);
639 SysFreeString(methdata
[1].szName
);
640 SysFreeString(methdata
[2].szName
);
641 SysFreeString(methdata
[3].szName
);
644 static void write_typelib(int res_no
, const char *filename
)
651 file
= CreateFileA( filename
, GENERIC_READ
|GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, 0 );
652 ok( file
!= INVALID_HANDLE_VALUE
, "file creation failed\n" );
653 if (file
== INVALID_HANDLE_VALUE
) return;
654 res
= FindResourceA( GetModuleHandleA(NULL
), (LPCSTR
)MAKEINTRESOURCE(res_no
), "TYPELIB" );
655 ok( res
!= 0, "couldn't find resource\n" );
656 ptr
= LockResource( LoadResource( GetModuleHandleA(NULL
), res
));
657 WriteFile( file
, ptr
, SizeofResource( GetModuleHandleA(NULL
), res
), &written
, NULL
);
658 ok( written
== SizeofResource( GetModuleHandleA(NULL
), res
), "couldn't write resource\n" );
662 static const char *create_test_typelib(int res_no
)
664 static char filename
[MAX_PATH
];
666 GetTempFileNameA( ".", "tlb", 0, filename
);
667 write_typelib(res_no
, filename
);
671 static void test_TypeInfo(void)
674 ITypeInfo
*pTypeInfo
, *ti
;
675 ITypeInfo2
*pTypeInfo2
;
677 static WCHAR wszBogus
[] = { 'b','o','g','u','s',0 };
678 static WCHAR wszGetTypeInfo
[] = { 'G','e','t','T','y','p','e','I','n','f','o',0 };
679 static WCHAR wszClone
[] = {'C','l','o','n','e',0};
680 OLECHAR
* bogus
= wszBogus
;
681 OLECHAR
* pwszGetTypeInfo
= wszGetTypeInfo
;
682 OLECHAR
* pwszClone
= wszClone
;
684 DISPPARAMS dispparams
;
685 GUID bogusguid
= {0x806afb4f,0x13f7,0x42d2,{0x89,0x2c,0x6c,0x97,0xc3,0x6a,0x36,0xc1}};
686 VARIANT var
, res
, args
[2];
689 const char *filenameA
;
690 WCHAR filename
[MAX_PATH
];
694 hr
= LoadTypeLib(wszStdOle2
, &pTypeLib
);
695 ok_ole_success(hr
, LoadTypeLib
);
697 count
= ITypeLib_GetTypeInfoCount(pTypeLib
);
698 ok(count
> 0, "got %d\n", count
);
701 hr
= ITypeLib_GetTypeInfo(pTypeLib
, count
, &pTypeInfo
);
702 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got 0x%08x\n", hr
);
704 hr
= ITypeLib_GetTypeInfo(pTypeLib
, 0, NULL
);
705 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
707 hr
= ITypeLib_GetLibAttr(pTypeLib
, NULL
);
708 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
710 hr
= ITypeLib_GetTypeInfoType(pTypeLib
, count
, &kind
);
711 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got 0x%08x\n", hr
);
713 hr
= ITypeLib_GetTypeInfoType(pTypeLib
, count
, NULL
);
714 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
716 hr
= ITypeLib_GetTypeInfoType(pTypeLib
, 0, NULL
);
717 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
719 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IFont
, &pTypeInfo
);
720 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
722 /* test nonexistent method name */
723 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &bogus
, 1, &dispidMember
);
724 ok(hr
== DISP_E_UNKNOWNNAME
,
725 "ITypeInfo_GetIDsOfNames should have returned DISP_E_UNKNOWNNAME instead of 0x%08x\n",
728 dispparams
.cArgs
= 0;
729 dispparams
.rgdispidNamedArgs
= NULL
;
730 dispparams
.rgvarg
= NULL
;
732 /* test dispparams not NULL */
734 /* invalid member id -- wrong flags -- cNamedArgs not bigger than cArgs */
735 dispparams
.cNamedArgs
= 0;
736 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
737 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
738 /* invalid member id -- correct flags -- cNamedArgs not bigger than cArgs */
739 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
740 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
742 /* invalid member id -- wrong flags -- cNamedArgs bigger than cArgs */
743 dispparams
.cNamedArgs
= 1;
744 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
745 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
746 /* invalid member id -- correct flags -- cNamedArgs bigger than cArgs */
747 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
748 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
751 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &pwszClone
, 1, &dispidMember
);
752 ok_ole_success(hr
, ITypeInfo_GetIDsOfNames
);
754 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
755 dispparams
.cNamedArgs
= 0;
756 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
757 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
758 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
759 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
760 ok(hr
== DISP_E_BADPARAMCOUNT
, "ITypeInfo_Invoke should have returned DISP_E_BADPARAMCOUNT instead of 0x%08x\n", hr
);
762 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
763 dispparams
.cNamedArgs
= 1;
764 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
765 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
766 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
767 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
768 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
770 /* test NULL dispparams */
772 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
773 dispparams
.cNamedArgs
= 0;
774 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
775 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
776 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
777 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
778 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
780 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
781 dispparams
.cNamedArgs
= 1;
782 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
783 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
784 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
785 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
786 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
788 ITypeInfo_Release(pTypeInfo
);
790 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IDispatch
, &pTypeInfo
);
791 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
793 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &pwszGetTypeInfo
, 1, &dispidMember
);
794 ok_ole_success(hr
, ITypeInfo_GetIDsOfNames
);
796 hr
= ITypeInfo_QueryInterface(pTypeInfo
, &IID_ITypeInfo2
, (void**)&pTypeInfo2
);
797 ok_ole_success(hr
, ITypeInfo_QueryInterface
);
805 /* test unknown guid passed to GetCustData */
806 hr
= ITypeInfo2_GetCustData(pTypeInfo2
, &bogusguid
, &var
);
807 ok_ole_success(hr
, ITypeInfo_GetCustData
);
808 ok(V_VT(&var
) == VT_EMPTY
, "got %i, expected VT_EMPTY\n", V_VT(&var
));
810 ITypeInfo2_Release(pTypeInfo2
);
815 /* Check instance size for IDispatch, typelib is loaded using system SYS_WIN* kind so it always matches
817 hr
= ITypeInfo_GetTypeAttr(pTypeInfo
, &attr
);
818 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
819 ok(attr
->cbSizeInstance
== sizeof(void*), "got size %d\n", attr
->cbSizeInstance
);
820 ok(attr
->typekind
== TKIND_INTERFACE
, "got typekind %d\n", attr
->typekind
);
821 ITypeInfo_ReleaseTypeAttr(pTypeInfo
, attr
);
823 /* same size check with some general interface */
824 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IEnumVARIANT
, &ti
);
825 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
826 hr
= ITypeInfo_GetTypeAttr(ti
, &attr
);
827 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
828 ok(attr
->cbSizeInstance
== sizeof(void*), "got size %d\n", attr
->cbSizeInstance
);
829 ITypeInfo_ReleaseTypeAttr(ti
, attr
);
830 ITypeInfo_Release(ti
);
832 /* test invoking a method with a [restricted] keyword */
834 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
835 dispparams
.cNamedArgs
= 0;
836 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
837 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
838 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
839 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
840 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
842 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
843 dispparams
.cNamedArgs
= 1;
844 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
845 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
846 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
847 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
848 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
850 /* test NULL dispparams */
852 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
853 dispparams
.cNamedArgs
= 0;
854 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
855 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
856 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
857 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
858 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
860 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
861 dispparams
.cNamedArgs
= 1;
862 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
863 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
864 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
865 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
866 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
868 ITypeInfo_Release(pTypeInfo
);
869 ITypeLib_Release(pTypeLib
);
871 filenameA
= create_test_typelib(3);
872 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filename
, MAX_PATH
);
873 hr
= LoadTypeLib(filename
, &pTypeLib
);
874 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
876 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IInvokeTest
, &pTypeInfo
);
877 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
879 dispparams
.cArgs
= 1;
880 dispparams
.cNamedArgs
= 0;
881 dispparams
.rgdispidNamedArgs
= NULL
;
882 dispparams
.rgvarg
= args
;
884 V_VT(&args
[0]) = VT_I4
;
888 V_VT(&res
) = VT_EMPTY
;
890 /* call propget with DISPATCH_METHOD|DISPATCH_PROPERTYGET flags */
891 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, DISPID_VALUE
, DISPATCH_METHOD
|DISPATCH_PROPERTYGET
,
892 &dispparams
, &res
, NULL
, &i
);
893 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
894 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
895 ok(V_I4(&res
) == 1, "got %d\n", V_I4(&res
));
898 /* call propget with DISPATCH_METHOD flags */
899 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, DISPID_VALUE
, DISPATCH_METHOD
,
900 &dispparams
, &res
, NULL
, &i
);
901 ok(hr
== DISP_E_MEMBERNOTFOUND
, "got 0x%08x, %d\n", hr
, i
);
904 V_VT(&res
) = VT_EMPTY
;
906 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, DISPID_VALUE
, DISPATCH_PROPERTYGET
,
907 &dispparams
, &res
, NULL
, &i
);
908 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
909 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
910 ok(V_I4(&res
) == 1, "got %d\n", V_I4(&res
));
912 /* DISPATCH_PROPERTYPUTREF */
914 V_VT(&args
[0]) = VT_I4
|VT_BYREF
;
915 V_I4REF(&args
[0]) = &l
;
917 dispidMember
= DISPID_PROPERTYPUT
;
918 dispparams
.cArgs
= 1;
919 dispparams
.cNamedArgs
= 1;
920 dispparams
.rgdispidNamedArgs
= &dispidMember
;
921 dispparams
.rgvarg
= args
;
924 V_VT(&res
) = VT_EMPTY
;
926 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 1, DISPATCH_PROPERTYPUTREF
, &dispparams
, &res
, NULL
, &i
);
927 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
928 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
929 ok(V_I4(&res
) == 3, "got %d\n", V_I4(&res
));
932 V_VT(&res
) = VT_EMPTY
;
934 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 1, DISPATCH_PROPERTYPUT
, &dispparams
, &res
, NULL
, &i
);
935 ok(hr
== DISP_E_MEMBERNOTFOUND
, "got 0x%08x, %d\n", hr
, i
);
938 V_VT(&args
[0]) = VT_UNKNOWN
;
939 V_UNKNOWN(&args
[0]) = NULL
;
941 V_VT(&res
) = VT_EMPTY
;
943 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 2, DISPATCH_PROPERTYPUTREF
, &dispparams
, &res
, NULL
, &i
);
944 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
945 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
946 ok(V_I4(&res
) == 6, "got %d\n", V_I4(&res
));
949 V_VT(&res
) = VT_EMPTY
;
951 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 2, DISPATCH_PROPERTYPUT
, &dispparams
, &res
, NULL
, &i
);
952 ok(hr
== DISP_E_MEMBERNOTFOUND
, "got 0x%08x, %d\n", hr
, i
);
954 ITypeInfo_Release(pTypeInfo
);
955 ITypeLib_Release(pTypeLib
);
956 DeleteFileA(filenameA
);
959 static int WINAPI
int_func( int a0
, int a1
, int a2
, int a3
, int a4
)
961 ok( a0
== 1, "wrong arg0 %x\n", a0
);
962 ok( a1
== -1, "wrong arg1 %x\n", a1
);
963 ok( a2
== (0x55550000 | 1234), "wrong arg2 %x\n", a2
);
964 ok( a3
== 0xdeadbeef, "wrong arg3 %x\n", a3
);
965 ok( a4
== 0x555555fd, "wrong arg4 %x\n", a4
);
969 static double WINAPI
double_func( double a0
, float a1
, double a2
, int a3
)
971 ok( a0
== 1.2, "wrong arg0 %f\n", (double)a0
);
972 ok( a1
== 3.25, "wrong arg1 %f\n", (double)a1
);
973 ok( a2
== 1.2e12
, "wrong arg2 %f\n", (double)a2
);
974 ok( a3
== -4433.0, "wrong arg3 %f\n", (double)a3
);
978 static LONGLONG WINAPI
longlong_func( LONGLONG a0
, CY a1
)
980 ok( a0
== (((ULONGLONG
)0xdead << 32) | 0xbeef), "wrong arg0 %08x%08x\n", (DWORD
)(a0
>> 32), (DWORD
)a0
);
981 ok( a1
.int64
== ((ULONGLONG
)10000 * 12345678), "wrong arg1 %08x%08x\n",
982 (DWORD
)(a1
.int64
>> 32), (DWORD
)a1
.int64
);
983 return ((ULONGLONG
)4321 << 32) | 8765;
986 static VARIANT WINAPI
variant_func( int a0
, BOOL a1
, DECIMAL a2
, VARIANT a3
)
989 ok( a0
== 2233, "wrong arg0 %x\n", a0
);
990 ok( a1
== 1 || broken(a1
== 0x55550001), "wrong arg1 %x\n", a1
);
991 V_VT(&var
) = VT_LPWSTR
;
992 V_UI4(&var
) = 0xbabe;
993 ok( a2
.Hi32
== 1122, "wrong arg2.Hi32 %x\n", a2
.Hi32
);
994 ok( U1(a2
).Lo64
== 3344, "wrong arg2.Lo64 %08x%08x\n", (DWORD
)(U1(a2
).Lo64
>> 32), (DWORD
)U1(a2
).Lo64
);
995 ok( V_VT(&a3
) == VT_EMPTY
, "wrong arg3 type %x\n", V_VT(&a3
) );
996 ok( V_UI4(&a3
) == 0xdeadbeef, "wrong arg3 value %x\n", V_UI4(&a3
) );
1000 static int CDECL
void_func( int a0
, int a1
)
1002 if (is_win64
) /* VT_EMPTY is passed as real arg on win64 */
1004 ok( a0
== 0x55555555, "wrong arg0 %x\n", a0
);
1005 ok( a1
== 1111, "wrong arg1 %x\n", a1
);
1009 ok( a0
== 1111, "wrong arg0 %x\n", a0
);
1010 ok( a1
== 0, "wrong arg1 %x\n", a1
);
1015 static int WINAPI
stdcall_func( int a
)
1020 static int WINAPI
inst_func( void *inst
, int a
)
1022 ok( (*(void ***)inst
)[3] == inst_func
, "wrong ptr %p\n", inst
);
1023 ok( a
== 3, "wrong arg %x\n", a
);
1027 static HRESULT WINAPI
ret_false_func(void)
1032 static const void *vtable
[] = { NULL
, NULL
, NULL
, inst_func
};
1034 static void test_DispCallFunc(void)
1036 const void **inst
= vtable
;
1038 VARIANT result
, args
[5];
1039 VARIANTARG
*pargs
[5];
1043 for (i
= 0; i
< 5; i
++) pargs
[i
] = &args
[i
];
1045 memset( args
, 0x55, sizeof(args
) );
1047 V_UI4(&args
[0]) = 1;
1049 V_I4(&args
[1]) = -1;
1051 V_I2(&args
[2]) = 1234;
1053 V_UI4(&args
[3]) = 0xdeadbeef;
1055 V_I1(&args
[4]) = -3;
1056 memset( &result
, 0xcc, sizeof(result
) );
1057 res
= DispCallFunc( NULL
, (ULONG_PTR
)int_func
, CC_STDCALL
, VT_UI4
, 5, types
, pargs
, &result
);
1058 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1059 ok( V_VT(&result
) == VT_UI4
, "wrong result type %d\n", V_VT(&result
) );
1060 ok( V_UI4(&result
) == 4321, "wrong result %u\n", V_UI4(&result
) );
1062 /* the function checks the argument sizes for stdcall */
1063 if (!is_win64
) /* no stdcall on 64-bit */
1065 res
= DispCallFunc( NULL
, (ULONG_PTR
)stdcall_func
, CC_STDCALL
, VT_UI4
, 0, types
, pargs
, &result
);
1066 ok( res
== DISP_E_BADCALLEE
, "DispCallFunc wrong error %x\n", res
);
1067 res
= DispCallFunc( NULL
, (ULONG_PTR
)stdcall_func
, CC_STDCALL
, VT_UI4
, 1, types
, pargs
, &result
);
1068 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1069 res
= DispCallFunc( NULL
, (ULONG_PTR
)stdcall_func
, CC_STDCALL
, VT_UI4
, 2, types
, pargs
, &result
);
1070 ok( res
== DISP_E_BADCALLEE
, "DispCallFunc wrong error %x\n", res
);
1073 memset( args
, 0x55, sizeof(args
) );
1075 V_R8(&args
[0]) = 1.2;
1077 V_R4(&args
[1]) = 3.25;
1079 V_R8(&args
[2]) = 1.2e12
;
1081 V_I4(&args
[3]) = -4433;
1082 memset( &result
, 0xcc, sizeof(result
) );
1083 res
= DispCallFunc( NULL
, (ULONG_PTR
)double_func
, CC_STDCALL
, VT_R8
, 4, types
, pargs
, &result
);
1084 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1085 ok( V_VT(&result
) == VT_R8
, "wrong result type %d\n", V_VT(&result
) );
1086 ok( V_R8(&result
) == 4321, "wrong result %f\n", V_R8(&result
) );
1088 memset( args
, 0x55, sizeof(args
) );
1090 V_I8(&args
[0]) = ((ULONGLONG
)0xdead << 32) | 0xbeef;
1092 V_CY(&args
[1]).int64
= (ULONGLONG
)10000 * 12345678;
1093 memset( &result
, 0xcc, sizeof(result
) );
1094 res
= DispCallFunc( NULL
, (ULONG_PTR
)longlong_func
, CC_STDCALL
, VT_I8
, 2, types
, pargs
, &result
);
1095 ok( res
== S_OK
|| broken(res
== E_INVALIDARG
), /* longlong not supported on <= win2k */
1096 "DispCallFunc failed %x\n", res
);
1099 ok( V_VT(&result
) == VT_I8
, "wrong result type %d\n", V_VT(&result
) );
1100 ok( V_I8(&result
) == (((ULONGLONG
)4321 << 32) | 8765), "wrong result %08x%08x\n",
1101 (DWORD
)(V_I8(&result
) >> 32), (DWORD
)V_I8(&result
) );
1104 memset( args
, 0x55, sizeof(args
) );
1106 V_I4(&args
[0]) = 2233;
1108 V_BOOL(&args
[1]) = 1;
1109 types
[2] = VT_DECIMAL
;
1110 V_DECIMAL(&args
[2]).Hi32
= 1122;
1111 U1(V_DECIMAL(&args
[2])).Lo64
= 3344;
1112 types
[3] = VT_VARIANT
;
1113 V_VT(&args
[3]) = VT_EMPTY
;
1114 V_UI4(&args
[3]) = 0xdeadbeef;
1115 types
[4] = VT_EMPTY
;
1116 memset( &result
, 0xcc, sizeof(result
) );
1117 res
= DispCallFunc( NULL
, (ULONG_PTR
)variant_func
, CC_STDCALL
, VT_VARIANT
, 5, types
, pargs
, &result
);
1118 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1119 ok( V_VT(&result
) == VT_LPWSTR
, "wrong result type %d\n", V_VT(&result
) );
1120 ok( V_UI4(&result
) == 0xbabe, "wrong result %08x\n", V_UI4(&result
) );
1122 memset( args
, 0x55, sizeof(args
) );
1123 types
[0] = VT_EMPTY
;
1125 V_I4(&args
[1]) = 1111;
1126 types
[2] = VT_EMPTY
;
1129 types
[4] = VT_EMPTY
;
1130 memset( &result
, 0xcc, sizeof(result
) );
1131 res
= DispCallFunc( NULL
, (ULONG_PTR
)void_func
, CC_CDECL
, VT_EMPTY
, 5, types
, pargs
, &result
);
1132 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1133 ok( V_VT(&result
) == VT_EMPTY
, "wrong result type %d\n", V_VT(&result
) );
1135 ok( V_UI4(&result
) == 12, "wrong result %08x\n", V_UI4(&result
) );
1137 ok( V_UI4(&result
) == 0xcccccccc, "wrong result %08x\n", V_UI4(&result
) );
1139 memset( args
, 0x55, sizeof(args
) );
1142 memset( &result
, 0xcc, sizeof(result
) );
1143 res
= DispCallFunc( &inst
, 3 * sizeof(void*), CC_STDCALL
, VT_I4
, 1, types
, pargs
, &result
);
1144 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1145 ok( V_VT(&result
) == VT_I4
, "wrong result type %d\n", V_VT(&result
) );
1146 ok( V_I4(&result
) == 6, "wrong result %08x\n", V_I4(&result
) );
1148 memset( &result
, 0xcc, sizeof(result
) );
1149 res
= DispCallFunc(NULL
, (ULONG_PTR
)ret_false_func
, CC_STDCALL
, VT_ERROR
, 0, NULL
, NULL
, &result
);
1150 ok(res
== S_OK
, "DispCallFunc failed: %08x\n", res
);
1151 ok(V_VT(&result
) == VT_ERROR
, "V_VT(result) = %u\n", V_VT(&result
));
1152 ok(V_ERROR(&result
) == S_FALSE
, "V_ERROR(result) = %08x\n", V_ERROR(&result
));
1154 memset( &result
, 0xcc, sizeof(result
) );
1155 res
= DispCallFunc(NULL
, (ULONG_PTR
)ret_false_func
, CC_STDCALL
, VT_HRESULT
, 0, NULL
, NULL
, &result
);
1156 ok(res
== E_INVALIDARG
, "DispCallFunc failed: %08x\n", res
);
1157 ok(V_VT(&result
) == 0xcccc, "V_VT(result) = %u\n", V_VT(&result
));
1160 /* RegDeleteTreeW from dlls/advapi32/registry.c, plus additional view flag */
1161 static LSTATUS
myRegDeleteTreeW(HKEY hKey
, LPCWSTR lpszSubKey
, REGSAM view
)
1164 DWORD dwMaxSubkeyLen
, dwMaxValueLen
;
1165 DWORD dwMaxLen
, dwSize
;
1166 WCHAR szNameBuf
[MAX_PATH
], *lpszName
= szNameBuf
;
1167 HKEY hSubKey
= hKey
;
1168 view
&= (KEY_WOW64_64KEY
| KEY_WOW64_32KEY
);
1172 ret
= RegOpenKeyExW(hKey
, lpszSubKey
, 0, KEY_READ
| view
, &hSubKey
);
1173 if (ret
) return ret
;
1176 ret
= RegQueryInfoKeyW(hSubKey
, NULL
, NULL
, NULL
, NULL
,
1177 &dwMaxSubkeyLen
, NULL
, NULL
, &dwMaxValueLen
, NULL
, NULL
, NULL
);
1178 if (ret
) goto cleanup
;
1182 dwMaxLen
= max(dwMaxSubkeyLen
, dwMaxValueLen
);
1183 if (dwMaxLen
> sizeof(szNameBuf
)/sizeof(WCHAR
))
1185 /* Name too big: alloc a buffer for it */
1186 if (!(lpszName
= HeapAlloc( GetProcessHeap(), 0, dwMaxLen
*sizeof(WCHAR
))))
1188 ret
= ERROR_NOT_ENOUGH_MEMORY
;
1193 /* Recursively delete all the subkeys */
1197 if (RegEnumKeyExW(hSubKey
, 0, lpszName
, &dwSize
, NULL
,
1198 NULL
, NULL
, NULL
)) break;
1200 ret
= myRegDeleteTreeW(hSubKey
, lpszName
, view
);
1201 if (ret
) goto cleanup
;
1205 if (pRegDeleteKeyExW
&& view
!= 0)
1206 ret
= pRegDeleteKeyExW(hKey
, lpszSubKey
, view
, 0);
1208 ret
= RegDeleteKeyW(hKey
, lpszSubKey
);
1213 if (RegEnumValueW(hKey
, 0, lpszName
, &dwSize
,
1214 NULL
, NULL
, NULL
, NULL
)) break;
1216 ret
= RegDeleteValueW(hKey
, lpszName
);
1217 if (ret
) goto cleanup
;
1221 if (lpszName
!= szNameBuf
)
1222 HeapFree(GetProcessHeap(), 0, lpszName
);
1224 RegCloseKey(hSubKey
);
1228 static BOOL
do_typelib_reg_key(GUID
*uid
, WORD maj
, WORD min
, DWORD arch
, LPCWSTR base
, BOOL remove
)
1230 static const WCHAR typelibW
[] = {'T','y','p','e','l','i','b','\\',0};
1231 static const WCHAR formatW
[] = {'\\','%','u','.','%','u','\\','0','\\','w','i','n','%','u',0};
1232 static const WCHAR format2W
[] = {'%','s','_','%','u','_','%','u','.','d','l','l',0};
1238 memcpy(buf
, typelibW
, sizeof(typelibW
));
1239 StringFromGUID2(uid
, buf
+ lstrlenW(buf
), 40);
1243 ok(myRegDeleteTreeW(HKEY_CLASSES_ROOT
, buf
, 0) == ERROR_SUCCESS
, "SHDeleteKey failed\n");
1247 wsprintfW(buf
+ lstrlenW(buf
), formatW
, maj
, min
, arch
);
1249 SetLastError(0xdeadbeef);
1250 res
= RegCreateKeyExW(HKEY_CLASSES_ROOT
, buf
, 0, NULL
, 0,
1251 KEY_WRITE
, NULL
, &hkey
, NULL
);
1252 if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
)
1254 win_skip("W-calls are not implemented\n");
1258 if (res
!= ERROR_SUCCESS
)
1260 trace("RegCreateKeyExW failed: %u\n", res
);
1264 wsprintfW(buf
, format2W
, base
, maj
, min
);
1265 if (RegSetValueExW(hkey
, NULL
, 0, REG_SZ
,
1266 (BYTE
*)buf
, (lstrlenW(buf
) + 1) * sizeof(WCHAR
)) != ERROR_SUCCESS
)
1268 trace("RegSetValueExW failed\n");
1275 static void test_QueryPathOfRegTypeLib(DWORD arch
)
1277 static const struct test_data
1281 const WCHAR path
[16];
1283 { 1, 0, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1284 { 3, 0, S_OK
, {'f','a','k','e','_','3','_','0','.','d','l','l',0 } },
1285 { 3, 1, S_OK
, {'f','a','k','e','_','3','_','1','.','d','l','l',0 } },
1286 { 3, 22, S_OK
, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
1287 { 3, 37, S_OK
, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
1288 { 3, 40, S_OK
, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
1289 { 0xffff, 0xffff, S_OK
, {'f','a','k','e','_','5','_','3','7','.','d','l','l',0 } },
1290 { 0xffff, 0, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1291 { 3, 0xffff, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1292 { 5, 0xffff, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1293 { 4, 0, TYPE_E_LIBNOTREGISTERED
, { 0 } }
1295 static const WCHAR base
[] = {'f','a','k','e',0};
1296 static const WCHAR wrongW
[] = {'w','r','o','n','g',0};
1304 status
= UuidCreate(&uid
);
1305 ok(!status
|| status
== RPC_S_UUID_LOCAL_ONLY
, "UuidCreate error %08x\n", status
);
1307 StringFromGUID2(&uid
, uid_str
, 40);
1308 /*trace("GUID: %s\n", wine_dbgstr_w(uid_str));*/
1310 if (!do_typelib_reg_key(&uid
, 3, 0, arch
, base
, FALSE
)) return;
1311 if (!do_typelib_reg_key(&uid
, 3, 1, arch
, base
, FALSE
)) return;
1312 if (!do_typelib_reg_key(&uid
, 3, 37, arch
, base
, FALSE
)) return;
1313 if (!do_typelib_reg_key(&uid
, 5, 37, arch
, base
, FALSE
)) return;
1314 if (arch
== 64 && !do_typelib_reg_key(&uid
, 5, 37, 32, wrongW
, FALSE
)) return;
1316 for (i
= 0; i
< sizeof(td
)/sizeof(td
[0]); i
++)
1318 ret
= QueryPathOfRegTypeLib(&uid
, td
[i
].maj
, td
[i
].min
, LOCALE_NEUTRAL
, &path
);
1319 ok(ret
== td
[i
].ret
, "QueryPathOfRegTypeLib(%u.%u) returned %08x\n", td
[i
].maj
, td
[i
].min
, ret
);
1322 ok(!lstrcmpW(td
[i
].path
, path
), "typelib %u.%u path doesn't match\n", td
[i
].maj
, td
[i
].min
);
1323 SysFreeString(path
);
1327 do_typelib_reg_key(&uid
, 0, 0, arch
, NULL
, TRUE
);
1330 static void test_inheritance(void)
1334 ITypeInfo
*pTI
, *pTI_p
;
1338 WCHAR path
[MAX_PATH
];
1339 CHAR pathA
[MAX_PATH
];
1340 static const WCHAR tl_path
[] = {'.','\\','m','i','d','l','_','t','m','a','r','s','h','a','l','.','t','l','b',0};
1342 BOOL use_midl_tlb
= FALSE
;
1344 GetModuleFileNameA(NULL
, pathA
, MAX_PATH
);
1345 MultiByteToWideChar(CP_ACP
, 0, pathA
, -1, path
, MAX_PATH
);
1348 memcpy(path
, tl_path
, sizeof(tl_path
));
1350 hr
= LoadTypeLib(path
, &pTL
);
1351 if(FAILED(hr
)) return;
1354 /* ItestIF3 is a syntax 2 dispinterface */
1355 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF3
, &pTI
);
1356 ok(hr
== S_OK
, "hr %08x\n", hr
);
1358 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1359 ok(hr
== S_OK
, "hr %08x\n", hr
);
1360 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1361 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1362 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1364 ok(pTA
->cFuncs
== 6, "cfuncs %d\n", pTA
->cFuncs
);
1365 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1367 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1370 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1371 ok(hr
== S_OK
, "hr %08x\n", hr
);
1372 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1373 ok(hr
== S_OK
, "hr %08x\n", hr
);
1374 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1375 ok(hr
== S_OK
, "got %08x\n", hr
);
1376 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1377 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1378 ITypeInfo_Release(pTI_p
);
1380 /* Should have six methods */
1381 hr
= ITypeInfo_GetFuncDesc(pTI
, 6, &pFD
);
1382 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1383 hr
= ITypeInfo_GetFuncDesc(pTI
, 5, &pFD
);
1384 ok(hr
== S_OK
, "hr %08x\n", hr
);
1385 ok(pFD
->memid
== 0x60020000, "memid %08x\n", pFD
->memid
);
1386 ok(pFD
->oVft
== 5 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1387 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1389 ITypeInfo_Release(pTI
);
1392 /* ItestIF4 is a syntax 1 dispinterface */
1393 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF4
, &pTI
);
1394 ok(hr
== S_OK
, "hr %08x\n", hr
);
1396 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1397 ok(hr
== S_OK
, "hr %08x\n", hr
);
1398 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1399 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1400 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1401 ok(pTA
->cFuncs
== 1, "cfuncs %d\n", pTA
->cFuncs
);
1402 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1403 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1405 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1406 ok(hr
== S_OK
, "hr %08x\n", hr
);
1407 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1408 ok(hr
== S_OK
, "hr %08x\n", hr
);
1409 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1410 ok(hr
== S_OK
, "got %08x\n", hr
);
1411 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1412 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1413 ITypeInfo_Release(pTI_p
);
1414 hr
= ITypeInfo_GetFuncDesc(pTI
, 1, &pFD
);
1415 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1416 hr
= ITypeInfo_GetFuncDesc(pTI
, 0, &pFD
);
1417 ok(hr
== S_OK
, "hr %08x\n", hr
);
1418 ok(pFD
->memid
== 0x1c, "memid %08x\n", pFD
->memid
);
1419 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1420 ITypeInfo_Release(pTI
);
1423 /* ItestIF5 is dual with inherited ifaces which derive from IUnknown but not IDispatch */
1424 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF5
, &pTI
);
1425 ok(hr
== S_OK
, "hr %08x\n", hr
);
1427 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1428 ok(hr
== S_OK
, "hr %08x\n", hr
);
1431 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1432 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1434 ok(pTA
->wTypeFlags
== TYPEFLAG_FDUAL
, "typeflags %x\n", pTA
->wTypeFlags
);
1436 ok(pTA
->cFuncs
== 8, "cfuncs %d\n", pTA
->cFuncs
);
1437 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1438 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1440 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1441 ok(hr
== S_OK
, "hr %08x\n", hr
);
1442 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1443 ok(hr
== S_OK
, "hr %08x\n", hr
);
1444 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1445 ok(hr
== S_OK
, "got %08x\n", hr
);
1446 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1447 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1448 ITypeInfo_Release(pTI_p
);
1450 hr
= ITypeInfo_GetFuncDesc(pTI
, 6, &pFD
);
1451 ok(hr
== S_OK
, "hr %08x\n", hr
);
1452 ok(pFD
->memid
== 0x1234, "memid %08x\n", pFD
->memid
);
1453 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1455 ITypeInfo_Release(pTI
);
1457 /* ItestIF7 is dual with inherited ifaces which derive from Dispatch */
1458 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF7
, &pTI
);
1459 ok(hr
== S_OK
, "hr %08x\n", hr
);
1461 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1462 ok(hr
== S_OK
, "hr %08x\n", hr
);
1463 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1464 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1465 ok(pTA
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "typeflags %x\n", pTA
->wTypeFlags
);
1466 ok(pTA
->cFuncs
== 10, "cfuncs %d\n", pTA
->cFuncs
);
1467 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1468 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1470 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1471 ok(hr
== S_OK
, "hr %08x\n", hr
);
1472 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1473 ok(hr
== S_OK
, "hr %08x\n", hr
);
1474 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1475 ok(hr
== S_OK
, "got %08x\n", hr
);
1476 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1477 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1478 ITypeInfo_Release(pTI_p
);
1480 hr
= ITypeInfo_GetFuncDesc(pTI
, 9, &pFD
);
1481 ok(hr
== S_OK
, "hr %08x\n", hr
);
1482 ok(pFD
->memid
== 0x1236, "memid %08x\n", pFD
->memid
);
1483 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1484 ITypeInfo_Release(pTI
);
1486 /* ItestIF10 is a syntax 2 dispinterface which doesn't derive from IUnknown */
1487 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF10
, &pTI
);
1488 ok(hr
== S_OK
, "hr %08x\n", hr
);
1490 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1491 ok(hr
== S_OK
, "hr %08x\n", hr
);
1492 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1493 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1494 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1496 ok(pTA
->cFuncs
== 3, "cfuncs %d\n", pTA
->cFuncs
);
1497 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1499 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1502 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, -1, &href
);
1503 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1504 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1505 ok(hr
== S_OK
, "hr %08x\n", hr
);
1506 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1507 ok(hr
== S_OK
, "hr %08x\n", hr
);
1508 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1509 ok(hr
== S_OK
, "got %08x\n", hr
);
1510 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1511 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1512 ITypeInfo_Release(pTI_p
);
1514 /* Should have three methods */
1515 hr
= ITypeInfo_GetFuncDesc(pTI
, 3, &pFD
);
1516 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1517 hr
= ITypeInfo_GetFuncDesc(pTI
, 2, &pFD
);
1518 ok(hr
== S_OK
, "hr %08x\n", hr
);
1519 ok(pFD
->memid
== 0x60010000, "memid %08x\n", pFD
->memid
);
1520 ok(pFD
->oVft
== 2 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1521 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1523 ITypeInfo_Release(pTI
);
1525 /* ItestIF11 is a syntax 2 dispinterface which derives from IDispatch */
1526 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF11
, &pTI
);
1527 ok(hr
== S_OK
, "hr %08x\n", hr
);
1529 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1530 ok(hr
== S_OK
, "hr %08x\n", hr
);
1531 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1532 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1533 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1535 ok(pTA
->cFuncs
== 10, "cfuncs %d\n", pTA
->cFuncs
);
1536 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1538 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1541 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1542 ok(hr
== S_OK
, "hr %08x\n", hr
);
1543 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1544 ok(hr
== S_OK
, "hr %08x\n", hr
);
1545 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1546 ok(hr
== S_OK
, "got %08x\n", hr
);
1547 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1548 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1549 ITypeInfo_Release(pTI_p
);
1551 /* Should have ten methods */
1552 hr
= ITypeInfo_GetFuncDesc(pTI
, 10, &pFD
);
1553 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1554 hr
= ITypeInfo_GetFuncDesc(pTI
, 9, &pFD
);
1555 ok(hr
== S_OK
, "hr %08x\n", hr
);
1556 ok(pFD
->memid
== 0x1236, "memid %08x\n", pFD
->memid
);
1557 ok(pFD
->oVft
== 9 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1559 /* first argument to 10th function is an HREFTYPE from the impl type */
1560 ok(pFD
->cParams
== 1, "cParams %i\n", pFD
->cParams
);
1561 ok(pFD
->lprgelemdescParam
[0].tdesc
.vt
== VT_USERDEFINED
,
1562 "vt 0x%x\n", pFD
->lprgelemdescParam
[0].tdesc
.vt
);
1563 href
= U(pFD
->lprgelemdescParam
[0].tdesc
).hreftype
;
1564 ok((href
& 0xff000000) == 0x04000000, "href 0x%08x\n", href
);
1565 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1566 ok(hr
== S_OK
, "hr %08x\n", hr
);
1567 if (SUCCEEDED(hr
)) ITypeInfo_Release(pTI_p
);
1568 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1570 ITypeInfo_Release(pTI
);
1573 /* ItestIF2 is an interface which derives from IUnknown */
1574 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF2
, &pTI
);
1575 ok(hr
== S_OK
, "hr %08x\n", hr
);
1577 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1578 ok(hr
== S_OK
, "hr %08x\n", hr
);
1579 ok(pTA
->typekind
== TKIND_INTERFACE
, "kind %04x\n", pTA
->typekind
);
1580 ok(pTA
->cbSizeVft
== 6 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1581 ok(pTA
->wTypeFlags
== 0, "typeflags %x\n", pTA
->wTypeFlags
);
1583 ok(pTA
->cFuncs
== 1, "cfuncs %d\n", pTA
->cFuncs
);
1584 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1586 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1589 /* Should have one method */
1590 hr
= ITypeInfo_GetFuncDesc(pTI
, 1, &pFD
);
1591 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1592 hr
= ITypeInfo_GetFuncDesc(pTI
, 0, &pFD
);
1593 ok(hr
== S_OK
, "hr %08x\n", hr
);
1594 ok(pFD
->memid
== 0x60020000, "memid %08x\n", pFD
->memid
);
1595 ok(pFD
->oVft
== 5 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1596 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1598 ITypeInfo_Release(pTI
);
1600 ITypeLib_Release(pTL
);
1605 static void test_CreateTypeLib(SYSKIND sys
) {
1606 static OLECHAR typelibW
[] = {'t','y','p','e','l','i','b',0};
1607 static OLECHAR helpfileW
[] = {'C',':','\\','b','o','g','u','s','.','h','l','p',0};
1608 static OLECHAR interface1W
[] = {'i','n','t','e','r','f','a','c','e','1',0};
1609 static OLECHAR interface2W
[] = {'i','n','t','e','r','f','a','c','e','2',0};
1610 static OLECHAR interface3W
[] = {'i','n','t','e','r','f','a','c','e','3',0};
1611 static OLECHAR dualW
[] = {'d','u','a','l',0};
1612 static OLECHAR coclassW
[] = {'c','o','c','l','a','s','s',0};
1613 static const WCHAR defaultW
[] = {'d','e','f','a','u','l','t',0x3213,0};
1614 static const WCHAR defaultQW
[] = {'d','e','f','a','u','l','t','?',0};
1615 static OLECHAR func1W
[] = {'f','u','n','c','1',0};
1616 static OLECHAR func2W
[] = {'f','u','n','c','2',0};
1617 static OLECHAR prop1W
[] = {'P','r','o','p','1',0};
1618 static OLECHAR param1W
[] = {'p','a','r','a','m','1',0};
1619 static OLECHAR param2W
[] = {'p','a','r','a','m','2',0};
1620 static OLECHAR asdfW
[] = {'A','s','d','f',0};
1621 static OLECHAR aliasW
[] = {'a','l','i','a','s',0};
1622 static OLECHAR invokeW
[] = {'I','n','v','o','k','e',0};
1623 static OLECHAR
*names1
[] = {func1W
, param1W
, param2W
};
1624 static OLECHAR
*names2
[] = {func2W
, param1W
, param2W
};
1625 static OLECHAR
*propname
[] = {prop1W
, param1W
};
1626 static const GUID custguid
= {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x70}};
1627 static const GUID bogusguid
= {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x71}};
1628 static const GUID interfaceguid
= {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
1629 static const GUID interface2guid
= {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcd}};
1631 char filename
[MAX_PATH
];
1632 WCHAR filenameW
[MAX_PATH
];
1633 ICreateTypeLib2
*createtl
;
1634 ICreateTypeInfo
*createti
;
1635 ICreateTypeInfo2
*createti2
;
1636 ITypeLib
*tl
, *stdole
;
1637 ITypeInfo
*interface1
, *interface2
, *dual
, *unknown
, *dispatch
, *ti
;
1638 ITypeInfo
*tinfos
[2];
1642 FUNCDESC funcdesc
, *pfuncdesc
;
1643 ELEMDESC elemdesc
[5], *edesc
;
1644 PARAMDESCEX paramdescex
;
1645 TYPEDESC typedesc1
, typedesc2
;
1649 BSTR name
, docstring
, helpfile
, names
[3];
1650 DWORD helpcontext
, ptr_size
, alignment
;
1652 unsigned int cnames
;
1662 trace("testing SYS_WIN32\n");
1664 alignment
= sizeof(void*);
1667 trace("testing SYS_WIN64\n");
1675 trace("CreateTypeLib tests\n");
1677 hres
= LoadTypeLib(wszStdOle2
, &stdole
);
1678 ok(hres
== S_OK
, "got %08x\n", hres
);
1680 hres
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IUnknown
, &unknown
);
1681 ok(hres
== S_OK
, "got %08x\n", hres
);
1683 hres
= ITypeInfo_GetTypeAttr(unknown
, &typeattr
);
1684 ok(hres
== S_OK
, "got %08x\n", hres
);
1685 ok(typeattr
->cbSizeVft
== 3 * sizeof(void*), "Got wrong cbSizeVft: %u\n", typeattr
->cbSizeVft
);
1686 ITypeInfo_ReleaseTypeAttr(unknown
, typeattr
);
1688 hres
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IDispatch
, &dispatch
);
1689 ok(hres
== S_OK
, "got %08x\n", hres
);
1691 GetTempFileNameA(".", "tlb", 0, filename
);
1692 MultiByteToWideChar(CP_ACP
, 0, filename
, -1, filenameW
, MAX_PATH
);
1694 hres
= CreateTypeLib2(sys
, filenameW
, &createtl
);
1695 ok(hres
== S_OK
, "got %08x\n", hres
);
1697 hres
= ICreateTypeLib2_QueryInterface(createtl
, &IID_ITypeLib
, (void**)&tl
);
1698 ok(hres
== S_OK
, "got %08x\n", hres
);
1700 hres
= ITypeLib_GetTypeInfo(tl
, 0, NULL
);
1701 ok(hres
== E_INVALIDARG
, "got 0x%08x\n", hres
);
1703 hres
= ITypeLib_GetTypeInfoType(tl
, 0, &kind
);
1704 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got 0x%08x\n", hres
);
1706 hres
= ITypeLib_GetTypeInfoType(tl
, 0, NULL
);
1707 ok(hres
== E_INVALIDARG
, "got 0x%08x\n", hres
);
1709 hres
= ITypeLib_GetTypeInfoType(tl
, 0, NULL
);
1710 ok(hres
== E_INVALIDARG
, "got 0x%08x\n", hres
);
1712 hres
= ITypeLib_GetLibAttr(tl
, NULL
);
1713 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1715 hres
= ITypeLib_GetLibAttr(tl
, &libattr
);
1716 ok(hres
== S_OK
, "got %08x\n", hres
);
1718 ok(libattr
->syskind
== sys
, "syskind = %d\n", libattr
->syskind
);
1719 ok(libattr
->wMajorVerNum
== 0, "wMajorVer = %d\n", libattr
->wMajorVerNum
);
1720 ok(libattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", libattr
->wMinorVerNum
);
1721 ok(libattr
->wLibFlags
== 0, "wLibFlags = %d\n", libattr
->wLibFlags
);
1723 ITypeLib_ReleaseTLibAttr(tl
, libattr
);
1725 name
= (BSTR
)0xdeadbeef;
1726 hres
= ITypeLib_GetDocumentation(tl
, -1, &name
, &docstring
, &helpcontext
, &helpfile
);
1727 ok(hres
== S_OK
, "got %08x\n", hres
);
1728 ok(name
== NULL
, "name != NULL\n");
1729 ok(docstring
== NULL
, "docstring != NULL\n");
1730 ok(helpcontext
== 0, "helpcontext != 0\n");
1731 ok(helpfile
== NULL
, "helpfile != NULL\n");
1733 hres
= ITypeLib_GetDocumentation(tl
, 0, &name
, NULL
, NULL
, NULL
);
1734 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1736 hres
= ICreateTypeLib2_SetName(createtl
, typelibW
);
1737 ok(hres
== S_OK
, "got %08x\n", hres
);
1739 hres
= ICreateTypeLib2_SetHelpFileName(createtl
, helpfileW
);
1740 ok(hres
== S_OK
, "got %08x\n", hres
);
1742 hres
= ITypeLib_GetDocumentation(tl
, -1, NULL
, NULL
, NULL
, NULL
);
1743 ok(hres
== S_OK
, "got %08x\n", hres
);
1745 hres
= ITypeLib_GetDocumentation(tl
, -1, &name
, NULL
, NULL
, &helpfile
);
1746 ok(hres
== S_OK
, "got %08x\n", hres
);
1747 ok(!memcmp(name
, typelibW
, sizeof(typelibW
)), "name = %s\n", wine_dbgstr_w(name
));
1748 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "helpfile = %s\n", wine_dbgstr_w(helpfile
));
1750 SysFreeString(name
);
1751 SysFreeString(helpfile
);
1753 /* invalid parameters */
1754 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, NULL
, TKIND_INTERFACE
, &createti
);
1755 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1757 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, NULL
);
1758 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1760 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, NULL
, TKIND_INTERFACE
, NULL
);
1761 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1763 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, &createti
);
1764 ok(hres
== S_OK
, "got %08x\n", hres
);
1766 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&interface1
);
1767 ok(hres
== S_OK
, "got %08x\n", hres
);
1769 hres
= ITypeLib_GetDocumentation(tl
, 0, &name
, NULL
, NULL
, NULL
);
1770 ok(hres
== S_OK
, "got %08x\n", hres
);
1771 ok(!memcmp(name
, interface1W
, sizeof(interface1W
)), "name = %s\n", wine_dbgstr_w(name
));
1773 SysFreeString(name
);
1775 ITypeLib_Release(tl
);
1777 name
= (BSTR
)0xdeadbeef;
1778 helpfile
= (BSTR
)0xdeadbeef;
1779 hres
= ITypeInfo_GetDocumentation(interface1
, -1, &name
, &docstring
, &helpcontext
, &helpfile
);
1780 ok(hres
== S_OK
, "got %08x\n", hres
);
1781 ok(!memcmp(name
, interface1W
, sizeof(interface1W
)), "name = %s\n", wine_dbgstr_w(name
));
1782 ok(docstring
== NULL
, "docstring != NULL\n");
1783 ok(helpcontext
== 0, "helpcontext != 0\n");
1784 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "helpfile = %s\n", wine_dbgstr_w(helpfile
));
1786 SysFreeString(name
);
1787 SysFreeString(helpfile
);
1789 hres
= ITypeInfo_GetDocumentation(interface1
, 0, &name
, NULL
, NULL
, NULL
);
1790 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1792 hres
= ITypeInfo_GetRefTypeInfo(interface1
, 0, NULL
);
1793 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1796 hres
= ICreateTypeInfo_LayOut(createti
);
1797 ok(hres
== S_OK
, "got %08x\n", hres
);
1799 hres
= ICreateTypeInfo_SetGuid(createti
, &interfaceguid
);
1800 ok(hres
== S_OK
, "got %08x\n", hres
);
1802 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, NULL
, &hreftype
);
1803 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1805 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, unknown
, NULL
);
1806 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1808 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, unknown
, &hreftype
);
1809 ok(hres
== S_OK
, "got %08x\n", hres
);
1811 skip("Skipping some tests\n");
1815 hres
= ICreateTypeInfo_AddImplType(createti
, 1, hreftype
);
1816 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1818 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
1819 ok(hres
== S_OK
, "got %08x\n", hres
);
1821 hres
= ITypeInfo_GetRefTypeOfImplType(interface1
, 0, &hreftype
);
1822 ok(hres
== S_OK
, "got %08x\n", hres
);
1823 ok(hreftype
== 3, "hreftype = %d\n", hreftype
);
1825 hres
= ITypeInfo_GetRefTypeInfo(interface1
, hreftype
, &ti
);
1826 ok(hres
== S_OK
, "got %08x\n", hres
);
1828 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
1829 ok(hres
== S_OK
, "got %08x\n", hres
);
1830 ok(typeattr
->cbSizeVft
== 3 * ptr_size
|| broken(sys
== SYS_WIN32
&& typeattr
->cbSizeVft
== 24) /* xp64 */,
1831 "retrieved IUnknown gave wrong cbSizeVft: %u\n", typeattr
->cbSizeVft
);
1832 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
1834 ITypeInfo_Release(ti
);
1836 hres
= ITypeInfo_GetRefTypeOfImplType(interface1
, -1, &hreftype
);
1837 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1839 ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo2
, (void**)&ti2
);
1841 memset(&funcdesc
, 0, sizeof(FUNCDESC
));
1842 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
1843 funcdesc
.invkind
= INVOKE_PROPERTYGET
;
1844 funcdesc
.callconv
= CC_STDCALL
;
1845 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_BSTR
;
1846 U(funcdesc
.elemdescFunc
).idldesc
.wIDLFlags
= IDLFLAG_NONE
;
1848 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, NULL
);
1849 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1851 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
1852 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1854 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
1855 ok(hres
== S_OK
, "got %08x\n", hres
);
1857 hres
= ITypeInfo2_GetFuncDesc(ti2
, 0, NULL
);
1858 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1860 hres
= ITypeInfo2_GetFuncDesc(ti2
, 1, &pfuncdesc
);
1861 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1863 hres
= ITypeInfo2_GetFuncDesc(ti2
, 0, &pfuncdesc
);
1864 ok(hres
== S_OK
, "got %08x\n", hres
);
1866 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
1867 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
1868 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
1869 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
1870 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYGET
, "got 0x%x\n", pfuncdesc
->invkind
);
1871 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
1872 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
1873 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
1874 ok(pfuncdesc
->oVft
== 3 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 24) /* xp64 */,
1875 "got %d\n", pfuncdesc
->oVft
);
1876 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
1877 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_BSTR
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
1878 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
1880 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
1882 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 0, 0xabcdefab);
1883 ok(hres
== S_OK
, "got %08x\n", hres
);
1885 funcdesc
.invkind
= INVOKE_PROPERTYPUT
;
1886 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
1887 ok(hres
== TYPE_E_INCONSISTENTPROPFUNCS
, "got %08x\n", hres
);
1889 funcdesc
.invkind
= INVOKE_PROPERTYPUTREF
;
1890 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
1891 ok(hres
== TYPE_E_INCONSISTENTPROPFUNCS
, "got %08x\n", hres
);
1893 elemdesc
[0].tdesc
.vt
= VT_BSTR
;
1894 U(elemdesc
[0]).idldesc
.dwReserved
= 0;
1895 U(elemdesc
[0]).idldesc
.wIDLFlags
= IDLFLAG_FIN
;
1897 funcdesc
.lprgelemdescParam
= elemdesc
;
1898 funcdesc
.invkind
= INVOKE_PROPERTYPUT
;
1899 funcdesc
.cParams
= 1;
1900 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
1902 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
1903 ok(hres
== S_OK
, "got %08x\n", hres
);
1905 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 1, 0xabcdefab);
1906 ok(hres
== S_OK
, "got %08x\n", hres
);
1908 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, propname
, 0);
1909 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1911 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, NULL
, 1);
1912 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1914 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, propname
, 1);
1915 ok(hres
== S_OK
, "got %08x\n", hres
);
1917 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1, propname
, 1);
1918 ok(hres
== S_OK
, "got %08x\n", hres
);
1920 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1, propname
, 2);
1921 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1923 hres
= ITypeInfo2_GetFuncDesc(ti2
, 1, &pfuncdesc
);
1924 ok(hres
== S_OK
, "got %08x\n", hres
);
1926 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
1927 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
1928 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
1929 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
1930 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYPUT
, "got 0x%x\n", pfuncdesc
->invkind
);
1931 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
1932 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
1933 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
1934 ok(pfuncdesc
->oVft
== 4 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 28) /* xp64 */,
1935 "got %d\n", pfuncdesc
->oVft
);
1936 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
1937 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
1938 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
1940 edesc
= pfuncdesc
->lprgelemdescParam
;
1941 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
1942 ok(U(*edesc
).idldesc
.wIDLFlags
== IDLFLAG_FIN
, "got: %x\n", U(*edesc
).idldesc
.wIDLFlags
);
1944 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
1947 funcdesc
.invkind
= INVOKE_PROPERTYPUTREF
;
1948 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
1949 ok(hres
== S_OK
, "got %08x\n", hres
);
1951 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 0, 0xabcdefab);
1952 ok(hres
== S_OK
, "got %08x\n", hres
);
1954 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 0, 0x201);
1955 ok(hres
== S_OK
, "got %08x\n", hres
);
1958 funcdesc
.lprgelemdescParam
= NULL
;
1959 funcdesc
.invkind
= INVOKE_FUNC
;
1960 funcdesc
.cParams
= 0;
1961 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
1962 ok(hres
== S_OK
, "got %08x\n", hres
);
1964 hres
= ITypeInfo2_GetFuncDesc(ti2
, 1, &pfuncdesc
);
1965 ok(hres
== S_OK
, "got %08x\n", hres
);
1967 ok(pfuncdesc
->memid
== 1, "got %d\n", pfuncdesc
->memid
);
1968 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
1969 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
1970 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
1971 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
1972 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
1973 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
1974 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
1975 ok(pfuncdesc
->oVft
== 4 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 28), /* xp64 */
1976 "got %d\n", pfuncdesc
->oVft
);
1977 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
1978 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
1979 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
1981 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
1983 funcdesc
.memid
= MEMBERID_NIL
;
1984 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
1985 ok(hres
== S_OK
, "got %08x\n", hres
);
1987 elemdesc
[0].tdesc
.vt
= VT_PTR
;
1988 U(elemdesc
[0].tdesc
).lptdesc
= &typedesc1
;
1989 typedesc1
.vt
= VT_BSTR
;
1990 funcdesc
.cParams
= 1;
1991 funcdesc
.lprgelemdescParam
= elemdesc
;
1992 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 4, &funcdesc
);
1993 ok(hres
== S_OK
, "got %08x\n", hres
);
1995 hres
= ITypeInfo2_GetFuncDesc(ti2
, 4, &pfuncdesc
);
1996 ok(hres
== S_OK
, "got %08x\n", hres
);
1998 ok(pfuncdesc
->memid
== 0x60010004, "got %x\n", pfuncdesc
->memid
);
1999 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2000 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2001 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2002 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2003 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2004 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2005 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2006 ok(pfuncdesc
->oVft
== 7 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 40) /* xp64 */,
2007 "got %d\n", pfuncdesc
->oVft
);
2008 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2009 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2010 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2012 edesc
= pfuncdesc
->lprgelemdescParam
;
2013 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
2014 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2015 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2016 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
2017 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
2019 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2021 U(elemdesc
[0].tdesc
).lptdesc
= &typedesc2
;
2022 typedesc2
.vt
= VT_PTR
;
2023 U(typedesc2
).lptdesc
= &typedesc1
;
2024 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 4, &funcdesc
);
2025 ok(hres
== S_OK
, "got %08x\n", hres
);
2027 hres
= ITypeInfo2_GetFuncDesc(ti2
, 4, &pfuncdesc
);
2028 ok(hres
== S_OK
, "got %08x\n", hres
);
2030 ok(pfuncdesc
->memid
== 0x60010007, "got %x\n", pfuncdesc
->memid
);
2031 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2032 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2033 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2034 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2035 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2036 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2037 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2038 ok(pfuncdesc
->oVft
== 7 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 40) /* xp64 */,
2039 "got %d\n", pfuncdesc
->oVft
);
2040 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2041 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2042 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2044 edesc
= pfuncdesc
->lprgelemdescParam
;
2045 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
2046 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2047 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2048 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
2049 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_PTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
2050 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
!= NULL
, "got: %p\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
);
2051 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
);
2053 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2055 elemdesc
[0].tdesc
.vt
= VT_INT
;
2056 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2057 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2058 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2059 V_INT(¶mdescex
.varDefaultValue
) = 0x123;
2060 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2061 ok(hres
== S_OK
, "got %08x\n", hres
);
2063 hres
= ITypeInfo2_GetFuncDesc(ti2
, 3, &pfuncdesc
);
2064 ok(hres
== S_OK
, "got %08x\n", hres
);
2066 ok(pfuncdesc
->memid
== 0x60010003, "got %x\n", pfuncdesc
->memid
);
2067 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2068 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2069 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2070 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2071 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2072 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2073 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2074 ok(pfuncdesc
->oVft
== 6 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 36) /* xp64 */,
2075 "got %d\n", pfuncdesc
->oVft
);
2076 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2077 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2078 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2080 edesc
= pfuncdesc
->lprgelemdescParam
;
2081 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
2082 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2083 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2084 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2085 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2086 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
2087 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2088 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x123, "got: 0x%x\n",
2089 V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2091 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2093 U(elemdesc
[0]).idldesc
.dwReserved
= 0;
2094 U(elemdesc
[0]).idldesc
.wIDLFlags
= IDLFLAG_FIN
;
2095 elemdesc
[1].tdesc
.vt
= VT_UI2
;
2096 U(elemdesc
[1]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2097 U(elemdesc
[1]).paramdesc
.pparamdescex
= ¶mdescex
;
2098 V_VT(¶mdescex
.varDefaultValue
) = VT_UI2
;
2099 V_UI2(¶mdescex
.varDefaultValue
) = 0xffff;
2100 funcdesc
.cParams
= 2;
2101 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2102 ok(hres
== S_OK
, "got %08x\n", hres
);
2104 hres
= ITypeInfo2_GetFuncDesc(ti2
, 3, &pfuncdesc
);
2105 ok(hres
== S_OK
, "got %08x\n", hres
);
2107 ok(pfuncdesc
->memid
== 0x60010009, "got %x\n", pfuncdesc
->memid
);
2108 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2109 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2110 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2111 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2112 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2113 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
2114 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2115 ok(pfuncdesc
->oVft
== 6 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 36) /* xp64 */,
2116 "got %d\n", pfuncdesc
->oVft
);
2117 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2118 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2119 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2121 edesc
= pfuncdesc
->lprgelemdescParam
;
2122 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
2123 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2124 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2126 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
2127 ok(edesc
->tdesc
.vt
== VT_UI2
, "got: %d\n", edesc
->tdesc
.vt
);
2128 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2129 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2130 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2131 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2132 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_UI2
, "got: %d\n",
2133 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2134 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFF, "got: 0x%x\n",
2135 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2137 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2139 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2140 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2141 elemdesc
[1].tdesc
.vt
= VT_INT
;
2142 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2143 V_INT(¶mdescex
.varDefaultValue
) = 0xffffffff;
2144 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2145 ok(hres
== S_OK
, "got %08x\n", hres
);
2147 elemdesc
[0].tdesc
.vt
= VT_BSTR
;
2148 elemdesc
[1].tdesc
.vt
= VT_BSTR
;
2149 V_VT(¶mdescex
.varDefaultValue
) = VT_BSTR
;
2150 V_BSTR(¶mdescex
.varDefaultValue
) = SysAllocString(defaultW
);
2151 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2152 ok(hres
== S_OK
, "got %08x\n", hres
);
2153 SysFreeString(V_BSTR(¶mdescex
.varDefaultValue
));
2155 hres
= ITypeInfo2_GetFuncDesc(ti2
, 3, &pfuncdesc
);
2156 ok(hres
== S_OK
, "got %08x\n", hres
);
2158 ok(pfuncdesc
->memid
== 0x6001000b, "got %x\n", pfuncdesc
->memid
);
2159 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2160 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2161 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2162 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2163 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2164 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
2165 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2166 ok(pfuncdesc
->oVft
== 6 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 36) /* xp64 */,
2167 "got %d\n", pfuncdesc
->oVft
);
2168 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2169 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2170 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2172 edesc
= pfuncdesc
->lprgelemdescParam
;
2173 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2174 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2175 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2176 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2177 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2178 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
2179 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2180 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), defaultQW
),
2182 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
2184 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
2185 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2186 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2187 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2188 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2189 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2190 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
2191 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2192 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), defaultQW
),
2194 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
2196 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2198 elemdesc
[0].tdesc
.vt
= VT_USERDEFINED
;
2199 U(elemdesc
[0].tdesc
).hreftype
= hreftype
;
2200 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2201 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2202 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2203 V_INT(¶mdescex
.varDefaultValue
) = 0x789;
2205 funcdesc
.lprgelemdescParam
= elemdesc
;
2206 funcdesc
.invkind
= INVOKE_FUNC
;
2207 funcdesc
.cParams
= 1;
2208 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
2210 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 5, &funcdesc
);
2211 ok(hres
== S_OK
, "got %08x\n", hres
);
2213 hres
= ITypeInfo2_GetFuncDesc(ti2
, 5, &pfuncdesc
);
2214 ok(hres
== S_OK
, "got %08x\n", hres
);
2216 ok(pfuncdesc
->memid
== 0x60010005, "got %x\n", pfuncdesc
->memid
);
2217 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2218 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2219 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2220 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2221 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2222 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2223 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2224 ok(pfuncdesc
->oVft
== 8 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 44), /* xp64 */
2225 "got %d\n", pfuncdesc
->oVft
);
2226 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2227 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2228 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2230 edesc
= pfuncdesc
->lprgelemdescParam
;
2231 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2232 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
2233 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2234 ok(edesc
->tdesc
.vt
== VT_USERDEFINED
, "got: %d\n", edesc
->tdesc
.vt
);
2235 ok(U(edesc
->tdesc
).hreftype
== hreftype
, "got: 0x%x\n", U(edesc
->tdesc
).hreftype
);
2236 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
2237 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2238 ok(V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x789, "got: %d\n",
2239 V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2241 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2243 elemdesc
[0].tdesc
.vt
= VT_VARIANT
;
2244 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2245 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2246 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2247 V_INT(¶mdescex
.varDefaultValue
) = 3;
2249 funcdesc
.lprgelemdescParam
= elemdesc
;
2250 funcdesc
.invkind
= INVOKE_FUNC
;
2251 funcdesc
.cParams
= 1;
2252 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VARIANT
;
2254 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 6, &funcdesc
);
2255 ok(hres
== S_OK
, "got %08x\n", hres
);
2257 hres
= ITypeInfo2_GetFuncDesc(ti2
, 6, &pfuncdesc
);
2258 ok(hres
== S_OK
, "got %08x\n", hres
);
2260 ok(pfuncdesc
->memid
== 0x60010006, "got %x\n", pfuncdesc
->memid
);
2261 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2262 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2263 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2264 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2265 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2266 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2267 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2268 ok(pfuncdesc
->oVft
== 9 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 48), /* xp64 */
2269 "got %d\n", pfuncdesc
->oVft
);
2270 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2271 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VARIANT
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2272 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2274 edesc
= pfuncdesc
->lprgelemdescParam
;
2275 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2276 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
2277 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2278 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
2279 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
2280 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2281 ok(V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 3, "got: %d\n",
2282 V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2284 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2286 hres
= ITypeInfo_GetDocumentation(interface1
, 0, &name
, &docstring
, &helpcontext
, &helpfile
);
2287 ok(hres
== S_OK
, "got %08x\n", hres
);
2288 ok(name
== NULL
, "name != NULL\n");
2289 ok(docstring
== NULL
, "docstring != NULL\n");
2290 ok(helpcontext
== 0x201, "helpcontext != 0x201\n");
2291 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "helpfile = %s\n", wine_dbgstr_w(helpfile
));
2293 SysFreeString(helpfile
);
2295 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1000, NULL
, 1);
2296 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2298 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1000, names1
, 1);
2299 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2301 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, names1
, 2);
2302 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2304 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, names2
, 1);
2305 ok(hres
== S_OK
, "got %08x\n", hres
);
2307 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, names1
, 1);
2308 ok(hres
== S_OK
, "got %08x\n", hres
);
2310 hres
= ITypeInfo_GetDocumentation(interface1
, 0, &name
, NULL
, NULL
, NULL
);
2311 ok(hres
== S_OK
, "got %08x\n", hres
);
2312 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "name = %s\n", wine_dbgstr_w(name
));
2314 SysFreeString(name
);
2316 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 3, names2
, 3);
2317 ok(hres
== S_OK
, "got %08x\n", hres
);
2319 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 3, names1
, 3);
2320 ok(hres
== TYPE_E_AMBIGUOUSNAME
, "got %08x\n", hres
);
2322 ITypeInfo2_Release(ti2
);
2323 ICreateTypeInfo_Release(createti
);
2325 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, &createti
);
2326 ok(hres
== TYPE_E_NAMECONFLICT
, "got %08x\n", hres
);
2328 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface2W
, TKIND_INTERFACE
, &createti
);
2329 ok(hres
== S_OK
, "got %08x\n", hres
);
2331 hres
= ICreateTypeInfo_SetGuid(createti
, &interface2guid
);
2332 ok(hres
== S_OK
, "got %08x\n", hres
);
2334 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&interface2
);
2335 ok(hres
== S_OK
, "got %08x\n", hres
);
2337 hres
= ITypeInfo_GetRefTypeOfImplType(interface2
, 0, &hreftype
);
2338 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2340 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, interface1
, &hreftype
);
2341 ok(hres
== S_OK
, "got %08x\n", hres
);
2343 hres
= ITypeInfo_GetRefTypeInfo(interface2
, 0, &ti
);
2344 ok(hres
== S_OK
, "got %08x\n", hres
);
2345 ok(ti
== interface1
, "Received and added interfaces are different\n");
2347 ITypeInfo_Release(ti
);
2349 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2350 ok(hres
== S_OK
, "got %08x\n", hres
);
2352 hres
= ITypeInfo_GetRefTypeOfImplType(interface2
, 0, &hreftype
);
2353 ok(hres
== S_OK
, "got %08x\n", hres
);
2354 ok(hreftype
== 2, "hreftype = %d\n", hreftype
);
2356 hres
= ITypeInfo_GetRefTypeOfImplType(interface2
, -1, &hreftype
);
2357 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2359 hres
= ICreateTypeInfo_SetImplTypeFlags(createti
, 0, IMPLTYPEFLAG_FDEFAULT
);
2360 ok(hres
== TYPE_E_BADMODULEKIND
, "got %08x\n", hres
);
2362 hres
= ITypeInfo_GetImplTypeFlags(interface2
, 0, &impltypeflags
);
2363 ok(hres
== S_OK
, "got %08x\n", hres
);
2364 ok(impltypeflags
== 0, "impltypeflags = %x\n", impltypeflags
);
2366 hres
= ITypeInfo_GetImplTypeFlags(interface2
, 1, &impltypeflags
);
2367 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2369 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
2370 funcdesc
.oVft
= 0xaaac;
2371 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2372 if(sys
== SYS_WIN64
){
2373 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2374 funcdesc
.oVft
= 0xaab0;
2375 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2377 ok(hres
== S_OK
, "got %08x\n", hres
);
2378 funcdesc
.oVft
= 0xaaa8;
2379 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2380 ok(hres
== S_OK
, "got %08x\n", hres
);
2382 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&ti2
);
2383 ok(hres
== S_OK
, "got %08x\n", hres
);
2385 hres
= ITypeInfo2_GetFuncDesc(ti2
, 0, &pfuncdesc
);
2386 ok(hres
== S_OK
, "got %08x\n", hres
);
2388 ok(pfuncdesc
->memid
== 0x60020000, "got %x\n", pfuncdesc
->memid
);
2389 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2390 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2391 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2392 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2393 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2394 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2395 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2396 ok(pfuncdesc
->oVft
== (short)0xaaa8, "got %d\n", pfuncdesc
->oVft
);
2397 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2398 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2399 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2401 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2402 ITypeInfo2_Release(ti2
);
2406 ICreateTypeInfo_Release(createti
);
2408 VariantInit(&cust_data
);
2410 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface3W
, TKIND_INTERFACE
, &createti
);
2411 ok(hres
== S_OK
, "got %08x\n", hres
);
2413 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ICreateTypeInfo2
, (void**)&createti2
);
2414 ok(hres
== S_OK
, "got %08x\n", hres
);
2416 hres
= ICreateTypeInfo2_QueryInterface(createti2
, &IID_ITypeInfo2
, (void**)&ti2
);
2417 ok(hres
== S_OK
, "got %08x\n", hres
);
2419 hres
= ITypeInfo2_GetCustData(ti2
, NULL
, NULL
);
2420 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2422 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, NULL
);
2423 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2425 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2426 ok(hres
== S_OK
, "got %08x\n", hres
);
2428 hres
= ICreateTypeInfo2_SetCustData(createti2
, NULL
, NULL
);
2429 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2431 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, NULL
);
2432 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2434 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2435 ok(hres
== DISP_E_BADVARTYPE
, "got %08x\n", hres
);
2437 V_VT(&cust_data
) = VT_UI4
;
2438 V_I4(&cust_data
) = 0xdeadbeef;
2440 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2441 ok(hres
== S_OK
, "got %08x\n", hres
);
2443 V_I4(&cust_data
) = 0;
2444 V_VT(&cust_data
) = VT_EMPTY
;
2446 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2447 ok(hres
== S_OK
, "got %08x\n", hres
);
2449 ok(V_VT(&cust_data
) == VT_UI4
, "got %d\n", V_VT(&cust_data
));
2450 ok(V_I4(&cust_data
) == 0xdeadbeef, "got 0x%08x\n", V_I4(&cust_data
));
2452 V_VT(&cust_data
) = VT_UI4
;
2453 V_I4(&cust_data
) = 12345678;
2455 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2456 ok(hres
== S_OK
, "got %08x\n", hres
);
2458 V_I4(&cust_data
) = 0;
2459 V_VT(&cust_data
) = VT_EMPTY
;
2461 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2462 ok(hres
== S_OK
, "got %08x\n", hres
);
2464 ok(V_VT(&cust_data
) == VT_UI4
, "got %d\n", V_VT(&cust_data
));
2465 ok(V_I4(&cust_data
) == 12345678, "got 0x%08x\n", V_I4(&cust_data
));
2467 V_VT(&cust_data
) = VT_BSTR
;
2468 V_BSTR(&cust_data
) = SysAllocString(asdfW
);
2470 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2471 ok(hres
== S_OK
, "got %08x\n", hres
);
2473 SysFreeString(V_BSTR(&cust_data
));
2474 V_I4(&cust_data
) = 0;
2475 V_VT(&cust_data
) = VT_EMPTY
;
2477 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2478 ok(hres
== S_OK
, "got %08x\n", hres
);
2480 ok(V_VT(&cust_data
) == VT_BSTR
, "got %d\n", V_VT(&cust_data
));
2481 ok(!lstrcmpW(V_BSTR(&cust_data
), asdfW
), "got %s\n", wine_dbgstr_w(V_BSTR(&cust_data
)));
2482 SysFreeString(V_BSTR(&cust_data
));
2484 V_VT(&cust_data
) = VT_UI4
;
2485 V_UI4(&cust_data
) = 17;
2487 hres
= ITypeInfo2_GetCustData(ti2
, &bogusguid
, &cust_data
);
2488 ok(hres
== S_OK
, "got %08x\n", hres
);
2490 ok(V_VT(&cust_data
) == VT_EMPTY
, "got: %d\n", V_VT(&cust_data
));
2492 ITypeInfo2_Release(ti2
);
2493 ICreateTypeInfo2_Release(createti2
);
2494 ICreateTypeInfo_Release(createti
);
2496 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, coclassW
, TKIND_COCLASS
, &createti
);
2497 ok(hres
== S_OK
, "got %08x\n", hres
);
2499 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, interface1
, &hreftype
);
2500 ok(hres
== S_OK
, "got %08x\n", hres
);
2502 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2503 ok(hres
== S_OK
, "got %08x\n", hres
);
2505 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2506 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2508 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, unknown
, &hreftype
);
2509 ok(hres
== S_OK
, "got %08x\n", hres
);
2511 hres
= ICreateTypeInfo_AddImplType(createti
, 1, hreftype
);
2512 ok(hres
== S_OK
, "got %08x\n", hres
);
2514 hres
= ICreateTypeInfo_AddImplType(createti
, 1, hreftype
);
2515 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2517 hres
= ICreateTypeInfo_AddImplType(createti
, 2, hreftype
);
2518 ok(hres
== S_OK
, "got %08x\n", hres
);
2520 hres
= ICreateTypeInfo_SetImplTypeFlags(createti
, 0, IMPLTYPEFLAG_FDEFAULT
);
2521 ok(hres
== S_OK
, "got %08x\n", hres
);
2523 hres
= ICreateTypeInfo_SetImplTypeFlags(createti
, 1, IMPLTYPEFLAG_FRESTRICTED
);
2524 ok(hres
== S_OK
, "got %08x\n", hres
);
2526 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&ti
);
2527 ok(hres
== S_OK
, "got %08x\n", hres
);
2529 hres
= ITypeInfo_GetImplTypeFlags(ti
, 0, NULL
);
2530 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2532 hres
= ITypeInfo_GetImplTypeFlags(ti
, 0, &impltypeflags
);
2533 ok(hres
== S_OK
, "got %08x\n", hres
);
2534 ok(impltypeflags
== IMPLTYPEFLAG_FDEFAULT
, "impltypeflags = %x\n", impltypeflags
);
2536 hres
= ITypeInfo_GetImplTypeFlags(ti
, 1, &impltypeflags
);
2537 ok(hres
== S_OK
, "got %08x\n", hres
);
2538 ok(impltypeflags
== IMPLTYPEFLAG_FRESTRICTED
, "impltypeflags = %x\n", impltypeflags
);
2540 hres
= ITypeInfo_GetImplTypeFlags(ti
, 2, &impltypeflags
);
2541 ok(hres
== S_OK
, "got %08x\n", hres
);
2542 ok(impltypeflags
== 0, "impltypeflags = %x\n", impltypeflags
);
2544 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
2545 ok(hres
== S_OK
, "got %08x\n", hres
);
2546 ok(hreftype
== 0, "hreftype = %d\n", hreftype
);
2548 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 1, &hreftype
);
2549 ok(hres
== S_OK
, "got %08x\n", hres
);
2550 ok(hreftype
== 1, "hreftype = %d\n", hreftype
);
2552 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 2, &hreftype
);
2553 ok(hres
== S_OK
, "got %08x\n", hres
);
2554 ok(hreftype
== 1, "hreftype = %d\n", hreftype
);
2556 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, -1, &hreftype
);
2557 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2559 ITypeInfo_Release(ti
);
2561 ICreateTypeInfo_Release(createti
);
2563 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, dualW
, TKIND_INTERFACE
, &createti
);
2564 ok(hres
== S_OK
, "got %08x\n", hres
);
2566 hres
= ICreateTypeInfo_SetTypeFlags(createti
, TYPEFLAG_FDUAL
);
2567 ok(hres
== S_OK
, "got %08x\n", hres
);
2569 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2570 ok(hres
== S_OK
, "got %08x\n", hres
);
2572 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, dispatch
, &hreftype
);
2573 ok(hres
== S_OK
, "got %08x\n", hres
);
2575 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2576 ok(hres
== S_OK
, "got %08x\n", hres
);
2578 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&dual
);
2579 ok(hres
== S_OK
, "got %08x\n", hres
);
2581 hres
= ITypeInfo_GetTypeAttr(dual
, &typeattr
);
2582 ok(hres
== S_OK
, "got %08x\n", hres
);
2583 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2584 ok(typeattr
->typekind
== 3, "typekind = %d\n", typeattr
->typekind
);
2585 ok(typeattr
->cFuncs
== 1, "cFuncs = %d\n", typeattr
->cFuncs
);
2586 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2587 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2588 ok(typeattr
->cbSizeVft
== 8 * ptr_size
|| broken(sys
== SYS_WIN32
&& typeattr
->cbSizeVft
== 7 * sizeof(void *) + 4), /* xp64 */
2589 "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2590 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2591 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2592 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2593 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2595 ITypeInfo_ReleaseTypeAttr(dual
, typeattr
);
2597 hres
= ITypeInfo_GetRefTypeOfImplType(dual
, -1, &hreftype
);
2598 ok(hres
== S_OK
, "got %08x\n", hres
);
2599 ok(hreftype
== -2, "got %08x\n", hreftype
);
2601 hres
= ITypeInfo_GetRefTypeInfo(dual
, -2, &ti
);
2602 ok(hres
== S_OK
, "got %08x\n", hres
);
2604 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
2605 ok(hres
== S_OK
, "got %08x\n", hres
);
2606 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2607 ok(typeattr
->typekind
== 4, "typekind = %d\n", typeattr
->typekind
);
2608 ok(typeattr
->cFuncs
== 8, "cFuncs = %d\n", typeattr
->cFuncs
);
2609 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2610 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2611 ok(typeattr
->cbSizeVft
== 7 * sizeof(void *), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2612 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2613 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2614 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2615 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2617 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
2619 ITypeInfo_Release(ti
);
2621 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, &typedesc1
);
2622 ok(hres
== TYPE_E_BADMODULEKIND
, "got %08x\n", hres
);
2624 ICreateTypeInfo_Release(createti
);
2626 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
2627 ok(hres
== S_OK
, "got %08x\n", hres
);
2628 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2629 ok(typeattr
->typekind
== 3, "typekind = %d\n", typeattr
->typekind
);
2630 ok(typeattr
->cFuncs
== 13, "cFuncs = %d\n", typeattr
->cFuncs
);
2631 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2632 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2633 ok(typeattr
->cbSizeVft
== 16 * ptr_size
|| broken(sys
== SYS_WIN32
&& typeattr
->cbSizeVft
== 3 * sizeof(void *) + 52), /* xp64 */
2634 "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2635 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2636 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2637 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2638 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2640 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
2642 hres
= ITypeInfo_GetTypeAttr(interface2
, &typeattr
);
2643 ok(hres
== S_OK
, "got %08x\n", hres
);
2644 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2645 ok(typeattr
->typekind
== 3, "typekind = %d\n", typeattr
->typekind
);
2646 ok(typeattr
->cFuncs
== 2, "cFuncs = %d\n", typeattr
->cFuncs
);
2647 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2648 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2649 ok((sys
== SYS_WIN32
&& typeattr
->cbSizeVft
== 0xaab0) ||
2650 (sys
== SYS_WIN64
&& typeattr
->cbSizeVft
== 0xaab8),
2651 "cbSizeVft = 0x%x\n", typeattr
->cbSizeVft
);
2652 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2653 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2654 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2655 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2657 ITypeInfo_ReleaseTypeAttr(interface2
, typeattr
);
2659 ok(ITypeInfo_Release(interface2
)==0, "Object should be freed\n");
2660 ok(ITypeInfo_Release(interface1
)==0, "Object should be freed\n");
2661 ok(ITypeInfo_Release(dual
)==0, "Object should be freed\n");
2663 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, aliasW
, TKIND_ALIAS
, &createti
);
2664 ok(hres
== S_OK
, "got %08x\n", hres
);
2666 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&interface1
);
2667 ok(hres
== S_OK
, "got %08x\n", hres
);
2670 /* windows gives invalid values here, and even breaks the typeinfo permanently
2671 * on winxp. only call GetTypeAttr() on a TKIND_ALIAS after SetTypeDescAlias. */
2672 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
2673 ok(hres
== S_OK
, "got %08x\n", hres
);
2674 ok(typeattr
->cbSizeInstance
== 0xffffffb4, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2675 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
2676 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
2677 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2678 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2679 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2680 ok(typeattr
->cbAlignment
== 0, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2681 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2682 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2683 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2684 ok(typeattr
->tdescAlias
.vt
== VT_EMPTY
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
2685 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
2688 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, NULL
);
2689 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2691 typedesc1
.vt
= VT_I1
;
2692 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, &typedesc1
);
2693 ok(hres
== S_OK
, "got %08x\n", hres
);
2695 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
2696 ok(hres
== S_OK
, "got %08x\n", hres
);
2697 ok(typeattr
->cbSizeInstance
== 1, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2698 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
2699 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
2700 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2701 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2702 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2703 ok(typeattr
->cbAlignment
== 1, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2704 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2705 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2706 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2707 ok(typeattr
->tdescAlias
.vt
== VT_I1
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
2708 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
2710 typedesc1
.vt
= VT_R8
;
2711 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, &typedesc1
);
2712 ok(hres
== S_OK
, "got %08x\n", hres
);
2714 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
2715 ok(hres
== S_OK
, "got %08x\n", hres
);
2716 ok(typeattr
->cbSizeInstance
== 8, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2717 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
2718 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
2719 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2720 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2721 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2722 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2723 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2724 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2725 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2726 ok(typeattr
->tdescAlias
.vt
== VT_R8
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
2727 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
2729 ITypeInfo_Release(interface1
);
2730 ICreateTypeInfo_Release(createti
);
2732 hres
= ICreateTypeLib2_SaveAllChanges(createtl
);
2733 ok(hres
== S_OK
, "got %08x\n", hres
);
2735 ok(ICreateTypeLib2_Release(createtl
)==0, "Object should be freed\n");
2737 ok(ITypeInfo_Release(dispatch
)==0, "Object should be freed\n");
2738 ok(ITypeInfo_Release(unknown
)==0, "Object should be freed\n");
2739 ok(ITypeLib_Release(stdole
)==0, "Object should be freed\n");
2741 hres
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &tl
);
2742 ok(hres
== S_OK
, "got %08x\n", hres
);
2744 hres
= ITypeLib_GetLibAttr(tl
, &libattr
);
2745 ok(hres
== S_OK
, "got %08x\n", hres
);
2746 ok(libattr
->syskind
== sys
, "syskind = %d\n", libattr
->syskind
);
2747 ok(libattr
->wMajorVerNum
== 0, "wMajorVer = %d\n", libattr
->wMajorVerNum
);
2748 ok(libattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", libattr
->wMinorVerNum
);
2749 ok(libattr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "wLibFlags = %d\n", libattr
->wLibFlags
);
2750 ITypeLib_ReleaseTLibAttr(tl
, libattr
);
2753 memset(tinfos
, 0, sizeof(tinfos
));
2754 memids
[0] = 0xdeadbeef;
2755 memids
[1] = 0xdeadbeef;
2756 hres
= ITypeLib_FindName(tl
, param1W
, 0, tinfos
, memids
, &found
);
2757 ok(hres
== S_OK
, "got: %08x\n", hres
);
2758 ok(found
== 0, "got wrong count: %u\n", found
);
2759 ok(tinfos
[0] == NULL
, "got invalid typeinfo[0]\n");
2760 ok(tinfos
[1] == NULL
, "got invalid typeinfo[1]\n");
2761 ok(memids
[0] == 0xdeadbeef, "got invalid memid[0]\n");
2762 ok(memids
[1] == 0xdeadbeef, "got invalid memid[1]\n");
2765 memset(tinfos
, 0, sizeof(tinfos
));
2766 memids
[0] = 0xdeadbeef;
2767 memids
[1] = 0xdeadbeef;
2768 hres
= ITypeLib_FindName(tl
, func1W
, 0, tinfos
, memids
, &found
);
2769 ok(hres
== S_OK
, "got: %08x\n", hres
);
2770 ok(found
== 1, "got wrong count: %u\n", found
);
2771 ok(tinfos
[0] != NULL
, "got invalid typeinfo[0]\n");
2772 ok(tinfos
[1] == NULL
, "got invalid typeinfo[1]\n");
2773 ok(memids
[0] == 0, "got invalid memid[0]\n");
2774 ok(memids
[1] == 0xdeadbeef, "got invalid memid[1]\n");
2776 ITypeInfo_Release(tinfos
[0]);
2779 memset(tinfos
, 0, sizeof(tinfos
));
2780 memids
[0] = 0xdeadbeef;
2781 memids
[1] = 0xdeadbeef;
2782 hres
= ITypeLib_FindName(tl
, interface1W
, 0, tinfos
, memids
, &found
);
2783 ok(hres
== S_OK
, "got: %08x\n", hres
);
2784 ok(found
== 1, "got wrong count: %u\n", found
);
2785 ok(tinfos
[0] != NULL
, "got invalid typeinfo[0]\n");
2786 ok(tinfos
[1] == NULL
, "got invalid typeinfo[1]\n");
2787 ok(memids
[0] == MEMBERID_NIL
, "got invalid memid[0]: %x\n", memids
[0]);
2788 ok(memids
[1] == 0xdeadbeef, "got invalid memid[1]\n");
2790 ITypeInfo_Release(tinfos
[0]);
2792 hres
= ITypeLib_GetDocumentation(tl
, -1, &name
, &docstring
, &helpcontext
, &helpfile
);
2793 ok(hres
== S_OK
, "got %08x\n", hres
);
2794 ok(memcmp(typelibW
, name
, sizeof(typelibW
)) == 0, "got wrong typelib name: %s\n",
2795 wine_dbgstr_w(name
));
2796 ok(docstring
== NULL
, "got wrong docstring: %s\n", wine_dbgstr_w(docstring
));
2797 ok(helpcontext
== 0, "got wrong helpcontext: 0x%x\n", helpcontext
);
2798 ok(memcmp(helpfileW
, helpfile
, sizeof(helpfileW
)) == 0,
2799 "got wrong helpfile: %s\n", wine_dbgstr_w(helpfile
));
2800 SysFreeString(name
);
2801 SysFreeString(helpfile
);
2803 hres
= ITypeLib_GetDocumentation(tl
, 0, &name
, &docstring
, &helpcontext
, &helpfile
);
2804 ok(hres
== S_OK
, "got %08x\n", hres
);
2805 ok(memcmp(interface1W
, name
, sizeof(interface1W
)) == 0, "got wrong typeinfo name: %s\n",
2806 wine_dbgstr_w(name
));
2807 ok(docstring
== NULL
, "got wrong docstring: %s\n", wine_dbgstr_w(docstring
));
2808 ok(helpcontext
== 0, "got wrong helpcontext: 0x%x\n", helpcontext
);
2809 ok(memcmp(helpfileW
, helpfile
, sizeof(helpfileW
)) == 0,
2810 "got wrong helpfile: %s\n", wine_dbgstr_w(helpfile
));
2811 SysFreeString(name
);
2812 SysFreeString(helpfile
);
2814 hres
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
2815 ok(hres
== S_OK
, "got %08x\n", hres
);
2817 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
2818 ok(hres
== S_OK
, "got %08x\n", hres
);
2819 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2820 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
2821 ok(typeattr
->cFuncs
== 13, "cFuncs = %d\n", typeattr
->cFuncs
);
2822 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2823 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2825 if(sys
== SYS_WIN32
)
2826 todo_wine
ok(typeattr
->cbSizeVft
== 16 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2829 ok(typeattr
->cbSizeVft
== 16 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2830 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2831 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2832 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2833 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2834 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
2836 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
2837 ok(hres
== S_OK
, "got %08x\n", hres
);
2838 ok(hreftype
== 3, "hreftype = %d\n", hreftype
);
2840 hres
= ITypeInfo_GetRefTypeInfo(ti
, hreftype
, &unknown
);
2841 ok(hres
== S_OK
, "got %08x\n", hres
);
2843 hres
= ITypeInfo_GetTypeAttr(unknown
, &typeattr
);
2844 ok(hres
== S_OK
, "got %08x\n", hres
);
2845 ok(IsEqualGUID(&typeattr
->guid
, &IID_IUnknown
), "got wrong reftypeinfo\n");
2846 ITypeInfo_ReleaseTypeAttr(unknown
, typeattr
);
2848 ITypeInfo_Release(unknown
);
2850 hres
= ITypeInfo_GetFuncDesc(ti
, 0, &pfuncdesc
);
2851 ok(hres
== S_OK
, "got %08x\n", hres
);
2852 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
2853 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2854 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2855 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2856 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYPUTREF
, "got 0x%x\n", pfuncdesc
->invkind
);
2857 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2858 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2859 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2860 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2861 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2862 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2863 edesc
= pfuncdesc
->lprgelemdescParam
;
2864 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2865 ok(U(*edesc
).idldesc
.wIDLFlags
== IDLFLAG_FIN
, "got: %x\n", U(*edesc
).idldesc
.wIDLFlags
);
2867 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
2868 ok(hres
== S_OK
, "got: %08x\n", hres
);
2869 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "got name: %s\n", wine_dbgstr_w(name
));
2870 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
2871 ok(helpcontext
== 0x201, "got helpcontext: 0x%x\n", helpcontext
);
2872 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
2873 SysFreeString(name
);
2874 SysFreeString(helpfile
);
2876 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, NULL
, 0, &cnames
);
2877 ok(hres
== E_INVALIDARG
, "got: %08x\n", hres
);
2880 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, 0, &cnames
);
2881 ok(hres
== S_OK
, "got: %08x\n", hres
);
2882 ok(cnames
== 0, "got: %u\n", cnames
);
2884 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, sizeof(names
) / sizeof(*names
), &cnames
);
2885 ok(hres
== S_OK
, "got: %08x\n", hres
);
2886 ok(cnames
== 1, "got: %u\n", cnames
);
2887 ok(!memcmp(names
[0], func1W
, sizeof(func1W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
2888 SysFreeString(names
[0]);
2890 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
2892 hres
= ITypeInfo_GetFuncDesc(ti
, 1, &pfuncdesc
);
2893 ok(hres
== S_OK
, "got %08x\n", hres
);
2894 ok(pfuncdesc
->memid
== 0x60010001, "got %x\n", pfuncdesc
->memid
);
2895 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2896 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2897 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2898 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2899 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2900 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
2901 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2903 if(sys
== SYS_WIN32
)
2904 todo_wine
ok(pfuncdesc
->oVft
== 4 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
2907 ok(pfuncdesc
->oVft
== 4 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
2908 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2909 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2910 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2912 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
2913 ok(hres
== S_OK
, "got: %08x\n", hres
);
2914 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
2915 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
2916 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
2917 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
2918 SysFreeString(helpfile
);
2919 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
2921 hres
= ITypeInfo_GetFuncDesc(ti
, 2, &pfuncdesc
);
2922 ok(hres
== S_OK
, "got %08x\n", hres
);
2923 ok(pfuncdesc
->memid
== 0x1, "got %x\n", pfuncdesc
->memid
);
2924 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2925 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2926 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2927 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2928 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2929 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
2930 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2932 if(sys
== SYS_WIN32
)
2933 todo_wine
ok(pfuncdesc
->oVft
== 5 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
2936 ok(pfuncdesc
->oVft
== 5 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
2937 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2938 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2939 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2941 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
2942 ok(hres
== S_OK
, "got: %08x\n", hres
);
2943 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
2944 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
2945 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
2946 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
2947 SysFreeString(helpfile
);
2948 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
2950 hres
= ITypeInfo_GetFuncDesc(ti
, 3, &pfuncdesc
);
2951 ok(hres
== S_OK
, "got %08x\n", hres
);
2952 ok(pfuncdesc
->memid
== 0x6001000b, "got %x\n", pfuncdesc
->memid
);
2953 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2954 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2955 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2956 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2957 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2958 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
2959 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2961 if(sys
== SYS_WIN32
)
2962 todo_wine
ok(pfuncdesc
->oVft
== 6 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
2965 ok(pfuncdesc
->oVft
== 6 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
2966 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2967 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2968 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2970 edesc
= pfuncdesc
->lprgelemdescParam
;
2971 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2972 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2973 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2974 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2975 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2976 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
2977 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2978 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), defaultQW
),
2980 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
2982 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
2983 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2984 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2985 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2986 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2987 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2988 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
2989 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2990 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), defaultQW
),
2992 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
2994 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
2995 ok(hres
== S_OK
, "got: %08x\n", hres
);
2996 ok(!memcmp(name
, func2W
, sizeof(func2W
)), "got name: %s\n", wine_dbgstr_w(name
));
2997 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
2998 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
2999 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3000 SysFreeString(name
);
3001 SysFreeString(helpfile
);
3003 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, sizeof(names
) / sizeof(*names
), &cnames
);
3004 ok(hres
== S_OK
, "got: %08x\n", hres
);
3005 ok(cnames
== 3, "got: %u\n", cnames
);
3006 ok(!memcmp(names
[0], func2W
, sizeof(func2W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3007 ok(!memcmp(names
[1], param1W
, sizeof(func2W
)), "got names[1]: %s\n", wine_dbgstr_w(names
[1]));
3008 ok(!memcmp(names
[2], param2W
, sizeof(func2W
)), "got names[2]: %s\n", wine_dbgstr_w(names
[2]));
3009 SysFreeString(names
[0]);
3010 SysFreeString(names
[1]);
3011 SysFreeString(names
[2]);
3012 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3014 hres
= ITypeInfo_GetFuncDesc(ti
, 4, &pfuncdesc
);
3015 ok(hres
== S_OK
, "got %08x\n", hres
);
3016 ok(pfuncdesc
->memid
== 0x6001000c, "got %x\n", pfuncdesc
->memid
);
3017 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3018 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3019 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3020 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3021 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3022 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
3023 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3025 if(sys
== SYS_WIN32
)
3026 todo_wine
ok(pfuncdesc
->oVft
== 7 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3029 ok(pfuncdesc
->oVft
== 7 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3030 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3031 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3032 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3034 edesc
= pfuncdesc
->lprgelemdescParam
;
3035 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3036 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3037 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3038 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3039 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3040 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
3041 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3042 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFFFFFF,
3043 "got: 0x%x\n", V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3045 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
3046 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3047 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3048 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3049 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3050 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3051 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
3052 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3053 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFFFFFF,
3054 "got: 0x%x\n", V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3056 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3057 ok(hres
== S_OK
, "got: %08x\n", hres
);
3058 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3059 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3060 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3061 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3062 SysFreeString(helpfile
);
3063 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3065 hres
= ITypeInfo_GetFuncDesc(ti
, 5, &pfuncdesc
);
3066 ok(hres
== S_OK
, "got %08x\n", hres
);
3067 ok(pfuncdesc
->memid
== 0x60010005, "got %x\n", pfuncdesc
->memid
);
3068 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3069 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3070 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3071 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3072 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3073 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3074 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3076 if(sys
== SYS_WIN32
)
3077 todo_wine
ok(pfuncdesc
->oVft
== 8 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3080 ok(pfuncdesc
->oVft
== 8 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3081 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3082 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3083 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3085 edesc
= pfuncdesc
->lprgelemdescParam
;
3086 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3087 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3088 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3089 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3090 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3091 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x789, "got: 0x%x\n",
3092 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3093 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3094 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3095 ok(edesc
->tdesc
.vt
== VT_USERDEFINED
, "got: %d\n", edesc
->tdesc
.vt
);
3096 ok(U(edesc
->tdesc
).hreftype
== hreftype
, "got: 0x%x\n", U(edesc
->tdesc
).hreftype
);
3098 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3099 ok(hres
== S_OK
, "got: %08x\n", hres
);
3100 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3101 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3102 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3103 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3104 SysFreeString(helpfile
);
3105 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3107 hres
= ITypeInfo_GetFuncDesc(ti
, 6, &pfuncdesc
);
3108 ok(hres
== S_OK
, "got %08x\n", hres
);
3109 ok(pfuncdesc
->memid
== 0x60010006, "got %x\n", pfuncdesc
->memid
);
3110 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3111 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3112 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3113 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3114 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3115 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3116 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3118 if(sys
== SYS_WIN32
)
3119 todo_wine
ok(pfuncdesc
->oVft
== 9 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3122 ok(pfuncdesc
->oVft
== 9 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3123 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3124 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VARIANT
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3125 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3127 edesc
= pfuncdesc
->lprgelemdescParam
;
3128 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3129 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3130 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3131 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3132 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3133 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x3, "got: 0x%x\n",
3134 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3135 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3136 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3137 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
3138 ok(U(edesc
->tdesc
).hreftype
== 0, "got: 0x%x\n", U(edesc
->tdesc
).hreftype
);
3140 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3141 ok(hres
== S_OK
, "got: %08x\n", hres
);
3142 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3143 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3144 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3145 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3146 SysFreeString(helpfile
);
3147 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3149 hres
= ITypeInfo_GetFuncDesc(ti
, 7, &pfuncdesc
);
3150 ok(hres
== S_OK
, "got %08x\n", hres
);
3151 ok(pfuncdesc
->memid
== 0x60010009, "got %x\n", pfuncdesc
->memid
);
3152 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3153 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3154 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3155 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3156 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3157 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
3158 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3160 if(sys
== SYS_WIN32
)
3161 todo_wine
ok(pfuncdesc
->oVft
== 10 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3164 ok(pfuncdesc
->oVft
== 10 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3165 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3166 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3167 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3169 edesc
= pfuncdesc
->lprgelemdescParam
;
3170 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3171 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3172 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3174 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
3175 ok(edesc
->tdesc
.vt
== VT_UI2
, "got: %d\n", edesc
->tdesc
.vt
);
3176 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3177 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3178 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3179 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3180 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_UI2
, "got: %d\n",
3181 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3182 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFF, "got: 0x%x\n",
3183 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3185 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3186 ok(hres
== S_OK
, "got: %08x\n", hres
);
3187 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3188 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3189 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3190 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3191 SysFreeString(helpfile
);
3192 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3194 hres
= ITypeInfo_GetFuncDesc(ti
, 8, &pfuncdesc
);
3195 ok(hres
== S_OK
, "got %08x\n", hres
);
3196 ok(pfuncdesc
->memid
== 0x60010003, "got %x\n", pfuncdesc
->memid
);
3197 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3198 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3199 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3200 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3201 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3202 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3203 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3205 if(sys
== SYS_WIN32
)
3206 todo_wine
ok(pfuncdesc
->oVft
== 11 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3209 ok(pfuncdesc
->oVft
== 11 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3210 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3211 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3212 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3214 edesc
= pfuncdesc
->lprgelemdescParam
;
3215 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3216 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3217 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3218 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3219 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3220 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
3221 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3222 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x123, "got: 0x%x\n",
3223 V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3225 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3226 ok(hres
== S_OK
, "got: %08x\n", hres
);
3227 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3228 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3229 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3230 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3231 SysFreeString(helpfile
);
3232 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3234 hres
= ITypeInfo_GetFuncDesc(ti
, 9, &pfuncdesc
);
3235 ok(hres
== S_OK
, "got %08x\n", hres
);
3236 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
3237 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3238 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3239 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3240 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYGET
, "got 0x%x\n", pfuncdesc
->invkind
);
3241 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3242 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
3243 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3245 if(sys
== SYS_WIN32
)
3246 todo_wine
ok(pfuncdesc
->oVft
== 12 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3249 ok(pfuncdesc
->oVft
== 12 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3250 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3251 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_BSTR
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3252 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3254 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3255 ok(hres
== S_OK
, "got: %08x\n", hres
);
3256 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "got name: %s\n", wine_dbgstr_w(name
));
3257 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3258 ok(helpcontext
== 0x201, "got helpcontext: 0x%x\n", helpcontext
);
3259 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3260 SysFreeString(name
);
3261 SysFreeString(helpfile
);
3263 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, sizeof(names
) / sizeof(*names
), &cnames
);
3264 ok(hres
== S_OK
, "got: %08x\n", hres
);
3265 ok(cnames
== 1, "got: %u\n", cnames
);
3266 ok(!memcmp(names
[0], func1W
, sizeof(func1W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3267 SysFreeString(names
[0]);
3268 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3270 hres
= ITypeInfo_GetFuncDesc(ti
, 10, &pfuncdesc
);
3271 ok(hres
== S_OK
, "got %08x\n", hres
);
3272 ok(pfuncdesc
->memid
== 0x60010007, "got %x\n", pfuncdesc
->memid
);
3273 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3274 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3275 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3276 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3277 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3278 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3279 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3281 if(sys
== SYS_WIN32
)
3282 todo_wine
ok(pfuncdesc
->oVft
== 13 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3285 ok(pfuncdesc
->oVft
== 13 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3286 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3287 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3288 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3290 edesc
= pfuncdesc
->lprgelemdescParam
;
3291 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
3292 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3293 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3294 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3295 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_PTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
3296 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
!= NULL
, "got: %p\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
);
3297 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
);
3299 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3300 ok(hres
== S_OK
, "got: %08x\n", hres
);
3301 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3302 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3303 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3304 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3305 SysFreeString(helpfile
);
3306 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3308 hres
= ITypeInfo_GetFuncDesc(ti
, 11, &pfuncdesc
);
3309 ok(hres
== S_OK
, "got %08x\n", hres
);
3310 ok(pfuncdesc
->memid
== 0x60010004, "got %x\n", pfuncdesc
->memid
);
3311 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3312 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3313 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3314 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3315 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3316 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3317 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3319 if(sys
== SYS_WIN32
)
3320 todo_wine
ok(pfuncdesc
->oVft
== 14 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3323 ok(pfuncdesc
->oVft
== 14 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3324 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3325 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3326 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3328 edesc
= pfuncdesc
->lprgelemdescParam
;
3329 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
3330 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3331 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3332 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3333 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
3335 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3336 ok(hres
== S_OK
, "got: %08x\n", hres
);
3337 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3338 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3339 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3340 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3341 SysFreeString(helpfile
);
3342 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3344 hres
= ITypeInfo_GetFuncDesc(ti
, 12, &pfuncdesc
);
3345 ok(hres
== S_OK
, "got %08x\n", hres
);
3346 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
3347 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3348 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3349 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3350 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYPUT
, "got 0x%x\n", pfuncdesc
->invkind
);
3351 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3352 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3353 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3355 if(sys
== SYS_WIN32
)
3356 todo_wine
ok(pfuncdesc
->oVft
== 15 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3359 ok(pfuncdesc
->oVft
== 15 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3360 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3361 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3362 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3364 edesc
= pfuncdesc
->lprgelemdescParam
;
3365 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
3366 ok(U(*edesc
).idldesc
.wIDLFlags
== IDLFLAG_FIN
, "got: %x\n", U(*edesc
).idldesc
.wIDLFlags
);
3368 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3369 ok(hres
== S_OK
, "got: %08x\n", hres
);
3370 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "got name: %s\n", wine_dbgstr_w(name
));
3371 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3372 ok(helpcontext
== 0x201, "got helpcontext: 0x%x\n", helpcontext
);
3373 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3374 SysFreeString(name
);
3375 SysFreeString(helpfile
);
3377 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, sizeof(names
) / sizeof(*names
), &cnames
);
3378 ok(hres
== S_OK
, "got: %08x\n", hres
);
3379 ok(cnames
== 1, "got: %u\n", cnames
);
3380 ok(!memcmp(names
[0], func1W
, sizeof(func1W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3381 SysFreeString(names
[0]);
3382 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3384 hres
= ITypeInfo_GetFuncDesc(ti
, 13, &pfuncdesc
);
3385 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
3387 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3389 hres
= ITypeLib_GetTypeInfo(tl
, 1, &ti
);
3390 ok(hres
== S_OK
, "got %08x\n", hres
);
3392 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3393 ok(hres
== S_OK
, "got %08x\n", hres
);
3394 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3395 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3396 ok(typeattr
->cFuncs
== 2, "cFuncs = %d\n", typeattr
->cFuncs
);
3397 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3398 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3399 ok(typeattr
->cbSizeVft
== 0xaab8 || typeattr
->cbSizeVft
== 0xaab0 ||
3400 typeattr
->cbSizeVft
== 0x5560, "cbSizeVft = 0x%x\n", typeattr
->cbSizeVft
);
3401 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3402 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3403 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3404 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3405 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3407 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
3408 ok(hres
== S_OK
, "got %08x\n", hres
);
3410 hres
= ITypeInfo_GetFuncDesc(ti
, 0, &pfuncdesc
);
3411 ok(hres
== S_OK
, "got %08x\n", hres
);
3412 ok(pfuncdesc
->memid
== 0x60020000, "got %x\n", pfuncdesc
->memid
);
3413 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3414 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3415 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3416 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3417 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3418 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3419 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3420 ok(pfuncdesc
->oVft
== 0xffffaaa8 ||
3421 pfuncdesc
->oVft
== 0x5550, "got %x\n", pfuncdesc
->oVft
);
3422 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3423 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3424 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3426 edesc
= pfuncdesc
->lprgelemdescParam
;
3427 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
3428 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3429 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3430 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3431 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3432 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3433 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3434 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3435 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x3, "got: 0x%x\n",
3436 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3437 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3438 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3439 ok(U(edesc
->tdesc
).lptdesc
== NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3440 ok(U(edesc
->tdesc
).hreftype
== 0, "got: %d\n", U(edesc
->tdesc
).hreftype
);
3441 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3443 hres
= ITypeInfo_GetFuncDesc(ti
, 1, &pfuncdesc
);
3444 ok(hres
== S_OK
, "got %08x\n", hres
);
3445 ok(pfuncdesc
->memid
== 0x60020001, "got %x\n", pfuncdesc
->memid
);
3446 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3447 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3448 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3449 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3450 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3451 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3452 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3453 ok(pfuncdesc
->oVft
== 0xffffaaac ||
3454 pfuncdesc
->oVft
== 0xffffaab0 ||
3455 pfuncdesc
->oVft
== 0x5558, "got %x\n", pfuncdesc
->oVft
);
3456 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3457 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3458 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3460 edesc
= pfuncdesc
->lprgelemdescParam
;
3461 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
3462 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3463 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3464 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3465 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3466 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3467 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3468 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3469 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x3, "got: 0x%x\n",
3470 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3471 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3472 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3473 ok(U(edesc
->tdesc
).lptdesc
== NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3474 ok(U(edesc
->tdesc
).hreftype
== 0, "got: %d\n", U(edesc
->tdesc
).hreftype
);
3475 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3477 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3479 hres
= ITypeLib_GetTypeInfo(tl
, 2, &ti
);
3480 ok(hres
== S_OK
, "got %08x\n", hres
);
3482 hres
= ITypeInfo_QueryInterface(ti
, &IID_ITypeInfo2
, (void**)&ti2
);
3483 ok(hres
== S_OK
, "got %08x\n", hres
);
3485 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3486 ok(hres
== S_OK
, "got %08x\n", hres
);
3487 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3488 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3489 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3490 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3491 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3492 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3493 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3494 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3495 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3496 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3497 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3499 VariantClear(&cust_data
);
3500 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
3501 ok(hres
== S_OK
, "got %08x\n", hres
);
3502 ok(V_VT(&cust_data
) == VT_BSTR
, "got wrong custdata type: %u\n", V_VT(&cust_data
));
3503 ok(!lstrcmpW(V_BSTR(&cust_data
), asdfW
), "got wrong custdata value: %s\n", wine_dbgstr_w(V_BSTR(&cust_data
)));
3504 SysFreeString(V_BSTR(&cust_data
));
3506 ITypeInfo2_Release(ti2
);
3507 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3509 hres
= ITypeLib_GetTypeInfo(tl
, 3, &ti
);
3510 ok(hres
== S_OK
, "got %08x\n", hres
);
3512 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3513 ok(hres
== S_OK
, "got %08x\n", hres
);
3514 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3515 ok(typeattr
->typekind
== TKIND_COCLASS
, "typekind = %d\n", typeattr
->typekind
);
3516 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3517 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3518 ok(typeattr
->cImplTypes
== 3, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3519 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3520 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3521 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3522 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3523 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3524 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3526 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
3527 ok(hres
== S_OK
, "got %08x\n", hres
);
3528 ok(hreftype
== 0, "got wrong hreftype: %x\n", hreftype
);
3530 hres
= ITypeInfo_GetImplTypeFlags(ti
, 0, &impltypeflags
);
3531 ok(hres
== S_OK
, "got %08x\n", hres
);
3532 ok(impltypeflags
== IMPLTYPEFLAG_FDEFAULT
, "got wrong flag: %x\n", impltypeflags
);
3534 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 1, &hreftype
);
3535 ok(hres
== S_OK
, "got %08x\n", hres
);
3536 ok(hreftype
== 1, "got wrong hreftype: %x\n", hreftype
);
3538 hres
= ITypeInfo_GetImplTypeFlags(ti
, 1, &impltypeflags
);
3539 ok(hres
== S_OK
, "got %08x\n", hres
);
3540 ok(impltypeflags
== IMPLTYPEFLAG_FRESTRICTED
, "got wrong flag: %x\n", impltypeflags
);
3542 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 2, &hreftype
);
3543 ok(hres
== S_OK
, "got %08x\n", hres
);
3544 ok(hreftype
== 1, "got wrong hreftype: %x\n", hreftype
);
3546 hres
= ITypeInfo_GetImplTypeFlags(ti
, 2, &impltypeflags
);
3547 ok(hres
== S_OK
, "got %08x\n", hres
);
3548 ok(impltypeflags
== 0, "got wrong flag: %x\n", impltypeflags
);
3550 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 3, &hreftype
);
3551 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
3553 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3555 hres
= ITypeLib_GetTypeInfo(tl
, 4, &ti
);
3556 ok(hres
== S_OK
, "got %08x\n", hres
);
3558 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3559 ok(hres
== S_OK
, "got %08x\n", hres
);
3560 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3561 ok(typeattr
->typekind
== TKIND_DISPATCH
, "typekind = %d\n", typeattr
->typekind
);
3562 ok(typeattr
->cFuncs
== 8, "cFuncs = %d\n", typeattr
->cFuncs
);
3563 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3564 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3565 ok(typeattr
->cbSizeVft
== 7 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3566 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3567 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
), "wTypeFlags = 0x%x\n", typeattr
->wTypeFlags
);
3568 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3569 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3570 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3572 hres
= ITypeInfo_GetTypeComp(ti
, &tcomp
);
3573 ok(hres
== S_OK
, "got %08x\n", hres
);
3575 hres
= ITypeComp_Bind(tcomp
, invokeW
, 0, INVOKE_FUNC
, &interface1
, &desckind
, &bindptr
);
3576 ok(hres
== S_OK
, "got %08x\n", hres
);
3577 ok(desckind
== DESCKIND_FUNCDESC
, "got wrong desckind: 0x%x\n", desckind
);
3578 ok(bindptr
.lpfuncdesc
->memid
== 0x60010003, "got %x\n", bindptr
.lpfuncdesc
->memid
);
3579 ok(bindptr
.lpfuncdesc
->lprgscode
== NULL
, "got %p\n", bindptr
.lpfuncdesc
->lprgscode
);
3580 ok(bindptr
.lpfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", bindptr
.lpfuncdesc
->lprgelemdescParam
);
3581 ok(bindptr
.lpfuncdesc
->funckind
== FUNC_DISPATCH
, "got 0x%x\n", bindptr
.lpfuncdesc
->funckind
);
3582 ok(bindptr
.lpfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", bindptr
.lpfuncdesc
->invkind
);
3583 ok(bindptr
.lpfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", bindptr
.lpfuncdesc
->callconv
);
3584 ok(bindptr
.lpfuncdesc
->cParams
== 8, "got %d\n", bindptr
.lpfuncdesc
->cParams
);
3585 ok(bindptr
.lpfuncdesc
->cParamsOpt
== 0, "got %d\n", bindptr
.lpfuncdesc
->cParamsOpt
);
3587 if(sys
== SYS_WIN32
)
3588 todo_wine
ok(bindptr
.lpfuncdesc
->oVft
== 6 * sizeof(void*), "got %x\n", bindptr
.lpfuncdesc
->oVft
);
3591 ok(bindptr
.lpfuncdesc
->oVft
== 6 * sizeof(void*), "got %x\n", bindptr
.lpfuncdesc
->oVft
);
3592 ok(bindptr
.lpfuncdesc
->cScodes
== 0, "got %d\n", bindptr
.lpfuncdesc
->cScodes
);
3593 ok(bindptr
.lpfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", bindptr
.lpfuncdesc
->elemdescFunc
.tdesc
.vt
);
3594 ok(bindptr
.lpfuncdesc
->wFuncFlags
== FUNCFLAG_FRESTRICTED
, "got 0x%x\n", bindptr
.lpfuncdesc
->wFuncFlags
);
3596 ITypeInfo_ReleaseFuncDesc(interface1
, bindptr
.lpfuncdesc
);
3597 ITypeInfo_Release(interface1
);
3598 ITypeComp_Release(tcomp
);
3600 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, -1, &hreftype
);
3601 ok(hres
== S_OK
, "got %08x\n", hres
);
3602 ok(hreftype
== -2, "got wrong hreftype: %x\n", hreftype
);
3604 hres
= ITypeInfo_GetRefTypeInfo(ti
, hreftype
, &interface1
);
3605 ok(hres
== S_OK
, "got %08x\n", hres
);
3607 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
3608 ok(hres
== S_OK
, "got %08x\n", hres
);
3609 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3610 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3611 ok(typeattr
->cFuncs
== 1, "cFuncs = %d\n", typeattr
->cFuncs
);
3612 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3613 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3615 if(sys
== SYS_WIN32
)
3616 todo_wine
ok(typeattr
->cbSizeVft
== 8 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3619 ok(typeattr
->cbSizeVft
== 8 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3620 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3621 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
), "wTypeFlags = 0x%x\n", typeattr
->wTypeFlags
);
3622 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3623 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3624 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
3626 ITypeInfo_Release(interface1
);
3628 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3630 hres
= ITypeLib_GetTypeInfo(tl
, 5, &ti
);
3631 ok(hres
== S_OK
, "got %08x\n", hres
);
3633 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3634 ok(hres
== S_OK
, "got %08x\n", hres
);
3635 ok(typeattr
->cbSizeInstance
== 8, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3636 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
3637 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3638 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3639 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3640 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3641 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3642 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = 0x%x\n", typeattr
->wTypeFlags
);
3643 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3644 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3645 ok(typeattr
->tdescAlias
.vt
== VT_R8
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
3646 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3648 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3650 ok(ITypeLib_Release(tl
)==0, "Object should be freed\n");
3652 DeleteFileA(filename
);
3655 #if 0 /* use this to generate more tests */
3657 #define OLE_CHECK(x) { HRESULT hr = x; if (FAILED(hr)) { printf(#x "failed - %x\n", hr); return; } }
3659 static char *dump_string(LPWSTR wstr
)
3661 int size
= lstrlenW(wstr
)+3;
3662 char *out
= CoTaskMemAlloc(size
);
3663 WideCharToMultiByte(20127, 0, wstr
, -1, out
+1, size
, NULL
, NULL
);
3675 #define MAP_ENTRY(x) { x, #x }
3676 static const struct map_entry tkind_map
[] = {
3677 MAP_ENTRY(TKIND_ENUM
),
3678 MAP_ENTRY(TKIND_RECORD
),
3679 MAP_ENTRY(TKIND_MODULE
),
3680 MAP_ENTRY(TKIND_INTERFACE
),
3681 MAP_ENTRY(TKIND_DISPATCH
),
3682 MAP_ENTRY(TKIND_COCLASS
),
3683 MAP_ENTRY(TKIND_ALIAS
),
3684 MAP_ENTRY(TKIND_UNION
),
3685 MAP_ENTRY(TKIND_MAX
),
3689 static const struct map_entry funckind_map
[] = {
3690 MAP_ENTRY(FUNC_VIRTUAL
),
3691 MAP_ENTRY(FUNC_PUREVIRTUAL
),
3692 MAP_ENTRY(FUNC_NONVIRTUAL
),
3693 MAP_ENTRY(FUNC_STATIC
),
3694 MAP_ENTRY(FUNC_DISPATCH
),
3698 static const struct map_entry invkind_map
[] = {
3699 MAP_ENTRY(INVOKE_FUNC
),
3700 MAP_ENTRY(INVOKE_PROPERTYGET
),
3701 MAP_ENTRY(INVOKE_PROPERTYPUT
),
3702 MAP_ENTRY(INVOKE_PROPERTYPUTREF
),
3708 static const char *map_value(DWORD val
, const struct map_entry
*map
)
3711 static char bufs
[16][256];
3716 if (map
->value
== val
)
3721 buf
= bufs
[(map_id
++)%16];
3722 sprintf(buf
, "0x%x", val
);
3726 static void test_dump_typelib(const char *name
)
3728 WCHAR wszString
[260];
3734 MultiByteToWideChar(CP_ACP
, 0, name
, -1, wszString
, 260);
3735 OLE_CHECK(LoadTypeLib(wszString
, &lib
));
3736 count
= ITypeLib_GetTypeInfoCount(lib
);
3737 printf("/* interfaces count: %d */\n", count
);
3738 for (i
= 0; i
< count
; i
++)
3744 OLE_CHECK(ITypeLib_GetDocumentation(lib
, i
, &name
, NULL
, NULL
, NULL
));
3746 " %s,\n", dump_string(name
));
3747 SysFreeString(name
);
3749 OLE_CHECK(ITypeLib_GetTypeInfo(lib
, i
, &info
));
3750 ITypeInfo_GetTypeAttr(info
, &attr
);
3751 printf(" /*kind*/ %s, /*flags*/ 0x%x, /*align*/ %d, /*size*/ %d,\n"
3752 " /*#vtbl*/ %d, /*#func*/ %d,\n"
3754 map_value(attr
->typekind
, tkind_map
), attr
->wTypeFlags
, attr
->cbAlignment
, attr
->cbSizeInstance
, attr
->cbSizeVft
,
3756 ITypeInfo_ReleaseTypeAttr(info
, attr
);
3764 if (FAILED(ITypeInfo_GetFuncDesc(info
, f
, &desc
)))
3767 " 0x%x, /*func*/ %s, /*inv*/ %s, /*call*/ 0x%x,\n",
3768 desc
->memid
, map_value(desc
->funckind
, funckind_map
), map_value(desc
->invkind
, invkind_map
),
3770 printf(" /*#param*/ %d, /*#opt*/ %d, /*vtbl*/ %d, /*#scodes*/ %d, /*flags*/ 0x%x,\n",
3771 desc
->cParams
, desc
->cParamsOpt
, desc
->oVft
, desc
->cScodes
, desc
->wFuncFlags
);
3772 printf(" {%d, %x}, /* ret */\n", desc
->elemdescFunc
.tdesc
.vt
, desc
->elemdescFunc
.paramdesc
.wParamFlags
);
3773 printf(" { /* params */\n");
3774 for (p
= 0; p
< desc
->cParams
; p
++)
3776 ELEMDESC e
= desc
->lprgelemdescParam
[p
];
3777 printf(" {%d, %x},\n", e
.tdesc
.vt
, e
.paramdesc
.wParamFlags
);
3779 printf(" {-1, -1}\n");
3781 printf(" { /* names */\n");
3782 OLE_CHECK(ITypeInfo_GetNames(info
, desc
->memid
, tab
, 256, &cNames
));
3783 for (p
= 0; p
< cNames
; p
++)
3785 printf(" %s,\n", dump_string(tab
[p
]));
3786 SysFreeString(tab
[p
]);
3791 ITypeInfo_ReleaseFuncDesc(info
, desc
);
3796 ITypeInfo_Release(info
);
3798 ITypeLib_Release(lib
);
3803 typedef struct _element_info
3809 typedef struct _function_info
3820 element_info ret_type
;
3821 element_info params
[15];
3825 typedef struct _type_info
3832 USHORT cbSizeInstance
;
3835 function_info funcs
[20];
3838 static const type_info info
[] = {
3841 "{b14b6bb5-904e-4ff9-b247-bd361f7aaedd}",
3842 /*kind*/ TKIND_DISPATCH
, /*flags*/ TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
, /*align*/ 4, /*size*/ sizeof(void*),
3843 /*#vtbl*/ 7, /*#func*/ 8,
3846 0x60000000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
3847 /*#param*/ 2, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0x1,
3862 0x60000001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
3863 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 1, /*#scodes*/ 0, /*flags*/ 0x1,
3874 0x60000002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
3875 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 2, /*#scodes*/ 0, /*flags*/ 0x1,
3886 0x60010000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
3887 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 3, /*#scodes*/ 0, /*flags*/ 0x1,
3900 0x60010001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
3901 /*#param*/ 3, /*#opt*/ 0, /*vtbl*/ 4, /*#scodes*/ 0, /*flags*/ 0x1,
3918 0x60010002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
3919 /*#param*/ 5, /*#opt*/ 0, /*vtbl*/ 5, /*#scodes*/ 0, /*flags*/ 0x1,
3940 0x60010003, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
3941 /*#param*/ 8, /*#opt*/ 0, /*vtbl*/ 6, /*#scodes*/ 0, /*flags*/ 0x1,
3968 0x60020000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
3969 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0x0,
3983 "{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac009}",
3984 /*kind*/ TKIND_INTERFACE
, /*flags*/ TYPEFLAG_FDISPATCHABLE
, /*align*/ 4, /*size*/ sizeof(void*),
3985 /*#vtbl*/ 8, /*#func*/ 1,
3988 0x60020000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
3989 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0x0,
4003 "{4029f190-ca4a-4611-aeb9-673983cb96dd}",
4004 /* kind */ TKIND_RECORD
, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct
)
4008 #define check_type(elem, info) { \
4009 expect_int((elem)->tdesc.vt, (info)->vt); \
4010 expect_hex(U(*(elem)).paramdesc.wParamFlags, (info)->wParamFlags); \
4013 static void test_dump_typelib(const char *name
)
4015 WCHAR wszName
[MAX_PATH
];
4017 int ticount
= sizeof(info
)/sizeof(info
[0]);
4020 MultiByteToWideChar(CP_ACP
, 0, name
, -1, wszName
, MAX_PATH
);
4021 ole_check(LoadTypeLibEx(wszName
, REGKIND_NONE
, &typelib
));
4022 expect_eq(ITypeLib_GetTypeInfoCount(typelib
), ticount
, UINT
, "%d");
4023 for (iface
= 0; iface
< ticount
; iface
++)
4025 const type_info
*ti
= &info
[iface
];
4026 ITypeInfo
*typeinfo
;
4030 trace("Interface %s\n", ti
->name
);
4031 ole_check(ITypeLib_GetTypeInfo(typelib
, iface
, &typeinfo
));
4032 ole_check(ITypeLib_GetDocumentation(typelib
, iface
, &bstrIfName
, NULL
, NULL
, NULL
));
4033 expect_wstr_acpval(bstrIfName
, ti
->name
);
4034 SysFreeString(bstrIfName
);
4036 ole_check(ITypeInfo_GetTypeAttr(typeinfo
, &typeattr
));
4037 expect_int(typeattr
->typekind
, ti
->type
);
4038 expect_hex(typeattr
->wTypeFlags
, ti
->wTypeFlags
);
4039 expect_int(typeattr
->cbAlignment
, ti
->cbAlignment
);
4040 expect_int(typeattr
->cbSizeInstance
, ti
->cbSizeInstance
);
4041 expect_int(typeattr
->cbSizeVft
, ti
->cbSizeVft
* sizeof(void*));
4042 expect_int(typeattr
->cFuncs
, ti
->cFuncs
);
4044 /* compare type uuid */
4045 if (ti
->uuid
&& *ti
->uuid
)
4048 ITypeInfo
*typeinfo2
;
4052 MultiByteToWideChar(CP_ACP
, 0, ti
->uuid
, -1, guidW
, sizeof(guidW
)/sizeof(guidW
[0]));
4053 IIDFromString(guidW
, &guid
);
4054 expect_guid(&guid
, &typeattr
->guid
);
4056 /* check that it's possible to search using this uuid */
4058 hr
= ITypeLib_GetTypeInfoOfGuid(typelib
, &guid
, &typeinfo2
);
4059 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4060 ITypeInfo_Release(typeinfo2
);
4063 for (func
= 0; func
< typeattr
->cFuncs
; func
++)
4065 function_info
*fn_info
= (function_info
*)&ti
->funcs
[func
];
4071 trace("Function %s\n", fn_info
->names
[0]);
4072 ole_check(ITypeInfo_GetFuncDesc(typeinfo
, func
, &desc
));
4073 expect_int(desc
->memid
, fn_info
->memid
);
4074 expect_int(desc
->funckind
, fn_info
->funckind
);
4075 expect_int(desc
->invkind
, fn_info
->invkind
);
4076 expect_int(desc
->callconv
, fn_info
->callconv
);
4077 expect_int(desc
->cParams
, fn_info
->cParams
);
4078 expect_int(desc
->cParamsOpt
, fn_info
->cParamsOpt
);
4079 ok( desc
->oVft
== fn_info
->vtbl_index
* sizeof(void*) ||
4080 broken(desc
->oVft
== fn_info
->vtbl_index
* 4), /* xp64 */
4081 "desc->oVft got %u\n", desc
->oVft
);
4082 expect_int(desc
->cScodes
, fn_info
->cScodes
);
4083 expect_int(desc
->wFuncFlags
, fn_info
->wFuncFlags
);
4084 ole_check(ITypeInfo_GetNames(typeinfo
, desc
->memid
, namesTab
, 256, &cNames
));
4085 for (i
= 0; i
< cNames
; i
++)
4087 expect_wstr_acpval(namesTab
[i
], fn_info
->names
[i
]);
4088 SysFreeString(namesTab
[i
]);
4090 expect_null(fn_info
->names
[cNames
]);
4092 check_type(&desc
->elemdescFunc
, &fn_info
->ret_type
);
4093 for (i
= 0 ; i
< desc
->cParams
; i
++)
4095 check_type(&desc
->lprgelemdescParam
[i
], &fn_info
->params
[i
]);
4097 expect_int(fn_info
->params
[desc
->cParams
].vt
, (VARTYPE
)-1);
4099 ITypeInfo_ReleaseFuncDesc(typeinfo
, desc
);
4102 ITypeInfo_ReleaseTypeAttr(typeinfo
, typeattr
);
4103 ITypeInfo_Release(typeinfo
);
4105 ITypeLib_Release(typelib
);
4110 static void test_create_typelib_lcid(LCID lcid
)
4112 char filename
[MAX_PATH
];
4113 WCHAR name
[MAX_PATH
];
4115 ICreateTypeLib2
*tl
;
4117 DWORD msft_header
[8];
4122 GetTempFileNameA( ".", "tlb", 0, filename
);
4123 MultiByteToWideChar(CP_ACP
, 0, filename
, -1, name
, MAX_PATH
);
4125 hr
= CreateTypeLib2(SYS_WIN32
, name
, &tl
);
4126 ok(hr
== S_OK
, "got %08x\n", hr
);
4128 hr
= ICreateTypeLib2_QueryInterface(tl
, &IID_ITypeLib
, (void**)&typelib
);
4129 ok(hr
== S_OK
, "got %08x\n", hr
);
4131 hr
= ITypeLib_GetLibAttr(typelib
, &attr
);
4132 ok(hr
== S_OK
, "got %08x\n", hr
);
4133 ok(attr
->wLibFlags
== 0, "flags 0x%x\n", attr
->wLibFlags
);
4134 ITypeLib_ReleaseTLibAttr(typelib
, attr
);
4136 hr
= ICreateTypeLib2_SetLcid(tl
, lcid
);
4137 ok(hr
== S_OK
, "got %08x\n", hr
);
4139 hr
= ICreateTypeLib2_SetVersion(tl
, 3, 4);
4140 ok(hr
== S_OK
, "got %08x\n", hr
);
4142 hr
= ICreateTypeLib2_SaveAllChanges(tl
);
4143 ok(hr
== S_OK
, "got %08x\n", hr
);
4145 hr
= ITypeLib_GetLibAttr(typelib
, &attr
);
4146 ok(hr
== S_OK
, "got %08x\n", hr
);
4147 ok(attr
->wLibFlags
== 0, "flags 0x%x\n", attr
->wLibFlags
);
4148 ITypeLib_ReleaseTLibAttr(typelib
, attr
);
4150 ITypeLib_Release(typelib
);
4151 ICreateTypeLib2_Release(tl
);
4153 file
= CreateFileA( filename
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, 0, 0 );
4154 ok( file
!= INVALID_HANDLE_VALUE
, "file creation failed\n" );
4156 ReadFile( file
, msft_header
, sizeof(msft_header
), &read
, NULL
);
4157 ok(read
== sizeof(msft_header
), "read %d\n", read
);
4158 CloseHandle( file
);
4160 ok(msft_header
[0] == 0x5446534d, "got %08x\n", msft_header
[0]);
4161 ok(msft_header
[1] == 0x00010002, "got %08x\n", msft_header
[1]);
4162 ok(msft_header
[2] == 0xffffffff, "got %08x\n", msft_header
[2]);
4163 ok(msft_header
[3] == (lcid
? lcid
: 0x409), "got %08x (lcid %08x)\n", msft_header
[3], lcid
);
4164 ok(msft_header
[4] == lcid
, "got %08x (lcid %08x)\n", msft_header
[4], lcid
);
4165 ok(msft_header
[6] == 0x00040003, "got %08x\n", msft_header
[6]);
4166 ok(msft_header
[7] == 0, "got %08x\n", msft_header
[7]);
4168 /* check flags after loading */
4169 hr
= LoadTypeLib(name
, &typelib
);
4170 ok(hr
== S_OK
, "got %08x\n", hr
);
4172 hr
= ITypeLib_GetLibAttr(typelib
, &attr
);
4173 ok(hr
== S_OK
, "got %08x\n", hr
);
4174 ok(attr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "flags 0x%x\n", attr
->wLibFlags
);
4175 ITypeLib_ReleaseTLibAttr(typelib
, attr
);
4176 ITypeLib_Release(typelib
);
4178 DeleteFileA(filename
);
4181 static void test_create_typelibs(void)
4183 test_create_typelib_lcid(LOCALE_SYSTEM_DEFAULT
);
4184 test_create_typelib_lcid(LOCALE_USER_DEFAULT
);
4185 test_create_typelib_lcid(LOCALE_NEUTRAL
);
4187 test_create_typelib_lcid(0x009);
4188 test_create_typelib_lcid(0x409);
4189 test_create_typelib_lcid(0x809);
4191 test_create_typelib_lcid(0x007);
4192 test_create_typelib_lcid(0x407);
4196 static void test_register_typelib(BOOL system_registration
)
4199 WCHAR filename
[MAX_PATH
];
4200 const char *filenameA
;
4203 char key_name
[MAX_PATH
], uuid
[40];
4204 LONG ret
, expect_ret
;
4207 REGSAM opposite
= (sizeof(void*) == 8 ? KEY_WOW64_32KEY
: KEY_WOW64_64KEY
);
4208 BOOL is_wow64
= FALSE
;
4215 { TKIND_INTERFACE
, 0 },
4216 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
},
4217 { TKIND_INTERFACE
, TYPEFLAG_FOLEAUTOMATION
},
4218 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FOLEAUTOMATION
},
4219 { TKIND_DISPATCH
, 0 /* TYPEFLAG_FDUAL - widl clears this flag for non-IDispatch derived interfaces */ },
4220 { TKIND_DISPATCH
, 0 /* TYPEFLAG_FDUAL - widl clears this flag for non-IDispatch derived interfaces */ },
4221 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
},
4222 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
},
4223 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
},
4224 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
},
4225 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
},
4226 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
}
4229 trace("Starting %s typelib registration tests\n",
4230 system_registration
? "system" : "user");
4232 if (!system_registration
&& (!pRegisterTypeLibForUser
|| !pUnRegisterTypeLibForUser
))
4234 win_skip("User typelib registration functions are not available\n");
4238 if (pIsWow64Process
)
4239 pIsWow64Process(GetCurrentProcess(), &is_wow64
);
4241 filenameA
= create_test_typelib(3);
4242 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filename
, MAX_PATH
);
4244 hr
= LoadTypeLibEx(filename
, REGKIND_NONE
, &typelib
);
4245 ok(hr
== S_OK
, "got %08x\n", hr
);
4247 if (system_registration
)
4248 hr
= RegisterTypeLib(typelib
, filename
, NULL
);
4250 hr
= pRegisterTypeLibForUser(typelib
, filename
, NULL
);
4251 if (hr
== TYPE_E_REGISTRYACCESS
)
4253 win_skip("Insufficient privileges to register typelib in the registry\n");
4254 ITypeLib_Release(typelib
);
4255 DeleteFileA(filenameA
);
4258 ok(hr
== S_OK
, "got %08x\n", hr
);
4260 count
= ITypeLib_GetTypeInfoCount(typelib
);
4261 ok(count
== 12, "got %d\n", count
);
4263 for(i
= 0; i
< count
; i
++)
4265 ITypeInfo
*typeinfo
;
4268 hr
= ITypeLib_GetTypeInfo(typelib
, i
, &typeinfo
);
4269 ok(hr
== S_OK
, "got %08x\n", hr
);
4271 hr
= ITypeInfo_GetTypeAttr(typeinfo
, &attr
);
4272 ok(hr
== S_OK
, "got %08x\n", hr
);
4274 ok(attr
->typekind
== attrs
[i
].kind
, "%d: got kind %d\n", i
, attr
->typekind
);
4275 ok(attr
->wTypeFlags
== attrs
[i
].flags
, "%d: got flags %04x\n", i
, attr
->wTypeFlags
);
4277 if(attr
->typekind
== TKIND_DISPATCH
&& (attr
->wTypeFlags
& TYPEFLAG_FDUAL
))
4280 ITypeInfo
*dual_info
;
4281 TYPEATTR
*dual_attr
;
4283 hr
= ITypeInfo_GetRefTypeOfImplType(typeinfo
, -1, &reftype
);
4284 ok(hr
== S_OK
, "got %08x\n", hr
);
4286 hr
= ITypeInfo_GetRefTypeInfo(typeinfo
, reftype
, &dual_info
);
4287 ok(hr
== S_OK
, "got %08x\n", hr
);
4289 hr
= ITypeInfo_GetTypeAttr(dual_info
, &dual_attr
);
4290 ok(hr
== S_OK
, "got %08x\n", hr
);
4292 ok(dual_attr
->typekind
== TKIND_INTERFACE
, "%d: got kind %d\n", i
, dual_attr
->typekind
);
4293 ok(dual_attr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FOLEAUTOMATION
| TYPEFLAG_FDUAL
), "%d: got flags %04x\n", i
, dual_attr
->wTypeFlags
);
4295 ITypeInfo_ReleaseTypeAttr(dual_info
, dual_attr
);
4296 ITypeInfo_Release(dual_info
);
4300 StringFromGUID2(&attr
->guid
, uuidW
, sizeof(uuidW
) / sizeof(uuidW
[0]));
4301 WideCharToMultiByte(CP_ACP
, 0, uuidW
, -1, uuid
, sizeof(uuid
), NULL
, NULL
);
4302 sprintf(key_name
, "Interface\\%s", uuid
);
4304 /* All dispinterfaces will be registered (this includes dual interfaces) as well
4305 as oleautomation interfaces */
4306 if((attr
->typekind
== TKIND_INTERFACE
&& (attr
->wTypeFlags
& TYPEFLAG_FOLEAUTOMATION
)) ||
4307 attr
->typekind
== TKIND_DISPATCH
)
4308 expect_ret
= ERROR_SUCCESS
;
4310 expect_ret
= ERROR_FILE_NOT_FOUND
;
4312 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
, &hkey
);
4313 ok(ret
== expect_ret
, "%d: got %d\n", i
, ret
);
4314 if(ret
== ERROR_SUCCESS
) RegCloseKey(hkey
);
4316 /* 32-bit typelibs should be registered into both registry bit modes */
4317 if (is_win64
|| is_wow64
)
4319 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
| opposite
, &hkey
);
4320 ok(ret
== expect_ret
, "%d: got %d\n", i
, ret
);
4321 if(ret
== ERROR_SUCCESS
) RegCloseKey(hkey
);
4324 ITypeInfo_ReleaseTypeAttr(typeinfo
, attr
);
4325 ITypeInfo_Release(typeinfo
);
4328 if (system_registration
)
4329 hr
= UnRegisterTypeLib(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, is_win64
? SYS_WIN64
: SYS_WIN32
);
4331 hr
= pUnRegisterTypeLibForUser(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, is_win64
? SYS_WIN64
: SYS_WIN32
);
4332 ok(hr
== S_OK
, "got %08x\n", hr
);
4334 for(i
= 0; i
< count
; i
++)
4336 ITypeInfo
*typeinfo
;
4339 hr
= ITypeLib_GetTypeInfo(typelib
, i
, &typeinfo
);
4340 ok(hr
== S_OK
, "got %08x\n", hr
);
4342 hr
= ITypeInfo_GetTypeAttr(typeinfo
, &attr
);
4343 ok(hr
== S_OK
, "got %08x\n", hr
);
4345 if((attr
->typekind
== TKIND_INTERFACE
&& (attr
->wTypeFlags
& TYPEFLAG_FOLEAUTOMATION
)) ||
4346 attr
->typekind
== TKIND_DISPATCH
)
4348 StringFromGUID2(&attr
->guid
, uuidW
, sizeof(uuidW
) / sizeof(uuidW
[0]));
4349 WideCharToMultiByte(CP_ACP
, 0, uuidW
, -1, uuid
, sizeof(uuid
), NULL
, NULL
);
4350 sprintf(key_name
, "Interface\\%s", uuid
);
4352 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
, &hkey
);
4353 ok(ret
== ERROR_FILE_NOT_FOUND
, "Interface registry remains in %s (%d)\n", key_name
, i
);
4354 if (is_win64
|| is_wow64
)
4356 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
| opposite
, &hkey
);
4357 ok(ret
== ERROR_FILE_NOT_FOUND
, "Interface registry remains in %s (%d)\n", key_name
, i
);
4360 ITypeInfo_ReleaseTypeAttr(typeinfo
, attr
);
4361 ITypeInfo_Release(typeinfo
);
4364 ITypeLib_Release(typelib
);
4365 DeleteFileA( filenameA
);
4368 static void test_LoadTypeLib(void)
4373 static const WCHAR kernel32_dllW
[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
4375 hres
= LoadTypeLib(kernel32_dllW
, &tl
);
4376 ok(hres
== TYPE_E_CANTLOADLIBRARY
, "LoadTypeLib returned: %08x, expected TYPE_E_CANTLOADLIBRARY\n", hres
);
4379 static void test_SetVarHelpContext(void)
4381 static OLECHAR nameW
[] = {'n','a','m','e',0};
4382 CHAR filenameA
[MAX_PATH
];
4383 WCHAR filenameW
[MAX_PATH
];
4384 ICreateTypeLib2
*ctl
;
4385 ICreateTypeInfo
*cti
;
4388 VARDESC desc
, *pdesc
;
4393 GetTempFileNameA(".", "tlb", 0, filenameA
);
4394 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
4396 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
4397 ok(hr
== S_OK
, "got %08x\n", hr
);
4399 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_ENUM
, &cti
);
4400 ok(hr
== S_OK
, "got %08x\n", hr
);
4402 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 0, 0);
4403 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
4405 memset(&desc
, 0, sizeof(desc
));
4406 desc
.memid
= MEMBERID_NIL
;
4407 desc
.elemdescVar
.tdesc
.vt
= VT_INT
;
4408 desc
.varkind
= VAR_CONST
;
4412 U(desc
).lpvarValue
= &v
;
4413 hr
= ICreateTypeInfo_AddVarDesc(cti
, 0, &desc
);
4414 ok(hr
== S_OK
, "got %08x\n", hr
);
4416 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 0, 0);
4417 ok(hr
== S_OK
, "got %08x\n", hr
);
4420 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 0, 1);
4421 ok(hr
== S_OK
, "got %08x\n", hr
);
4423 /* wrong index now */
4424 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 1, 0);
4425 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
4427 ICreateTypeInfo_Release(cti
);
4429 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
4430 ok(hr
== S_OK
, "got: %08x\n", hr
);
4432 ICreateTypeLib2_Release(ctl
);
4434 hr
= LoadTypeLib(filenameW
, &tl
);
4435 ok(hr
== S_OK
, "got: %08x\n", hr
);
4437 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
4438 ok(hr
== S_OK
, "got %08x\n", hr
);
4440 hr
= ITypeInfo_GetVarDesc(ti
, 0, &pdesc
);
4441 ok(hr
== S_OK
, "got %08x\n", hr
);
4442 ok(pdesc
->memid
== 0x40000000, "got wrong memid: %x\n", pdesc
->memid
);
4443 ok(pdesc
->elemdescVar
.tdesc
.vt
== VT_INT
, "got wrong vardesc type: %u\n", pdesc
->elemdescVar
.tdesc
.vt
);
4444 ok(pdesc
->varkind
== VAR_CONST
, "got wrong varkind: %u\n", pdesc
->varkind
);
4445 ok(V_VT(U(*pdesc
).lpvarValue
) == VT_INT
, "got wrong value type: %u\n", V_VT(U(*pdesc
).lpvarValue
));
4446 ok(V_INT(U(*pdesc
).lpvarValue
) == 1, "got wrong value: 0x%x\n", V_INT(U(*pdesc
).lpvarValue
));
4448 hr
= ITypeInfo_GetDocumentation(ti
, pdesc
->memid
, NULL
, NULL
, &ctx
, NULL
);
4449 ok(hr
== S_OK
, "got %08x\n", hr
);
4450 ok(ctx
== 1, "got wrong help context: 0x%x\n", ctx
);
4452 ITypeInfo_ReleaseVarDesc(ti
, pdesc
);
4453 ITypeInfo_Release(ti
);
4454 ITypeLib_Release(tl
);
4456 DeleteFileA(filenameA
);
4459 static void test_SetFuncAndParamNames(void)
4461 static OLECHAR nameW
[] = {'n','a','m','e',0};
4462 static OLECHAR name2W
[] = {'n','a','m','e','2',0};
4463 static OLECHAR prop
[] = {'p','r','o','p',0};
4464 static OLECHAR
*propW
[] = {prop
};
4465 static OLECHAR func
[] = {'f','u','n','c',0};
4466 static OLECHAR
*funcW
[] = {func
, NULL
};
4467 CHAR filenameA
[MAX_PATH
];
4468 WCHAR filenameW
[MAX_PATH
];
4469 ICreateTypeLib2
*ctl
;
4470 ICreateTypeInfo
*cti
;
4472 ITypeInfo
*infos
[3];
4479 GetTempFileNameA(".", "tlb", 0, filenameA
);
4480 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
4482 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
4483 ok(hr
== S_OK
, "got %08x\n", hr
);
4485 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_DISPATCH
, &cti
);
4486 ok(hr
== S_OK
, "got %08x\n", hr
);
4489 memset(&funcdesc
, 0, sizeof(FUNCDESC
));
4490 funcdesc
.funckind
= FUNC_DISPATCH
;
4491 funcdesc
.callconv
= CC_STDCALL
;
4492 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
4493 funcdesc
.wFuncFlags
= FUNCFLAG_FBINDABLE
;
4496 memset(&edesc
, 0, sizeof(edesc
));
4497 edesc
.tdesc
.vt
= VT_BSTR
;
4498 U(edesc
).idldesc
.dwReserved
= 0;
4499 U(edesc
).idldesc
.wIDLFlags
= IDLFLAG_FIN
;
4501 funcdesc
.lprgelemdescParam
= &edesc
;
4502 funcdesc
.invkind
= INVOKE_PROPERTYPUT
;
4503 funcdesc
.cParams
= 1;
4505 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 0, &funcdesc
);
4506 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4509 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 0, propW
, 1);
4510 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4513 funcdesc
.invkind
= INVOKE_PROPERTYPUTREF
;
4514 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 1, &funcdesc
);
4515 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4518 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 1, propW
, 1);
4519 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4521 funcdesc
.invkind
= INVOKE_PROPERTYGET
;
4522 funcdesc
.cParams
= 0;
4523 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 2, &funcdesc
);
4524 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4527 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 2, propW
, 1);
4528 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4530 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 3, &funcdesc
);
4531 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4533 /* getter name again */
4534 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 3, propW
, 1);
4535 ok(hr
== TYPE_E_AMBIGUOUSNAME
, "got 0x%08x\n", hr
);
4537 /* regular function */
4538 funcdesc
.invkind
= INVOKE_FUNC
;
4539 funcdesc
.cParams
= 1;
4540 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 4, &funcdesc
);
4541 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4543 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 4, funcW
, 2);
4544 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4546 ICreateTypeInfo_Release(cti
);
4548 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, name2W
, TKIND_INTERFACE
, &cti
);
4549 ok(hr
== S_OK
, "got %08x\n", hr
);
4551 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
4552 funcdesc
.invkind
= INVOKE_FUNC
;
4553 funcdesc
.cParams
= 0;
4554 funcdesc
.lprgelemdescParam
= NULL
;
4555 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 0, &funcdesc
);
4556 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4558 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 0, funcW
, 1);
4559 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4561 ICreateTypeInfo_Release(cti
);
4563 hr
= ICreateTypeLib2_QueryInterface(ctl
, &IID_ITypeLib
, (void**)&tl
);
4564 ok(hr
== S_OK
, "got %08x\n", hr
);
4567 memset(infos
, 0, sizeof(infos
));
4568 memids
[0] = 0xdeadbeef;
4569 memids
[1] = 0xdeadbeef;
4570 memids
[2] = 0xdeadbeef;
4571 hr
= ITypeLib_FindName(tl
, func
, 0, infos
, memids
, &found
);
4572 ok(hr
== S_OK
, "got %08x\n", hr
);
4573 ok(found
== 1, "got wrong count: %u\n", found
);
4574 ok(infos
[0] && !infos
[1] && !infos
[2], "got wrong typeinfo\n");
4575 ok(memids
[0] == 0, "got wrong memid[0]\n");
4576 ok(memids
[1] == 0xdeadbeef && memids
[2] == 0xdeadbeef, "got wrong memids\n");
4579 memset(infos
, 0, sizeof(infos
));
4580 memids
[0] = 0xdeadbeef;
4581 memids
[1] = 0xdeadbeef;
4582 memids
[2] = 0xdeadbeef;
4583 hr
= ITypeLib_FindName(tl
, func
, 0, infos
, memids
, &found
);
4584 ok(hr
== S_OK
, "got %08x\n", hr
);
4585 ok(found
== 2, "got wrong count: %u\n", found
);
4586 ok(infos
[0] && infos
[1] && infos
[0] != infos
[1], "got same typeinfo\n");
4587 ok(memids
[0] == 0, "got wrong memid[0]\n");
4588 ok(memids
[1] == 0, "got wrong memid[1]\n");
4590 ITypeLib_Release(tl
);
4591 ICreateTypeLib2_Release(ctl
);
4592 DeleteFileA(filenameA
);
4595 static void test_SetDocString(void)
4597 static OLECHAR nameW
[] = {'n','a','m','e',0};
4598 static OLECHAR name2W
[] = {'n','a','m','e','2',0};
4599 static OLECHAR doc1W
[] = {'d','o','c','1',0};
4600 static OLECHAR doc2W
[] = {'d','o','c','2',0};
4601 static OLECHAR var_nameW
[] = {'v','a','r','n','a','m','e',0};
4602 CHAR filenameA
[MAX_PATH
];
4603 WCHAR filenameW
[MAX_PATH
];
4604 ICreateTypeLib2
*ctl
;
4605 ICreateTypeInfo
*cti
;
4608 BSTR namestr
, docstr
;
4609 VARDESC desc
, *pdesc
;
4610 FUNCDESC funcdesc
, *pfuncdesc
;
4614 GetTempFileNameA(".", "tlb", 0, filenameA
);
4615 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
4617 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
4618 ok(hr
== S_OK
, "got %08x\n", hr
);
4620 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_ENUM
, &cti
);
4621 ok(hr
== S_OK
, "got %08x\n", hr
);
4623 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, doc1W
);
4624 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
4626 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, NULL
);
4627 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
4629 memset(&desc
, 0, sizeof(desc
));
4630 desc
.memid
= MEMBERID_NIL
;
4631 desc
.elemdescVar
.tdesc
.vt
= VT_INT
;
4632 desc
.varkind
= VAR_CONST
;
4636 U(desc
).lpvarValue
= &v
;
4637 hr
= ICreateTypeInfo_AddVarDesc(cti
, 0, &desc
);
4638 ok(hr
== S_OK
, "got %08x\n", hr
);
4640 hr
= ICreateTypeInfo_SetVarName(cti
, 0, NULL
);
4641 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
4643 hr
= ICreateTypeInfo_SetVarName(cti
, 1, var_nameW
);
4644 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
4646 hr
= ICreateTypeInfo_SetVarName(cti
, 0, var_nameW
);
4647 ok(hr
== S_OK
, "got %08x\n", hr
);
4649 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, NULL
);
4650 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
4652 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, doc1W
);
4653 ok(hr
== S_OK
, "got %08x\n", hr
);
4656 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, doc2W
);
4657 ok(hr
== S_OK
, "got %08x\n", hr
);
4659 /* wrong index now */
4660 hr
= ICreateTypeInfo_SetVarDocString(cti
, 1, doc1W
);
4661 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
4663 ICreateTypeInfo_Release(cti
);
4665 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, name2W
, TKIND_INTERFACE
, &cti
);
4666 ok(hr
== S_OK
, "got %08x\n", hr
);
4668 hr
= ICreateTypeInfo_SetFuncDocString(cti
, 0, doc1W
);
4669 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
4671 hr
= ICreateTypeInfo_SetFuncDocString(cti
, 0, NULL
);
4672 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
4674 memset(&funcdesc
, 0, sizeof(funcdesc
));
4675 funcdesc
.memid
= MEMBERID_NIL
;
4676 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
4677 funcdesc
.invkind
= INVOKE_FUNC
;
4678 funcdesc
.callconv
= CC_STDCALL
;
4680 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 0, &funcdesc
);
4681 ok(hr
== S_OK
, "got %08x\n", hr
);
4683 hr
= ICreateTypeInfo_SetFuncDocString(cti
, 0, doc1W
);
4684 ok(hr
== S_OK
, "got %08x\n", hr
);
4686 ICreateTypeInfo_Release(cti
);
4688 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
4689 ok(hr
== S_OK
, "got: %08x\n", hr
);
4691 ICreateTypeLib2_Release(ctl
);
4693 hr
= LoadTypeLib(filenameW
, &tl
);
4694 ok(hr
== S_OK
, "got: %08x\n", hr
);
4696 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
4697 ok(hr
== S_OK
, "got %08x\n", hr
);
4699 hr
= ITypeInfo_GetVarDesc(ti
, 0, &pdesc
);
4700 ok(hr
== S_OK
, "got %08x\n", hr
);
4701 ok(pdesc
->memid
== 0x40000000, "got wrong memid: %x\n", pdesc
->memid
);
4702 ok(pdesc
->elemdescVar
.tdesc
.vt
== VT_INT
, "got wrong vardesc type: %u\n", pdesc
->elemdescVar
.tdesc
.vt
);
4703 ok(pdesc
->varkind
== VAR_CONST
, "got wrong varkind: %u\n", pdesc
->varkind
);
4704 ok(V_VT(U(*pdesc
).lpvarValue
) == VT_INT
, "got wrong value type: %u\n", V_VT(U(*pdesc
).lpvarValue
));
4705 ok(V_INT(U(*pdesc
).lpvarValue
) == 1, "got wrong value: 0x%x\n", V_INT(U(*pdesc
).lpvarValue
));
4707 hr
= ITypeInfo_GetDocumentation(ti
, pdesc
->memid
, &namestr
, &docstr
, NULL
, NULL
);
4708 ok(hr
== S_OK
, "got %08x\n", hr
);
4709 ok(memcmp(namestr
, var_nameW
, sizeof(var_nameW
)) == 0, "got wrong name: %s\n", wine_dbgstr_w(namestr
));
4710 ok(memcmp(docstr
, doc2W
, sizeof(doc2W
)) == 0, "got wrong docstring: %s\n", wine_dbgstr_w(docstr
));
4712 SysFreeString(namestr
);
4713 SysFreeString(docstr
);
4715 ITypeInfo_ReleaseVarDesc(ti
, pdesc
);
4716 ITypeInfo_Release(ti
);
4718 hr
= ITypeLib_GetTypeInfo(tl
, 1, &ti
);
4719 ok(hr
== S_OK
, "got %08x\n", hr
);
4721 hr
= ITypeInfo_GetFuncDesc(ti
, 0, &pfuncdesc
);
4722 ok(hr
== S_OK
, "got %08x\n", hr
);
4723 ok(pfuncdesc
->memid
== 0x60000000, "got wrong memid: %x\n", pfuncdesc
->memid
);
4724 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got wrong funckind: %x\n", pfuncdesc
->funckind
);
4725 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got wrong invkind: %x\n", pfuncdesc
->invkind
);
4726 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got wrong callconv: %x\n", pfuncdesc
->callconv
);
4728 hr
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &namestr
, &docstr
, NULL
, NULL
);
4729 ok(hr
== S_OK
, "got %08x\n", hr
);
4730 ok(namestr
== NULL
, "got wrong name: %s\n", wine_dbgstr_w(namestr
));
4731 ok(memcmp(docstr
, doc1W
, sizeof(doc1W
)) == 0, "got wrong docstring: %s\n", wine_dbgstr_w(docstr
));
4733 SysFreeString(docstr
);
4735 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
4736 ITypeInfo_Release(ti
);
4738 ITypeLib_Release(tl
);
4740 DeleteFileA(filenameA
);
4743 static void test_FindName(void)
4745 static const WCHAR invalidW
[] = {'i','n','v','a','l','i','d',0};
4753 hr
= LoadTypeLib(wszStdOle2
, &tl
);
4754 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4756 hr
= ITypeLib_FindName(tl
, NULL
, 0, NULL
, NULL
, NULL
);
4757 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
4759 lstrcpyW(buffW
, wszGUID
);
4760 hr
= ITypeLib_FindName(tl
, buffW
, 0, NULL
, NULL
, NULL
);
4761 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
4764 ti
= (void*)0xdeadbeef;
4765 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, NULL
, &c
);
4766 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
4767 ok(c
== 0, "got %d\n", c
);
4768 ok(ti
== (void*)0xdeadbeef, "got %p\n", ti
);
4771 ti
= (void*)0xdeadbeef;
4772 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, NULL
, &c
);
4773 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
4774 ok(c
== 1, "got %d\n", c
);
4775 ok(ti
== (void*)0xdeadbeef, "got %p\n", ti
);
4779 ti
= (void*)0xdeadbeef;
4780 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, &memid
, &c
);
4781 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4782 ok(memid
== MEMBERID_NIL
, "got %d\n", memid
);
4783 ok(!lstrcmpW(buffW
, wszGUID
), "got %s\n", wine_dbgstr_w(buffW
));
4784 ok(c
== 1, "got %d\n", c
);
4785 ITypeInfo_Release(ti
);
4789 lstrcpyW(buffW
, wszguid
);
4790 ti
= (void*)0xdeadbeef;
4791 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, &memid
, &c
);
4792 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4794 ok(memid
== MEMBERID_NIL
, "got %d\n", memid
);
4795 ok(!lstrcmpW(buffW
, wszGUID
), "got %s\n", wine_dbgstr_w(buffW
));
4796 ok(c
== 1, "got %d\n", c
);
4799 ITypeInfo_Release(ti
);
4803 lstrcpyW(buffW
, invalidW
);
4804 ti
= (void*)0xdeadbeef;
4805 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, &memid
, &c
);
4806 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4807 ok(memid
== MEMBERID_NIL
, "got %d\n", memid
);
4808 ok(!lstrcmpW(buffW
, invalidW
), "got %s\n", wine_dbgstr_w(buffW
));
4809 ok(c
== 0, "got %d\n", c
);
4810 ok(ti
== (void*)0xdeadbeef, "got %p\n", ti
);
4812 ITypeLib_Release(tl
);
4815 static void test_TypeInfo2_GetContainingTypeLib(void)
4817 static const WCHAR test
[] = {'t','e','s','t','.','t','l','b',0};
4818 static OLECHAR testTI
[] = {'t','e','s','t','T','y','p','e','I','n','f','o',0};
4820 ICreateTypeLib2
*ctl2
;
4821 ICreateTypeInfo
*cti
;
4827 hr
= CreateTypeLib2(SYS_WIN32
, test
, &ctl2
);
4828 ok_ole_success(hr
, CreateTypeLib2
);
4830 hr
= ICreateTypeLib2_CreateTypeInfo(ctl2
, testTI
, TKIND_DISPATCH
, &cti
);
4831 ok_ole_success(hr
, ICreateTypeLib2_CreateTypeInfo
);
4833 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo2
, (void**)&ti2
);
4834 ok_ole_success(hr
, ICreateTypeInfo2_QueryInterface
);
4838 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, &tl
, &Index
);
4839 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
4840 ok(tl
!= NULL
, "ITypeInfo2_GetContainingTypeLib returned empty TypeLib\n");
4841 ok(Index
== 0, "ITypeInfo2_GetContainingTypeLib returned Index = %u, expected 0\n", Index
);
4842 if(tl
) ITypeLib_Release(tl
);
4845 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, &tl
, NULL
);
4846 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
4847 ok(tl
!= NULL
, "ITypeInfo2_GetContainingTypeLib returned empty TypeLib\n");
4848 if(tl
) ITypeLib_Release(tl
);
4851 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, NULL
, &Index
);
4852 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
4853 ok(Index
== 0, "ITypeInfo2_GetContainingTypeLib returned Index = %u, expected 0\n", Index
);
4855 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, NULL
, NULL
);
4856 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
4858 ITypeInfo2_Release(ti2
);
4859 ICreateTypeInfo_Release(cti
);
4860 ICreateTypeLib2_Release(ctl2
);
4863 static void create_manifest_file(const char *filename
, const char *manifest
)
4868 file
= CreateFileA(filename
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
4869 FILE_ATTRIBUTE_NORMAL
, NULL
);
4870 ok(file
!= INVALID_HANDLE_VALUE
, "CreateFile failed: %u\n", GetLastError());
4871 WriteFile(file
, manifest
, strlen(manifest
), &size
, NULL
);
4875 static HANDLE
create_actctx(const char *file
)
4877 WCHAR path
[MAX_PATH
];
4881 MultiByteToWideChar(CP_ACP
, 0, file
, -1, path
, MAX_PATH
);
4882 memset(&actctx
, 0, sizeof(ACTCTXW
));
4883 actctx
.cbSize
= sizeof(ACTCTXW
);
4884 actctx
.lpSource
= path
;
4886 handle
= pCreateActCtxW(&actctx
);
4887 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
4889 ok(actctx
.cbSize
== sizeof(actctx
), "actctx.cbSize=%d\n", actctx
.cbSize
);
4890 ok(actctx
.dwFlags
== 0, "actctx.dwFlags=%d\n", actctx
.dwFlags
);
4891 ok(actctx
.lpSource
== path
, "actctx.lpSource=%p\n", actctx
.lpSource
);
4892 ok(actctx
.wProcessorArchitecture
== 0, "actctx.wProcessorArchitecture=%d\n", actctx
.wProcessorArchitecture
);
4893 ok(actctx
.wLangId
== 0, "actctx.wLangId=%d\n", actctx
.wLangId
);
4894 ok(actctx
.lpAssemblyDirectory
== NULL
, "actctx.lpAssemblyDirectory=%p\n", actctx
.lpAssemblyDirectory
);
4895 ok(actctx
.lpResourceName
== NULL
, "actctx.lpResourceName=%p\n", actctx
.lpResourceName
);
4896 ok(actctx
.lpApplicationName
== NULL
, "actctx.lpApplicationName=%p\n",
4897 actctx
.lpApplicationName
);
4898 ok(actctx
.hModule
== NULL
, "actctx.hModule=%p\n", actctx
.hModule
);
4903 static const char manifest_dep
[] =
4904 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
4905 "<assemblyIdentity version=\"1.2.3.4\" name=\"testdep\" type=\"win32\" processorArchitecture=\"" ARCH
"\"/>"
4906 "<file name=\"test_actctx_tlb.tlb\">"
4907 " <typelib tlbid=\"{d96d8a3e-78b6-4c8d-8f27-059db959be8a}\" version=\"2.7\" helpdir=\"\" resourceid=\"409\""
4908 " flags=\"Restricted,cONTROL\""
4911 "<file name=\"test_actctx_tlb2.tlb\">"
4912 " <typelib tlbid=\"{a2cfdbd3-2bbf-4b1c-a414-5a5904e634c9}\" version=\"2.0\" helpdir=\"\" resourceid=\"409\""
4913 " flags=\"RESTRICTED,CONTROL\""
4918 static const char manifest_main
[] =
4919 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
4920 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\" />"
4922 " <dependentAssembly>"
4923 " <assemblyIdentity type=\"win32\" name=\"testdep\" version=\"1.2.3.4\" processorArchitecture=\"" ARCH
"\" />"
4924 " </dependentAssembly>"
4928 static void test_LoadRegTypeLib(void)
4930 LCID lcid_en
= MAKELCID(MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_US
), SORT_DEFAULT
);
4931 LCID lcid_ru
= MAKELCID(MAKELANGID(LANG_RUSSIAN
, SUBLANG_NEUTRAL
), SORT_DEFAULT
);
4940 if (!pActivateActCtx
)
4942 win_skip("Activation contexts not supported, skipping LoadRegTypeLib tests\n");
4946 create_manifest_file("testdep.manifest", manifest_dep
);
4947 create_manifest_file("main.manifest", manifest_main
);
4949 handle
= create_actctx("main.manifest");
4950 DeleteFileA("testdep.manifest");
4951 DeleteFileA("main.manifest");
4953 /* create typelib file */
4954 write_typelib(1, "test_actctx_tlb.tlb");
4955 write_typelib(3, "test_actctx_tlb2.tlb");
4957 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 1, 0, LOCALE_NEUTRAL
, &tl
);
4958 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
4960 hr
= LoadRegTypeLib(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, &tl
);
4961 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
4963 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, LOCALE_NEUTRAL
, &path
);
4964 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
4966 ret
= pActivateActCtx(handle
, &cookie
);
4967 ok(ret
, "ActivateActCtx failed: %u\n", GetLastError());
4970 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, LOCALE_NEUTRAL
, &path
);
4971 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4972 SysFreeString(path
);
4975 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_en
, &path
);
4976 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4977 SysFreeString(path
);
4980 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_ru
, &path
);
4981 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4982 SysFreeString(path
);
4984 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 8, LOCALE_NEUTRAL
, &path
);
4985 ok(hr
== TYPE_E_LIBNOTREGISTERED
|| broken(hr
== S_OK
) /* winxp */, "got 0x%08x\n", hr
);
4988 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 7, LOCALE_NEUTRAL
, &path
);
4989 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
4990 SysFreeString(path
);
4993 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 1, 0, LOCALE_NEUTRAL
, &path
);
4994 ok(hr
== TYPE_E_LIBNOTREGISTERED
|| broken(hr
== S_OK
) /* winxp */, "got 0x%08x\n", hr
);
4995 SysFreeString(path
);
4997 /* manifest version is 2.0, actual is 1.0 */
4998 hr
= LoadRegTypeLib(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, &tl
);
4999 ok(hr
== TYPE_E_LIBNOTREGISTERED
|| broken(hr
== S_OK
) /* winxp */, "got 0x%08x\n", hr
);
5000 if (hr
== S_OK
) ITypeLib_Release(tl
);
5002 hr
= LoadRegTypeLib(&LIBID_register_test
, 2, 0, LOCALE_NEUTRAL
, &tl
);
5003 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
5005 /* manifest version is 2.7, actual is 2.5 */
5006 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 0, LOCALE_NEUTRAL
, &tl
);
5007 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5008 if (hr
== S_OK
) ITypeLib_Release(tl
);
5010 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 1, LOCALE_NEUTRAL
, &tl
);
5011 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5012 if (hr
== S_OK
) ITypeLib_Release(tl
);
5014 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_en
, &tl
);
5015 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5016 if (hr
== S_OK
) ITypeLib_Release(tl
);
5018 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_ru
, &tl
);
5019 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5020 if (hr
== S_OK
) ITypeLib_Release(tl
);
5022 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 7, LOCALE_NEUTRAL
, &tl
);
5023 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
5025 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 5, LOCALE_NEUTRAL
, &tl
);
5026 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5028 hr
= ITypeLib_GetLibAttr(tl
, &attr
);
5029 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5031 ok(attr
->lcid
== 0, "got %x\n", attr
->lcid
);
5032 ok(attr
->wMajorVerNum
== 2, "got %d\n", attr
->wMajorVerNum
);
5033 ok(attr
->wMinorVerNum
== 5, "got %d\n", attr
->wMinorVerNum
);
5034 ok(attr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "got %x\n", attr
->wLibFlags
);
5036 ITypeLib_ReleaseTLibAttr(tl
, attr
);
5037 ITypeLib_Release(tl
);
5039 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 1, 7, LOCALE_NEUTRAL
, &tl
);
5040 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
5042 DeleteFileA("test_actctx_tlb.tlb");
5043 DeleteFileA("test_actctx_tlb2.tlb");
5045 ret
= pDeactivateActCtx(0, cookie
);
5046 ok(ret
, "DeactivateActCtx failed: %u\n", GetLastError());
5048 pReleaseActCtx(handle
);
5054 static struct _TDATest
{
5056 ULONG size
; /* -1 == typelib ptr size */
5058 WORD align3264
; /* for 32-bit typelibs loaded in 64-bit mode */
5068 { VT_DATE
, 8, 4, 8 },
5069 { VT_BSTR
, -1, 4, 8 },
5070 { VT_DISPATCH
, -1, 4, 8 },
5071 { VT_ERROR
, 4, 4, 4 },
5072 { VT_BOOL
, 2, 2, 2 },
5073 { VT_VARIANT
, 0 /* see code below */, 4, 8 },
5074 { VT_UNKNOWN
, -1, 4, 8 },
5075 { VT_DECIMAL
, 16, 4, 8 },
5077 { VT_UI1
, 1, 1, 1 },
5078 { VT_UI2
, 2, 2, 2 },
5079 { VT_UI4
, 4, 4, 4 },
5081 { VT_UI8
, 8, 4, 8 },
5082 { VT_INT
, 4, 4, 4 },
5083 { VT_UINT
, 4, 4, 4 },
5084 { VT_VOID
, 0, 0, 0 },
5085 { VT_HRESULT
, 4, 4, 4 },
5086 { VT_PTR
, -1, 4, 8, AUX_TDESC
, { { 0 }, VT_INT
} },
5087 { VT_SAFEARRAY
, -1, 4, 8, AUX_TDESC
, { { 0 }, VT_INT
} },
5088 { VT_CARRAY
, 16 /* == 4 * sizeof(int) */, 4, 4, AUX_ADESC
, { { 0 } }, { { { 0 }, VT_INT
}, 1, { { 4, 0 } } } },
5089 { VT_USERDEFINED
, 0, 0, 0, AUX_HREF
},
5090 { VT_LPSTR
, -1, 4, 8 },
5091 { VT_LPWSTR
, -1, 4, 8 },
5095 static void testTDA(ITypeLib
*tl
, struct _TDATest
*TDATest
,
5096 ULONG ptr_size
, HREFTYPE hreftype
, ULONG href_cbSizeInstance
,
5097 WORD href_cbAlignment
, BOOL create
)
5102 ICreateTypeInfo
*cti
;
5103 ICreateTypeLib2
*ctl
;
5109 static const WCHAR name_fmtW
[] = {'a','l','i','a','s','%','0','2','u',0};
5111 wsprintfW(nameW
, name_fmtW
, TDATest
->vt
);
5114 hr
= ITypeLib_QueryInterface(tl
, &IID_ICreateTypeLib2
, (void**)&ctl
);
5115 ok(hr
== S_OK
, "got %08x\n", hr
);
5117 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_ALIAS
, &cti
);
5118 ok(hr
== S_OK
, "got %08x\n", hr
);
5120 tdesc
.vt
= TDATest
->vt
;
5121 if(TDATest
->aux
== AUX_TDESC
)
5122 U(tdesc
).lptdesc
= &TDATest
->tdesc
;
5123 else if(TDATest
->aux
== AUX_ADESC
)
5124 U(tdesc
).lpadesc
= &TDATest
->adesc
;
5125 else if(TDATest
->aux
== AUX_HREF
)
5126 U(tdesc
).hreftype
= hreftype
;
5128 hr
= ICreateTypeInfo_SetTypeDescAlias(cti
, &tdesc
);
5129 ok(hr
== S_OK
, "for VT %u, got %08x\n", TDATest
->vt
, hr
);
5131 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo
, (void**)&ti
);
5132 ok(hr
== S_OK
, "got %08x\n", hr
);
5134 ICreateTypeInfo_Release(cti
);
5135 ICreateTypeLib2_Release(ctl
);
5140 hr
= ITypeLib_FindName(tl
, nameW
, 0, &ti
, &memid
, &found
);
5141 ok(hr
== S_OK
, "for VT %u, got %08x\n", TDATest
->vt
, hr
);
5144 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
5145 ok(hr
== S_OK
, "got %08x\n", hr
);
5147 if(TDATest
->aux
== AUX_HREF
){
5148 size
= href_cbSizeInstance
;
5149 alignment
= href_cbAlignment
;
5151 size
= TDATest
->size
;
5156 size
= sizeof(void*);
5157 }else if(TDATest
->vt
== VT_VARIANT
){
5159 size
= sizeof(VARIANT
);
5161 if(ptr_size
!= sizeof(void*))
5162 size
-= 8; /* 32-bit variant is 4 bytes smaller than 64-bit variant */
5165 size
= sizeof(VARIANT
);
5167 alignment
= TDATest
->align
;
5169 if(!create
&& ptr_size
!= sizeof(void*))
5170 alignment
= TDATest
->align3264
;
5174 ok(typeattr
->cbSizeInstance
== size
||
5175 broken(TDATest
->vt
== VT_VARIANT
&& ptr_size
!= sizeof(void*) && typeattr
->cbSizeInstance
== sizeof(VARIANT
)) /* winxp64 */,
5176 "got wrong size for VT %u: 0x%x\n", TDATest
->vt
, typeattr
->cbSizeInstance
);
5177 ok(typeattr
->cbAlignment
== alignment
, "got wrong alignment for VT %u: 0x%x\n", TDATest
->vt
, typeattr
->cbAlignment
);
5178 ok(typeattr
->tdescAlias
.vt
== TDATest
->vt
, "got wrong VT for VT %u: 0x%x\n", TDATest
->vt
, typeattr
->tdescAlias
.vt
);
5180 switch(TDATest
->aux
){
5182 ok(U(typeattr
->tdescAlias
).hreftype
== hreftype
, "got wrong hreftype for VT %u: 0x%x\n", TDATest
->vt
, U(typeattr
->tdescAlias
).hreftype
);
5185 ok(U(typeattr
->tdescAlias
).lptdesc
->vt
== TDATest
->tdesc
.vt
, "got wrong typedesc VT for VT %u: 0x%x\n", TDATest
->vt
, U(typeattr
->tdescAlias
).lptdesc
->vt
);
5188 ok(U(typeattr
->tdescAlias
).lpadesc
->tdescElem
.vt
== TDATest
->adesc
.tdescElem
.vt
, "got wrong arraydesc element VT for VT %u: 0x%x\n", TDATest
->vt
, U(typeattr
->tdescAlias
).lpadesc
->tdescElem
.vt
);
5189 ok(U(typeattr
->tdescAlias
).lpadesc
->cDims
== TDATest
->adesc
.cDims
, "got wrong arraydesc dimension count for VT %u: 0x%x\n", TDATest
->vt
, U(typeattr
->tdescAlias
).lpadesc
->cDims
);
5190 ok(U(typeattr
->tdescAlias
).lpadesc
->rgbounds
[0].cElements
== TDATest
->adesc
.rgbounds
[0].cElements
, "got wrong arraydesc element count for VT %u: 0x%x\n", TDATest
->vt
, U(typeattr
->tdescAlias
).lpadesc
->rgbounds
[0].cElements
);
5191 ok(U(typeattr
->tdescAlias
).lpadesc
->rgbounds
[0].lLbound
== TDATest
->adesc
.rgbounds
[0].lLbound
, "got wrong arraydesc lower bound for VT %u: 0x%x\n", TDATest
->vt
, U(typeattr
->tdescAlias
).lpadesc
->rgbounds
[0].lLbound
);
5195 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
5196 ITypeInfo_Release(ti
);
5199 static void test_SetTypeDescAlias(SYSKIND kind
)
5201 CHAR filenameA
[MAX_PATH
];
5202 WCHAR filenameW
[MAX_PATH
];
5204 ICreateTypeLib2
*ctl
;
5206 ICreateTypeInfo
*cti
;
5209 ULONG href_cbSizeInstance
, i
;
5210 WORD href_cbAlignment
, ptr_size
;
5213 static OLECHAR interfaceW
[] = {'i','n','t','e','r','f','a','c','e',0};
5217 trace("testing SYS_WIN32\n");
5221 trace("testing SYS_WIN64\n");
5228 GetTempFileNameA(".", "tlb", 0, filenameA
);
5229 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
5231 hr
= CreateTypeLib2(kind
, filenameW
, &ctl
);
5232 ok(hr
== S_OK
, "got %08x\n", hr
);
5234 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, interfaceW
, TKIND_INTERFACE
, &cti
);
5235 ok(hr
== S_OK
, "got %08x\n", hr
);
5237 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo
, (void**)&ti
);
5238 ok(hr
== S_OK
, "got %08x\n", hr
);
5240 hr
= ICreateTypeInfo_AddRefTypeInfo(cti
, ti
, &hreftype
);
5241 ok(hr
== S_OK
, "got %08x\n", hr
);
5243 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
5244 ok(hr
== S_OK
, "got %08x\n", hr
);
5246 href_cbSizeInstance
= typeattr
->cbSizeInstance
;
5247 href_cbAlignment
= typeattr
->cbAlignment
;
5249 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
5251 ITypeInfo_Release(ti
);
5252 ICreateTypeInfo_Release(cti
);
5254 hr
= ICreateTypeLib2_QueryInterface(ctl
, &IID_ITypeLib
, (void**)&tl
);
5255 ok(hr
== S_OK
, "got %08x\n", hr
);
5257 for(i
= 0; TDATests
[i
].vt
; ++i
)
5258 testTDA(tl
, &TDATests
[i
], ptr_size
, hreftype
, href_cbSizeInstance
, href_cbAlignment
, TRUE
);
5260 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
5261 ok(hr
== S_OK
, "got %08x\n", hr
);
5263 ITypeLib_Release(tl
);
5264 ok(0 == ICreateTypeLib2_Release(ctl
), "typelib should have been released\n");
5266 trace("after save...\n");
5268 hr
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &tl
);
5269 ok(hr
== S_OK
, "got %08x\n", hr
);
5271 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
5272 ok(hr
== S_OK
, "got %08x\n", hr
);
5274 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
5275 ok(hr
== S_OK
, "got %08x\n", hr
);
5277 href_cbSizeInstance
= typeattr
->cbSizeInstance
;
5278 href_cbAlignment
= typeattr
->cbAlignment
;
5280 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
5281 ITypeInfo_Release(ti
);
5283 for(i
= 0; TDATests
[i
].vt
; ++i
)
5284 testTDA(tl
, &TDATests
[i
], ptr_size
, hreftype
, href_cbSizeInstance
, href_cbAlignment
, FALSE
);
5286 ok(0 == ITypeLib_Release(tl
), "typelib should have been released\n");
5288 DeleteFileA(filenameA
);
5291 static void test_GetLibAttr(void)
5298 hr
= LoadTypeLib(wszStdOle2
, &tl
);
5299 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5301 ref1
= ITypeLib_AddRef(tl
);
5302 ITypeLib_Release(tl
);
5304 hr
= ITypeLib_GetLibAttr(tl
, &attr
);
5305 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5307 ref2
= ITypeLib_AddRef(tl
);
5308 ITypeLib_Release(tl
);
5309 ok(ref2
== ref1
, "got %d, %d\n", ref2
, ref1
);
5311 ITypeLib_ReleaseTLibAttr(tl
, attr
);
5312 ITypeLib_Release(tl
);
5315 static HRESULT WINAPI
uk_QueryInterface(IUnknown
*obj
, REFIID iid
, void **out
)
5317 return E_NOINTERFACE
;
5320 static ULONG WINAPI
uk_AddRef(IUnknown
*obj
)
5325 static ULONG WINAPI
uk_Release(IUnknown
*obj
)
5336 IUnknown uk
= {&vt
};
5338 static void test_stub(void)
5340 BOOL is_wow64
= FALSE
;
5344 ICreateTypeLib2
*ctl
;
5345 ICreateTypeInfo
*cti
;
5347 ITypeInfo
*unk
, *ti
;
5349 char filenameA
[MAX_PATH
];
5350 WCHAR filenameW
[MAX_PATH
];
5353 static const GUID libguid
= {0x3b9ff02e,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
5354 static const GUID interfaceguid
= {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
5355 static const GUID coclassguid
= {0x3b9ff030,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
5356 static OLECHAR interfaceW
[] = {'i','n','t','e','r','f','a','c','e',0};
5357 static OLECHAR classW
[] = {'c','l','a','s','s',0};
5358 static DWORD sam_list32
[] = { 0, ~0 };
5359 static DWORD sam_list64
[] = { 0, KEY_WOW64_32KEY
, KEY_WOW64_64KEY
, ~0 };
5361 if (pIsWow64Process
)
5362 pIsWow64Process(GetCurrentProcess(), &is_wow64
);
5363 if (is_wow64
|| is_win64
)
5364 sam_list
= sam_list64
;
5366 sam_list
= sam_list32
;
5368 CoInitializeEx(NULL
, COINIT_APARTMENTTHREADED
);
5370 hr
= LoadTypeLib(wszStdOle2
, &stdole
);
5371 ok(hr
== S_OK
, "got %08x\n", hr
);
5373 hr
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IUnknown
, &unk
);
5374 ok(hr
== S_OK
, "got %08x\n", hr
);
5376 GetTempFileNameA(".", "tlb", 0, filenameA
);
5377 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
5379 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
5380 ok(hr
== S_OK
, "got %08x\n", hr
);
5382 hr
= ICreateTypeLib2_SetGuid(ctl
, &libguid
);
5383 ok(hr
== S_OK
, "got %08x\n", hr
);
5385 hr
= ICreateTypeLib2_SetLcid(ctl
, LOCALE_NEUTRAL
);
5386 ok(hr
== S_OK
, "got %08x\n", hr
);
5388 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, interfaceW
, TKIND_INTERFACE
, &cti
);
5389 ok(hr
== S_OK
, "got %08x\n", hr
);
5391 hr
= ICreateTypeInfo_SetGuid(cti
, &interfaceguid
);
5392 ok(hr
== S_OK
, "got %08x\n", hr
);
5394 hr
= ICreateTypeInfo_SetTypeFlags(cti
, TYPEFLAG_FOLEAUTOMATION
);
5395 ok(hr
== S_OK
, "got %08x\n", hr
);
5397 hr
= ICreateTypeInfo_AddRefTypeInfo(cti
, unk
, &href
);
5398 ok(hr
== S_OK
, "got %08x\n", hr
);
5400 hr
= ICreateTypeInfo_AddImplType(cti
, 0, href
);
5401 ok(hr
== S_OK
, "got %08x\n", hr
);
5403 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo
, (void**)&ti
);
5404 ok(hr
== S_OK
, "got %08x\n", hr
);
5406 ICreateTypeInfo_Release(cti
);
5407 ITypeInfo_Release(unk
);
5408 ITypeLib_Release(stdole
);
5410 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, classW
, TKIND_COCLASS
, &cti
);
5411 ok(hr
== S_OK
, "got %08x\n", hr
);
5413 hr
= ICreateTypeInfo_SetGuid(cti
, &coclassguid
);
5414 ok(hr
== S_OK
, "got %08x\n", hr
);
5416 hr
= ICreateTypeInfo_AddRefTypeInfo(cti
, ti
, &href
);
5417 ok(hr
== S_OK
, "got %08x\n", hr
);
5419 hr
= ICreateTypeInfo_AddImplType(cti
, 0, href
);
5420 ok(hr
== S_OK
, "got %08x\n", hr
);
5422 ITypeInfo_Release(ti
);
5423 ICreateTypeInfo_Release(cti
);
5425 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
5426 ok(hr
== S_OK
, "got %08x\n", hr
);
5428 hr
= ICreateTypeLib2_QueryInterface(ctl
, &IID_ITypeLib
, (void**)&tl
);
5429 ok(hr
== S_OK
, "got %08x\n", hr
);
5431 for (i
= 0; sam_list
[i
] != ~0; i
++)
5433 IPSFactoryBuffer
*factory
;
5434 IRpcStubBuffer
*base_stub
;
5435 REGSAM side
= sam_list
[i
];
5440 hr
= RegisterTypeLib(tl
, filenameW
, NULL
);
5441 if (hr
== TYPE_E_REGISTRYACCESS
)
5443 win_skip("Insufficient privileges to register typelib in the registry\n");
5446 ok(hr
== S_OK
, "got %08x, side: %04x\n", hr
, side
);
5448 /* SYS_WIN32 typelibs should be registered only as 32-bit */
5449 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "TypeLib\\{3b9ff02e-9675-4861-b781-ceaea4782acc}\\0.0\\0\\win64", 0, KEY_READ
| side
, &hkey
);
5450 ok(lr
== ERROR_FILE_NOT_FOUND
, "got wrong return code: %u, side: %04x\n", lr
, side
);
5452 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "TypeLib\\{3b9ff02e-9675-4861-b781-ceaea4782acc}\\0.0\\0\\win32", 0, KEY_READ
| side
, &hkey
);
5453 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
5456 /* Simulate pre-win7 installers that create interface key on one side */
5460 REGSAM opposite
= side
^ (KEY_WOW64_64KEY
| KEY_WOW64_32KEY
);
5462 StringFromGUID2(&interfaceguid
, guidW
, sizeof(guidW
)/sizeof(guidW
[0]));
5464 /* Delete the opposite interface key */
5465 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "Interface", 0, KEY_READ
| opposite
, &hkey
);
5466 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
5467 lr
= myRegDeleteTreeW(hkey
, guidW
, opposite
);
5468 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
5471 /* Is our side interface key affected by above operation? */
5472 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "Interface\\{3b9ff02f-9675-4861-b781-ceaea4782acc}", 0, KEY_READ
| side
, &hkey
);
5473 ok(lr
== ERROR_SUCCESS
|| broken(lr
== ERROR_FILE_NOT_FOUND
), "got wrong return code: %u, side: %04x\n", lr
, side
);
5474 if (lr
== ERROR_FILE_NOT_FOUND
)
5476 /* win2k3, vista, 2008 */
5477 win_skip("Registry reflection is enabled on this platform.\n");
5482 /* Opposite side typelib key still exists */
5483 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "TypeLib\\{3b9ff02e-9675-4861-b781-ceaea4782acc}\\0.0\\0\\win32", 0, KEY_READ
| opposite
, &hkey
);
5484 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
5488 hr
= CoGetPSClsid(&interfaceguid
, &clsid
);
5489 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
5491 hr
= CoGetClassObject(&clsid
, CLSCTX_INPROC_SERVER
, NULL
,
5492 &IID_IPSFactoryBuffer
, (void **)&factory
);
5493 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
5495 hr
= IPSFactoryBuffer_CreateStub(factory
, &interfaceguid
, &uk
, &base_stub
);
5496 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
5498 IPSFactoryBuffer_Release(factory
);
5500 hr
= UnRegisterTypeLib(&libguid
, 0, 0, 0, SYS_WIN32
);
5501 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
5504 ITypeLib_Release(tl
);
5505 ok(0 == ICreateTypeLib2_Release(ctl
), "Typelib still has references\n");
5507 DeleteFileW(filenameW
);
5512 static void test_dep(void) {
5514 const char *refFilename
;
5515 WCHAR refFilenameW
[MAX_PATH
];
5517 ITypeInfo
*preftInfo
;
5518 char filename
[MAX_PATH
];
5519 WCHAR filenameW
[MAX_PATH
];
5520 ICreateTypeLib2
*pctLib
;
5521 ICreateTypeInfo
*pctInfo
;
5524 ITypeInfo
*ptInfoExt
= NULL
;
5527 static WCHAR ifacenameW
[] = {'I','T','e','s','t','D','e','p',0};
5529 static const GUID libguid
= {0xe0228f26,0x2946,0x478c,{0xb6,0x4a,0x93,0xfe,0xef,0xa5,0x05,0x32}};
5530 static const GUID ifaceguid
= {0x394376dd,0x3bb8,0x4804,{0x8c,0xcc,0x95,0x59,0x43,0x40,0x04,0xf3}};
5532 trace("Starting typelib dependency tests\n");
5534 refFilename
= create_test_typelib(2);
5535 MultiByteToWideChar(CP_ACP
, 0, refFilename
, -1, refFilenameW
, MAX_PATH
);
5537 hr
= LoadTypeLibEx(refFilenameW
, REGKIND_NONE
, &preftLib
);
5538 ok(hr
== S_OK
, "got %08x\n", hr
);
5540 hr
= ITypeLib_GetTypeInfoOfGuid(preftLib
, &IID_ISimpleIface
, &preftInfo
);
5541 ok(hr
== S_OK
, "got %08x\n", hr
);
5543 GetTempFileNameA(".", "tlb", 0, filename
);
5544 MultiByteToWideChar(CP_ACP
, 0, filename
, -1, filenameW
, MAX_PATH
);
5546 if(sizeof(void*) == 8) {
5547 hr
= CreateTypeLib2(SYS_WIN64
, filenameW
, &pctLib
);
5548 ok(hr
== S_OK
, "got %08x\n", hr
);
5550 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &pctLib
);
5551 ok(hr
== S_OK
, "got %08x\n", hr
);
5554 hr
= ICreateTypeLib2_SetGuid(pctLib
, &libguid
);
5555 ok(hr
== S_OK
, "got %08x\n", hr
);
5557 hr
= ICreateTypeLib2_SetLcid(pctLib
, LOCALE_NEUTRAL
);
5558 ok(hr
== S_OK
, "got %08x\n", hr
);
5560 hr
= ICreateTypeLib2_CreateTypeInfo(pctLib
, ifacenameW
, TKIND_INTERFACE
, &pctInfo
);
5561 ok(hr
== S_OK
, "got %08x\n", hr
);
5563 hr
= ICreateTypeInfo_SetGuid(pctInfo
, &ifaceguid
);
5564 ok(hr
== S_OK
, "got %08x\n", hr
);
5566 hr
= ICreateTypeInfo_SetTypeFlags(pctInfo
, TYPEFLAG_FOLEAUTOMATION
);
5567 ok(hr
== S_OK
, "got %08x\n", hr
);
5569 hr
= ICreateTypeInfo_AddRefTypeInfo(pctInfo
, preftInfo
, &refType
);
5570 ok(hr
== S_OK
, "got %08x\n", hr
);
5572 hr
= ICreateTypeInfo_AddImplType(pctInfo
, 0, refType
);
5573 ok(hr
== S_OK
, "got %08x\n", hr
);
5575 ICreateTypeInfo_Release(pctInfo
);
5577 hr
= ICreateTypeLib2_SaveAllChanges(pctLib
);
5578 ok(hr
== S_OK
, "got %08x\n", hr
);
5580 ICreateTypeLib2_Release(pctLib
);
5582 ITypeInfo_Release(preftInfo
);
5583 ITypeLib_Release(preftLib
);
5585 DeleteFileW(refFilenameW
);
5587 hr
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &ptLib
);
5588 ok(hr
== S_OK
, "got: %x\n", hr
);
5590 hr
= ITypeLib_GetTypeInfoOfGuid(ptLib
, &ifaceguid
, &ptInfo
);
5591 ok(hr
== S_OK
, "got: %x\n", hr
);
5593 hr
= ITypeInfo_GetRefTypeOfImplType(ptInfo
, 0, &refType
);
5594 ok(hr
== S_OK
, "got: %x\n", hr
);
5596 hr
= ITypeInfo_GetRefTypeInfo(ptInfo
, refType
, &ptInfoExt
);
5597 ok(hr
== S_OK
|| broken(hr
== TYPE_E_CANTLOADLIBRARY
) /* win 2000 */, "got: %x\n", hr
);
5599 ITypeInfo_Release(ptInfo
);
5601 ITypeInfo_Release(ptInfoExt
);
5602 ITypeLib_Release(ptLib
);
5604 DeleteFileW(filenameW
);
5609 const char *filename
;
5611 init_function_pointers();
5613 ref_count_test(wszStdOle2
);
5615 test_CreateDispTypeInfo();
5617 test_DispCallFunc();
5618 test_QueryPathOfRegTypeLib(32);
5619 if(sizeof(void*) == 8){
5620 test_QueryPathOfRegTypeLib(64);
5621 test_CreateTypeLib(SYS_WIN64
);
5622 test_SetTypeDescAlias(SYS_WIN64
);
5624 test_CreateTypeLib(SYS_WIN32
);
5625 test_SetTypeDescAlias(SYS_WIN32
);
5627 test_SetVarHelpContext();
5628 test_SetFuncAndParamNames();
5629 test_SetDocString();
5632 if ((filename
= create_test_typelib(2)))
5634 test_dump_typelib( filename
);
5635 DeleteFileA( filename
);
5638 test_register_typelib(TRUE
);
5639 test_register_typelib(FALSE
);
5640 test_create_typelibs();
5642 test_TypeInfo2_GetContainingTypeLib();
5643 test_LoadRegTypeLib();