2 * ITypeLib and ITypeInfo test
4 * Copyright 2004 Jacek Caban
5 * Copyright 2006,2015 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
22 #define NONAMELESSSTRUCT
23 #define NONAMELESSUNION
28 #include <wine/test.h>
44 #include "test_simple.h"
46 #define expect_eq(expr, value, type, format) { type _ret = (expr); ok((value) == _ret, #expr " expected " format " got " format "\n", value, _ret); }
47 #define expect_int(expr, value) expect_eq(expr, (int)(value), int, "%d")
48 #define expect_hex(expr, value) expect_eq(expr, (int)(value), int, "0x%x")
49 #define expect_null(expr) expect_eq(expr, NULL, const void *, "%p")
50 #define expect_guid(expected, guid) { ok(IsEqualGUID(expected, guid), "got wrong guid %s\n", wine_dbgstr_guid(guid)); }
52 #define expect_wstr_acpval(expr, value) \
55 expect_eq(!WideCharToMultiByte(CP_ACP, 0, (expr), -1, buf, 260, NULL, NULL), 0, int, "%d"); \
56 ok(value && strcmp(value, buf) == 0, #expr " expected \"%s\" got \"%s\"\n", value, buf); \
59 #define ole_expect(expr, expect) { \
61 ok(r == (expect), #expr " returned %x, expected %s (%x)\n", r, #expect, expect); \
64 #define ole_check(expr) ole_expect(expr, S_OK);
66 #define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)
70 #elif defined __x86_64__
74 #elif defined __aarch64__
80 #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
81 static void _expect_ref(IUnknown
* obj
, ULONG ref
, int line
)
85 rc
= IUnknown_Release(obj
);
86 ok_(__FILE__
,line
)(rc
== ref
, "expected refcount %d, got %d\n", ref
, rc
);
89 static HRESULT (WINAPI
*pRegisterTypeLibForUser
)(ITypeLib
*,OLECHAR
*,OLECHAR
*);
90 static HRESULT (WINAPI
*pUnRegisterTypeLibForUser
)(REFGUID
,WORD
,WORD
,LCID
,SYSKIND
);
92 static BOOL (WINAPI
*pIsWow64Process
)(HANDLE
,LPBOOL
);
93 static LONG (WINAPI
*pRegDeleteKeyExW
)(HKEY
,LPCWSTR
,REGSAM
,DWORD
);
95 static const WCHAR wszStdOle2
[] = {'s','t','d','o','l','e','2','.','t','l','b',0};
96 static WCHAR wszGUID
[] = {'G','U','I','D',0};
97 static WCHAR wszguid
[] = {'g','u','i','d',0};
99 static const BOOL is_win64
= sizeof(void *) > sizeof(int);
102 static const BOOL abi_supports_stdcall
= TRUE
;
104 static const BOOL abi_supports_stdcall
= FALSE
;
107 static HRESULT WINAPI
collection_QueryInterface(ICollection
*iface
, REFIID riid
, void **ret
)
109 if (IsEqualIID(riid
, &IID_IUnknown
) ||
110 IsEqualIID(riid
, &IID_IDispatch
) ||
111 IsEqualIID(riid
, &IID_ICollection
))
117 return E_NOINTERFACE
;
120 static ULONG WINAPI
collection_AddRef(ICollection
*iface
)
125 static ULONG WINAPI
collection_Release(ICollection
*iface
)
130 static HRESULT WINAPI
collection_GetTypeInfoCount(ICollection
*iface
, UINT
*cnt
)
132 ok(0, "unexpected call\n");
137 static HRESULT WINAPI
collection_GetTypeInfo(ICollection
*iface
, UINT index
, LCID lcid
, ITypeInfo
**ti
)
139 ok(0, "unexpected call\n");
143 static HRESULT WINAPI
collection_GetIDsOfNames(ICollection
*iface
, REFIID riid
, LPOLESTR
*names
,
144 UINT cnt
, LCID lcid
, DISPID
*dispid
)
146 ok(0, "unexpected call\n");
150 static HRESULT WINAPI
collection_Invoke(ICollection
*iface
, DISPID dispid
, REFIID riid
,
151 LCID lcid
, WORD flags
, DISPPARAMS
*dispparams
, VARIANT
*res
, EXCEPINFO
*ei
, UINT
*argerr
)
153 if(dispid
!= DISPID_VALUE
) {
154 ok(0, "unexpected call\n");
158 ok(flags
== (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
), "flags = %x\n", flags
);
159 ok(dispparams
!= NULL
, "dispparams == NULL\n");
160 ok(!dispparams
->rgdispidNamedArgs
, "dispparams->rgdispidNamedArgs != NULL\n");
161 ok(dispparams
->cArgs
== 1, "dispparams->cArgs = %d\n", dispparams
->cArgs
);
162 ok(!dispparams
->cNamedArgs
, "dispparams->cNamedArgs = %d\n", dispparams
->cNamedArgs
);
163 ok(V_VT(dispparams
->rgvarg
) == VT_I4
, "V_VT(dispparams->rgvarg) = %d\n", V_VT(dispparams
->rgvarg
));
164 ok(V_I4(dispparams
->rgvarg
) == 7, "V_I4(dispparams->rgvarg) = %d\n", V_I4(dispparams
->rgvarg
));
165 ok(res
!= NULL
, "res == NULL\n");
166 ok(V_VT(res
) == VT_EMPTY
, "V_VT(res) = %d\n", V_VT(res
));
173 static HRESULT WINAPI
collection_Item(ICollection
*iface
, int i
, int *p
)
175 ok(0, "unexpected call\n");
179 static const ICollectionVtbl collectionvtbl
= {
180 collection_QueryInterface
,
183 collection_GetTypeInfoCount
,
184 collection_GetTypeInfo
,
185 collection_GetIDsOfNames
,
190 static ICollection collection
= { &collectionvtbl
};
192 static HRESULT WINAPI
invoketest_QueryInterface(IInvokeTest
*iface
, REFIID riid
, void **ret
)
194 if (IsEqualIID(riid
, &IID_IUnknown
) ||
195 IsEqualIID(riid
, &IID_IDispatch
) ||
196 IsEqualIID(riid
, &IID_IInvokeTest
))
202 return E_NOINTERFACE
;
205 static ULONG WINAPI
invoketest_AddRef(IInvokeTest
*iface
)
210 static ULONG WINAPI
invoketest_Release(IInvokeTest
*iface
)
215 static HRESULT WINAPI
invoketest_GetTypeInfoCount(IInvokeTest
*iface
, UINT
*cnt
)
217 ok(0, "unexpected call\n");
222 static HRESULT WINAPI
invoketest_GetTypeInfo(IInvokeTest
*iface
, UINT index
, LCID lcid
, ITypeInfo
**ti
)
224 ok(0, "unexpected call\n");
228 static HRESULT WINAPI
invoketest_GetIDsOfNames(IInvokeTest
*iface
, REFIID riid
, LPOLESTR
*names
,
229 UINT cnt
, LCID lcid
, DISPID
*dispid
)
231 ok(0, "unexpected call\n");
235 static HRESULT WINAPI
invoketest_Invoke(IInvokeTest
*iface
, DISPID dispid
, REFIID riid
,
236 LCID lcid
, WORD flags
, DISPPARAMS
*dispparams
, VARIANT
*res
, EXCEPINFO
*ei
, UINT
*argerr
)
238 ok(0, "unexpected call\n");
242 static LONG WINAPI
invoketest_get_test(IInvokeTest
*iface
, LONG i
)
247 static LONG WINAPI
invoketest_putref_testprop(IInvokeTest
*iface
, LONG
*i
)
252 static LONG WINAPI
invoketest_putref_testprop2(IInvokeTest
*iface
, IUnknown
*i
)
257 static HRESULT WINAPI
invoketest_testfunc(IInvokeTest
*iface
, int i
, int *p
)
263 static HRESULT WINAPI
invoketest_testget(IInvokeTest
*iface
, ICollection
**p
)
266 ICollection_AddRef(&collection
);
270 static const IInvokeTestVtbl invoketestvtbl
= {
271 invoketest_QueryInterface
,
274 invoketest_GetTypeInfoCount
,
275 invoketest_GetTypeInfo
,
276 invoketest_GetIDsOfNames
,
279 invoketest_putref_testprop
,
280 invoketest_putref_testprop2
,
285 static IInvokeTest invoketest
= { &invoketestvtbl
};
287 static void init_function_pointers(void)
289 HMODULE hmod
= GetModuleHandleA("oleaut32.dll");
290 HMODULE hk32
= GetModuleHandleA("kernel32.dll");
291 HMODULE hadv
= GetModuleHandleA("advapi32.dll");
293 pRegisterTypeLibForUser
= (void *)GetProcAddress(hmod
, "RegisterTypeLibForUser");
294 pUnRegisterTypeLibForUser
= (void *)GetProcAddress(hmod
, "UnRegisterTypeLibForUser");
295 pIsWow64Process
= (void *)GetProcAddress(hk32
, "IsWow64Process");
296 pRegDeleteKeyExW
= (void*)GetProcAddress(hadv
, "RegDeleteKeyExW");
299 static void ref_count_test(LPCWSTR type_lib
)
302 ITypeInfo
*iti1
, *iti2
;
306 trace("Loading type library\n");
307 hRes
= LoadTypeLib(type_lib
, &iface
);
308 ok(hRes
== S_OK
, "Could not load type library\n");
312 hRes
= ITypeLib_GetTypeInfo(iface
, 1, &iti1
);
313 ok(hRes
== S_OK
, "ITypeLib_GetTypeInfo failed on index = 1\n");
314 ref_count
= ITypeLib_Release(iface
);
315 ok(ref_count
> 0, "ITypeLib destroyed while ITypeInfo has back pointer\n");
319 hRes
= ITypeLib_GetTypeInfo(iface
, 1, &iti2
);
320 ok(hRes
== S_OK
, "ITypeLib_GetTypeInfo failed on index = 1\n");
321 ok(iti1
== iti2
, "ITypeLib_GetTypeInfo returned different pointers for same indexes\n");
323 ITypeLib_AddRef(iface
);
324 ITypeInfo_Release(iti2
);
325 ITypeInfo_Release(iti1
);
326 ok(ITypeLib_Release(iface
) == 0, "ITypeLib should be destroyed here.\n");
329 static void test_TypeComp(void)
331 ITypeComp
*pTypeComp
, *tcomp
, *pTypeComp_tmp
;
332 ITypeInfo
*pTypeInfo
, *ti
, *pFontTypeInfo
;
338 static WCHAR wszStdFunctions
[] = {'S','t','d','F','u','n','c','t','i','o','n','s',0};
339 static WCHAR wszSavePicture
[] = {'S','a','v','e','P','i','c','t','u','r','e',0};
340 static WCHAR wszOLE_TRISTATE
[] = {'O','L','E','_','T','R','I','S','T','A','T','E',0};
341 static WCHAR wszUnchecked
[] = {'U','n','c','h','e','c','k','e','d',0};
342 static WCHAR wszIUnknown
[] = {'I','U','n','k','n','o','w','n',0};
343 static WCHAR wszFont
[] = {'F','o','n','t',0};
344 static WCHAR wszStdPicture
[] = {'S','t','d','P','i','c','t','u','r','e',0};
345 static WCHAR wszOLE_COLOR
[] = {'O','L','E','_','C','O','L','O','R',0};
346 static WCHAR wszClone
[] = {'C','l','o','n','e',0};
347 static WCHAR wszclone
[] = {'c','l','o','n','e',0};
348 static WCHAR wszJunk
[] = {'J','u','n','k',0};
349 static WCHAR wszAddRef
[] = {'A','d','d','R','e','f',0};
351 hr
= LoadTypeLib(wszStdOle2
, &pTypeLib
);
352 ok_ole_success(hr
, LoadTypeLib
);
354 hr
= ITypeLib_GetTypeComp(pTypeLib
, &pTypeComp
);
355 ok_ole_success(hr
, ITypeLib_GetTypeComp
);
357 /* test getting a TKIND_MODULE */
358 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszStdFunctions
);
359 hr
= ITypeComp_Bind(pTypeComp
, wszStdFunctions
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
360 ok_ole_success(hr
, ITypeComp_Bind
);
362 ok(desckind
== DESCKIND_TYPECOMP
,
363 "desckind should have been DESCKIND_TYPECOMP instead of %d\n",
365 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
367 ITypeComp_Release(bindptr
.lptcomp
);
369 /* test getting a TKIND_MODULE with INVOKE_PROPERTYGET */
370 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszStdFunctions
);
371 hr
= ITypeComp_Bind(pTypeComp
, wszStdFunctions
, ulHash
, INVOKE_PROPERTYGET
, &pTypeInfo
, &desckind
, &bindptr
);
372 ok_ole_success(hr
, ITypeComp_Bind
);
374 ok(desckind
== DESCKIND_TYPECOMP
,
375 "desckind should have been DESCKIND_TYPECOMP instead of %d\n",
377 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
378 ITypeComp_Release(bindptr
.lptcomp
);
380 /* test getting a function within a TKIND_MODULE */
381 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszSavePicture
);
382 hr
= ITypeComp_Bind(pTypeComp
, wszSavePicture
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
383 ok_ole_success(hr
, ITypeComp_Bind
);
385 ok(desckind
== DESCKIND_FUNCDESC
,
386 "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
388 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr.lpfuncdesc should not have been set to NULL\n");
389 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
390 ITypeInfo_Release(pTypeInfo
);
392 /* test getting a function within a TKIND_MODULE with INVOKE_PROPERTYGET */
393 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszSavePicture
);
394 hr
= ITypeComp_Bind(pTypeComp
, wszSavePicture
, ulHash
, INVOKE_PROPERTYGET
, &pTypeInfo
, &desckind
, &bindptr
);
395 ok(hr
== TYPE_E_TYPEMISMATCH
,
396 "ITypeComp_Bind should have failed with TYPE_E_TYPEMISMATCH instead of 0x%08x\n",
399 ok(desckind
== DESCKIND_NONE
,
400 "desckind should have been DESCKIND_NONE instead of %d\n",
402 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
403 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
405 /* test getting a TKIND_ENUM */
406 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszOLE_TRISTATE
);
407 hr
= ITypeComp_Bind(pTypeComp
, wszOLE_TRISTATE
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
408 ok_ole_success(hr
, ITypeComp_Bind
);
410 ok(desckind
== DESCKIND_TYPECOMP
,
411 "desckind should have been DESCKIND_TYPECOMP instead of %d\n",
413 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
415 ITypeComp_Release(bindptr
.lptcomp
);
417 /* test getting a value within a TKIND_ENUM */
418 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszUnchecked
);
419 hr
= ITypeComp_Bind(pTypeComp
, wszUnchecked
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
420 ok_ole_success(hr
, ITypeComp_Bind
);
422 ok(desckind
== DESCKIND_VARDESC
,
423 "desckind should have been DESCKIND_VARDESC instead of %d\n",
425 ITypeInfo_ReleaseVarDesc(pTypeInfo
, bindptr
.lpvardesc
);
426 ITypeInfo_Release(pTypeInfo
);
428 /* test getting a TKIND_INTERFACE */
429 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszIUnknown
);
430 hr
= ITypeComp_Bind(pTypeComp
, wszIUnknown
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
431 ok_ole_success(hr
, ITypeComp_Bind
);
433 ok(desckind
== DESCKIND_NONE
,
434 "desckind should have been DESCKIND_NONE instead of %d\n",
436 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
437 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
439 /* test getting a TKIND_DISPATCH */
440 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszFont
);
441 hr
= ITypeComp_Bind(pTypeComp
, wszFont
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
442 ok_ole_success(hr
, ITypeComp_Bind
);
444 ok(desckind
== DESCKIND_NONE
,
445 "desckind should have been DESCKIND_NONE instead of %d\n",
447 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
448 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
450 /* test getting a TKIND_RECORD/TKIND_ALIAS */
451 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
452 hr
= ITypeComp_Bind(pTypeComp
, wszGUID
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
453 ok_ole_success(hr
, ITypeComp_Bind
);
455 ok(desckind
== DESCKIND_NONE
,
456 "desckind should have been DESCKIND_NONE instead of %d\n",
458 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
459 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
461 /* test getting a TKIND_ALIAS */
462 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszOLE_COLOR
);
463 hr
= ITypeComp_Bind(pTypeComp
, wszOLE_COLOR
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
464 ok_ole_success(hr
, ITypeComp_Bind
);
466 ok(desckind
== DESCKIND_NONE
,
467 "desckind should have been DESCKIND_NONE instead of %d\n",
469 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
470 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
472 /* test getting a TKIND_COCLASS */
473 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszStdPicture
);
474 hr
= ITypeComp_Bind(pTypeComp
, wszStdPicture
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
475 ok_ole_success(hr
, ITypeComp_Bind
);
477 ok(desckind
== DESCKIND_NONE
,
478 "desckind should have been DESCKIND_NONE instead of %d\n",
480 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
481 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
483 /* test basic BindType argument handling */
484 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
485 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, NULL
, NULL
);
486 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
488 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
489 pTypeInfo
= (void*)0xdeadbeef;
490 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, &pTypeInfo
, NULL
);
491 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
492 ok(pTypeInfo
== (void*)0xdeadbeef, "Got %p\n", pTypeInfo
);
494 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
495 pTypeComp_tmp
= (void*)0xdeadbeef;
496 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, NULL
, &pTypeComp_tmp
);
497 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
498 ok(pTypeComp_tmp
== (void*)0xdeadbeef, "Got %p\n", pTypeComp_tmp
);
500 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
501 pTypeComp_tmp
= (void*)0xdeadbeef;
502 pTypeInfo
= (void*)0xdeadbeef;
503 hr
= ITypeComp_BindType(pTypeComp
, NULL
, ulHash
, &pTypeInfo
, &pTypeComp_tmp
);
504 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
505 ok(pTypeInfo
== (void*)0xdeadbeef, "Got %p\n", pTypeInfo
);
506 ok(pTypeComp_tmp
== (void*)0xdeadbeef, "Got %p\n", pTypeComp_tmp
);
508 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
509 pTypeComp_tmp
= (void*)0xdeadbeef;
510 pTypeInfo
= (void*)0xdeadbeef;
511 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, &pTypeInfo
, &pTypeComp_tmp
);
512 ok_ole_success(hr
, ITypeComp_BindType
);
513 ok(pTypeInfo
!= NULL
, "Got NULL pTypeInfo\n");
514 todo_wine
ok(pTypeComp_tmp
== NULL
, "Got pTypeComp_tmp %p\n", pTypeComp_tmp
);
515 ITypeInfo_Release(pTypeInfo
);
516 if(pTypeComp_tmp
) ITypeComp_Release(pTypeComp_tmp
); /* fixme */
518 /* test BindType case-insensitivity */
519 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszguid
);
520 pTypeComp_tmp
= (void*)0xdeadbeef;
521 pTypeInfo
= (void*)0xdeadbeef;
522 hr
= ITypeComp_BindType(pTypeComp
, wszguid
, ulHash
, &pTypeInfo
, &pTypeComp_tmp
);
523 ok_ole_success(hr
, ITypeComp_BindType
);
524 ok(pTypeInfo
!= NULL
, "Got NULL pTypeInfo\n");
525 todo_wine
ok(pTypeComp_tmp
== NULL
, "Got pTypeComp_tmp %p\n", pTypeComp_tmp
);
526 ITypeInfo_Release(pTypeInfo
);
527 if(pTypeComp_tmp
) ITypeComp_Release(pTypeComp_tmp
); /* fixme */
529 ITypeComp_Release(pTypeComp
);
531 /* tests for ITypeComp on an interface */
532 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IFont
, &pFontTypeInfo
);
533 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
535 hr
= ITypeInfo_GetTypeComp(pFontTypeInfo
, &pTypeComp
);
536 ok_ole_success(hr
, ITypeLib_GetTypeComp
);
538 hr
= ITypeInfo_QueryInterface(pFontTypeInfo
, &IID_ITypeComp
, (void**)&tcomp
);
539 ok(hr
== S_OK
, "got %08x\n", hr
);
540 ok(tcomp
== pTypeComp
, "got %p, was %p\n", tcomp
, pTypeComp
);
542 hr
= ITypeComp_QueryInterface(tcomp
, &IID_ITypeInfo
, (void**)&ti
);
543 ok(hr
== S_OK
, "got %08x\n", hr
);
544 ok(ti
== pFontTypeInfo
, "got %p, was %p\n", ti
, pFontTypeInfo
);
545 ITypeInfo_Release(ti
);
547 ITypeComp_Release(tcomp
);
549 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszClone
);
550 hr
= ITypeComp_Bind(pTypeComp
, wszClone
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
551 ok_ole_success(hr
, ITypeComp_Bind
);
553 ok(desckind
== DESCKIND_FUNCDESC
,
554 "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
556 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr.lpfuncdesc should not have been set to NULL\n");
557 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
558 ITypeInfo_Release(pTypeInfo
);
560 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszClone
);
561 hr
= ITypeComp_Bind(pTypeComp
, wszClone
, ulHash
, INVOKE_PROPERTYGET
, &pTypeInfo
, &desckind
, &bindptr
);
562 ok(hr
== TYPE_E_TYPEMISMATCH
, "ITypeComp_Bind should have failed with TYPE_E_TYPEMISMATCH instead of 0x%08x\n", hr
);
564 ok(desckind
== DESCKIND_NONE
,
565 "desckind should have been DESCKIND_NONE instead of %d\n",
567 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
568 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
570 /* tests that the compare is case-insensitive */
571 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszclone
);
572 hr
= ITypeComp_Bind(pTypeComp
, wszclone
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
573 ok_ole_success(hr
, ITypeComp_Bind
);
575 ok(desckind
== DESCKIND_FUNCDESC
,
576 "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
578 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr.lpfuncdesc should not have been set to NULL\n");
579 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
580 ITypeInfo_Release(pTypeInfo
);
582 /* tests nonexistent members */
583 desckind
= 0xdeadbeef;
584 bindptr
.lptcomp
= (ITypeComp
*)0xdeadbeef;
585 pTypeInfo
= (ITypeInfo
*)0xdeadbeef;
586 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszJunk
);
587 hr
= ITypeComp_Bind(pTypeComp
, wszJunk
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
588 ok_ole_success(hr
, ITypeComp_Bind
);
589 ok(desckind
== DESCKIND_NONE
, "desckind should have been DESCKIND_NONE, was: %d\n", desckind
);
590 ok(pTypeInfo
== NULL
, "pTypeInfo should have been NULL, was: %p\n", pTypeInfo
);
591 ok(bindptr
.lptcomp
== NULL
, "bindptr should have been NULL, was: %p\n", bindptr
.lptcomp
);
593 /* tests inherited members */
594 desckind
= 0xdeadbeef;
595 bindptr
.lpfuncdesc
= NULL
;
597 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszAddRef
);
598 hr
= ITypeComp_Bind(pTypeComp
, wszAddRef
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
599 ok_ole_success(hr
, ITypeComp_Bind
);
600 ok(desckind
== DESCKIND_FUNCDESC
, "desckind should have been DESCKIND_FUNCDESC, was: %d\n", desckind
);
601 ok(pTypeInfo
!= NULL
, "pTypeInfo should not have been NULL, was: %p\n", pTypeInfo
);
602 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr should not have been NULL, was: %p\n", bindptr
.lpfuncdesc
);
603 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
604 ITypeInfo_Release(pTypeInfo
);
606 ITypeComp_Release(pTypeComp
);
607 ITypeInfo_Release(pFontTypeInfo
);
608 ITypeLib_Release(pTypeLib
);
611 static void test_CreateDispTypeInfo(void)
613 ITypeInfo
*pTypeInfo
, *pTI2
;
615 INTERFACEDATA ifdata
;
616 METHODDATA methdata
[4];
624 static WCHAR func1
[] = {'f','u','n','c','1',0};
625 static const WCHAR func2
[] = {'f','u','n','c','2',0};
626 static const WCHAR func3
[] = {'f','u','n','c','3',0};
627 static const WCHAR parm1
[] = {'p','a','r','m','1',0};
628 static const WCHAR parm2
[] = {'p','a','r','m','2',0};
629 OLECHAR
*name
= func1
;
631 ifdata
.pmethdata
= methdata
;
632 ifdata
.cMembers
= ARRAY_SIZE(methdata
);
634 methdata
[0].szName
= SysAllocString(func1
);
635 methdata
[0].ppdata
= parms1
;
636 methdata
[0].dispid
= 0x123;
637 methdata
[0].iMeth
= 0;
638 methdata
[0].cc
= CC_STDCALL
;
639 methdata
[0].cArgs
= 2;
640 methdata
[0].wFlags
= DISPATCH_METHOD
;
641 methdata
[0].vtReturn
= VT_HRESULT
;
642 parms1
[0].szName
= SysAllocString(parm1
);
643 parms1
[0].vt
= VT_I4
;
644 parms1
[1].szName
= SysAllocString(parm2
);
645 parms1
[1].vt
= VT_BSTR
;
647 methdata
[1].szName
= SysAllocString(func2
);
648 methdata
[1].ppdata
= NULL
;
649 methdata
[1].dispid
= 0x124;
650 methdata
[1].iMeth
= 1;
651 methdata
[1].cc
= CC_STDCALL
;
652 methdata
[1].cArgs
= 0;
653 methdata
[1].wFlags
= DISPATCH_PROPERTYGET
;
654 methdata
[1].vtReturn
= VT_I4
;
656 methdata
[2].szName
= SysAllocString(func3
);
657 methdata
[2].ppdata
= parms3
;
658 methdata
[2].dispid
= 0x125;
659 methdata
[2].iMeth
= 3;
660 methdata
[2].cc
= CC_STDCALL
;
661 methdata
[2].cArgs
= 1;
662 methdata
[2].wFlags
= DISPATCH_PROPERTYPUT
;
663 methdata
[2].vtReturn
= VT_HRESULT
;
664 parms3
[0].szName
= SysAllocString(parm1
);
665 parms3
[0].vt
= VT_I4
;
667 methdata
[3].szName
= SysAllocString(func3
);
668 methdata
[3].ppdata
= NULL
;
669 methdata
[3].dispid
= 0x125;
670 methdata
[3].iMeth
= 4;
671 methdata
[3].cc
= CC_STDCALL
;
672 methdata
[3].cArgs
= 0;
673 methdata
[3].wFlags
= DISPATCH_PROPERTYGET
;
674 methdata
[3].vtReturn
= VT_I4
;
676 hr
= CreateDispTypeInfo(&ifdata
, LOCALE_NEUTRAL
, &pTypeInfo
);
677 ok(hr
== S_OK
, "hr %08x\n", hr
);
679 hr
= ITypeInfo_GetTypeAttr(pTypeInfo
, &pTypeAttr
);
680 ok(hr
== S_OK
, "hr %08x\n", hr
);
682 ok(pTypeAttr
->typekind
== TKIND_COCLASS
, "typekind %0x\n", pTypeAttr
->typekind
);
683 ok(pTypeAttr
->cImplTypes
== 1, "cImplTypes %d\n", pTypeAttr
->cImplTypes
);
684 ok(pTypeAttr
->cFuncs
== 0, "cFuncs %d\n", pTypeAttr
->cFuncs
);
685 ok(pTypeAttr
->wTypeFlags
== 0, "wTypeFlags %04x\n", pTypeAttr
->cFuncs
);
686 ITypeInfo_ReleaseTypeAttr(pTypeInfo
, pTypeAttr
);
688 hr
= ITypeInfo_GetRefTypeOfImplType(pTypeInfo
, 0, &href
);
689 ok(hr
== S_OK
, "hr %08x\n", hr
);
690 ok(href
== 0, "href = 0x%x\n", href
);
691 hr
= ITypeInfo_GetRefTypeInfo(pTypeInfo
, href
, &pTI2
);
692 ok(hr
== S_OK
, "hr %08x\n", hr
);
693 hr
= ITypeInfo_GetTypeAttr(pTI2
, &pTypeAttr
);
694 ok(hr
== S_OK
, "hr %08x\n", hr
);
695 ok(pTypeAttr
->typekind
== TKIND_INTERFACE
, "typekind %0x\n", pTypeAttr
->typekind
);
696 ok(pTypeAttr
->cFuncs
== 4, "cFuncs %d\n", pTypeAttr
->cFuncs
);
697 ok(IsEqualGUID(&pTypeAttr
->guid
, &GUID_NULL
), "guid {%08x-...}\n", pTypeAttr
->guid
.Data1
);
698 ok(pTypeAttr
->wTypeFlags
== 0, "typeflags %08x\n", pTypeAttr
->wTypeFlags
);
700 ITypeInfo_ReleaseTypeAttr(pTI2
, pTypeAttr
);
702 hr
= ITypeInfo_GetFuncDesc(pTI2
, 0, &pFuncDesc
);
703 ok(hr
== S_OK
, "hr %08x\n", hr
);
704 ok(pFuncDesc
->memid
== 0x123, "memid %x\n", pFuncDesc
->memid
);
705 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
706 ok(pFuncDesc
->invkind
== methdata
[0].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
707 ok(pFuncDesc
->callconv
== methdata
[0].cc
, "callconv %d\n", pFuncDesc
->callconv
);
708 ok(pFuncDesc
->cParams
== methdata
[0].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
709 ok(pFuncDesc
->oVft
== 0, "oVft %d\n", pFuncDesc
->oVft
);
710 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
711 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_HRESULT
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
712 ok(pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
== VT_I4
, "parm 0 vt %x\n", pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
);
713 ok(U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
== PARAMFLAG_NONE
, "parm 0 flags %x\n", U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
);
715 ok(pFuncDesc
->lprgelemdescParam
[1].tdesc
.vt
== VT_BSTR
, "parm 1 vt %x\n", pFuncDesc
->lprgelemdescParam
[1].tdesc
.vt
);
716 ok(U(pFuncDesc
->lprgelemdescParam
[1]).paramdesc
.wParamFlags
== PARAMFLAG_NONE
, "parm 1 flags %x\n", U(pFuncDesc
->lprgelemdescParam
[1]).paramdesc
.wParamFlags
);
717 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
719 hr
= ITypeInfo_GetFuncDesc(pTI2
, 1, &pFuncDesc
);
720 ok(hr
== S_OK
, "hr %08x\n", hr
);
721 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
722 ok(pFuncDesc
->invkind
== methdata
[1].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
723 ok(pFuncDesc
->callconv
== methdata
[1].cc
, "callconv %d\n", pFuncDesc
->callconv
);
724 ok(pFuncDesc
->cParams
== methdata
[1].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
725 ok(pFuncDesc
->oVft
== sizeof(void *), "oVft %d\n", pFuncDesc
->oVft
);
726 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
727 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_I4
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
728 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
730 hr
= ITypeInfo_GetFuncDesc(pTI2
, 2, &pFuncDesc
);
731 ok(hr
== S_OK
, "hr %08x\n", hr
);
732 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
733 ok(pFuncDesc
->invkind
== methdata
[2].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
734 ok(pFuncDesc
->callconv
== methdata
[2].cc
, "callconv %d\n", pFuncDesc
->callconv
);
735 ok(pFuncDesc
->cParams
== methdata
[2].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
736 ok(pFuncDesc
->oVft
== 3 * sizeof(void *), "oVft %d\n", pFuncDesc
->oVft
);
737 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
738 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_HRESULT
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
739 ok(pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
== VT_I4
, "parm 0 vt %x\n", pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
);
740 ok(U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
== PARAMFLAG_NONE
, "parm 0 flags %x\n", U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
);
741 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
743 hr
= ITypeInfo_GetFuncDesc(pTI2
, 3, &pFuncDesc
);
744 ok(hr
== S_OK
, "hr %08x\n", hr
);
745 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
746 ok(pFuncDesc
->invkind
== methdata
[3].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
747 ok(pFuncDesc
->callconv
== methdata
[3].cc
, "callconv %d\n", pFuncDesc
->callconv
);
748 ok(pFuncDesc
->cParams
== methdata
[3].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
749 ok(pFuncDesc
->oVft
== 4 * sizeof(void *), "oVft %d\n", pFuncDesc
->oVft
);
750 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
751 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_I4
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
752 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
754 /* test GetIDsOfNames on a coclass to see if it searches its interfaces */
755 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &name
, 1, &memid
);
756 ok(hr
== S_OK
, "hr 0x%08x\n", hr
);
757 ok(memid
== 0x123, "memid 0x%08x\n", memid
);
759 ITypeInfo_Release(pTI2
);
760 ITypeInfo_Release(pTypeInfo
);
762 SysFreeString(parms1
[0].szName
);
763 SysFreeString(parms1
[1].szName
);
764 SysFreeString(parms3
[0].szName
);
765 SysFreeString(methdata
[0].szName
);
766 SysFreeString(methdata
[1].szName
);
767 SysFreeString(methdata
[2].szName
);
768 SysFreeString(methdata
[3].szName
);
771 static void write_typelib(int res_no
, const WCHAR
*filename
, const WCHAR
*type
)
778 file
= CreateFileW( filename
, GENERIC_READ
|GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, 0 );
779 ok( file
!= INVALID_HANDLE_VALUE
, "file creation failed\n" );
780 if (file
== INVALID_HANDLE_VALUE
) return;
781 res
= FindResourceW( GetModuleHandleA(NULL
), (const WCHAR
*)MAKEINTRESOURCE(res_no
), type
);
782 ok( res
!= 0, "couldn't find resource %d %s\n", res_no
, debugstr_w(type
) );
783 ptr
= LockResource( LoadResource( GetModuleHandleA(NULL
), res
));
784 WriteFile( file
, ptr
, SizeofResource( GetModuleHandleA(NULL
), res
), &written
, NULL
);
785 ok( written
== SizeofResource( GetModuleHandleA(NULL
), res
), "couldn't write resource\n" );
789 static void test_invoke_func(ITypeInfo
*typeinfo
)
791 DISPID named_args
[3] = { DISPID_THIS
};
792 VARIANT args
[3], res
;
793 DISPPARAMS dp
= {args
, named_args
, 1, 0};
799 V_VT(&res
) = VT_ERROR
;
800 hres
= ITypeInfo_Invoke(typeinfo
, &invoketest
, 3, DISPATCH_METHOD
, &dp
, &res
, NULL
, &i
);
801 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
802 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
803 ok(V_I4(&res
) == 4, "got %d\n", V_I4(&res
));
805 V_VT(args
) = VT_DISPATCH
;
806 V_DISPATCH(args
) = (IDispatch
*)&invoketest
;
807 V_VT(args
+1) = VT_INT
;
809 V_VT(&res
) = VT_ERROR
;
812 hres
= ITypeInfo_Invoke(typeinfo
, &invoketest
, 3, DISPATCH_METHOD
, &dp
, &res
, NULL
, &i
);
813 ok(hres
== DISP_E_BADPARAMCOUNT
, "got 0x%08x\n", hres
);
816 static WCHAR
*create_test_typelib(int res_no
, const WCHAR
*type
)
818 static WCHAR filename
[MAX_PATH
];
820 GetTempFileNameW(L
".", L
"tlb", 0, filename
);
821 write_typelib(res_no
, filename
, type
);
825 static void test_TypeInfo(void)
828 ITypeInfo
*pTypeInfo
, *ti
;
829 ITypeInfo2
*pTypeInfo2
;
831 static WCHAR wszBogus
[] = { 'b','o','g','u','s',0 };
832 static WCHAR wszGetTypeInfo
[] = { 'G','e','t','T','y','p','e','I','n','f','o',0 };
833 static WCHAR wszClone
[] = {'C','l','o','n','e',0};
834 static WCHAR wszTestDll
[] = {'t','e','s','t','.','d','l','l',0};
835 OLECHAR
* bogus
= wszBogus
;
836 OLECHAR
* pwszGetTypeInfo
= wszGetTypeInfo
;
837 OLECHAR
* pwszClone
= wszClone
;
839 DISPPARAMS dispparams
;
840 GUID bogusguid
= {0x806afb4f,0x13f7,0x42d2,{0x89,0x2c,0x6c,0x97,0xc3,0x6a,0x36,0xc1}};
841 static const GUID moduleTestGetDllEntryGuid
= {0xf073cd92,0xa199,0x11ea,{0xbb,0x37,0x02,0x42,0xac,0x13,0x00,0x02}};
842 VARIANT var
, res
, args
[2];
845 const WCHAR
*filename
;
849 BSTR bstrDllName
, bstrName
;
851 hr
= LoadTypeLib(wszStdOle2
, &pTypeLib
);
852 ok_ole_success(hr
, LoadTypeLib
);
854 count
= ITypeLib_GetTypeInfoCount(pTypeLib
);
855 ok(count
> 0, "got %d\n", count
);
858 hr
= ITypeLib_GetTypeInfo(pTypeLib
, count
, &pTypeInfo
);
859 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got 0x%08x\n", hr
);
861 hr
= ITypeLib_GetTypeInfo(pTypeLib
, 0, NULL
);
862 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
864 hr
= ITypeLib_GetLibAttr(pTypeLib
, NULL
);
865 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
867 hr
= ITypeLib_GetTypeInfoType(pTypeLib
, count
, &kind
);
868 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got 0x%08x\n", hr
);
870 hr
= ITypeLib_GetTypeInfoType(pTypeLib
, count
, NULL
);
871 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
873 hr
= ITypeLib_GetTypeInfoType(pTypeLib
, 0, NULL
);
874 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
876 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IFont
, &pTypeInfo
);
877 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
879 /* test nonexistent method name */
880 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &bogus
, 1, &dispidMember
);
881 ok(hr
== DISP_E_UNKNOWNNAME
,
882 "ITypeInfo_GetIDsOfNames should have returned DISP_E_UNKNOWNNAME instead of 0x%08x\n",
885 dispparams
.cArgs
= 0;
886 dispparams
.rgdispidNamedArgs
= NULL
;
887 dispparams
.rgvarg
= NULL
;
889 /* test dispparams not NULL */
891 /* invalid member id -- wrong flags -- cNamedArgs not bigger than cArgs */
892 dispparams
.cNamedArgs
= 0;
893 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
894 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
895 /* invalid member id -- correct flags -- cNamedArgs not bigger than cArgs */
896 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
897 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
899 /* invalid member id -- wrong flags -- cNamedArgs bigger than cArgs */
900 dispparams
.cNamedArgs
= 1;
901 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
902 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
903 /* invalid member id -- correct flags -- cNamedArgs bigger than cArgs */
904 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
905 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
908 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &pwszClone
, 1, &dispidMember
);
909 ok_ole_success(hr
, ITypeInfo_GetIDsOfNames
);
911 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
912 dispparams
.cNamedArgs
= 0;
913 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
914 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
915 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
916 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
917 ok(hr
== DISP_E_BADPARAMCOUNT
, "ITypeInfo_Invoke should have returned DISP_E_BADPARAMCOUNT instead of 0x%08x\n", hr
);
919 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
920 dispparams
.cNamedArgs
= 1;
921 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
922 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
923 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
924 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
925 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
927 /* test NULL dispparams */
929 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
930 dispparams
.cNamedArgs
= 0;
931 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
932 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
933 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
934 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
935 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
937 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
938 dispparams
.cNamedArgs
= 1;
939 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
940 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
941 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
942 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
943 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
945 ITypeInfo_Release(pTypeInfo
);
947 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IDispatch
, &pTypeInfo
);
948 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
950 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &pwszGetTypeInfo
, 1, &dispidMember
);
951 ok_ole_success(hr
, ITypeInfo_GetIDsOfNames
);
953 hr
= ITypeInfo_QueryInterface(pTypeInfo
, &IID_ITypeInfo2
, (void**)&pTypeInfo2
);
954 ok_ole_success(hr
, ITypeInfo_QueryInterface
);
962 /* test unknown guid passed to GetCustData */
963 hr
= ITypeInfo2_GetCustData(pTypeInfo2
, &bogusguid
, &var
);
964 ok_ole_success(hr
, ITypeInfo_GetCustData
);
965 ok(V_VT(&var
) == VT_EMPTY
, "got %i, expected VT_EMPTY\n", V_VT(&var
));
967 ITypeInfo2_Release(pTypeInfo2
);
972 /* Check instance size for IDispatch, typelib is loaded using system SYS_WIN* kind so it always matches
974 hr
= ITypeInfo_GetTypeAttr(pTypeInfo
, &attr
);
975 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
976 ok(attr
->cbSizeInstance
== sizeof(void*), "got size %d\n", attr
->cbSizeInstance
);
977 ok(attr
->typekind
== TKIND_INTERFACE
, "got typekind %d\n", attr
->typekind
);
978 ITypeInfo_ReleaseTypeAttr(pTypeInfo
, attr
);
980 /* same size check with some general interface */
981 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IEnumVARIANT
, &ti
);
982 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
983 hr
= ITypeInfo_GetTypeAttr(ti
, &attr
);
984 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
985 ok(attr
->cbSizeInstance
== sizeof(void*), "got size %d\n", attr
->cbSizeInstance
);
986 ITypeInfo_ReleaseTypeAttr(ti
, attr
);
987 ITypeInfo_Release(ti
);
989 /* test invoking a method with a [restricted] keyword */
991 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
992 dispparams
.cNamedArgs
= 0;
993 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
994 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
995 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
996 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
997 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
999 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
1000 dispparams
.cNamedArgs
= 1;
1001 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
1002 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1003 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
1004 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
1005 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1007 /* test NULL dispparams */
1009 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
1010 dispparams
.cNamedArgs
= 0;
1011 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
1012 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1013 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
1014 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
1015 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1017 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
1018 dispparams
.cNamedArgs
= 1;
1019 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
1020 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1021 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
1022 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
1023 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1025 ITypeInfo_Release(pTypeInfo
);
1026 ITypeLib_Release(pTypeLib
);
1028 filename
= create_test_typelib(3, L
"TYPELIB");
1029 hr
= LoadTypeLib(filename
, &pTypeLib
);
1030 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1032 /* test GetDllEntry */
1033 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &moduleTestGetDllEntryGuid
, &pTypeInfo
);
1034 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
1035 ok(pTypeInfo
!= NULL
, "got NULL typeinfo\n");
1037 /* wrong memberid -- wrong invkind */
1038 hr
= ITypeInfo_GetDllEntry(pTypeInfo
, 0x6000000d, INVOKE_FUNC
, &bstrDllName
, &bstrName
, &ordinal
);
1039 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr
);
1041 hr
= ITypeInfo_GetDllEntry(pTypeInfo
, 0x6000000d, INVOKE_PROPERTYPUTREF
, &bstrDllName
, &bstrName
, &ordinal
);
1042 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr
);
1044 /* wrong memberid -- correct invkind */
1045 hr
= ITypeInfo_GetDllEntry(pTypeInfo
, 0x6000000d, INVOKE_PROPERTYGET
, &bstrDllName
, &bstrName
, &ordinal
);
1046 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr
);
1048 hr
= ITypeInfo_GetDllEntry(pTypeInfo
, 0x6000000d, INVOKE_PROPERTYPUT
, &bstrDllName
, &bstrName
, &ordinal
);
1049 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr
);
1051 /* correct memberid -- wrong invkind */
1052 hr
= ITypeInfo_GetDllEntry(pTypeInfo
, 0x60000000, INVOKE_FUNC
, &bstrDllName
, &bstrName
, &ordinal
);
1053 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr
);
1055 hr
= ITypeInfo_GetDllEntry(pTypeInfo
, 0x60000000, INVOKE_PROPERTYPUTREF
, &bstrDllName
, &bstrName
, &ordinal
);
1056 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "ITypeInfo_GetDllEntry should have returned TYPE_E_ELEMENTNOTFOUND instead of 0x%08x\n", hr
);
1058 /* correct memberid -- correct invkind */
1059 hr
= ITypeInfo_GetDllEntry(pTypeInfo
, 0x60000000, INVOKE_PROPERTYGET
, &bstrDllName
, &bstrName
, &ordinal
);
1060 ok_ole_success(hr
, ITypeInfo_GetDllEntry
);
1061 ok(!lstrcmpW(bstrDllName
, wszTestDll
), "got %s\n", wine_dbgstr_w(bstrDllName
));
1062 ok(bstrName
== NULL
, "got %s\n", wine_dbgstr_w(bstrName
));
1063 ok(ordinal
== 1, "got ordinal: %04x\n", ordinal
);
1064 SysFreeString(bstrDllName
);
1066 hr
= ITypeInfo_GetDllEntry(pTypeInfo
, 0x60000000, INVOKE_PROPERTYPUT
, &bstrDllName
, &bstrName
, &ordinal
);
1067 ok_ole_success(hr
, ITypeInfo_GetDllEntry
);
1068 ok(!lstrcmpW(bstrDllName
, wszTestDll
), "got %s\n", wine_dbgstr_w(bstrDllName
));
1069 ok(bstrName
== NULL
, "got %s\n", wine_dbgstr_w(bstrName
));
1070 ok(ordinal
== 2, "got ordinal: %04x\n", ordinal
);
1071 SysFreeString(bstrDllName
);
1073 ITypeInfo_Release(pTypeInfo
);
1075 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IInvokeTest
, &pTypeInfo
);
1076 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1078 dispparams
.cArgs
= 1;
1079 dispparams
.cNamedArgs
= 0;
1080 dispparams
.rgdispidNamedArgs
= NULL
;
1081 dispparams
.rgvarg
= args
;
1083 V_VT(&args
[0]) = VT_I4
;
1087 V_VT(&res
) = VT_EMPTY
;
1089 /* call propget with DISPATCH_METHOD|DISPATCH_PROPERTYGET flags */
1090 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, DISPID_VALUE
, DISPATCH_METHOD
|DISPATCH_PROPERTYGET
,
1091 &dispparams
, &res
, NULL
, &i
);
1092 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1093 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1094 ok(V_I4(&res
) == 1, "got %d\n", V_I4(&res
));
1097 /* call propget with DISPATCH_METHOD flags */
1098 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, DISPID_VALUE
, DISPATCH_METHOD
,
1099 &dispparams
, &res
, NULL
, &i
);
1100 ok(hr
== DISP_E_MEMBERNOTFOUND
, "got 0x%08x, %d\n", hr
, i
);
1103 V_VT(&res
) = VT_EMPTY
;
1105 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, DISPID_VALUE
, DISPATCH_PROPERTYGET
,
1106 &dispparams
, &res
, NULL
, &i
);
1107 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
1108 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1109 ok(V_I4(&res
) == 1, "got %d\n", V_I4(&res
));
1111 /* call propget with DISPATCH_METHOD|DISPATCH_PROPERTYGET flags */
1112 V_VT(&args
[0]) = VT_I4
;
1115 dispparams
.cArgs
= 1;
1116 dispparams
.rgvarg
= args
;
1119 V_VT(&res
) = VT_EMPTY
;
1121 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 4, DISPATCH_METHOD
|DISPATCH_PROPERTYGET
, &dispparams
, &res
, NULL
, &i
);
1122 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
1123 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1124 ok(V_I4(&res
) == 15, "got %d\n", V_I4(&res
));
1127 /* DISPATCH_PROPERTYPUTREF */
1129 V_VT(&args
[0]) = VT_I4
|VT_BYREF
;
1130 V_I4REF(&args
[0]) = &l
;
1132 dispidMember
= DISPID_PROPERTYPUT
;
1133 dispparams
.cArgs
= 1;
1134 dispparams
.cNamedArgs
= 1;
1135 dispparams
.rgdispidNamedArgs
= &dispidMember
;
1136 dispparams
.rgvarg
= args
;
1139 V_VT(&res
) = VT_EMPTY
;
1141 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 1, DISPATCH_PROPERTYPUTREF
, &dispparams
, &res
, NULL
, &i
);
1142 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
1143 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1144 ok(V_I4(&res
) == 3, "got %d\n", V_I4(&res
));
1147 V_VT(&res
) = VT_EMPTY
;
1149 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 1, DISPATCH_PROPERTYPUT
, &dispparams
, &res
, NULL
, &i
);
1150 ok(hr
== DISP_E_MEMBERNOTFOUND
, "got 0x%08x, %d\n", hr
, i
);
1153 V_VT(&args
[0]) = VT_UNKNOWN
;
1154 V_UNKNOWN(&args
[0]) = NULL
;
1156 V_VT(&res
) = VT_EMPTY
;
1158 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 2, DISPATCH_PROPERTYPUTREF
, &dispparams
, &res
, NULL
, &i
);
1159 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
1160 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1161 ok(V_I4(&res
) == 6, "got %d\n", V_I4(&res
));
1164 V_VT(&res
) = VT_EMPTY
;
1166 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 2, DISPATCH_PROPERTYPUT
, &dispparams
, &res
, NULL
, &i
);
1167 ok(hr
== DISP_E_MEMBERNOTFOUND
, "got 0x%08x, %d\n", hr
, i
);
1169 test_invoke_func(pTypeInfo
);
1171 ITypeInfo_Release(pTypeInfo
);
1172 ITypeLib_Release(pTypeLib
);
1173 DeleteFileW(filename
);
1176 static int WINAPI
int_func( int a0
, int a1
, int a2
, int a3
, int a4
)
1178 ok( a0
== 1, "wrong arg0 %x\n", a0
);
1179 ok( a1
== -1, "wrong arg1 %x\n", a1
);
1180 ok( a2
== (0x55550000 | 1234), "wrong arg2 %x\n", a2
);
1181 ok( a3
== 0xdeadbeef, "wrong arg3 %x\n", a3
);
1182 ok( a4
== 0x555555fd, "wrong arg4 %x\n", a4
);
1186 static double WINAPI
double_func( double a0
, float a1
, double a2
, int a3
)
1188 ok( a0
== 1.2, "wrong arg0 %f\n", a0
);
1189 ok( a1
== 3.25, "wrong arg1 %f\n", (double)a1
);
1190 ok( a2
== 1.2e12
, "wrong arg2 %f\n", a2
);
1191 ok( a3
== -4433.0, "wrong arg3 %f\n", (double)a3
);
1195 static LONGLONG WINAPI
longlong_func( LONGLONG a0
, CY a1
)
1197 ok( a0
== (((ULONGLONG
)0xdead << 32) | 0xbeef), "wrong arg0 %08x%08x\n", (DWORD
)(a0
>> 32), (DWORD
)a0
);
1198 ok( a1
.int64
== ((ULONGLONG
)10000 * 12345678), "wrong arg1 %08x%08x\n",
1199 (DWORD
)(a1
.int64
>> 32), (DWORD
)a1
.int64
);
1200 return ((ULONGLONG
)4321 << 32) | 8765;
1203 static VARIANT WINAPI
variant_func( int a0
, BOOL a1
, DECIMAL a2
, VARIANT a3
)
1206 ok( a0
== 2233, "wrong arg0 %x\n", a0
);
1207 ok( a1
== 1 || broken(a1
== 0x55550001), "wrong arg1 %x\n", a1
);
1208 V_VT(&var
) = VT_LPWSTR
;
1209 V_UI4(&var
) = 0xbabe;
1210 ok( a2
.Hi32
== 1122, "wrong arg2.Hi32 %x\n", a2
.Hi32
);
1211 ok( U1(a2
).Lo64
== 3344, "wrong arg2.Lo64 %08x%08x\n", (DWORD
)(U1(a2
).Lo64
>> 32), (DWORD
)U1(a2
).Lo64
);
1212 ok( V_VT(&a3
) == VT_EMPTY
, "wrong arg3 type %x\n", V_VT(&a3
) );
1213 ok( V_UI4(&a3
) == 0xdeadbeef, "wrong arg3 value %x\n", V_UI4(&a3
) );
1217 static int CDECL
void_func( int a0
, int a1
)
1219 if (is_win64
) /* VT_EMPTY is passed as real arg on win64 */
1221 ok( a0
== 0x55555555, "wrong arg0 %x\n", a0
);
1222 ok( a1
== 1111, "wrong arg1 %x\n", a1
);
1226 ok( a0
== 1111, "wrong arg0 %x\n", a0
);
1227 ok( a1
== 0, "wrong arg1 %x\n", a1
);
1232 static int WINAPI
stdcall_func( int a
)
1237 static int WINAPI
inst_func( void *inst
, int a
)
1239 ok( (*(void ***)inst
)[3] == inst_func
, "wrong ptr %p\n", inst
);
1240 ok( a
== 3, "wrong arg %x\n", a
);
1244 static HRESULT WINAPI
ret_false_func(void)
1249 static const WCHAR testW
[] = { 'T','e','s','t',0 };
1251 static VARIANT WINAPI
variant_func2(VARIANT v1
, VARIANT v2
)
1255 ok(V_VT(&v1
) == VT_I4
, "unexpected %d\n", V_VT(&v1
));
1256 ok(V_I4(&v1
) == 2, "unexpected %d\n", V_I4(&v1
));
1257 ok(V_VT(&v2
) == VT_BSTR
, "unexpected %d\n", V_VT(&v2
));
1258 ok(lstrcmpW(V_BSTR(&v2
), testW
) == 0, "unexpected %s\n", wine_dbgstr_w(V_BSTR(&v2
)));
1260 V_VT(&ret
) = VT_UI4
;
1266 static VARIANT WINAPI
inst_func2(void *inst
, VARIANT v1
, VARIANT v2
)
1270 ok( (*(void ***)inst
)[3] == inst_func2
, "wrong ptr %p\n", inst
);
1272 ok(V_VT(&v1
) == VT_I4
, "unexpected %d\n", V_VT(&v1
));
1273 ok(V_I4(&v1
) == 2, "unexpected %d\n", V_I4(&v1
));
1274 ok(V_VT(&v2
) == VT_BSTR
, "unexpected %d\n", V_VT(&v2
));
1275 ok(lstrcmpW(V_BSTR(&v2
), testW
) == 0, "unexpected %s\n", wine_dbgstr_w(V_BSTR(&v2
)));
1277 V_VT(&ret
) = VT_UI4
;
1282 static void WINAPI
inst_func2(void *inst
, VARIANT
*ret
, VARIANT v1
, VARIANT v2
)
1284 ok( (*(void ***)inst
)[3] == inst_func2
, "wrong ptr %p\n", inst
);
1286 ok(V_VT(ret
) == VT_I4
|| broken(V_VT(ret
) == VT_VARIANT
) /* win64 */, "unexpected %d\n", V_VT(ret
));
1287 ok(V_I4(ret
) == 1234, "unexpected %d\n", V_I4(ret
));
1289 ok(V_VT(&v1
) == VT_I4
, "unexpected %d\n", V_VT(&v1
));
1290 ok(V_I4(&v1
) == 2, "unexpected %d\n", V_I4(&v1
));
1291 ok(V_VT(&v2
) == VT_BSTR
, "unexpected %d\n", V_VT(&v2
));
1292 ok(lstrcmpW(V_BSTR(&v2
), testW
) == 0, "unexpected %s\n", wine_dbgstr_w(V_BSTR(&v2
)));
1299 static void *vtable
[] = { NULL
, NULL
, NULL
, inst_func
};
1300 static void *vtable2
[] = { NULL
, NULL
, NULL
, inst_func2
};
1302 static void test_DispCallFunc(void)
1306 VARIANT result
, args
[5];
1307 VARIANTARG
*pargs
[5];
1311 for (i
= 0; i
< 5; i
++) pargs
[i
] = &args
[i
];
1313 memset( args
, 0x55, sizeof(args
) );
1315 types
[0] = VT_VARIANT
;
1316 V_VT(&args
[0]) = VT_I4
;
1318 types
[1] = VT_VARIANT
;
1319 V_VT(&args
[1]) = VT_BSTR
;
1320 V_BSTR(&args
[1]) = SysAllocString(testW
);
1321 memset( &result
, 0xcc, sizeof(result
) );
1322 res
= DispCallFunc(NULL
, (ULONG_PTR
)variant_func2
, CC_STDCALL
, VT_VARIANT
, 2, types
, pargs
, &result
);
1323 ok(res
== S_OK
, "DispCallFunc error %#x\n", res
);
1324 ok(V_VT(&result
) == VT_UI4
, "wrong result type %d\n", V_VT(&result
));
1325 ok(V_UI4(&result
) == 4321, "wrong result %u\n", V_UI4(&result
));
1327 V_VT(&result
) = VT_I4
;
1328 V_UI4(&result
) = 1234;
1330 res
= DispCallFunc(&inst
, 3 * sizeof(void *), CC_STDCALL
, VT_VARIANT
, 2, types
, pargs
, &result
);
1331 ok(res
== S_OK
, "DispCallFunc error %#x\n", res
);
1332 ok(V_VT(&result
) == VT_UI4
, "wrong result type %d\n", V_VT(&result
));
1333 ok(V_UI4(&result
) == 4321, "wrong result %u\n", V_UI4(&result
));
1335 VariantClear(&args
[1]);
1337 memset( args
, 0x55, sizeof(args
) );
1339 V_UI4(&args
[0]) = 1;
1341 V_I4(&args
[1]) = -1;
1343 V_I2(&args
[2]) = 1234;
1345 V_UI4(&args
[3]) = 0xdeadbeef;
1347 V_I1(&args
[4]) = -3;
1348 memset( &result
, 0xcc, sizeof(result
) );
1349 res
= DispCallFunc( NULL
, (ULONG_PTR
)int_func
, CC_STDCALL
, VT_UI4
, 5, types
, pargs
, &result
);
1350 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1351 ok( V_VT(&result
) == VT_UI4
, "wrong result type %d\n", V_VT(&result
) );
1352 ok( V_UI4(&result
) == 4321, "wrong result %u\n", V_UI4(&result
) );
1354 /* the function checks the argument sizes for stdcall */
1355 if (abi_supports_stdcall
)
1357 res
= DispCallFunc( NULL
, (ULONG_PTR
)stdcall_func
, CC_STDCALL
, VT_UI4
, 0, types
, pargs
, &result
);
1358 ok( res
== DISP_E_BADCALLEE
, "DispCallFunc wrong error %x\n", res
);
1359 res
= DispCallFunc( NULL
, (ULONG_PTR
)stdcall_func
, CC_STDCALL
, VT_UI4
, 1, types
, pargs
, &result
);
1360 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1361 res
= DispCallFunc( NULL
, (ULONG_PTR
)stdcall_func
, CC_STDCALL
, VT_UI4
, 2, types
, pargs
, &result
);
1362 ok( res
== DISP_E_BADCALLEE
, "DispCallFunc wrong error %x\n", res
);
1365 memset( args
, 0x55, sizeof(args
) );
1367 V_R8(&args
[0]) = 1.2;
1369 V_R4(&args
[1]) = 3.25;
1371 V_R8(&args
[2]) = 1.2e12
;
1373 V_I4(&args
[3]) = -4433;
1374 memset( &result
, 0xcc, sizeof(result
) );
1375 res
= DispCallFunc( NULL
, (ULONG_PTR
)double_func
, CC_STDCALL
, VT_R8
, 4, types
, pargs
, &result
);
1376 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1377 ok( V_VT(&result
) == VT_R8
, "wrong result type %d\n", V_VT(&result
) );
1378 ok( V_R8(&result
) == 4321, "wrong result %f\n", V_R8(&result
) );
1380 memset( args
, 0x55, sizeof(args
) );
1382 V_I8(&args
[0]) = ((ULONGLONG
)0xdead << 32) | 0xbeef;
1384 V_CY(&args
[1]).int64
= (ULONGLONG
)10000 * 12345678;
1385 memset( &result
, 0xcc, sizeof(result
) );
1386 res
= DispCallFunc( NULL
, (ULONG_PTR
)longlong_func
, CC_STDCALL
, VT_I8
, 2, types
, pargs
, &result
);
1387 ok( res
== S_OK
|| broken(res
== E_INVALIDARG
), /* longlong not supported on <= win2k */
1388 "DispCallFunc failed %x\n", res
);
1391 ok( V_VT(&result
) == VT_I8
, "wrong result type %d\n", V_VT(&result
) );
1392 ok( V_I8(&result
) == (((ULONGLONG
)4321 << 32) | 8765), "wrong result %08x%08x\n",
1393 (DWORD
)(V_I8(&result
) >> 32), (DWORD
)V_I8(&result
) );
1396 memset( args
, 0x55, sizeof(args
) );
1398 V_I4(&args
[0]) = 2233;
1400 V_BOOL(&args
[1]) = 1;
1401 types
[2] = VT_DECIMAL
;
1402 V_DECIMAL(&args
[2]).Hi32
= 1122;
1403 U1(V_DECIMAL(&args
[2])).Lo64
= 3344;
1404 types
[3] = VT_VARIANT
;
1405 V_VT(&args
[3]) = VT_EMPTY
;
1406 V_UI4(&args
[3]) = 0xdeadbeef;
1407 types
[4] = VT_EMPTY
;
1408 memset( &result
, 0xcc, sizeof(result
) );
1409 res
= DispCallFunc( NULL
, (ULONG_PTR
)variant_func
, CC_STDCALL
, VT_VARIANT
, 5, types
, pargs
, &result
);
1410 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1411 ok( V_VT(&result
) == VT_LPWSTR
, "wrong result type %d\n", V_VT(&result
) );
1412 ok( V_UI4(&result
) == 0xbabe, "wrong result %08x\n", V_UI4(&result
) );
1414 memset( args
, 0x55, sizeof(args
) );
1415 types
[0] = VT_EMPTY
;
1417 V_I4(&args
[1]) = 1111;
1418 types
[2] = VT_EMPTY
;
1421 types
[4] = VT_EMPTY
;
1422 memset( &result
, 0xcc, sizeof(result
) );
1423 res
= DispCallFunc( NULL
, (ULONG_PTR
)void_func
, CC_CDECL
, VT_EMPTY
, 5, types
, pargs
, &result
);
1424 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1425 ok( V_VT(&result
) == VT_EMPTY
, "wrong result type %d\n", V_VT(&result
) );
1427 ok( V_UI4(&result
) == 12, "wrong result %08x\n", V_UI4(&result
) );
1429 ok( V_UI4(&result
) == 0xcccccccc, "wrong result %08x\n", V_UI4(&result
) );
1431 memset( args
, 0x55, sizeof(args
) );
1434 memset( &result
, 0xcc, sizeof(result
) );
1436 res
= DispCallFunc( &inst
, 3 * sizeof(void*), CC_STDCALL
, VT_I4
, 1, types
, pargs
, &result
);
1437 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1438 ok( V_VT(&result
) == VT_I4
, "wrong result type %d\n", V_VT(&result
) );
1439 ok( V_I4(&result
) == 6, "wrong result %08x\n", V_I4(&result
) );
1441 memset( &result
, 0xcc, sizeof(result
) );
1442 res
= DispCallFunc(NULL
, (ULONG_PTR
)ret_false_func
, CC_STDCALL
, VT_ERROR
, 0, NULL
, NULL
, &result
);
1443 ok(res
== S_OK
, "DispCallFunc failed: %08x\n", res
);
1444 ok(V_VT(&result
) == VT_ERROR
, "V_VT(result) = %u\n", V_VT(&result
));
1445 ok(V_ERROR(&result
) == S_FALSE
, "V_ERROR(result) = %08x\n", V_ERROR(&result
));
1447 memset( &result
, 0xcc, sizeof(result
) );
1448 res
= DispCallFunc(NULL
, (ULONG_PTR
)ret_false_func
, CC_STDCALL
, VT_HRESULT
, 0, NULL
, NULL
, &result
);
1449 ok(res
== E_INVALIDARG
, "DispCallFunc failed: %08x\n", res
);
1450 ok(V_VT(&result
) == 0xcccc, "V_VT(result) = %u\n", V_VT(&result
));
1453 /* RegDeleteTreeW from dlls/advapi32/registry.c, plus additional view flag */
1454 static LSTATUS
myRegDeleteTreeW(HKEY hKey
, LPCWSTR lpszSubKey
, REGSAM view
)
1457 DWORD dwMaxSubkeyLen
, dwMaxValueLen
;
1458 DWORD dwMaxLen
, dwSize
;
1459 WCHAR szNameBuf
[MAX_PATH
], *lpszName
= szNameBuf
;
1460 HKEY hSubKey
= hKey
;
1461 view
&= (KEY_WOW64_64KEY
| KEY_WOW64_32KEY
);
1465 ret
= RegOpenKeyExW(hKey
, lpszSubKey
, 0, KEY_READ
| view
, &hSubKey
);
1466 if (ret
) return ret
;
1469 ret
= RegQueryInfoKeyW(hSubKey
, NULL
, NULL
, NULL
, NULL
,
1470 &dwMaxSubkeyLen
, NULL
, NULL
, &dwMaxValueLen
, NULL
, NULL
, NULL
);
1471 if (ret
) goto cleanup
;
1475 dwMaxLen
= max(dwMaxSubkeyLen
, dwMaxValueLen
);
1476 if (dwMaxLen
> ARRAY_SIZE(szNameBuf
))
1478 /* Name too big: alloc a buffer for it */
1479 if (!(lpszName
= HeapAlloc( GetProcessHeap(), 0, dwMaxLen
*sizeof(WCHAR
))))
1481 ret
= ERROR_NOT_ENOUGH_MEMORY
;
1486 /* Recursively delete all the subkeys */
1490 if (RegEnumKeyExW(hSubKey
, 0, lpszName
, &dwSize
, NULL
,
1491 NULL
, NULL
, NULL
)) break;
1493 ret
= myRegDeleteTreeW(hSubKey
, lpszName
, view
);
1494 if (ret
) goto cleanup
;
1498 if (pRegDeleteKeyExW
&& view
!= 0)
1499 ret
= pRegDeleteKeyExW(hKey
, lpszSubKey
, view
, 0);
1501 ret
= RegDeleteKeyW(hKey
, lpszSubKey
);
1506 if (RegEnumValueW(hKey
, 0, lpszName
, &dwSize
,
1507 NULL
, NULL
, NULL
, NULL
)) break;
1509 ret
= RegDeleteValueW(hKey
, lpszName
);
1510 if (ret
) goto cleanup
;
1514 if (lpszName
!= szNameBuf
)
1515 HeapFree(GetProcessHeap(), 0, lpszName
);
1517 RegCloseKey(hSubKey
);
1521 static BOOL
do_typelib_reg_key(GUID
*uid
, WORD maj
, WORD min
, DWORD arch
, LPCWSTR base
, BOOL remove
)
1523 static const WCHAR typelibW
[] = {'T','y','p','e','l','i','b','\\',0};
1524 static const WCHAR formatW
[] = {'\\','%','u','.','%','u','\\','0','\\','w','i','n','%','u',0};
1525 static const WCHAR format2W
[] = {'%','s','_','%','u','_','%','u','.','d','l','l',0};
1531 memcpy(buf
, typelibW
, sizeof(typelibW
));
1532 StringFromGUID2(uid
, buf
+ lstrlenW(buf
), 40);
1536 ok(myRegDeleteTreeW(HKEY_CLASSES_ROOT
, buf
, 0) == ERROR_SUCCESS
, "SHDeleteKey failed\n");
1540 wsprintfW(buf
+ lstrlenW(buf
), formatW
, maj
, min
, arch
);
1542 SetLastError(0xdeadbeef);
1543 res
= RegCreateKeyExW(HKEY_CLASSES_ROOT
, buf
, 0, NULL
, 0,
1544 KEY_WRITE
, NULL
, &hkey
, NULL
);
1545 if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
)
1547 win_skip("W-calls are not implemented\n");
1551 if (res
!= ERROR_SUCCESS
)
1553 trace("RegCreateKeyExW failed: %u\n", res
);
1557 wsprintfW(buf
, format2W
, base
, maj
, min
);
1558 if (RegSetValueExW(hkey
, NULL
, 0, REG_SZ
,
1559 (BYTE
*)buf
, (lstrlenW(buf
) + 1) * sizeof(WCHAR
)) != ERROR_SUCCESS
)
1561 trace("RegSetValueExW failed\n");
1568 static void test_QueryPathOfRegTypeLib(DWORD arch
)
1570 static const struct test_data
1574 const WCHAR path
[16];
1576 { 1, 0, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1577 { 3, 0, S_OK
, {'f','a','k','e','_','3','_','0','.','d','l','l',0 } },
1578 { 3, 1, S_OK
, {'f','a','k','e','_','3','_','1','.','d','l','l',0 } },
1579 { 3, 22, S_OK
, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
1580 { 3, 37, S_OK
, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
1581 { 3, 40, S_OK
, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
1582 { 0xffff, 0xffff, S_OK
, {'f','a','k','e','_','5','_','3','7','.','d','l','l',0 } },
1583 { 0xffff, 0, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1584 { 3, 0xffff, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1585 { 5, 0xffff, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1586 { 4, 0, TYPE_E_LIBNOTREGISTERED
, { 0 } }
1588 static const WCHAR base
[] = {'f','a','k','e',0};
1589 static const WCHAR wrongW
[] = {'w','r','o','n','g',0};
1597 status
= UuidCreate(&uid
);
1598 ok(!status
|| status
== RPC_S_UUID_LOCAL_ONLY
, "UuidCreate error %08x\n", status
);
1600 StringFromGUID2(&uid
, uid_str
, 40);
1601 /*trace("GUID: %s\n", wine_dbgstr_w(uid_str));*/
1603 if (!do_typelib_reg_key(&uid
, 3, 0, arch
, base
, FALSE
)) return;
1604 if (!do_typelib_reg_key(&uid
, 3, 1, arch
, base
, FALSE
)) return;
1605 if (!do_typelib_reg_key(&uid
, 3, 37, arch
, base
, FALSE
)) return;
1606 if (!do_typelib_reg_key(&uid
, 5, 37, arch
, base
, FALSE
)) return;
1607 if (arch
== 64 && !do_typelib_reg_key(&uid
, 5, 37, 32, wrongW
, FALSE
)) return;
1609 for (i
= 0; i
< ARRAY_SIZE(td
); i
++)
1611 ret
= QueryPathOfRegTypeLib(&uid
, td
[i
].maj
, td
[i
].min
, LOCALE_NEUTRAL
, &path
);
1612 ok(ret
== td
[i
].ret
, "QueryPathOfRegTypeLib(%u.%u) returned %08x\n", td
[i
].maj
, td
[i
].min
, ret
);
1615 ok(!lstrcmpW(td
[i
].path
, path
), "typelib %u.%u path doesn't match\n", td
[i
].maj
, td
[i
].min
);
1616 SysFreeString(path
);
1620 do_typelib_reg_key(&uid
, 0, 0, arch
, NULL
, TRUE
);
1623 static void test_inheritance(void)
1627 ITypeInfo
*pTI
, *pTI_p
, *dual_ti
;
1631 WCHAR path
[MAX_PATH
];
1632 CHAR pathA
[MAX_PATH
];
1634 GetModuleFileNameA(NULL
, pathA
, MAX_PATH
);
1635 MultiByteToWideChar(CP_ACP
, 0, pathA
, -1, path
, MAX_PATH
);
1637 hr
= LoadTypeLib(path
, &pTL
);
1638 if(FAILED(hr
)) return;
1641 /* ItestIF3 is a syntax 2 dispinterface */
1642 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF3
, &pTI
);
1643 ok(hr
== S_OK
, "hr %08x\n", hr
);
1645 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1646 ok(hr
== S_OK
, "hr %08x\n", hr
);
1647 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1648 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1649 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1650 ok(pTA
->cFuncs
== 6, "cfuncs %d\n", pTA
->cFuncs
);
1651 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1652 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1654 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1655 ok(hr
== S_OK
, "hr %08x\n", hr
);
1656 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1657 ok(hr
== S_OK
, "hr %08x\n", hr
);
1658 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1659 ok(hr
== S_OK
, "got %08x\n", hr
);
1660 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1661 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1662 ITypeInfo_Release(pTI_p
);
1664 /* Should have six methods */
1665 hr
= ITypeInfo_GetFuncDesc(pTI
, 6, &pFD
);
1666 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1667 hr
= ITypeInfo_GetFuncDesc(pTI
, 5, &pFD
);
1668 ok(hr
== S_OK
, "hr %08x\n", hr
);
1669 ok(pFD
->memid
== 0x60020000, "memid %08x\n", pFD
->memid
);
1670 ok(pFD
->oVft
== 5 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1671 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1672 ITypeInfo_Release(pTI
);
1675 /* ItestIF4 is a syntax 1 dispinterface */
1676 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF4
, &pTI
);
1677 ok(hr
== S_OK
, "hr %08x\n", hr
);
1679 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1680 ok(hr
== S_OK
, "hr %08x\n", hr
);
1681 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1682 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1683 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1684 ok(pTA
->cFuncs
== 1, "cfuncs %d\n", pTA
->cFuncs
);
1685 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1686 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1688 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1689 ok(hr
== S_OK
, "hr %08x\n", hr
);
1690 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1691 ok(hr
== S_OK
, "hr %08x\n", hr
);
1692 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1693 ok(hr
== S_OK
, "got %08x\n", hr
);
1694 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1695 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1696 ITypeInfo_Release(pTI_p
);
1697 hr
= ITypeInfo_GetFuncDesc(pTI
, 1, &pFD
);
1698 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1699 hr
= ITypeInfo_GetFuncDesc(pTI
, 0, &pFD
);
1700 ok(hr
== S_OK
, "hr %08x\n", hr
);
1701 ok(pFD
->memid
== 0x1c, "memid %08x\n", pFD
->memid
);
1702 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1703 ITypeInfo_Release(pTI
);
1706 /* ItestIF5 is dual with inherited ifaces which derive from IUnknown but not IDispatch */
1707 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF5
, &pTI
);
1708 ok(hr
== S_OK
, "hr %08x\n", hr
);
1710 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1711 ok(hr
== S_OK
, "hr %08x\n", hr
);
1712 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1713 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1714 ok(pTA
->wTypeFlags
== TYPEFLAG_FDUAL
, "typeflags %x\n", pTA
->wTypeFlags
);
1715 ok(pTA
->cFuncs
== 8, "cfuncs %d\n", pTA
->cFuncs
);
1716 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1717 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1719 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1720 ok(hr
== S_OK
, "hr %08x\n", hr
);
1721 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1722 ok(hr
== S_OK
, "hr %08x\n", hr
);
1723 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1724 ok(hr
== S_OK
, "got %08x\n", hr
);
1725 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1726 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1727 ITypeInfo_Release(pTI_p
);
1728 hr
= ITypeInfo_GetFuncDesc(pTI
, 6, &pFD
);
1729 ok(hr
== S_OK
, "hr %08x\n", hr
);
1730 ok(pFD
->memid
== 0x1234, "memid %08x\n", pFD
->memid
);
1731 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1732 ITypeInfo_Release(pTI
);
1734 /* ItestIF7 is dual with inherited ifaces which derive from Dispatch */
1735 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF7
, &pTI
);
1736 ok(hr
== S_OK
, "hr %08x\n", hr
);
1738 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1739 ok(hr
== S_OK
, "hr %08x\n", hr
);
1740 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1741 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1742 ok(pTA
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "typeflags %x\n", pTA
->wTypeFlags
);
1743 ok(pTA
->cFuncs
== 10, "cfuncs %d\n", pTA
->cFuncs
);
1744 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1745 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1747 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1748 ok(hr
== S_OK
, "hr %08x\n", hr
);
1749 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1750 ok(hr
== S_OK
, "hr %08x\n", hr
);
1751 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1752 ok(hr
== S_OK
, "got %08x\n", hr
);
1753 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1754 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1755 ITypeInfo_Release(pTI_p
);
1757 hr
= ITypeInfo_GetFuncDesc(pTI
, 9, &pFD
);
1758 ok(hr
== S_OK
, "hr %08x\n", hr
);
1759 ok(pFD
->memid
== 0x1236, "memid %08x\n", pFD
->memid
);
1760 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1761 ITypeInfo_Release(pTI
);
1763 /* ItestIF10 is a syntax 2 dispinterface which doesn't derive from IUnknown */
1764 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF10
, &pTI
);
1765 ok(hr
== S_OK
, "hr %08x\n", hr
);
1767 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1768 ok(hr
== S_OK
, "hr %08x\n", hr
);
1769 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1770 ok(pTA
->cbSizeVft
== sizeof(IDispatchVtbl
), "sizevft %d\n", pTA
->cbSizeVft
);
1771 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1772 ok(pTA
->cFuncs
== 3, "cfuncs %d\n", pTA
->cFuncs
);
1773 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1774 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1776 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, -1, &href
);
1777 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1778 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1779 ok(hr
== S_OK
, "hr %08x\n", hr
);
1780 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1781 ok(hr
== S_OK
, "hr %08x\n", hr
);
1782 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1783 ok(hr
== S_OK
, "got %08x\n", hr
);
1784 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1785 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1786 ITypeInfo_Release(pTI_p
);
1788 /* Should have three methods */
1789 hr
= ITypeInfo_GetFuncDesc(pTI
, 3, &pFD
);
1790 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1791 hr
= ITypeInfo_GetFuncDesc(pTI
, 2, &pFD
);
1792 ok(hr
== S_OK
, "hr %08x\n", hr
);
1793 ok(pFD
->memid
== 0x60010000, "memid %08x\n", pFD
->memid
);
1794 ok(pFD
->oVft
== 2 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1795 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1796 ITypeInfo_Release(pTI
);
1798 /* ItestIF11 is a syntax 2 dispinterface which derives from IDispatch */
1799 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF11
, &pTI
);
1800 ok(hr
== S_OK
, "hr %08x\n", hr
);
1802 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1803 ok(hr
== S_OK
, "hr %08x\n", hr
);
1804 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1805 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1806 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1807 ok(pTA
->cFuncs
== 10, "cfuncs %d\n", pTA
->cFuncs
);
1808 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1809 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1811 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1812 ok(hr
== S_OK
, "hr %08x\n", hr
);
1813 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1814 ok(hr
== S_OK
, "hr %08x\n", hr
);
1815 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1816 ok(hr
== S_OK
, "got %08x\n", hr
);
1817 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1818 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1819 ITypeInfo_Release(pTI_p
);
1821 /* Should have ten methods */
1822 hr
= ITypeInfo_GetFuncDesc(pTI
, 10, &pFD
);
1823 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1824 hr
= ITypeInfo_GetFuncDesc(pTI
, 9, &pFD
);
1825 ok(hr
== S_OK
, "hr %08x\n", hr
);
1826 ok(pFD
->memid
== 0x1236, "memid %08x\n", pFD
->memid
);
1827 ok(pFD
->oVft
== 9 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1829 /* first argument to 10th function is an HREFTYPE from the impl type */
1830 ok(pFD
->cParams
== 1, "cParams %i\n", pFD
->cParams
);
1831 ok(pFD
->lprgelemdescParam
[0].tdesc
.vt
== VT_USERDEFINED
,
1832 "vt 0x%x\n", pFD
->lprgelemdescParam
[0].tdesc
.vt
);
1833 href
= U(pFD
->lprgelemdescParam
[0].tdesc
).hreftype
;
1834 ok((href
& 0xff000000) == 0x04000000, "href 0x%08x\n", href
);
1835 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1836 ok(hr
== S_OK
, "hr %08x\n", hr
);
1837 if (SUCCEEDED(hr
)) ITypeInfo_Release(pTI_p
);
1838 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1839 ITypeInfo_Release(pTI
);
1842 /* ItestIF2 is an interface which derives from IUnknown */
1843 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF2
, &pTI
);
1844 ok(hr
== S_OK
, "hr %08x\n", hr
);
1846 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1847 ok(hr
== S_OK
, "hr %08x\n", hr
);
1848 ok(pTA
->typekind
== TKIND_INTERFACE
, "kind %04x\n", pTA
->typekind
);
1849 ok(pTA
->cbSizeVft
== 6 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1850 ok(pTA
->wTypeFlags
== 0, "typeflags %x\n", pTA
->wTypeFlags
);
1851 ok(pTA
->cFuncs
== 1, "cfuncs %d\n", pTA
->cFuncs
);
1852 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1853 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1855 /* Should have one method */
1856 hr
= ITypeInfo_GetFuncDesc(pTI
, 1, &pFD
);
1857 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1858 hr
= ITypeInfo_GetFuncDesc(pTI
, 0, &pFD
);
1859 ok(hr
== S_OK
, "hr %08x\n", hr
);
1860 ok(pFD
->memid
== 0x60020000, "memid %08x\n", pFD
->memid
);
1861 ok(pFD
->oVft
== 5 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1862 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1863 ITypeInfo_Release(pTI
);
1865 /* ItestIF13 is dual with inherited dual ifaces */
1866 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF13
, &pTI
);
1867 ok(hr
== S_OK
, "hr %08x\n", hr
);
1869 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1870 ok(hr
== S_OK
, "hr %08x\n", hr
);
1871 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1872 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1873 ok(pTA
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "typeflags %x\n", pTA
->wTypeFlags
);
1874 ok(pTA
->cFuncs
== 10, "cfuncs %d\n", pTA
->cFuncs
);
1875 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1876 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1878 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1879 ok(hr
== S_OK
, "hr %08x\n", hr
);
1880 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1881 ok(hr
== S_OK
, "hr %08x\n", hr
);
1882 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1883 ok(hr
== S_OK
, "got %08x\n", hr
);
1884 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid %s\n", wine_dbgstr_guid(&pTA
->guid
));
1885 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1887 hr
= ITypeInfo_GetFuncDesc(pTI
, 9, &pFD
);
1888 ok(hr
== S_OK
, "hr %08x\n", hr
);
1889 ok(pFD
->memid
== 0x1236, "memid %08x\n", pFD
->memid
);
1890 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1892 hr
= ITypeInfo_GetRefTypeInfo(pTI
, -2, &dual_ti
);
1893 ok(hr
== S_OK
, "hr %08x\n", hr
);
1895 hr
= ITypeInfo_GetTypeAttr(dual_ti
, &pTA
);
1896 ok(hr
== S_OK
, "hr %08x\n", hr
);
1897 ok(pTA
->typekind
== TKIND_INTERFACE
, "kind %04x\n", pTA
->typekind
);
1898 ok(pTA
->cbSizeVft
== sizeof(ItestIF13Vtbl
), "sizevft %d\n", pTA
->cbSizeVft
);
1899 ok(pTA
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FOLEAUTOMATION
|TYPEFLAG_FDUAL
), "typeflags %x\n", pTA
->wTypeFlags
);
1900 ok(pTA
->cFuncs
== 1, "cfuncs %d\n", pTA
->cFuncs
);
1901 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1902 ITypeInfo_ReleaseTypeAttr(dual_ti
, pTA
);
1904 hr
= ITypeInfo_GetRefTypeOfImplType(dual_ti
, 0, &href
);
1905 ok(hr
== S_OK
, "hr %08x\n", hr
);
1906 hr
= ITypeInfo_GetRefTypeInfo(dual_ti
, href
, &pTI_p
);
1907 ok(hr
== S_OK
, "hr %08x\n", hr
);
1908 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1909 ok(hr
== S_OK
, "got %08x\n", hr
);
1910 ok(pTA
->typekind
== TKIND_INTERFACE
, "kind %04x\n", pTA
->typekind
);
1911 ok(pTA
->cbSizeVft
== sizeof(ItestIF12Vtbl
), "sizevft %d\n", pTA
->cbSizeVft
);
1912 ok(IsEqualGUID(&pTA
->guid
, &IID_ItestIF12
), "guid %s\n", wine_dbgstr_guid(&pTA
->guid
));
1913 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1914 ITypeInfo_Release(pTI_p
);
1916 ITypeInfo_Release(dual_ti
);
1917 ITypeInfo_Release(pTI
);
1919 ITypeLib_Release(pTL
);
1924 static void test_CreateTypeLib(SYSKIND sys
) {
1925 static OLECHAR typelibW
[] = {'t','y','p','e','l','i','b',0};
1926 static OLECHAR helpfileW
[] = {'C',':','\\','b','o','g','u','s','.','h','l','p',0};
1927 static OLECHAR interface1W
[] = {'i','n','t','e','r','f','a','c','e','1',0};
1928 static OLECHAR interface2W
[] = {'i','n','t','e','r','f','a','c','e','2',0};
1929 static OLECHAR interface3W
[] = {'i','n','t','e','r','f','a','c','e','3',0};
1930 static OLECHAR dualW
[] = {'d','u','a','l',0};
1931 static OLECHAR coclassW
[] = {'c','o','c','l','a','s','s',0};
1932 static const WCHAR defaultW
[] = {'d','e','f','a','u','l','t',0x3213,0};
1933 static OLECHAR func1W
[] = {'f','u','n','c','1',0};
1934 static OLECHAR func2W
[] = {'f','u','n','c','2',0};
1935 static OLECHAR prop1W
[] = {'P','r','o','p','1',0};
1936 static OLECHAR param1W
[] = {'p','a','r','a','m','1',0};
1937 static OLECHAR param2W
[] = {'p','a','r','a','m','2',0};
1938 static OLECHAR asdfW
[] = {'A','s','d','f',0};
1939 static OLECHAR aliasW
[] = {'a','l','i','a','s',0};
1940 static OLECHAR invokeW
[] = {'I','n','v','o','k','e',0};
1941 static OLECHAR
*names1
[] = {func1W
, param1W
, param2W
};
1942 static OLECHAR
*names2
[] = {func2W
, param1W
, param2W
};
1943 static OLECHAR
*propname
[] = {prop1W
, param1W
};
1944 static const GUID tlcustguid
= {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x69}};
1945 static const GUID custguid
= {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x70}};
1946 static const GUID bogusguid
= {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x71}};
1947 static const GUID interfaceguid
= {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
1948 static const GUID interface2guid
= {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcd}};
1950 ITypeInfo
*interface1
, *interface2
, *dual
, *unknown
, *dispatch
, *ti
, *ti_2
;
1951 char filename
[MAX_PATH
];
1952 WCHAR filenameW
[MAX_PATH
];
1953 ICreateTypeLib2
*createtl
;
1954 ICreateTypeInfo
*createti
;
1955 ICreateTypeInfo2
*createti2
;
1956 ITypeLib
*tl
, *stdole
;
1958 ITypeInfo
*tinfos
[2];
1960 ITypeComp
*tcomp
, *tcomp2
;
1962 FUNCDESC funcdesc
, *pfuncdesc
;
1963 ELEMDESC elemdesc
[5], *edesc
;
1964 PARAMDESCEX paramdescex
;
1965 TYPEDESC typedesc1
, typedesc2
;
1969 BSTR name
, docstring
, helpfile
, names
[3];
1970 DWORD helpcontext
, ptr_size
, alignment
;
1972 unsigned int cnames
;
1984 trace("testing SYS_WIN32\n");
1986 alignment
= sizeof(void*);
1989 trace("testing SYS_WIN64\n");
1997 trace("CreateTypeLib tests\n");
1999 hres
= LoadTypeLib(wszStdOle2
, &stdole
);
2000 ok(hres
== S_OK
, "got %08x\n", hres
);
2002 hres
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IUnknown
, &unknown
);
2003 ok(hres
== S_OK
, "got %08x\n", hres
);
2005 hres
= ITypeInfo_GetTypeAttr(unknown
, &typeattr
);
2006 ok(hres
== S_OK
, "got %08x\n", hres
);
2007 ok(typeattr
->cbSizeVft
== 3 * sizeof(void*), "Got wrong cbSizeVft: %u\n", typeattr
->cbSizeVft
);
2008 ITypeInfo_ReleaseTypeAttr(unknown
, typeattr
);
2010 hres
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IDispatch
, &dispatch
);
2011 ok(hres
== S_OK
, "got %08x\n", hres
);
2013 GetTempFileNameA(".", "tlb", 0, filename
);
2014 MultiByteToWideChar(CP_ACP
, 0, filename
, -1, filenameW
, MAX_PATH
);
2016 hres
= CreateTypeLib2(sys
, filenameW
, &createtl
);
2017 ok(hres
== S_OK
, "got %08x\n", hres
);
2019 hres
= ICreateTypeLib2_QueryInterface(createtl
, &IID_ITypeLib
, (void**)&tl
);
2020 ok(hres
== S_OK
, "got %08x\n", hres
);
2022 hres
= ITypeLib_GetTypeInfo(tl
, 0, NULL
);
2023 ok(hres
== E_INVALIDARG
, "got 0x%08x\n", hres
);
2025 hres
= ITypeLib_GetTypeInfoType(tl
, 0, &kind
);
2026 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got 0x%08x\n", hres
);
2028 hres
= ITypeLib_GetTypeInfoType(tl
, 0, NULL
);
2029 ok(hres
== E_INVALIDARG
, "got 0x%08x\n", hres
);
2031 hres
= ITypeLib_GetTypeInfoType(tl
, 0, NULL
);
2032 ok(hres
== E_INVALIDARG
, "got 0x%08x\n", hres
);
2034 hres
= ITypeLib_GetLibAttr(tl
, NULL
);
2035 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2037 hres
= ITypeLib_GetLibAttr(tl
, &libattr
);
2038 ok(hres
== S_OK
, "got %08x\n", hres
);
2040 ok(libattr
->syskind
== sys
, "syskind = %d\n", libattr
->syskind
);
2041 ok(libattr
->wMajorVerNum
== 0, "wMajorVer = %d\n", libattr
->wMajorVerNum
);
2042 ok(libattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", libattr
->wMinorVerNum
);
2043 ok(libattr
->wLibFlags
== 0, "wLibFlags = %d\n", libattr
->wLibFlags
);
2045 ITypeLib_ReleaseTLibAttr(tl
, libattr
);
2047 name
= (BSTR
)0xdeadbeef;
2048 hres
= ITypeLib_GetDocumentation(tl
, -1, &name
, &docstring
, &helpcontext
, &helpfile
);
2049 ok(hres
== S_OK
, "got %08x\n", hres
);
2050 ok(name
== NULL
, "name != NULL\n");
2051 ok(docstring
== NULL
, "docstring != NULL\n");
2052 ok(helpcontext
== 0, "helpcontext != 0\n");
2053 ok(helpfile
== NULL
, "helpfile != NULL\n");
2055 hres
= ITypeLib_GetDocumentation(tl
, 0, &name
, NULL
, NULL
, NULL
);
2056 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2058 hres
= ICreateTypeLib2_SetName(createtl
, typelibW
);
2059 ok(hres
== S_OK
, "got %08x\n", hres
);
2061 hres
= ICreateTypeLib2_SetHelpFileName(createtl
, helpfileW
);
2062 ok(hres
== S_OK
, "got %08x\n", hres
);
2064 hres
= ITypeLib_GetDocumentation(tl
, -1, NULL
, NULL
, NULL
, NULL
);
2065 ok(hres
== S_OK
, "got %08x\n", hres
);
2067 hres
= ITypeLib_GetDocumentation(tl
, -1, &name
, NULL
, NULL
, &helpfile
);
2068 ok(hres
== S_OK
, "got %08x\n", hres
);
2069 ok(!memcmp(name
, typelibW
, sizeof(typelibW
)), "name = %s\n", wine_dbgstr_w(name
));
2070 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "helpfile = %s\n", wine_dbgstr_w(helpfile
));
2072 SysFreeString(name
);
2073 SysFreeString(helpfile
);
2075 V_VT(&cust_data
) = VT_I4
;
2076 V_I4(&cust_data
) = 1;
2077 hres
= ICreateTypeLib2_SetCustData(createtl
, &tlcustguid
, &cust_data
);
2078 ok(hres
== S_OK
, "got %08x\n", hres
);
2080 hres
= ITypeLib_QueryInterface(tl
, &IID_ITypeLib2
, (void**)&tl2
);
2081 ok(hres
== S_OK
, "no ITypeLib2 interface (%x)\n", hres
);
2083 V_VT(&cust_data
) = VT_EMPTY
;
2084 V_I4(&cust_data
) = 0;
2085 hres
= ITypeLib2_GetCustData(tl2
, &tlcustguid
, &cust_data
);
2086 ok(hres
== S_OK
, "got %08x\n", hres
);
2087 ok(V_VT(&cust_data
) == VT_I4
, "V_VT(&cust_data) = %d\n", V_VT(&cust_data
));
2088 ok(V_I4(&cust_data
) == 1, "V_I4(&cust_data) = %d\n", V_I4(&cust_data
));
2090 ITypeLib2_Release(tl2
);
2092 /* invalid parameters */
2093 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, NULL
, TKIND_INTERFACE
, &createti
);
2094 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2096 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, NULL
);
2097 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2099 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, NULL
, TKIND_INTERFACE
, NULL
);
2100 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2102 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, &createti
);
2103 ok(hres
== S_OK
, "got %08x\n", hres
);
2105 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&interface1
);
2106 ok(hres
== S_OK
, "got %08x\n", hres
);
2108 hres
= ITypeLib_GetDocumentation(tl
, 0, &name
, NULL
, NULL
, NULL
);
2109 ok(hres
== S_OK
, "got %08x\n", hres
);
2110 ok(!memcmp(name
, interface1W
, sizeof(interface1W
)), "name = %s\n", wine_dbgstr_w(name
));
2112 SysFreeString(name
);
2114 ITypeLib_Release(tl
);
2116 name
= (BSTR
)0xdeadbeef;
2117 helpfile
= (BSTR
)0xdeadbeef;
2118 hres
= ITypeInfo_GetDocumentation(interface1
, -1, &name
, &docstring
, &helpcontext
, &helpfile
);
2119 ok(hres
== S_OK
, "got %08x\n", hres
);
2120 ok(!memcmp(name
, interface1W
, sizeof(interface1W
)), "name = %s\n", wine_dbgstr_w(name
));
2121 ok(docstring
== NULL
, "docstring != NULL\n");
2122 ok(helpcontext
== 0, "helpcontext != 0\n");
2123 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "helpfile = %s\n", wine_dbgstr_w(helpfile
));
2125 SysFreeString(name
);
2126 SysFreeString(helpfile
);
2128 hres
= ITypeInfo_GetDocumentation(interface1
, 0, &name
, NULL
, NULL
, NULL
);
2129 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2131 hres
= ITypeInfo_GetRefTypeInfo(interface1
, 0, NULL
);
2132 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2135 hres
= ICreateTypeInfo_LayOut(createti
);
2136 ok(hres
== S_OK
, "got %08x\n", hres
);
2138 hres
= ICreateTypeInfo_SetGuid(createti
, &interfaceguid
);
2139 ok(hres
== S_OK
, "got %08x\n", hres
);
2141 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, NULL
, &hreftype
);
2142 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2144 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, unknown
, NULL
);
2145 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2147 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, unknown
, &hreftype
);
2148 ok(hres
== S_OK
, "got %08x\n", hres
);
2150 skip("Skipping some tests\n");
2154 hres
= ICreateTypeInfo_AddImplType(createti
, 1, hreftype
);
2155 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2157 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2158 ok(hres
== S_OK
, "got %08x\n", hres
);
2160 hres
= ITypeInfo_GetRefTypeOfImplType(interface1
, 0, &hreftype
);
2161 ok(hres
== S_OK
, "got %08x\n", hres
);
2162 ok(hreftype
== 3, "hreftype = %d\n", hreftype
);
2164 hres
= ITypeInfo_GetRefTypeInfo(interface1
, hreftype
, &ti
);
2165 ok(hres
== S_OK
, "got %08x\n", hres
);
2167 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
2168 ok(hres
== S_OK
, "got %08x\n", hres
);
2169 ok(typeattr
->cbSizeVft
== 3 * ptr_size
, "retrieved IUnknown gave wrong cbSizeVft: %u\n", typeattr
->cbSizeVft
);
2170 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
2172 ITypeInfo_Release(ti
);
2174 hres
= ITypeInfo_GetRefTypeOfImplType(interface1
, -1, &hreftype
);
2175 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2177 ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo2
, (void**)&ti2
);
2179 memset(&funcdesc
, 0, sizeof(FUNCDESC
));
2180 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
2181 funcdesc
.invkind
= INVOKE_PROPERTYGET
;
2182 funcdesc
.callconv
= CC_STDCALL
;
2183 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_BSTR
;
2184 U(funcdesc
.elemdescFunc
).idldesc
.wIDLFlags
= IDLFLAG_NONE
;
2186 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, NULL
);
2187 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2189 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2190 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2192 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2193 ok(hres
== S_OK
, "got %08x\n", hres
);
2195 hres
= ITypeInfo2_GetFuncDesc(ti2
, 0, NULL
);
2196 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2198 hres
= ITypeInfo2_GetFuncDesc(ti2
, 1, &pfuncdesc
);
2199 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2201 hres
= ITypeInfo2_GetFuncDesc(ti2
, 0, &pfuncdesc
);
2202 ok(hres
== S_OK
, "got %08x\n", hres
);
2204 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
2205 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2206 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2207 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2208 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYGET
, "got 0x%x\n", pfuncdesc
->invkind
);
2209 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2210 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
2211 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2212 ok(pfuncdesc
->oVft
== 3 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2213 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2214 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_BSTR
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2215 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2217 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2219 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 0, 0xabcdefab);
2220 ok(hres
== S_OK
, "got %08x\n", hres
);
2222 funcdesc
.invkind
= INVOKE_PROPERTYPUT
;
2223 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2224 ok(hres
== TYPE_E_INCONSISTENTPROPFUNCS
, "got %08x\n", hres
);
2226 funcdesc
.invkind
= INVOKE_PROPERTYPUTREF
;
2227 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2228 ok(hres
== TYPE_E_INCONSISTENTPROPFUNCS
, "got %08x\n", hres
);
2230 elemdesc
[0].tdesc
.vt
= VT_BSTR
;
2231 U(elemdesc
[0]).idldesc
.dwReserved
= 0;
2232 U(elemdesc
[0]).idldesc
.wIDLFlags
= IDLFLAG_FIN
;
2234 funcdesc
.lprgelemdescParam
= elemdesc
;
2235 funcdesc
.invkind
= INVOKE_PROPERTYPUT
;
2236 funcdesc
.cParams
= 1;
2237 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
2239 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2240 ok(hres
== S_OK
, "got %08x\n", hres
);
2242 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 1, 0xabcdefab);
2243 ok(hres
== S_OK
, "got %08x\n", hres
);
2245 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, propname
, 0);
2246 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2248 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, NULL
, 1);
2249 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2251 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, propname
, 1);
2252 ok(hres
== S_OK
, "got %08x\n", hres
);
2254 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1, propname
, 1);
2255 ok(hres
== S_OK
, "got %08x\n", hres
);
2257 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1, propname
, 2);
2258 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2260 hres
= ITypeInfo2_GetFuncDesc(ti2
, 1, &pfuncdesc
);
2261 ok(hres
== S_OK
, "got %08x\n", hres
);
2263 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
2264 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2265 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2266 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2267 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYPUT
, "got 0x%x\n", pfuncdesc
->invkind
);
2268 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2269 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2270 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2271 ok(pfuncdesc
->oVft
== 4 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2272 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2273 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2274 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2276 edesc
= pfuncdesc
->lprgelemdescParam
;
2277 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2278 ok(U(*edesc
).idldesc
.wIDLFlags
== IDLFLAG_FIN
, "got: %x\n", U(*edesc
).idldesc
.wIDLFlags
);
2280 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2283 funcdesc
.invkind
= INVOKE_PROPERTYPUTREF
;
2284 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2285 ok(hres
== S_OK
, "got %08x\n", hres
);
2287 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 0, 0xabcdefab);
2288 ok(hres
== S_OK
, "got %08x\n", hres
);
2290 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 0, 0x201);
2291 ok(hres
== S_OK
, "got %08x\n", hres
);
2294 funcdesc
.lprgelemdescParam
= NULL
;
2295 funcdesc
.invkind
= INVOKE_FUNC
;
2296 funcdesc
.cParams
= 0;
2297 funcdesc
.cScodes
= 1;
2298 funcdesc
.lprgscode
= NULL
;
2299 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2300 ok(hres
== S_OK
, "got %08x\n", hres
);
2302 hres
= ITypeInfo2_GetFuncDesc(ti2
, 1, &pfuncdesc
);
2303 ok(hres
== S_OK
, "got %08x\n", hres
);
2305 ok(pfuncdesc
->memid
== 1, "got %d\n", pfuncdesc
->memid
);
2306 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2307 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2308 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2309 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2310 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2311 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
2312 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2313 ok(pfuncdesc
->oVft
== 4 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2314 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2315 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2316 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2318 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2320 funcdesc
.memid
= MEMBERID_NIL
;
2321 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2322 ok(hres
== S_OK
, "got %08x\n", hres
);
2324 elemdesc
[0].tdesc
.vt
= VT_PTR
;
2325 U(elemdesc
[0].tdesc
).lptdesc
= &typedesc1
;
2326 typedesc1
.vt
= VT_BSTR
;
2327 funcdesc
.cParams
= 1;
2328 funcdesc
.lprgelemdescParam
= elemdesc
;
2329 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 4, &funcdesc
);
2330 ok(hres
== S_OK
, "got %08x\n", hres
);
2332 hres
= ITypeInfo2_GetFuncDesc(ti2
, 4, &pfuncdesc
);
2333 ok(hres
== S_OK
, "got %08x\n", hres
);
2335 ok(pfuncdesc
->memid
== 0x60010004, "got %x\n", pfuncdesc
->memid
);
2336 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2337 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2338 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2339 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2340 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2341 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2342 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2343 ok(pfuncdesc
->oVft
== 7 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2344 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2345 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2346 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2348 edesc
= pfuncdesc
->lprgelemdescParam
;
2349 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
2350 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2351 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2352 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
2353 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
2355 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2357 U(elemdesc
[0].tdesc
).lptdesc
= &typedesc2
;
2358 typedesc2
.vt
= VT_PTR
;
2359 U(typedesc2
).lptdesc
= &typedesc1
;
2360 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 4, &funcdesc
);
2361 ok(hres
== S_OK
, "got %08x\n", hres
);
2363 hres
= ITypeInfo2_GetFuncDesc(ti2
, 4, &pfuncdesc
);
2364 ok(hres
== S_OK
, "got %08x\n", hres
);
2366 ok(pfuncdesc
->memid
== 0x60010007, "got %x\n", pfuncdesc
->memid
);
2367 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2368 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2369 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2370 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2371 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2372 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2373 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2374 ok(pfuncdesc
->oVft
== 7 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2375 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2376 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2377 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2379 edesc
= pfuncdesc
->lprgelemdescParam
;
2380 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
2381 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2382 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2383 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
2384 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_PTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
2385 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
!= NULL
, "got: %p\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
);
2386 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
);
2388 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2390 elemdesc
[0].tdesc
.vt
= VT_INT
;
2391 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2392 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2393 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2394 V_INT(¶mdescex
.varDefaultValue
) = 0x123;
2395 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2396 ok(hres
== S_OK
, "got %08x\n", hres
);
2398 hres
= ITypeInfo2_GetFuncDesc(ti2
, 3, &pfuncdesc
);
2399 ok(hres
== S_OK
, "got %08x\n", hres
);
2401 ok(pfuncdesc
->memid
== 0x60010003, "got %x\n", pfuncdesc
->memid
);
2402 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2403 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2404 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2405 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2406 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2407 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2408 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2409 ok(pfuncdesc
->oVft
== 6 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2410 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2411 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2412 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2414 edesc
= pfuncdesc
->lprgelemdescParam
;
2415 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
2416 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2417 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2418 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2419 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2420 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
2421 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2422 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x123, "got: 0x%x\n",
2423 V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2425 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2427 U(elemdesc
[0]).idldesc
.dwReserved
= 0;
2428 U(elemdesc
[0]).idldesc
.wIDLFlags
= IDLFLAG_FIN
;
2429 elemdesc
[1].tdesc
.vt
= VT_UI2
;
2430 U(elemdesc
[1]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2431 U(elemdesc
[1]).paramdesc
.pparamdescex
= ¶mdescex
;
2432 V_VT(¶mdescex
.varDefaultValue
) = VT_UI2
;
2433 V_UI2(¶mdescex
.varDefaultValue
) = 0xffff;
2434 funcdesc
.cParams
= 2;
2435 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2436 ok(hres
== S_OK
, "got %08x\n", hres
);
2438 hres
= ITypeInfo2_GetFuncDesc(ti2
, 3, &pfuncdesc
);
2439 ok(hres
== S_OK
, "got %08x\n", hres
);
2441 ok(pfuncdesc
->memid
== 0x60010009, "got %x\n", pfuncdesc
->memid
);
2442 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2443 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2444 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2445 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2446 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2447 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
2448 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2449 ok(pfuncdesc
->oVft
== 6 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2450 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2451 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2452 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2454 edesc
= pfuncdesc
->lprgelemdescParam
;
2455 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
2456 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2457 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2459 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
2460 ok(edesc
->tdesc
.vt
== VT_UI2
, "got: %d\n", edesc
->tdesc
.vt
);
2461 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2462 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2463 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2464 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2465 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_UI2
, "got: %d\n",
2466 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2467 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFF, "got: 0x%x\n",
2468 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2470 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2472 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2473 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2474 elemdesc
[1].tdesc
.vt
= VT_INT
;
2475 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2476 V_INT(¶mdescex
.varDefaultValue
) = 0xffffffff;
2477 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2478 ok(hres
== S_OK
, "got %08x\n", hres
);
2480 elemdesc
[0].tdesc
.vt
= VT_BSTR
;
2481 elemdesc
[1].tdesc
.vt
= VT_BSTR
;
2482 V_VT(¶mdescex
.varDefaultValue
) = VT_BSTR
;
2483 V_BSTR(¶mdescex
.varDefaultValue
) = SysAllocString(defaultW
);
2484 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2485 ok(hres
== S_OK
, "got %08x\n", hres
);
2486 SysFreeString(V_BSTR(¶mdescex
.varDefaultValue
));
2488 WideCharToMultiByte(CP_ACP
, 0, defaultW
, -1, nameA
, sizeof(nameA
), NULL
, NULL
);
2489 MultiByteToWideChar(CP_ACP
, 0, nameA
, -1, nameW
, ARRAY_SIZE(nameW
));
2491 hres
= ITypeInfo2_GetFuncDesc(ti2
, 3, &pfuncdesc
);
2492 ok(hres
== S_OK
, "got %08x\n", hres
);
2494 ok(pfuncdesc
->memid
== 0x6001000b, "got %x\n", pfuncdesc
->memid
);
2495 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2496 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2497 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2498 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2499 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2500 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
2501 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2502 ok(pfuncdesc
->oVft
== 6 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2503 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2504 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2505 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2507 edesc
= pfuncdesc
->lprgelemdescParam
;
2508 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2509 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2510 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2511 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2512 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2513 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
2514 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2515 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), nameW
),
2517 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
2519 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
2520 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2521 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2522 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2523 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2524 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2525 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
2526 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2527 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), nameW
),
2529 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
2531 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2533 elemdesc
[0].tdesc
.vt
= VT_USERDEFINED
;
2534 U(elemdesc
[0].tdesc
).hreftype
= hreftype
;
2535 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2536 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2537 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2538 V_INT(¶mdescex
.varDefaultValue
) = 0x789;
2540 funcdesc
.lprgelemdescParam
= elemdesc
;
2541 funcdesc
.invkind
= INVOKE_FUNC
;
2542 funcdesc
.cParams
= 1;
2543 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
2545 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 5, &funcdesc
);
2546 ok(hres
== S_OK
, "got %08x\n", hres
);
2548 hres
= ITypeInfo2_GetFuncDesc(ti2
, 5, &pfuncdesc
);
2549 ok(hres
== S_OK
, "got %08x\n", hres
);
2551 ok(pfuncdesc
->memid
== 0x60010005, "got %x\n", pfuncdesc
->memid
);
2552 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2553 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2554 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2555 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2556 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2557 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2558 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2559 ok(pfuncdesc
->oVft
== 8 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2560 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2561 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2562 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2564 edesc
= pfuncdesc
->lprgelemdescParam
;
2565 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2566 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
2567 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2568 ok(edesc
->tdesc
.vt
== VT_USERDEFINED
, "got: %d\n", edesc
->tdesc
.vt
);
2569 ok(U(edesc
->tdesc
).hreftype
== hreftype
, "got: 0x%x\n", U(edesc
->tdesc
).hreftype
);
2570 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
2571 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2572 ok(V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x789, "got: %d\n",
2573 V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2575 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2577 elemdesc
[0].tdesc
.vt
= VT_VARIANT
;
2578 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2579 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2580 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2581 V_INT(¶mdescex
.varDefaultValue
) = 3;
2583 funcdesc
.lprgelemdescParam
= elemdesc
;
2584 funcdesc
.invkind
= INVOKE_FUNC
;
2585 funcdesc
.cParams
= 1;
2586 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VARIANT
;
2588 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 6, &funcdesc
);
2589 ok(hres
== S_OK
, "got %08x\n", hres
);
2591 hres
= ITypeInfo2_GetFuncDesc(ti2
, 6, &pfuncdesc
);
2592 ok(hres
== S_OK
, "got %08x\n", hres
);
2594 ok(pfuncdesc
->memid
== 0x60010006, "got %x\n", pfuncdesc
->memid
);
2595 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2596 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2597 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2598 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2599 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2600 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2601 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2602 ok(pfuncdesc
->oVft
== 9 * ptr_size
, "got %d\n", pfuncdesc
->oVft
);
2603 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2604 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VARIANT
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2605 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2607 edesc
= pfuncdesc
->lprgelemdescParam
;
2608 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2609 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
2610 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2611 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
2612 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
2613 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2614 ok(V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 3, "got: %d\n",
2615 V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2617 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2619 hres
= ITypeInfo_GetDocumentation(interface1
, 0, &name
, &docstring
, &helpcontext
, &helpfile
);
2620 ok(hres
== S_OK
, "got %08x\n", hres
);
2621 ok(name
== NULL
, "name != NULL\n");
2622 ok(docstring
== NULL
, "docstring != NULL\n");
2623 ok(helpcontext
== 0x201, "helpcontext != 0x201\n");
2624 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "helpfile = %s\n", wine_dbgstr_w(helpfile
));
2626 SysFreeString(helpfile
);
2628 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1000, NULL
, 1);
2629 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2631 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1000, names1
, 1);
2632 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2634 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, names1
, 2);
2635 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2637 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, names2
, 1);
2638 ok(hres
== S_OK
, "got %08x\n", hres
);
2640 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, names1
, 1);
2641 ok(hres
== S_OK
, "got %08x\n", hres
);
2643 hres
= ITypeInfo_GetDocumentation(interface1
, 0, &name
, NULL
, NULL
, NULL
);
2644 ok(hres
== S_OK
, "got %08x\n", hres
);
2645 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "name = %s\n", wine_dbgstr_w(name
));
2647 SysFreeString(name
);
2649 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 3, names2
, 3);
2650 ok(hres
== S_OK
, "got %08x\n", hres
);
2652 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 3, names1
, 3);
2653 ok(hres
== TYPE_E_AMBIGUOUSNAME
, "got %08x\n", hres
);
2655 ITypeInfo2_Release(ti2
);
2656 ICreateTypeInfo_Release(createti
);
2658 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, &createti
);
2659 ok(hres
== TYPE_E_NAMECONFLICT
, "got %08x\n", hres
);
2661 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface2W
, TKIND_INTERFACE
, &createti
);
2662 ok(hres
== S_OK
, "got %08x\n", hres
);
2664 hres
= ICreateTypeInfo_SetGuid(createti
, &interface2guid
);
2665 ok(hres
== S_OK
, "got %08x\n", hres
);
2667 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&interface2
);
2668 ok(hres
== S_OK
, "got %08x\n", hres
);
2670 hres
= ITypeInfo_GetRefTypeOfImplType(interface2
, 0, &hreftype
);
2671 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2673 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, interface1
, &hreftype
);
2674 ok(hres
== S_OK
, "got %08x\n", hres
);
2676 hres
= ITypeInfo_GetRefTypeInfo(interface2
, 0, &ti
);
2677 ok(hres
== S_OK
, "got %08x\n", hres
);
2678 ok(ti
== interface1
, "Received and added interfaces are different\n");
2680 ITypeInfo_Release(ti
);
2682 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2683 ok(hres
== S_OK
, "got %08x\n", hres
);
2685 hres
= ITypeInfo_GetRefTypeOfImplType(interface2
, 0, &hreftype
);
2686 ok(hres
== S_OK
, "got %08x\n", hres
);
2687 ok(hreftype
== 2, "hreftype = %d\n", hreftype
);
2689 hres
= ITypeInfo_GetRefTypeOfImplType(interface2
, -1, &hreftype
);
2690 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2692 hres
= ICreateTypeInfo_SetImplTypeFlags(createti
, 0, IMPLTYPEFLAG_FDEFAULT
);
2693 ok(hres
== TYPE_E_BADMODULEKIND
, "got %08x\n", hres
);
2695 hres
= ITypeInfo_GetImplTypeFlags(interface2
, 0, &impltypeflags
);
2696 ok(hres
== S_OK
, "got %08x\n", hres
);
2697 ok(impltypeflags
== 0, "impltypeflags = %x\n", impltypeflags
);
2699 hres
= ITypeInfo_GetImplTypeFlags(interface2
, 1, &impltypeflags
);
2700 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2702 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
2703 funcdesc
.oVft
= 0xaaac;
2704 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2705 if(sys
== SYS_WIN64
){
2706 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2707 funcdesc
.oVft
= 0xaab0;
2708 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2710 ok(hres
== S_OK
, "got %08x\n", hres
);
2711 funcdesc
.oVft
= 0xaaa8;
2712 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2713 ok(hres
== S_OK
, "got %08x\n", hres
);
2715 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&ti2
);
2716 ok(hres
== S_OK
, "got %08x\n", hres
);
2718 hres
= ITypeInfo2_GetFuncDesc(ti2
, 0, &pfuncdesc
);
2719 ok(hres
== S_OK
, "got %08x\n", hres
);
2721 ok(pfuncdesc
->memid
== 0x60020000, "got %x\n", pfuncdesc
->memid
);
2722 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2723 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2724 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2725 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2726 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2727 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2728 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2729 ok(pfuncdesc
->oVft
== (short)0xaaa8, "got %d\n", pfuncdesc
->oVft
);
2730 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2731 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2732 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2734 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2735 ITypeInfo2_Release(ti2
);
2739 ICreateTypeInfo_Release(createti
);
2741 VariantInit(&cust_data
);
2743 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface3W
, TKIND_INTERFACE
, &createti
);
2744 ok(hres
== S_OK
, "got %08x\n", hres
);
2746 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ICreateTypeInfo2
, (void**)&createti2
);
2747 ok(hres
== S_OK
, "got %08x\n", hres
);
2749 hres
= ICreateTypeInfo2_QueryInterface(createti2
, &IID_ITypeInfo2
, (void**)&ti2
);
2750 ok(hres
== S_OK
, "got %08x\n", hres
);
2752 hres
= ITypeInfo2_GetCustData(ti2
, NULL
, NULL
);
2753 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2755 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, NULL
);
2756 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2758 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2759 ok(hres
== S_OK
, "got %08x\n", hres
);
2761 hres
= ICreateTypeInfo2_SetCustData(createti2
, NULL
, NULL
);
2762 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2764 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, NULL
);
2765 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2767 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2768 ok(hres
== DISP_E_BADVARTYPE
, "got %08x\n", hres
);
2770 V_VT(&cust_data
) = VT_UI4
;
2771 V_I4(&cust_data
) = 0xdeadbeef;
2773 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2774 ok(hres
== S_OK
, "got %08x\n", hres
);
2776 V_I4(&cust_data
) = 0;
2777 V_VT(&cust_data
) = VT_EMPTY
;
2779 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2780 ok(hres
== S_OK
, "got %08x\n", hres
);
2782 ok(V_VT(&cust_data
) == VT_UI4
, "got %d\n", V_VT(&cust_data
));
2783 ok(V_I4(&cust_data
) == 0xdeadbeef, "got 0x%08x\n", V_I4(&cust_data
));
2785 V_VT(&cust_data
) = VT_UI4
;
2786 V_I4(&cust_data
) = 12345678;
2788 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2789 ok(hres
== S_OK
, "got %08x\n", hres
);
2791 V_I4(&cust_data
) = 0;
2792 V_VT(&cust_data
) = VT_EMPTY
;
2794 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2795 ok(hres
== S_OK
, "got %08x\n", hres
);
2797 ok(V_VT(&cust_data
) == VT_UI4
, "got %d\n", V_VT(&cust_data
));
2798 ok(V_I4(&cust_data
) == 12345678, "got 0x%08x\n", V_I4(&cust_data
));
2800 V_VT(&cust_data
) = VT_BSTR
;
2801 V_BSTR(&cust_data
) = SysAllocString(asdfW
);
2803 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2804 ok(hres
== S_OK
, "got %08x\n", hres
);
2806 SysFreeString(V_BSTR(&cust_data
));
2807 V_I4(&cust_data
) = 0;
2808 V_VT(&cust_data
) = VT_EMPTY
;
2810 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2811 ok(hres
== S_OK
, "got %08x\n", hres
);
2813 ok(V_VT(&cust_data
) == VT_BSTR
, "got %d\n", V_VT(&cust_data
));
2814 ok(!lstrcmpW(V_BSTR(&cust_data
), asdfW
), "got %s\n", wine_dbgstr_w(V_BSTR(&cust_data
)));
2815 SysFreeString(V_BSTR(&cust_data
));
2817 V_VT(&cust_data
) = VT_UI4
;
2818 V_UI4(&cust_data
) = 17;
2820 hres
= ITypeInfo2_GetCustData(ti2
, &bogusguid
, &cust_data
);
2821 ok(hres
== S_OK
, "got %08x\n", hres
);
2823 ok(V_VT(&cust_data
) == VT_EMPTY
, "got: %d\n", V_VT(&cust_data
));
2825 ITypeInfo2_Release(ti2
);
2826 ICreateTypeInfo2_Release(createti2
);
2827 ICreateTypeInfo_Release(createti
);
2829 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, coclassW
, TKIND_COCLASS
, &createti
);
2830 ok(hres
== S_OK
, "got %08x\n", hres
);
2832 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, interface1
, &hreftype
);
2833 ok(hres
== S_OK
, "got %08x\n", hres
);
2835 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2836 ok(hres
== S_OK
, "got %08x\n", hres
);
2838 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2839 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2841 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, unknown
, &hreftype
);
2842 ok(hres
== S_OK
, "got %08x\n", hres
);
2844 hres
= ICreateTypeInfo_AddImplType(createti
, 1, hreftype
);
2845 ok(hres
== S_OK
, "got %08x\n", hres
);
2847 hres
= ICreateTypeInfo_AddImplType(createti
, 1, hreftype
);
2848 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2850 hres
= ICreateTypeInfo_AddImplType(createti
, 2, hreftype
);
2851 ok(hres
== S_OK
, "got %08x\n", hres
);
2853 hres
= ICreateTypeInfo_SetImplTypeFlags(createti
, 0, IMPLTYPEFLAG_FDEFAULT
);
2854 ok(hres
== S_OK
, "got %08x\n", hres
);
2856 hres
= ICreateTypeInfo_SetImplTypeFlags(createti
, 1, IMPLTYPEFLAG_FRESTRICTED
);
2857 ok(hres
== S_OK
, "got %08x\n", hres
);
2859 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&ti
);
2860 ok(hres
== S_OK
, "got %08x\n", hres
);
2862 hres
= ITypeInfo_GetImplTypeFlags(ti
, 0, NULL
);
2863 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2865 hres
= ITypeInfo_GetImplTypeFlags(ti
, 0, &impltypeflags
);
2866 ok(hres
== S_OK
, "got %08x\n", hres
);
2867 ok(impltypeflags
== IMPLTYPEFLAG_FDEFAULT
, "impltypeflags = %x\n", impltypeflags
);
2869 hres
= ITypeInfo_GetImplTypeFlags(ti
, 1, &impltypeflags
);
2870 ok(hres
== S_OK
, "got %08x\n", hres
);
2871 ok(impltypeflags
== IMPLTYPEFLAG_FRESTRICTED
, "impltypeflags = %x\n", impltypeflags
);
2873 hres
= ITypeInfo_GetImplTypeFlags(ti
, 2, &impltypeflags
);
2874 ok(hres
== S_OK
, "got %08x\n", hres
);
2875 ok(impltypeflags
== 0, "impltypeflags = %x\n", impltypeflags
);
2877 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
2878 ok(hres
== S_OK
, "got %08x\n", hres
);
2879 ok(hreftype
== 0, "hreftype = %d\n", hreftype
);
2881 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 1, &hreftype
);
2882 ok(hres
== S_OK
, "got %08x\n", hres
);
2883 ok(hreftype
== 1, "hreftype = %d\n", hreftype
);
2885 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 2, &hreftype
);
2886 ok(hres
== S_OK
, "got %08x\n", hres
);
2887 ok(hreftype
== 1, "hreftype = %d\n", hreftype
);
2889 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, -1, &hreftype
);
2890 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2892 ITypeInfo_Release(ti
);
2894 ICreateTypeInfo_Release(createti
);
2896 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, dualW
, TKIND_INTERFACE
, &createti
);
2897 ok(hres
== S_OK
, "got %08x\n", hres
);
2899 hres
= ICreateTypeInfo_SetTypeFlags(createti
, TYPEFLAG_FDUAL
);
2900 ok(hres
== S_OK
, "got %08x\n", hres
);
2902 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2903 ok(hres
== S_OK
, "got %08x\n", hres
);
2905 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, dispatch
, &hreftype
);
2906 ok(hres
== S_OK
, "got %08x\n", hres
);
2908 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2909 ok(hres
== S_OK
, "got %08x\n", hres
);
2911 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&dual
);
2912 ok(hres
== S_OK
, "got %08x\n", hres
);
2914 hres
= ITypeInfo_GetTypeAttr(dual
, &typeattr
);
2915 ok(hres
== S_OK
, "got %08x\n", hres
);
2916 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2917 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
2918 ok(typeattr
->cFuncs
== 1, "cFuncs = %d\n", typeattr
->cFuncs
);
2919 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2920 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2921 ok(typeattr
->cbSizeVft
== 8 * ptr_size
, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2922 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2923 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2924 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2925 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2927 ITypeInfo_ReleaseTypeAttr(dual
, typeattr
);
2929 hres
= ITypeInfo_GetRefTypeOfImplType(dual
, -1, &hreftype
);
2930 ok(hres
== S_OK
, "got %08x\n", hres
);
2931 ok(hreftype
== -2, "got %08x\n", hreftype
);
2933 EXPECT_REF(dual
, 2);
2934 hres
= ITypeInfo_GetRefTypeInfo(dual
, -2, &ti
);
2935 ok(hres
== S_OK
, "got %08x\n", hres
);
2937 EXPECT_REF(dual
, 3);
2939 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
2940 ok(hres
== S_OK
, "got %08x\n", hres
);
2941 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2942 ok(typeattr
->typekind
== TKIND_DISPATCH
, "typekind = %d\n", typeattr
->typekind
);
2943 ok(typeattr
->cFuncs
== 8, "cFuncs = %d\n", typeattr
->cFuncs
);
2944 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2945 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2946 ok(typeattr
->cbSizeVft
== 7 * sizeof(void *), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2947 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2948 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2949 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2950 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2952 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
2954 hres
= ITypeInfo_GetRefTypeInfo(dual
, -2, &ti_2
);
2955 ok(hres
== S_OK
, "Failed to get reference typeinfo, hr %#x.\n", hres
);
2957 ok(ti
== ti_2
, "Unexpected typeinfo instance.\n");
2958 EXPECT_REF(dual
, 4);
2960 ITypeInfo_AddRef(ti_2
);
2962 EXPECT_REF(dual
, 5);
2963 ITypeInfo_Release(ti_2
);
2965 ITypeInfo_Release(ti_2
);
2966 ITypeInfo_Release(ti
);
2968 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, &typedesc1
);
2969 ok(hres
== TYPE_E_BADMODULEKIND
, "got %08x\n", hres
);
2971 ICreateTypeInfo_Release(createti
);
2973 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
2974 ok(hres
== S_OK
, "got %08x\n", hres
);
2975 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2976 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
2977 ok(typeattr
->cFuncs
== 13, "cFuncs = %d\n", typeattr
->cFuncs
);
2978 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2979 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2980 ok(typeattr
->cbSizeVft
== 16 * ptr_size
, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2981 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2982 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2983 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2984 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2986 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
2988 hres
= ITypeInfo_GetTypeAttr(interface2
, &typeattr
);
2989 ok(hres
== S_OK
, "got %08x\n", hres
);
2990 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2991 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
2992 ok(typeattr
->cFuncs
== 2, "cFuncs = %d\n", typeattr
->cFuncs
);
2993 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2994 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2995 ok((sys
== SYS_WIN32
&& typeattr
->cbSizeVft
== 0xaab0) ||
2996 (sys
== SYS_WIN64
&& typeattr
->cbSizeVft
== 0xaab8),
2997 "cbSizeVft = 0x%x\n", typeattr
->cbSizeVft
);
2998 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2999 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3000 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3001 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3003 ITypeInfo_ReleaseTypeAttr(interface2
, typeattr
);
3005 ok(ITypeInfo_Release(interface2
)==0, "Object should be freed\n");
3006 ok(ITypeInfo_Release(interface1
)==0, "Object should be freed\n");
3007 ok(ITypeInfo_Release(dual
)==0, "Object should be freed\n");
3009 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, aliasW
, TKIND_ALIAS
, &createti
);
3010 ok(hres
== S_OK
, "got %08x\n", hres
);
3012 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&interface1
);
3013 ok(hres
== S_OK
, "got %08x\n", hres
);
3016 /* windows gives invalid values here, and even breaks the typeinfo permanently
3017 * on winxp. only call GetTypeAttr() on a TKIND_ALIAS after SetTypeDescAlias. */
3018 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
3019 ok(hres
== S_OK
, "got %08x\n", hres
);
3020 ok(typeattr
->cbSizeInstance
== 0xffffffb4, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3021 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
3022 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3023 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3024 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3025 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3026 ok(typeattr
->cbAlignment
== 0, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3027 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3028 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3029 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3030 ok(typeattr
->tdescAlias
.vt
== VT_EMPTY
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
3031 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
3034 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, NULL
);
3035 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
3037 typedesc1
.vt
= VT_I1
;
3038 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, &typedesc1
);
3039 ok(hres
== S_OK
, "got %08x\n", hres
);
3041 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
3042 ok(hres
== S_OK
, "got %08x\n", hres
);
3043 ok(typeattr
->cbSizeInstance
== 1, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3044 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
3045 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3046 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3047 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3048 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3049 ok(typeattr
->cbAlignment
== 1, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3050 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3051 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3052 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3053 ok(typeattr
->tdescAlias
.vt
== VT_I1
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
3054 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
3056 typedesc1
.vt
= VT_R8
;
3057 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, &typedesc1
);
3058 ok(hres
== S_OK
, "got %08x\n", hres
);
3060 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
3061 ok(hres
== S_OK
, "got %08x\n", hres
);
3062 ok(typeattr
->cbSizeInstance
== 8, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3063 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
3064 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3065 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3066 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3067 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3068 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3069 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3070 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3071 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3072 ok(typeattr
->tdescAlias
.vt
== VT_R8
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
3073 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
3075 ITypeInfo_Release(interface1
);
3076 ICreateTypeInfo_Release(createti
);
3078 hres
= ICreateTypeLib2_SaveAllChanges(createtl
);
3079 ok(hres
== S_OK
, "got %08x\n", hres
);
3081 ok(ICreateTypeLib2_Release(createtl
)==0, "Object should be freed\n");
3083 ok(ITypeInfo_Release(dispatch
)==0, "Object should be freed\n");
3084 ok(ITypeInfo_Release(unknown
)==0, "Object should be freed\n");
3085 ok(ITypeLib_Release(stdole
)==0, "Object should be freed\n");
3087 hres
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &tl
);
3088 ok(hres
== S_OK
, "got %08x\n", hres
);
3090 hres
= ITypeLib_GetLibAttr(tl
, &libattr
);
3091 ok(hres
== S_OK
, "got %08x\n", hres
);
3092 ok(libattr
->syskind
== sys
, "syskind = %d\n", libattr
->syskind
);
3093 ok(libattr
->wMajorVerNum
== 0, "wMajorVer = %d\n", libattr
->wMajorVerNum
);
3094 ok(libattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", libattr
->wMinorVerNum
);
3095 ok(libattr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "wLibFlags = %d\n", libattr
->wLibFlags
);
3096 ITypeLib_ReleaseTLibAttr(tl
, libattr
);
3099 memset(tinfos
, 0, sizeof(tinfos
));
3100 memids
[0] = 0xdeadbeef;
3101 memids
[1] = 0xdeadbeef;
3102 hres
= ITypeLib_FindName(tl
, param1W
, 0, tinfos
, memids
, &found
);
3103 ok(hres
== S_OK
, "got: %08x\n", hres
);
3104 ok(found
== 0, "got wrong count: %u\n", found
);
3105 ok(tinfos
[0] == NULL
, "got invalid typeinfo[0]\n");
3106 ok(tinfos
[1] == NULL
, "got invalid typeinfo[1]\n");
3107 ok(memids
[0] == 0xdeadbeef, "got invalid memid[0]\n");
3108 ok(memids
[1] == 0xdeadbeef, "got invalid memid[1]\n");
3111 memset(tinfos
, 0, sizeof(tinfos
));
3112 memids
[0] = 0xdeadbeef;
3113 memids
[1] = 0xdeadbeef;
3114 hres
= ITypeLib_FindName(tl
, func1W
, 0, tinfos
, memids
, &found
);
3115 ok(hres
== S_OK
, "got: %08x\n", hres
);
3116 ok(found
== 1, "got wrong count: %u\n", found
);
3117 ok(tinfos
[0] != NULL
, "got invalid typeinfo[0]\n");
3118 ok(tinfos
[1] == NULL
, "got invalid typeinfo[1]\n");
3119 ok(memids
[0] == 0, "got invalid memid[0]\n");
3120 ok(memids
[1] == 0xdeadbeef, "got invalid memid[1]\n");
3122 ITypeInfo_Release(tinfos
[0]);
3125 memset(tinfos
, 0, sizeof(tinfos
));
3126 memids
[0] = 0xdeadbeef;
3127 memids
[1] = 0xdeadbeef;
3128 hres
= ITypeLib_FindName(tl
, interface1W
, 0, tinfos
, memids
, &found
);
3129 ok(hres
== S_OK
, "got: %08x\n", hres
);
3130 ok(found
== 1, "got wrong count: %u\n", found
);
3131 ok(tinfos
[0] != NULL
, "got invalid typeinfo[0]\n");
3132 ok(tinfos
[1] == NULL
, "got invalid typeinfo[1]\n");
3133 ok(memids
[0] == MEMBERID_NIL
, "got invalid memid[0]: %x\n", memids
[0]);
3134 ok(memids
[1] == 0xdeadbeef, "got invalid memid[1]\n");
3136 ITypeInfo_Release(tinfos
[0]);
3138 hres
= ITypeLib_GetDocumentation(tl
, -1, &name
, &docstring
, &helpcontext
, &helpfile
);
3139 ok(hres
== S_OK
, "got %08x\n", hres
);
3140 ok(memcmp(typelibW
, name
, sizeof(typelibW
)) == 0, "got wrong typelib name: %s\n",
3141 wine_dbgstr_w(name
));
3142 ok(docstring
== NULL
, "got wrong docstring: %s\n", wine_dbgstr_w(docstring
));
3143 ok(helpcontext
== 0, "got wrong helpcontext: 0x%x\n", helpcontext
);
3144 ok(memcmp(helpfileW
, helpfile
, sizeof(helpfileW
)) == 0,
3145 "got wrong helpfile: %s\n", wine_dbgstr_w(helpfile
));
3146 SysFreeString(name
);
3147 SysFreeString(helpfile
);
3149 hres
= ITypeLib_GetDocumentation(tl
, 0, &name
, &docstring
, &helpcontext
, &helpfile
);
3150 ok(hres
== S_OK
, "got %08x\n", hres
);
3151 ok(memcmp(interface1W
, name
, sizeof(interface1W
)) == 0, "got wrong typeinfo name: %s\n",
3152 wine_dbgstr_w(name
));
3153 ok(docstring
== NULL
, "got wrong docstring: %s\n", wine_dbgstr_w(docstring
));
3154 ok(helpcontext
== 0, "got wrong helpcontext: 0x%x\n", helpcontext
);
3155 ok(memcmp(helpfileW
, helpfile
, sizeof(helpfileW
)) == 0,
3156 "got wrong helpfile: %s\n", wine_dbgstr_w(helpfile
));
3157 SysFreeString(name
);
3158 SysFreeString(helpfile
);
3160 hres
= ITypeLib_QueryInterface(tl
, &IID_ITypeLib2
, (void**)&tl2
);
3161 ok(hres
== S_OK
, "no ITypeLib2 interface (%x)\n", hres
);
3162 V_VT(&cust_data
) = VT_EMPTY
;
3163 V_I4(&cust_data
) = 0;
3164 hres
= ITypeLib2_GetCustData(tl2
, &tlcustguid
, &cust_data
);
3165 ok(hres
== S_OK
, "got %08x\n", hres
);
3166 ok(V_VT(&cust_data
) == VT_I4
, "V_VT(&cust_data) = %d\n", V_VT(&cust_data
));
3167 ok(V_I4(&cust_data
) == 1, "V_I4(&cust_data) = %d\n", V_I4(&cust_data
));
3168 ITypeLib2_Release(tl2
);
3170 hres
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
3171 ok(hres
== S_OK
, "got %08x\n", hres
);
3173 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3174 ok(hres
== S_OK
, "got %08x\n", hres
);
3175 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3176 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3177 ok(typeattr
->cFuncs
== 13, "cFuncs = %d\n", typeattr
->cFuncs
);
3178 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3179 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3180 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3181 ok(typeattr
->cbSizeVft
== 16 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3182 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3183 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3184 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3185 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3186 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3188 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
3189 ok(hres
== S_OK
, "got %08x\n", hres
);
3190 ok(hreftype
== 3, "hreftype = %d\n", hreftype
);
3192 hres
= ITypeInfo_GetRefTypeInfo(ti
, hreftype
, &unknown
);
3193 ok(hres
== S_OK
, "got %08x\n", hres
);
3195 hres
= ITypeInfo_GetTypeAttr(unknown
, &typeattr
);
3196 ok(hres
== S_OK
, "got %08x\n", hres
);
3197 ok(IsEqualGUID(&typeattr
->guid
, &IID_IUnknown
), "got wrong reftypeinfo\n");
3198 ITypeInfo_ReleaseTypeAttr(unknown
, typeattr
);
3200 ITypeInfo_Release(unknown
);
3202 hres
= ITypeInfo_GetFuncDesc(ti
, 0, &pfuncdesc
);
3203 ok(hres
== S_OK
, "got %08x\n", hres
);
3204 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
3205 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3206 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3207 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3208 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYPUTREF
, "got 0x%x\n", pfuncdesc
->invkind
);
3209 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3210 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3211 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3212 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3213 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3214 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3215 edesc
= pfuncdesc
->lprgelemdescParam
;
3216 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
3217 ok(U(*edesc
).idldesc
.wIDLFlags
== IDLFLAG_FIN
, "got: %x\n", U(*edesc
).idldesc
.wIDLFlags
);
3219 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3220 ok(hres
== S_OK
, "got: %08x\n", hres
);
3221 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "got name: %s\n", wine_dbgstr_w(name
));
3222 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3223 ok(helpcontext
== 0x201, "got helpcontext: 0x%x\n", helpcontext
);
3224 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3225 SysFreeString(name
);
3226 SysFreeString(helpfile
);
3228 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, NULL
, 0, &cnames
);
3229 ok(hres
== E_INVALIDARG
, "got: %08x\n", hres
);
3232 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, 0, &cnames
);
3233 ok(hres
== S_OK
, "got: %08x\n", hres
);
3234 ok(cnames
== 0, "got: %u\n", cnames
);
3236 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, ARRAY_SIZE(names
), &cnames
);
3237 ok(hres
== S_OK
, "got: %08x\n", hres
);
3238 ok(cnames
== 1, "got: %u\n", cnames
);
3239 ok(!memcmp(names
[0], func1W
, sizeof(func1W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3240 SysFreeString(names
[0]);
3242 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3244 hres
= ITypeInfo_GetFuncDesc(ti
, 1, &pfuncdesc
);
3245 ok(hres
== S_OK
, "got %08x\n", hres
);
3246 ok(pfuncdesc
->memid
== 0x60010001, "got %x\n", pfuncdesc
->memid
);
3247 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3248 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3249 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3250 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3251 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3252 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
3253 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3254 ok(pfuncdesc
->oVft
== 4 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3255 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3256 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3257 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3259 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3260 ok(hres
== S_OK
, "got: %08x\n", hres
);
3261 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3262 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3263 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3264 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3265 SysFreeString(helpfile
);
3266 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3268 hres
= ITypeInfo_GetFuncDesc(ti
, 2, &pfuncdesc
);
3269 ok(hres
== S_OK
, "got %08x\n", hres
);
3270 ok(pfuncdesc
->memid
== 0x1, "got %x\n", pfuncdesc
->memid
);
3271 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3272 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3273 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3274 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3275 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3276 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
3277 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3278 ok(pfuncdesc
->oVft
== 5 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3279 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3280 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3281 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3283 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3284 ok(hres
== S_OK
, "got: %08x\n", hres
);
3285 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3286 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3287 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3288 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3289 SysFreeString(helpfile
);
3290 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3292 hres
= ITypeInfo_GetFuncDesc(ti
, 3, &pfuncdesc
);
3293 ok(hres
== S_OK
, "got %08x\n", hres
);
3294 ok(pfuncdesc
->memid
== 0x6001000b, "got %x\n", pfuncdesc
->memid
);
3295 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3296 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3297 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3298 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3299 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3300 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
3301 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3302 ok(pfuncdesc
->oVft
== 6 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3303 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3304 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3305 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3307 edesc
= pfuncdesc
->lprgelemdescParam
;
3308 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
3309 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3310 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3311 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3312 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3313 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
3314 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3315 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), nameW
),
3317 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
3319 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
3320 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
3321 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3322 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3323 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3324 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3325 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
3326 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3327 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), nameW
),
3329 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
3331 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3332 ok(hres
== S_OK
, "got: %08x\n", hres
);
3333 ok(!memcmp(name
, func2W
, sizeof(func2W
)), "got name: %s\n", wine_dbgstr_w(name
));
3334 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3335 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3336 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3337 SysFreeString(name
);
3338 SysFreeString(helpfile
);
3340 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, ARRAY_SIZE(names
), &cnames
);
3341 ok(hres
== S_OK
, "got: %08x\n", hres
);
3342 ok(cnames
== 3, "got: %u\n", cnames
);
3343 ok(!memcmp(names
[0], func2W
, sizeof(func2W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3344 ok(!memcmp(names
[1], param1W
, sizeof(func2W
)), "got names[1]: %s\n", wine_dbgstr_w(names
[1]));
3345 ok(!memcmp(names
[2], param2W
, sizeof(func2W
)), "got names[2]: %s\n", wine_dbgstr_w(names
[2]));
3346 SysFreeString(names
[0]);
3347 SysFreeString(names
[1]);
3348 SysFreeString(names
[2]);
3349 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3351 hres
= ITypeInfo_GetFuncDesc(ti
, 4, &pfuncdesc
);
3352 ok(hres
== S_OK
, "got %08x\n", hres
);
3353 ok(pfuncdesc
->memid
== 0x6001000c, "got %x\n", pfuncdesc
->memid
);
3354 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3355 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3356 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3357 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3358 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3359 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
3360 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3361 ok(pfuncdesc
->oVft
== 7 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3362 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3363 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3364 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3366 edesc
= pfuncdesc
->lprgelemdescParam
;
3367 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3368 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3369 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3370 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3371 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3372 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
3373 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3374 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFFFFFF,
3375 "got: 0x%x\n", V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3377 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
3378 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3379 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3380 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3381 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3382 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3383 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
3384 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3385 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFFFFFF,
3386 "got: 0x%x\n", V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3388 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3389 ok(hres
== S_OK
, "got: %08x\n", hres
);
3390 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3391 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3392 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3393 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3394 SysFreeString(helpfile
);
3395 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3397 hres
= ITypeInfo_GetFuncDesc(ti
, 5, &pfuncdesc
);
3398 ok(hres
== S_OK
, "got %08x\n", hres
);
3399 ok(pfuncdesc
->memid
== 0x60010005, "got %x\n", pfuncdesc
->memid
);
3400 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3401 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3402 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3403 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3404 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3405 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3406 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3407 ok(pfuncdesc
->oVft
== 8 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3408 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3409 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3410 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3412 edesc
= pfuncdesc
->lprgelemdescParam
;
3413 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3414 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3415 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3416 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3417 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3418 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x789, "got: 0x%x\n",
3419 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3420 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3421 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3422 ok(edesc
->tdesc
.vt
== VT_USERDEFINED
, "got: %d\n", edesc
->tdesc
.vt
);
3423 ok(U(edesc
->tdesc
).hreftype
== hreftype
, "got: 0x%x\n", U(edesc
->tdesc
).hreftype
);
3425 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3426 ok(hres
== S_OK
, "got: %08x\n", hres
);
3427 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3428 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3429 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3430 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3431 SysFreeString(helpfile
);
3432 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3434 hres
= ITypeInfo_GetFuncDesc(ti
, 6, &pfuncdesc
);
3435 ok(hres
== S_OK
, "got %08x\n", hres
);
3436 ok(pfuncdesc
->memid
== 0x60010006, "got %x\n", pfuncdesc
->memid
);
3437 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3438 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3439 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3440 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3441 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3442 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3443 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3444 ok(pfuncdesc
->oVft
== 9 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3445 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3446 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VARIANT
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3447 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3449 edesc
= pfuncdesc
->lprgelemdescParam
;
3450 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3451 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3452 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3453 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3454 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3455 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x3, "got: 0x%x\n",
3456 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3457 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3458 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3459 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
3460 ok(U(edesc
->tdesc
).hreftype
== 0, "got: 0x%x\n", U(edesc
->tdesc
).hreftype
);
3462 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3463 ok(hres
== S_OK
, "got: %08x\n", hres
);
3464 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3465 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3466 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3467 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3468 SysFreeString(helpfile
);
3469 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3471 hres
= ITypeInfo_GetFuncDesc(ti
, 7, &pfuncdesc
);
3472 ok(hres
== S_OK
, "got %08x\n", hres
);
3473 ok(pfuncdesc
->memid
== 0x60010009, "got %x\n", pfuncdesc
->memid
);
3474 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3475 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3476 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3477 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3478 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3479 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
3480 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3481 ok(pfuncdesc
->oVft
== 10 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3482 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3483 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3484 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3486 edesc
= pfuncdesc
->lprgelemdescParam
;
3487 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3488 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3489 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3491 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
3492 ok(edesc
->tdesc
.vt
== VT_UI2
, "got: %d\n", edesc
->tdesc
.vt
);
3493 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3494 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3495 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3496 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3497 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_UI2
, "got: %d\n",
3498 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3499 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFF, "got: 0x%x\n",
3500 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3502 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3503 ok(hres
== S_OK
, "got: %08x\n", hres
);
3504 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3505 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3506 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3507 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3508 SysFreeString(helpfile
);
3509 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3511 hres
= ITypeInfo_GetFuncDesc(ti
, 8, &pfuncdesc
);
3512 ok(hres
== S_OK
, "got %08x\n", hres
);
3513 ok(pfuncdesc
->memid
== 0x60010003, "got %x\n", pfuncdesc
->memid
);
3514 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3515 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3516 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3517 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3518 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3519 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3520 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3521 ok(pfuncdesc
->oVft
== 11 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3522 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3523 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3524 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3526 edesc
= pfuncdesc
->lprgelemdescParam
;
3527 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3528 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3529 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3530 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3531 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3532 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
3533 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3534 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x123, "got: 0x%x\n",
3535 V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3537 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3538 ok(hres
== S_OK
, "got: %08x\n", hres
);
3539 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3540 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3541 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3542 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3543 SysFreeString(helpfile
);
3544 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3546 hres
= ITypeInfo_GetFuncDesc(ti
, 9, &pfuncdesc
);
3547 ok(hres
== S_OK
, "got %08x\n", hres
);
3548 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
3549 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3550 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3551 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3552 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYGET
, "got 0x%x\n", pfuncdesc
->invkind
);
3553 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3554 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
3555 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3556 ok(pfuncdesc
->oVft
== 12 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3557 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3558 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_BSTR
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3559 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3561 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3562 ok(hres
== S_OK
, "got: %08x\n", hres
);
3563 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "got name: %s\n", wine_dbgstr_w(name
));
3564 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3565 ok(helpcontext
== 0x201, "got helpcontext: 0x%x\n", helpcontext
);
3566 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3567 SysFreeString(name
);
3568 SysFreeString(helpfile
);
3570 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, ARRAY_SIZE(names
), &cnames
);
3571 ok(hres
== S_OK
, "got: %08x\n", hres
);
3572 ok(cnames
== 1, "got: %u\n", cnames
);
3573 ok(!memcmp(names
[0], func1W
, sizeof(func1W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3574 SysFreeString(names
[0]);
3575 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3577 hres
= ITypeInfo_GetFuncDesc(ti
, 10, &pfuncdesc
);
3578 ok(hres
== S_OK
, "got %08x\n", hres
);
3579 ok(pfuncdesc
->memid
== 0x60010007, "got %x\n", pfuncdesc
->memid
);
3580 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3581 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3582 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3583 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3584 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3585 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3586 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3587 ok(pfuncdesc
->oVft
== 13 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3588 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3589 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3590 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3592 edesc
= pfuncdesc
->lprgelemdescParam
;
3593 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
3594 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3595 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3596 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3597 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_PTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
3598 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
!= NULL
, "got: %p\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
);
3599 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
);
3601 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3602 ok(hres
== S_OK
, "got: %08x\n", hres
);
3603 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3604 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3605 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3606 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3607 SysFreeString(helpfile
);
3608 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3610 hres
= ITypeInfo_GetFuncDesc(ti
, 11, &pfuncdesc
);
3611 ok(hres
== S_OK
, "got %08x\n", hres
);
3612 ok(pfuncdesc
->memid
== 0x60010004, "got %x\n", pfuncdesc
->memid
);
3613 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3614 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3615 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3616 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3617 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3618 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3619 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3620 ok(pfuncdesc
->oVft
== 14 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3621 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3622 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3623 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3625 edesc
= pfuncdesc
->lprgelemdescParam
;
3626 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
3627 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3628 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3629 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3630 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
3632 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3633 ok(hres
== S_OK
, "got: %08x\n", hres
);
3634 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3635 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3636 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3637 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3638 SysFreeString(helpfile
);
3639 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3641 hres
= ITypeInfo_GetFuncDesc(ti
, 12, &pfuncdesc
);
3642 ok(hres
== S_OK
, "got %08x\n", hres
);
3643 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
3644 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3645 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3646 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3647 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYPUT
, "got 0x%x\n", pfuncdesc
->invkind
);
3648 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3649 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3650 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3651 ok(pfuncdesc
->oVft
== 15 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3652 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3653 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3654 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3656 edesc
= pfuncdesc
->lprgelemdescParam
;
3657 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
3658 ok(U(*edesc
).idldesc
.wIDLFlags
== IDLFLAG_FIN
, "got: %x\n", U(*edesc
).idldesc
.wIDLFlags
);
3660 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3661 ok(hres
== S_OK
, "got: %08x\n", hres
);
3662 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "got name: %s\n", wine_dbgstr_w(name
));
3663 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3664 ok(helpcontext
== 0x201, "got helpcontext: 0x%x\n", helpcontext
);
3665 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3666 SysFreeString(name
);
3667 SysFreeString(helpfile
);
3669 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, ARRAY_SIZE(names
), &cnames
);
3670 ok(hres
== S_OK
, "got: %08x\n", hres
);
3671 ok(cnames
== 1, "got: %u\n", cnames
);
3672 ok(!memcmp(names
[0], func1W
, sizeof(func1W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3673 SysFreeString(names
[0]);
3674 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3676 hres
= ITypeInfo_GetFuncDesc(ti
, 13, &pfuncdesc
);
3677 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
3679 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3681 hres
= ITypeLib_GetTypeInfo(tl
, 1, &ti
);
3682 ok(hres
== S_OK
, "got %08x\n", hres
);
3684 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3685 ok(hres
== S_OK
, "got %08x\n", hres
);
3686 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3687 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3688 ok(typeattr
->cFuncs
== 2, "cFuncs = %d\n", typeattr
->cFuncs
);
3689 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3690 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3691 ok(typeattr
->cbSizeVft
== 0xaab8 || typeattr
->cbSizeVft
== 0xaab0 ||
3692 typeattr
->cbSizeVft
== 0x5560, "cbSizeVft = 0x%x\n", typeattr
->cbSizeVft
);
3693 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3694 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3695 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3696 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3697 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3699 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
3700 ok(hres
== S_OK
, "got %08x\n", hres
);
3702 hres
= ITypeInfo_GetFuncDesc(ti
, 0, &pfuncdesc
);
3703 ok(hres
== S_OK
, "got %08x\n", hres
);
3704 ok(pfuncdesc
->memid
== 0x60020000, "got %x\n", pfuncdesc
->memid
);
3705 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3706 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3707 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3708 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3709 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3710 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3711 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3712 ok(pfuncdesc
->oVft
== (short)(0xaaa8 * sizeof(void *) / ptr_size
), "got %x\n", pfuncdesc
->oVft
);
3713 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3714 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3715 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3717 edesc
= pfuncdesc
->lprgelemdescParam
;
3718 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
3719 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3720 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3721 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3722 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3723 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3724 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3725 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3726 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x3, "got: 0x%x\n",
3727 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3728 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3729 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3730 ok(U(edesc
->tdesc
).lptdesc
== NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3731 ok(U(edesc
->tdesc
).hreftype
== 0, "got: %d\n", U(edesc
->tdesc
).hreftype
);
3732 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3734 hres
= ITypeInfo_GetFuncDesc(ti
, 1, &pfuncdesc
);
3735 ok(hres
== S_OK
, "got %08x\n", hres
);
3736 ok(pfuncdesc
->memid
== 0x60020001, "got %x\n", pfuncdesc
->memid
);
3737 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3738 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3739 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3740 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3741 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3742 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3743 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3744 ok(pfuncdesc
->oVft
== (short)((sys
== SYS_WIN64
? 0xaab0 : 0xaaac) * sizeof(void *) / ptr_size
), "got %x\n", pfuncdesc
->oVft
);
3745 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3746 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3747 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3749 edesc
= pfuncdesc
->lprgelemdescParam
;
3750 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
3751 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3752 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3753 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3754 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3755 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3756 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3757 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3758 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x3, "got: 0x%x\n",
3759 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3760 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3761 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3762 ok(U(edesc
->tdesc
).lptdesc
== NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3763 ok(U(edesc
->tdesc
).hreftype
== 0, "got: %d\n", U(edesc
->tdesc
).hreftype
);
3764 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3766 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3768 hres
= ITypeLib_GetTypeInfo(tl
, 2, &ti
);
3769 ok(hres
== S_OK
, "got %08x\n", hres
);
3771 hres
= ITypeInfo_QueryInterface(ti
, &IID_ITypeInfo2
, (void**)&ti2
);
3772 ok(hres
== S_OK
, "got %08x\n", hres
);
3774 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3775 ok(hres
== S_OK
, "got %08x\n", hres
);
3776 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3777 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3778 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3779 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3780 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3781 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3782 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3783 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3784 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3785 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3786 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3788 VariantClear(&cust_data
);
3789 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
3790 ok(hres
== S_OK
, "got %08x\n", hres
);
3791 ok(V_VT(&cust_data
) == VT_BSTR
, "got wrong custdata type: %u\n", V_VT(&cust_data
));
3792 ok(!lstrcmpW(V_BSTR(&cust_data
), asdfW
), "got wrong custdata value: %s\n", wine_dbgstr_w(V_BSTR(&cust_data
)));
3793 SysFreeString(V_BSTR(&cust_data
));
3795 ITypeInfo2_Release(ti2
);
3796 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3798 hres
= ITypeLib_GetTypeInfo(tl
, 3, &ti
);
3799 ok(hres
== S_OK
, "got %08x\n", hres
);
3801 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3802 ok(hres
== S_OK
, "got %08x\n", hres
);
3803 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3804 ok(typeattr
->typekind
== TKIND_COCLASS
, "typekind = %d\n", typeattr
->typekind
);
3805 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3806 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3807 ok(typeattr
->cImplTypes
== 3, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3808 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3809 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3810 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3811 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3812 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3813 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3815 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
3816 ok(hres
== S_OK
, "got %08x\n", hres
);
3817 ok(hreftype
== 0, "got wrong hreftype: %x\n", hreftype
);
3819 hres
= ITypeInfo_GetImplTypeFlags(ti
, 0, &impltypeflags
);
3820 ok(hres
== S_OK
, "got %08x\n", hres
);
3821 ok(impltypeflags
== IMPLTYPEFLAG_FDEFAULT
, "got wrong flag: %x\n", impltypeflags
);
3823 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 1, &hreftype
);
3824 ok(hres
== S_OK
, "got %08x\n", hres
);
3825 ok(hreftype
== 1, "got wrong hreftype: %x\n", hreftype
);
3827 hres
= ITypeInfo_GetImplTypeFlags(ti
, 1, &impltypeflags
);
3828 ok(hres
== S_OK
, "got %08x\n", hres
);
3829 ok(impltypeflags
== IMPLTYPEFLAG_FRESTRICTED
, "got wrong flag: %x\n", impltypeflags
);
3831 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 2, &hreftype
);
3832 ok(hres
== S_OK
, "got %08x\n", hres
);
3833 ok(hreftype
== 1, "got wrong hreftype: %x\n", hreftype
);
3835 hres
= ITypeInfo_GetImplTypeFlags(ti
, 2, &impltypeflags
);
3836 ok(hres
== S_OK
, "got %08x\n", hres
);
3837 ok(impltypeflags
== 0, "got wrong flag: %x\n", impltypeflags
);
3839 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 3, &hreftype
);
3840 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
3842 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3844 hres
= ITypeLib_GetTypeInfo(tl
, 4, &ti
);
3845 ok(hres
== S_OK
, "got %08x\n", hres
);
3847 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3848 ok(hres
== S_OK
, "got %08x\n", hres
);
3849 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3850 ok(typeattr
->typekind
== TKIND_DISPATCH
, "typekind = %d\n", typeattr
->typekind
);
3851 ok(typeattr
->cFuncs
== 8, "cFuncs = %d\n", typeattr
->cFuncs
);
3852 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3853 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3854 ok(typeattr
->cbSizeVft
== 7 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3855 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3856 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
), "wTypeFlags = 0x%x\n", typeattr
->wTypeFlags
);
3857 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3858 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3859 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3861 hres
= ITypeInfo_GetTypeComp(ti
, &tcomp
);
3862 ok(hres
== S_OK
, "got %08x\n", hres
);
3864 hres
= ITypeInfo_QueryInterface(ti
, &IID_ITypeComp
, (void**)&tcomp2
);
3865 ok(hres
== S_OK
, "got %08x\n", hres
);
3866 ok(tcomp
== tcomp2
, "got %p, was %p\n", tcomp2
, tcomp
);
3867 ITypeComp_Release(tcomp2
);
3869 hres
= ITypeComp_Bind(tcomp
, invokeW
, 0, INVOKE_FUNC
, &interface1
, &desckind
, &bindptr
);
3870 ok(hres
== S_OK
, "got %08x\n", hres
);
3871 ok(desckind
== DESCKIND_FUNCDESC
, "got wrong desckind: 0x%x\n", desckind
);
3872 ok(bindptr
.lpfuncdesc
->memid
== 0x60010003, "got %x\n", bindptr
.lpfuncdesc
->memid
);
3873 ok(bindptr
.lpfuncdesc
->lprgscode
== NULL
, "got %p\n", bindptr
.lpfuncdesc
->lprgscode
);
3874 ok(bindptr
.lpfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", bindptr
.lpfuncdesc
->lprgelemdescParam
);
3875 ok(bindptr
.lpfuncdesc
->funckind
== FUNC_DISPATCH
, "got 0x%x\n", bindptr
.lpfuncdesc
->funckind
);
3876 ok(bindptr
.lpfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", bindptr
.lpfuncdesc
->invkind
);
3877 ok(bindptr
.lpfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", bindptr
.lpfuncdesc
->callconv
);
3878 ok(bindptr
.lpfuncdesc
->cParams
== 8, "got %d\n", bindptr
.lpfuncdesc
->cParams
);
3879 ok(bindptr
.lpfuncdesc
->cParamsOpt
== 0, "got %d\n", bindptr
.lpfuncdesc
->cParamsOpt
);
3880 ok(bindptr
.lpfuncdesc
->oVft
== 6 * sizeof(void*), "got %x\n", bindptr
.lpfuncdesc
->oVft
);
3881 ok(bindptr
.lpfuncdesc
->cScodes
== 0, "got %d\n", bindptr
.lpfuncdesc
->cScodes
);
3882 ok(bindptr
.lpfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", bindptr
.lpfuncdesc
->elemdescFunc
.tdesc
.vt
);
3883 ok(bindptr
.lpfuncdesc
->wFuncFlags
== FUNCFLAG_FRESTRICTED
, "got 0x%x\n", bindptr
.lpfuncdesc
->wFuncFlags
);
3885 ITypeInfo_ReleaseFuncDesc(interface1
, bindptr
.lpfuncdesc
);
3886 ITypeInfo_Release(interface1
);
3887 ITypeComp_Release(tcomp
);
3889 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, -1, &hreftype
);
3890 ok(hres
== S_OK
, "got %08x\n", hres
);
3891 ok(hreftype
== -2, "got wrong hreftype: %x\n", hreftype
);
3893 hres
= ITypeInfo_GetRefTypeInfo(ti
, hreftype
, &interface1
);
3894 ok(hres
== S_OK
, "got %08x\n", hres
);
3896 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
3897 ok(hres
== S_OK
, "got %08x\n", hres
);
3898 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3899 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3900 ok(typeattr
->cFuncs
== 1, "cFuncs = %d\n", typeattr
->cFuncs
);
3901 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3902 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3903 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3904 ok(typeattr
->cbSizeVft
== 8 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3905 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3906 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
), "wTypeFlags = 0x%x\n", typeattr
->wTypeFlags
);
3907 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3908 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3909 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
3911 ITypeInfo_Release(interface1
);
3913 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3915 hres
= ITypeLib_GetTypeInfo(tl
, 5, &ti
);
3916 ok(hres
== S_OK
, "got %08x\n", hres
);
3918 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3919 ok(hres
== S_OK
, "got %08x\n", hres
);
3920 ok(typeattr
->cbSizeInstance
== 8, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3921 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
3922 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3923 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3924 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3925 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3926 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3927 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = 0x%x\n", typeattr
->wTypeFlags
);
3928 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3929 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3930 ok(typeattr
->tdescAlias
.vt
== VT_R8
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
3931 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3933 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3935 ok(ITypeLib_Release(tl
)==0, "Object should be freed\n");
3937 DeleteFileA(filename
);
3940 #if 0 /* use this to generate more tests */
3942 #define OLE_CHECK(x) { HRESULT hr = x; if (FAILED(hr)) { printf(#x "failed - %x\n", hr); return; } }
3944 static char *dump_string(LPWSTR wstr
)
3946 int size
= lstrlenW(wstr
)+1;
3947 char *out
= CoTaskMemAlloc(size
);
3948 WideCharToMultiByte(20127, 0, wstr
, -1, out
, size
, NULL
, NULL
);
3958 #define MAP_ENTRY(x) { x, #x }
3959 static const struct map_entry tkind_map
[] = {
3960 MAP_ENTRY(TKIND_ENUM
),
3961 MAP_ENTRY(TKIND_RECORD
),
3962 MAP_ENTRY(TKIND_MODULE
),
3963 MAP_ENTRY(TKIND_INTERFACE
),
3964 MAP_ENTRY(TKIND_DISPATCH
),
3965 MAP_ENTRY(TKIND_COCLASS
),
3966 MAP_ENTRY(TKIND_ALIAS
),
3967 MAP_ENTRY(TKIND_UNION
),
3968 MAP_ENTRY(TKIND_MAX
),
3972 static const struct map_entry funckind_map
[] = {
3973 MAP_ENTRY(FUNC_VIRTUAL
),
3974 MAP_ENTRY(FUNC_PUREVIRTUAL
),
3975 MAP_ENTRY(FUNC_NONVIRTUAL
),
3976 MAP_ENTRY(FUNC_STATIC
),
3977 MAP_ENTRY(FUNC_DISPATCH
),
3981 static const struct map_entry varkind_map
[] = {
3982 MAP_ENTRY(VAR_PERINSTANCE
),
3983 MAP_ENTRY(VAR_STATIC
),
3984 MAP_ENTRY(VAR_CONST
),
3985 MAP_ENTRY(VAR_DISPATCH
),
3989 static const struct map_entry invkind_map
[] = {
3990 MAP_ENTRY(INVOKE_FUNC
),
3991 MAP_ENTRY(INVOKE_PROPERTYGET
),
3992 MAP_ENTRY(INVOKE_PROPERTYPUT
),
3993 MAP_ENTRY(INVOKE_PROPERTYPUTREF
),
3997 static const struct map_entry callconv_map
[] = {
3998 MAP_ENTRY(CC_FASTCALL
),
3999 MAP_ENTRY(CC_CDECL
),
4000 MAP_ENTRY(CC_PASCAL
),
4001 MAP_ENTRY(CC_MACPASCAL
),
4002 MAP_ENTRY(CC_STDCALL
),
4003 MAP_ENTRY(CC_FPFASTCALL
),
4004 MAP_ENTRY(CC_SYSCALL
),
4005 MAP_ENTRY(CC_MPWCDECL
),
4006 MAP_ENTRY(CC_MPWPASCAL
),
4010 static const struct map_entry vt_map
[] = {
4011 MAP_ENTRY(VT_EMPTY
),
4020 MAP_ENTRY(VT_DISPATCH
),
4021 MAP_ENTRY(VT_ERROR
),
4023 MAP_ENTRY(VT_VARIANT
),
4024 MAP_ENTRY(VT_UNKNOWN
),
4025 MAP_ENTRY(VT_DECIMAL
),
4036 MAP_ENTRY(VT_HRESULT
),
4038 MAP_ENTRY(VT_SAFEARRAY
),
4039 MAP_ENTRY(VT_CARRAY
),
4040 MAP_ENTRY(VT_USERDEFINED
),
4041 MAP_ENTRY(VT_LPSTR
),
4042 MAP_ENTRY(VT_LPWSTR
),
4043 MAP_ENTRY(VT_RECORD
),
4044 MAP_ENTRY(VT_INT_PTR
),
4045 MAP_ENTRY(VT_UINT_PTR
),
4071 MAP_ENTRY(VT_FILETIME
),
4073 MAP_ENTRY(VT_STREAM
),
4074 MAP_ENTRY(VT_STORAGE
),
4075 MAP_ENTRY(VT_STREAMED_OBJECT
),
4076 MAP_ENTRY(VT_STORED_OBJECT
),
4077 MAP_ENTRY(VT_BLOB_OBJECT
),
4079 MAP_ENTRY(VT_CLSID
),
4085 static const char *map_value(int val
, const struct map_entry
*map
)
4088 static char bufs
[16][256];
4093 if (map
->value
== val
)
4098 buf
= bufs
[(map_id
++)%16];
4099 sprintf(buf
, "%d", val
);
4103 static const char *dump_type_flags(DWORD flags
)
4105 static char buf
[256];
4107 if (!flags
) return "0";
4111 #define ADD_FLAG(x) if (flags & x) { if (buf[0]) strcat(buf, "|"); strcat(buf, #x); flags &= ~x; }
4112 ADD_FLAG(TYPEFLAG_FPROXY
)
4113 ADD_FLAG(TYPEFLAG_FREVERSEBIND
)
4114 ADD_FLAG(TYPEFLAG_FDISPATCHABLE
)
4115 ADD_FLAG(TYPEFLAG_FREPLACEABLE
)
4116 ADD_FLAG(TYPEFLAG_FAGGREGATABLE
)
4117 ADD_FLAG(TYPEFLAG_FRESTRICTED
)
4118 ADD_FLAG(TYPEFLAG_FOLEAUTOMATION
)
4119 ADD_FLAG(TYPEFLAG_FNONEXTENSIBLE
)
4120 ADD_FLAG(TYPEFLAG_FDUAL
)
4121 ADD_FLAG(TYPEFLAG_FCONTROL
)
4122 ADD_FLAG(TYPEFLAG_FHIDDEN
)
4123 ADD_FLAG(TYPEFLAG_FPREDECLID
)
4124 ADD_FLAG(TYPEFLAG_FLICENSED
)
4125 ADD_FLAG(TYPEFLAG_FCANCREATE
)
4126 ADD_FLAG(TYPEFLAG_FAPPOBJECT
)
4130 assert(strlen(buf
) < sizeof(buf
));
4135 static char *print_size(BSTR name
, TYPEATTR
*attr
)
4137 static char buf
[256];
4139 switch (attr
->typekind
)
4141 case TKIND_DISPATCH
:
4142 case TKIND_INTERFACE
:
4143 sprintf(buf
, "sizeof(%s*)", dump_string(name
));
4147 sprintf(buf
, "sizeof(struct %s)", dump_string(name
));
4151 sprintf(buf
, "sizeof(union %s)", dump_string(name
));
4155 sprintf(buf
, "sizeof(%s)", dump_string(name
));
4170 static char *print_align(BSTR name
, TYPEATTR
*attr
)
4172 static char buf
[256];
4174 switch (attr
->typekind
)
4176 case TKIND_DISPATCH
:
4177 case TKIND_INTERFACE
:
4178 sprintf(buf
, "TYPE_ALIGNMENT(%s*)", dump_string(name
));
4182 sprintf(buf
, "TYPE_ALIGNMENT(struct %s)", dump_string(name
));
4186 sprintf(buf
, "TYPE_ALIGNMENT(union %s)", dump_string(name
));
4190 sprintf(buf
, "TYPE_ALIGNMENT(%s)", dump_string(name
));
4205 static const char *dump_param_flags(DWORD flags
)
4207 static char buf
[256];
4209 if (!flags
) return "PARAMFLAG_NONE";
4213 #define ADD_FLAG(x) if (flags & x) { if (buf[0]) strcat(buf, "|"); strcat(buf, #x); flags &= ~x; }
4214 ADD_FLAG(PARAMFLAG_FIN
)
4215 ADD_FLAG(PARAMFLAG_FOUT
)
4216 ADD_FLAG(PARAMFLAG_FLCID
)
4217 ADD_FLAG(PARAMFLAG_FRETVAL
)
4218 ADD_FLAG(PARAMFLAG_FOPT
)
4219 ADD_FLAG(PARAMFLAG_FHASDEFAULT
)
4220 ADD_FLAG(PARAMFLAG_FHASCUSTDATA
)
4224 assert(strlen(buf
) < sizeof(buf
));
4229 static const char *dump_func_flags(DWORD flags
)
4231 static char buf
[256];
4233 if (!flags
) return "0";
4237 #define ADD_FLAG(x) if (flags & x) { if (buf[0]) strcat(buf, "|"); strcat(buf, #x); flags &= ~x; }
4238 ADD_FLAG(FUNCFLAG_FRESTRICTED
)
4239 ADD_FLAG(FUNCFLAG_FSOURCE
)
4240 ADD_FLAG(FUNCFLAG_FBINDABLE
)
4241 ADD_FLAG(FUNCFLAG_FREQUESTEDIT
)
4242 ADD_FLAG(FUNCFLAG_FDISPLAYBIND
)
4243 ADD_FLAG(FUNCFLAG_FDEFAULTBIND
)
4244 ADD_FLAG(FUNCFLAG_FHIDDEN
)
4245 ADD_FLAG(FUNCFLAG_FUSESGETLASTERROR
)
4246 ADD_FLAG(FUNCFLAG_FDEFAULTCOLLELEM
)
4247 ADD_FLAG(FUNCFLAG_FUIDEFAULT
)
4248 ADD_FLAG(FUNCFLAG_FNONBROWSABLE
)
4249 ADD_FLAG(FUNCFLAG_FREPLACEABLE
)
4250 ADD_FLAG(FUNCFLAG_FIMMEDIATEBIND
)
4254 assert(strlen(buf
) < sizeof(buf
));
4259 static const char *dump_var_flags(DWORD flags
)
4261 static char buf
[256];
4263 if (!flags
) return "0";
4267 #define ADD_FLAG(x) if (flags & x) { if (buf[0]) strcat(buf, "|"); strcat(buf, #x); flags &= ~x; }
4268 ADD_FLAG(VARFLAG_FREADONLY
)
4269 ADD_FLAG(VARFLAG_FSOURCE
)
4270 ADD_FLAG(VARFLAG_FBINDABLE
)
4271 ADD_FLAG(VARFLAG_FREQUESTEDIT
)
4272 ADD_FLAG(VARFLAG_FDISPLAYBIND
)
4273 ADD_FLAG(VARFLAG_FDEFAULTBIND
)
4274 ADD_FLAG(VARFLAG_FHIDDEN
)
4275 ADD_FLAG(VARFLAG_FRESTRICTED
)
4276 ADD_FLAG(VARFLAG_FDEFAULTCOLLELEM
)
4277 ADD_FLAG(VARFLAG_FUIDEFAULT
)
4278 ADD_FLAG(VARFLAG_FNONBROWSABLE
)
4279 ADD_FLAG(VARFLAG_FREPLACEABLE
)
4280 ADD_FLAG(VARFLAG_FIMMEDIATEBIND
)
4284 assert(strlen(buf
) < sizeof(buf
));
4289 static const char *dump_variant_info(const VARIANT
*v
)
4291 const char *vt_str
= map_value(V_VT(v
), vt_map
);
4292 static char buf
[256];
4294 case VT_I1
: sprintf(buf
, "{ %s, { .value_int = %d } }", vt_str
, V_I1(v
)); break;
4295 case VT_I2
: sprintf(buf
, "{ %s, { .value_int = %d } }", vt_str
, V_I2(v
)); break;
4296 case VT_I4
: sprintf(buf
, "{ %s, { .value_int = %d } }", vt_str
, V_I4(v
)); break;
4297 case VT_I8
: sprintf(buf
, "{ %s, { .value_int = %s } }", vt_str
, wine_dbgstr_longlong(V_I8(v
))); break;
4298 case VT_INT
: sprintf(buf
, "{ %s, { .value_int = %d } }", vt_str
, V_UINT(v
)); break;
4299 case VT_BOOL
: sprintf(buf
, "{ %s, { .value_int = %d } }", vt_str
, V_BOOL(v
)); break;
4301 case VT_UI1
: sprintf(buf
, "{ %s, { .value_uint = %u } }", vt_str
, V_UI1(v
)); break;
4302 case VT_UI2
: sprintf(buf
, "{ %s, { .value_uint = %u } }", vt_str
, V_UI2(v
)); break;
4303 case VT_UI4
: sprintf(buf
, "{ %s, { .value_uint = %u } }", vt_str
, V_UI4(v
)); break;
4304 case VT_UI8
: sprintf(buf
, "{ %s, { .value_uint = %u } }", vt_str
, wine_dbgstr_longlong(V_UI8(v
))); break;
4305 case VT_UINT
: sprintf(buf
, "{ %s, { .value_uint = %u } }", vt_str
, V_UINT(v
)); break;
4307 case VT_R4
: sprintf(buf
, "{ %s, { .value_float = %0.9g } }", vt_str
, V_R4(v
)); break;
4308 case VT_R8
: sprintf(buf
, "{ %s, { .value_float = %0.17g } }", vt_str
, V_R8(v
)); break;
4310 case VT_BSTR
: sprintf(buf
, "{ %s, { .value_str = \"%s\" } }", vt_str
, dump_string(V_BSTR(v
))); break;
4312 printf("failed - dump_variant_info: cannot serialize %s\n", vt_str
);
4313 sprintf(buf
, "{ %s, { /* cannot dump */ } }", vt_str
);
4318 static const char *dump_custdata_info(LPCUSTDATAITEM item
) {
4319 static char buf
[256];
4320 sprintf(buf
, "{ \"%s\", %s }", wine_dbgstr_guid(&item
->guid
), dump_variant_info(&item
->varValue
));
4324 static int get_href_type(ITypeInfo
*info
, TYPEDESC
*tdesc
)
4328 if (tdesc
->vt
== VT_USERDEFINED
)
4334 hr
= ITypeInfo_GetRefTypeInfo(info
, U(*tdesc
).hreftype
, ¶m
);
4335 ok(hr
== S_OK
, "GetRefTypeInfo error %#x\n", hr
);
4336 hr
= ITypeInfo_GetTypeAttr(param
, &attr
);
4337 ok(hr
== S_OK
, "GetTypeAttr error %#x\n", hr
);
4339 href_type
= attr
->typekind
;
4341 ITypeInfo_ReleaseTypeAttr(param
, attr
);
4342 ITypeInfo_Release(param
);
4348 static void test_dump_typelib(const WCHAR
*name
)
4355 HREFTYPE hRefType
= 0;
4358 OLE_CHECK(LoadTypeLib(name
, &lib
));
4360 printf("/*** Autogenerated data. Do not edit, change the generator above instead. ***/\n");
4362 count
= ITypeLib_GetTypeInfoCount(lib
);
4363 for (i
= 0; i
< count
;)
4368 int f
= 0, v
= 0, c
= 0;
4370 OLE_CHECK(ITypeLib_GetDocumentation(lib
, i
, &name
, NULL
, &help_ctx
, NULL
));
4372 " \"%s\",\n", dump_string(name
));
4374 OLE_CHECK(ITypeLib_GetTypeInfo(lib
, i
, &info
));
4378 OLE_CHECK(ITypeInfo_GetRefTypeInfo(info
, hRefType
, &refInfo
));
4379 ITypeInfo_Release(info
);
4382 OLE_CHECK(ITypeInfo_QueryInterface(info
, &IID_ITypeInfo2
, (void**)&info2
));
4384 OLE_CHECK(ITypeInfo_GetTypeAttr(info
, &attr
));
4385 OLE_CHECK(ITypeInfo2_GetAllCustData(info2
,&cust_data
));
4387 printf(" \"%s\",\n", wine_dbgstr_guid(&attr
->guid
));
4389 printf(" /*kind*/ %s, /*flags*/ %s, /*align*/ %s, /*size*/ %s,\n"
4390 " /*helpctx*/ 0x%04x, /*version*/ 0x%08x, /*#vtbl*/ %d, /*#func*/ %d, /*#var*/ %d,\n",
4391 map_value(attr
->typekind
, tkind_map
), dump_type_flags(attr
->wTypeFlags
),
4392 print_align(name
, attr
), print_size(name
, attr
),
4393 help_ctx
, MAKELONG(attr
->wMinorVerNum
, attr
->wMajorVerNum
),
4394 attr
->cbSizeVft
/sizeof(void*), attr
->cFuncs
, attr
->cVars
);
4396 printf(" /*#custdata*/ %d, %s\n", cust_data
.cCustData
, cust_data
.cCustData
? "{" : "{},");
4397 for (c
= 0; c
< cust_data
.cCustData
; ++c
) {
4398 printf(" %s,\n", dump_custdata_info(&cust_data
.prgCustData
[c
]));
4400 if (cust_data
.cCustData
) printf(" },\n");
4401 ClearCustData(&cust_data
);
4403 printf(" { /* funcs */%s", attr
->cFuncs
? "\n" : " },\n");
4411 if (FAILED(ITypeInfo_GetFuncDesc(info
, f
, &desc
)))
4413 OLE_CHECK(ITypeInfo2_GetAllFuncCustData(info2
,f
,&cust_data
));
4415 " /*id*/ 0x%x, /*func*/ %s, /*inv*/ %s, /*call*/ %s,\n",
4416 desc
->memid
, map_value(desc
->funckind
, funckind_map
), map_value(desc
->invkind
, invkind_map
),
4417 map_value(desc
->callconv
, callconv_map
));
4418 printf(" /*#param*/ %d, /*#opt*/ %d, /*vtbl*/ %d, /*#scodes*/ %d, /*flags*/ %s,\n",
4419 desc
->cParams
, desc
->cParamsOpt
, desc
->oVft
/sizeof(void*), desc
->cScodes
, dump_func_flags(desc
->wFuncFlags
));
4420 printf(" {%s, %s, %s}, /* ret */\n", map_value(desc
->elemdescFunc
.tdesc
.vt
, vt_map
),
4421 map_value(get_href_type(info
, &desc
->elemdescFunc
.tdesc
), tkind_map
), dump_param_flags(U(desc
->elemdescFunc
).paramdesc
.wParamFlags
));
4422 printf(" /*#custdata*/ %d, %s\n", cust_data
.cCustData
, cust_data
.cCustData
? "{" : "{},");
4423 for (c
= 0; c
< cust_data
.cCustData
; ++c
) {
4424 printf(" %s,\n", dump_custdata_info(&cust_data
.prgCustData
[c
]));
4426 if (cust_data
.cCustData
) printf(" },\n");
4427 ClearCustData(&cust_data
);
4429 printf(" { /* params */\n");
4430 for (p
= 0; p
< desc
->cParams
; p
++)
4432 ELEMDESC e
= desc
->lprgelemdescParam
[p
];
4433 OLE_CHECK(ITypeInfo2_GetAllParamCustData(info2
,f
,p
,&cust_data
));
4434 printf(" {%s, %s, %s", map_value(e
.tdesc
.vt
, vt_map
),
4435 map_value(get_href_type(info
, &e
.tdesc
), tkind_map
), dump_param_flags(U(e
).paramdesc
.wParamFlags
));
4436 if (cust_data
.cCustData
) {
4437 printf(", /*#custdata*/ %d, {\n", cust_data
.cCustData
);
4438 for (c
= 0; c
< cust_data
.cCustData
; ++c
) {
4439 printf(" %s,\n", dump_custdata_info(&cust_data
.prgCustData
[c
]));
4445 ClearCustData(&cust_data
);
4447 printf(" {-1, 0, 0}\n");
4449 printf(" { /* names */\n");
4450 OLE_CHECK(ITypeInfo_GetNames(info
, desc
->memid
, tab
, 256, &cNames
));
4451 for (p
= 0; p
< cNames
; p
++)
4453 printf(" \"%s\",\n", dump_string(tab
[p
]));
4454 SysFreeString(tab
[p
]);
4459 ITypeInfo_ReleaseFuncDesc(info
, desc
);
4462 if (attr
->cFuncs
) printf(" },\n");
4464 printf(" { /* vars */%s", attr
->cVars
? "\n" : " },\n");
4470 if (FAILED(ITypeInfo_GetVarDesc(info
, v
, &desc
)))
4472 OLE_CHECK(ITypeInfo2_GetAllVarCustData(info2
,v
,&cust_data
));
4473 OLE_CHECK(ITypeInfo_GetNames(info
, desc
->memid
, &varname
, 1, &cNames
));
4474 if(cNames
!=1) { printf("GetNames failed - VARDESC should have one name, got %d\n", cNames
); return; }
4476 " /*id*/ 0x%x, /*name*/ \"%s\", /*flags*/ %s, /*kind*/ %s,\n",
4477 desc
->memid
, dump_string(varname
), dump_var_flags(desc
->wVarFlags
), map_value(desc
->varkind
, varkind_map
));
4478 SysFreeString(varname
);
4479 if (desc
->varkind
== VAR_PERINSTANCE
) {
4480 printf(" { .oInst = %d },\n", desc
->DUMMYUNIONNAME
.oInst
);
4481 } else if (desc
->varkind
== VAR_CONST
) {
4482 printf(" { .varValue = %s },\n", dump_variant_info(desc
->DUMMYUNIONNAME
.lpvarValue
));
4484 printf(" { /* DUMMYUNIONNAME unused*/ },\n");
4487 printf(" /*#custdata*/ %d, %s\n", cust_data
.cCustData
, cust_data
.cCustData
? "{" : "{},");
4488 for (c
= 0; c
< cust_data
.cCustData
; ++c
) {
4489 printf(" %s,\n", dump_custdata_info(&cust_data
.prgCustData
[c
]));
4491 if (cust_data
.cCustData
) printf(" },\n");
4492 ClearCustData(&cust_data
);
4494 printf(" {%s, %s, %s}, /* ret */\n", map_value(desc
->elemdescVar
.tdesc
.vt
, vt_map
),
4495 map_value(get_href_type(info
, &desc
->elemdescVar
.tdesc
), tkind_map
), dump_param_flags(U(desc
->elemdescVar
).paramdesc
.wParamFlags
));
4497 ITypeInfo_ReleaseVarDesc(info
, desc
);
4500 if (attr
->cVars
) printf(" },\n");
4504 if ((attr
->typekind
== TKIND_DISPATCH
) && (attr
->wTypeFlags
& TYPEFLAG_FDUAL
) &&
4505 SUCCEEDED(ITypeInfo_GetRefTypeOfImplType(info
, -1, &hRefType
)))
4507 /* next iteration dumps hRefType, the TKIND_INTERFACE reference underneath this [dual] TKIND_DISPATCH */
4511 i
++; /* move to the next item in lib */
4515 ITypeInfo_ReleaseTypeAttr(info
, attr
);
4516 ITypeInfo2_Release(info2
);
4517 ITypeInfo_Release(info
);
4518 SysFreeString(name
);
4520 ITypeLib_Release(lib
);
4525 typedef struct _variant_info
{
4531 const char * value_str
;
4535 typedef struct _custdata_info
{
4540 typedef struct _element_info
4546 custdata_info custdata
[5];
4549 typedef struct _function_info
4560 element_info ret_type
;
4562 custdata_info custdata
[5];
4563 element_info params
[15];
4567 typedef struct _var_info
4574 ULONG oInst
; /* VAR_PERINSTANCE */
4575 variant_info varValue
; /* VAR_CONST */
4578 custdata_info custdata
[5];
4579 element_info elemdescVar
;
4582 typedef struct _type_info
4589 USHORT cbSizeInstance
;
4596 custdata_info custdata
[5];
4597 function_info funcs
[20];
4601 static const SYSKIND info_syskind
= SYS_WIN32
;
4602 static const type_info info
[] = {
4603 /*** Autogenerated data. Do not edit, change the generator above instead. ***/
4606 "{b14b6bb5-904e-4ff9-b247-bd361f7a0001}",
4607 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct g
), /*size*/ sizeof(struct g
),
4608 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 1,
4609 /*#custdata*/ 0, {},
4613 /*id*/ 0x40000000, /*name*/ "g1", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
4615 /*#custdata*/ 0, {},
4616 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
4622 "{b14b6bb5-904e-4ff9-b247-bd361f7a0002}",
4623 /*kind*/ TKIND_INTERFACE
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(test_iface
*), /*size*/ sizeof(test_iface
*),
4624 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 4, /*#func*/ 1, /*#var*/ 0,
4625 /*#custdata*/ 0, {},
4628 /*id*/ 0x60010000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4629 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 3, /*#scodes*/ 0, /*flags*/ 0,
4630 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4631 /*#custdata*/ 0, {},
4633 {VT_PTR
, -1, PARAMFLAG_FIN
},
4647 "{b14b6bb5-904e-4ff9-b247-bd361f7aa001}",
4648 /*kind*/ TKIND_INTERFACE
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(parent_iface
*), /*size*/ sizeof(parent_iface
*),
4649 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 4, /*#func*/ 1, /*#var*/ 0,
4650 /*#custdata*/ 0, {},
4653 /*id*/ 0x60010000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4654 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 3, /*#scodes*/ 0, /*flags*/ 0,
4655 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4656 /*#custdata*/ 0, {},
4658 {VT_PTR
, -1, PARAMFLAG_FOUT
|PARAMFLAG_FRETVAL
},
4672 "{b14b6bb5-904e-4ff9-b247-bd361f7aa002}",
4673 /*kind*/ TKIND_INTERFACE
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(child_iface
*), /*size*/ sizeof(child_iface
*),
4674 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 5, /*#func*/ 1, /*#var*/ 0,
4675 /*#custdata*/ 0, {},
4678 /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4679 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 4, /*#scodes*/ 0, /*flags*/ 0,
4680 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4681 /*#custdata*/ 0, {},
4695 "{016fe2ec-b2c8-45f8-b23b-39e53a753903}",
4696 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct _n
), /*size*/ sizeof(struct _n
),
4697 /*helpctx*/ 0x0003, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 1,
4698 /*#custdata*/ 0, {},
4702 /*id*/ 0x40000000, /*name*/ "n1", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
4704 /*#custdata*/ 0, {},
4705 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
4711 "{016fe2ec-b2c8-45f8-b23b-39e53a753902}",
4712 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FHIDDEN
, /*align*/ TYPE_ALIGNMENT(n
), /*size*/ sizeof(n
),
4713 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
4714 /*#custdata*/ 0, {},
4720 "{00000000-0000-0000-0000-000000000000}",
4721 /*kind*/ TKIND_ALIAS
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(nn
), /*size*/ sizeof(nn
),
4722 /*helpctx*/ 0x0003, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
4723 /*#custdata*/ 0, {},
4729 "{016fe2ec-b2c8-45f8-b23b-39e53a753906}",
4730 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct _m
), /*size*/ sizeof(struct _m
),
4731 /*helpctx*/ 0x0003, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 1,
4732 /*#custdata*/ 0, {},
4736 /*id*/ 0x40000000, /*name*/ "m1", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
4738 /*#custdata*/ 0, {},
4739 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
4745 "{016fe2ec-b2c8-45f8-b23b-39e53a753905}",
4746 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FHIDDEN
, /*align*/ TYPE_ALIGNMENT(m
), /*size*/ sizeof(m
),
4747 /*helpctx*/ 0x0000, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
4748 /*#custdata*/ 0, {},
4754 "{00000000-0000-0000-0000-000000000000}",
4755 /*kind*/ TKIND_ALIAS
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(mm
), /*size*/ sizeof(mm
),
4756 /*helpctx*/ 0x0003, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
4757 /*#custdata*/ 0, {},
4763 "{b14b6bb5-904e-4ff9-b247-bd361f7aaedd}",
4764 /*kind*/ TKIND_DISPATCH
, /*flags*/ TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
, /*align*/ TYPE_ALIGNMENT(IDualIface
*), /*size*/ sizeof(IDualIface
*),
4765 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 7, /*#func*/ 8, /*#var*/ 0,
4766 /*#custdata*/ 0, {},
4769 /*id*/ 0x60000000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4770 /*#param*/ 2, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4771 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4772 /*#custdata*/ 0, {},
4774 {VT_PTR
, -1, PARAMFLAG_FIN
},
4775 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4786 /*id*/ 0x60000001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4787 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 1, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4788 {VT_UI4
, -1, PARAMFLAG_NONE
}, /* ret */
4789 /*#custdata*/ 0, {},
4799 /*id*/ 0x60000002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4800 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 2, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4801 {VT_UI4
, -1, PARAMFLAG_NONE
}, /* ret */
4802 /*#custdata*/ 0, {},
4812 /*id*/ 0x60010000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4813 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 3, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4814 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4815 /*#custdata*/ 0, {},
4817 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4827 /*id*/ 0x60010001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4828 /*#param*/ 3, /*#opt*/ 0, /*vtbl*/ 4, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4829 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4830 /*#custdata*/ 0, {},
4832 {VT_UINT
, -1, PARAMFLAG_FIN
},
4833 {VT_UI4
, -1, PARAMFLAG_FIN
},
4834 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4846 /*id*/ 0x60010002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4847 /*#param*/ 5, /*#opt*/ 0, /*vtbl*/ 5, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4848 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4849 /*#custdata*/ 0, {},
4851 {VT_PTR
, -1, PARAMFLAG_FIN
},
4852 {VT_PTR
, -1, PARAMFLAG_FIN
},
4853 {VT_UINT
, -1, PARAMFLAG_FIN
},
4854 {VT_UI4
, -1, PARAMFLAG_FIN
},
4855 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4869 /*id*/ 0x60010003, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4870 /*#param*/ 8, /*#opt*/ 0, /*vtbl*/ 6, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4871 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4872 /*#custdata*/ 0, {},
4874 {VT_I4
, -1, PARAMFLAG_FIN
},
4875 {VT_PTR
, -1, PARAMFLAG_FIN
},
4876 {VT_UI4
, -1, PARAMFLAG_FIN
},
4877 {VT_UI2
, -1, PARAMFLAG_FIN
},
4878 {VT_PTR
, -1, PARAMFLAG_FIN
},
4879 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4880 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4881 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4898 /*id*/ 0x60020000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4899 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
4900 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4901 /*#custdata*/ 0, {},
4915 "{b14b6bb5-904e-4ff9-b247-bd361f7aaedd}",
4916 /*kind*/ TKIND_INTERFACE
, /*flags*/ TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FOLEAUTOMATION
|TYPEFLAG_FDUAL
, /*align*/ TYPE_ALIGNMENT(IDualIface
*), /*size*/ sizeof(IDualIface
*),
4917 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 8, /*#func*/ 1, /*#var*/ 0,
4918 /*#custdata*/ 0, {},
4921 /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4922 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
4923 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4924 /*#custdata*/ 0, {},
4938 "{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac009}",
4939 /*kind*/ TKIND_INTERFACE
, /*flags*/ TYPEFLAG_FDISPATCHABLE
, /*align*/ TYPE_ALIGNMENT(ISimpleIface
*), /*size*/ sizeof(ISimpleIface
*),
4940 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 8, /*#func*/ 1, /*#var*/ 0,
4941 /*#custdata*/ 0, {},
4944 /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4945 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
4946 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4947 /*#custdata*/ 0, {},
4961 "{4029f190-ca4a-4611-aeb9-673983cb96dd}",
4962 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct test_struct
), /*size*/ sizeof(struct test_struct
),
4963 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 4,
4964 /*#custdata*/ 0, {},
4968 /*id*/ 0x40000000, /*name*/ "hr", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
4970 /*#custdata*/ 0, {},
4971 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4974 /*id*/ 0x40000001, /*name*/ "b", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
4976 /*#custdata*/ 0, {},
4977 {VT_BOOL
, -1, PARAMFLAG_NONE
}, /* ret */
4980 /*id*/ 0x40000002, /*name*/ "disp", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
4982 /*#custdata*/ 0, {},
4983 {VT_DISPATCH
, -1, PARAMFLAG_NONE
}, /* ret */
4986 /*id*/ 0x40000003, /*name*/ "bstr", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
4988 /*#custdata*/ 0, {},
4989 {VT_BSTR
, -1, PARAMFLAG_NONE
}, /* ret */
4995 "{4029f190-ca4a-4611-aeb9-673983cb96de}",
4996 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct test_struct2
), /*size*/ sizeof(struct test_struct2
),
4997 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 4,
4998 /*#custdata*/ 0, {},
5002 /*id*/ 0x40000000, /*name*/ "hr", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5004 /*#custdata*/ 0, {},
5005 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5008 /*id*/ 0x40000001, /*name*/ "b", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5010 /*#custdata*/ 0, {},
5011 {VT_BOOL
, -1, PARAMFLAG_NONE
}, /* ret */
5014 /*id*/ 0x40000002, /*name*/ "disp", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5016 /*#custdata*/ 0, {},
5017 {VT_DISPATCH
, -1, PARAMFLAG_NONE
}, /* ret */
5020 /*id*/ 0x40000003, /*name*/ "bstr", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5022 /*#custdata*/ 0, {},
5023 {VT_BSTR
, -1, PARAMFLAG_NONE
}, /* ret */
5029 "{016fe2ec-b2c8-45f8-b23b-39e53a75396a}",
5030 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FRESTRICTED
, /*align*/ TYPE_ALIGNMENT(t_INT
), /*size*/ sizeof(t_INT
),
5031 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
5032 /*#custdata*/ 0, {},
5038 "{00000000-0000-0000-0000-000000000000}",
5039 /*kind*/ TKIND_ALIAS
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(a
), /*size*/ sizeof(a
),
5040 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
5041 /*#custdata*/ 0, {},
5047 "{00000000-0000-0000-0000-000000000000}",
5048 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
5049 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5050 /*#custdata*/ 0, {},
5054 /*id*/ 0x40000000, /*name*/ "a1", /*flags*/ 0, /*kind*/ VAR_CONST
,
5055 { .varValue
= { VT_I4
, { .value_int
= 0 } } },
5056 /*#custdata*/ 0, {},
5057 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5060 /*id*/ 0x40000001, /*name*/ "a2", /*flags*/ 0, /*kind*/ VAR_CONST
,
5061 { .varValue
= { VT_I4
, { .value_int
= 1 } } },
5062 /*#custdata*/ 0, {},
5063 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5069 "{00000000-0000-0000-0000-000000000000}",
5070 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
5071 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5072 /*#custdata*/ 0, {},
5076 /*id*/ 0x40000000, /*name*/ "aa1", /*flags*/ 0, /*kind*/ VAR_CONST
,
5077 { .varValue
= { VT_I4
, { .value_int
= 0 } } },
5078 /*#custdata*/ 0, {},
5079 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5082 /*id*/ 0x40000001, /*name*/ "aa2", /*flags*/ 0, /*kind*/ VAR_CONST
,
5083 { .varValue
= { VT_I4
, { .value_int
= 1 } } },
5084 /*#custdata*/ 0, {},
5085 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5091 "{00000000-0000-0000-0000-000000000000}",
5092 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
5093 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5094 /*#custdata*/ 0, {},
5098 /*id*/ 0x40000000, /*name*/ "b1", /*flags*/ 0, /*kind*/ VAR_CONST
,
5099 { .varValue
= { VT_I4
, { .value_int
= 0 } } },
5100 /*#custdata*/ 0, {},
5101 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5104 /*id*/ 0x40000001, /*name*/ "b2", /*flags*/ 0, /*kind*/ VAR_CONST
,
5105 { .varValue
= { VT_I4
, { .value_int
= 1 } } },
5106 /*#custdata*/ 0, {},
5107 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5113 "{00000000-0000-0000-0000-000000000000}",
5114 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
5115 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5116 /*#custdata*/ 0, {},
5120 /*id*/ 0x40000000, /*name*/ "bb1", /*flags*/ 0, /*kind*/ VAR_CONST
,
5121 { .varValue
= { VT_I4
, { .value_int
= 0 } } },
5122 /*#custdata*/ 0, {},
5123 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5126 /*id*/ 0x40000001, /*name*/ "bb2", /*flags*/ 0, /*kind*/ VAR_CONST
,
5127 { .varValue
= { VT_I4
, { .value_int
= 1 } } },
5128 /*#custdata*/ 0, {},
5129 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5135 "{016fe2ec-b2c8-45f8-b23b-39e53a75396b}",
5136 /*kind*/ TKIND_ALIAS
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(c
), /*size*/ sizeof(c
),
5137 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
5138 /*#custdata*/ 0, {},
5144 "{00000000-0000-0000-0000-000000000000}",
5145 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
5146 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5147 /*#custdata*/ 0, {},
5151 /*id*/ 0x40000000, /*name*/ "c1", /*flags*/ 0, /*kind*/ VAR_CONST
,
5152 { .varValue
= { VT_I4
, { .value_int
= 0 } } },
5153 /*#custdata*/ 0, {},
5154 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5157 /*id*/ 0x40000001, /*name*/ "c2", /*flags*/ 0, /*kind*/ VAR_CONST
,
5158 { .varValue
= { VT_I4
, { .value_int
= 1 } } },
5159 /*#custdata*/ 0, {},
5160 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5166 "{016fe2ec-b2c8-45f8-b23b-39e53a75396c}",
5167 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
5168 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5169 /*#custdata*/ 0, {},
5173 /*id*/ 0x40000000, /*name*/ "cc1", /*flags*/ 0, /*kind*/ VAR_CONST
,
5174 { .varValue
= { VT_I4
, { .value_int
= 0 } } },
5175 /*#custdata*/ 0, {},
5176 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5179 /*id*/ 0x40000001, /*name*/ "cc2", /*flags*/ 0, /*kind*/ VAR_CONST
,
5180 { .varValue
= { VT_I4
, { .value_int
= 1 } } },
5181 /*#custdata*/ 0, {},
5182 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5188 "{016fe2ec-b2c8-45f8-b23b-39e53a75396d}",
5189 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ TYPE_ALIGNMENT(d
), /*size*/ sizeof(d
),
5190 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
5191 /*#custdata*/ 0, {},
5197 "{00000000-0000-0000-0000-000000000000}",
5198 /*kind*/ TKIND_ENUM
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ 4,
5199 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5200 /*#custdata*/ 0, {},
5204 /*id*/ 0x40000000, /*name*/ "d1", /*flags*/ 0, /*kind*/ VAR_CONST
,
5205 { .varValue
= { VT_I4
, { .value_int
= 0 } } },
5206 /*#custdata*/ 0, {},
5207 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5210 /*id*/ 0x40000001, /*name*/ "d2", /*flags*/ 0, /*kind*/ VAR_CONST
,
5211 { .varValue
= { VT_I4
, { .value_int
= 1 } } },
5212 /*#custdata*/ 0, {},
5213 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5219 "{016fe2ec-b2c8-45f8-b23b-39e53a75396e}",
5220 /*kind*/ TKIND_ENUM
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ 4,
5221 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5222 /*#custdata*/ 0, {},
5226 /*id*/ 0x40000000, /*name*/ "dd1", /*flags*/ 0, /*kind*/ VAR_CONST
,
5227 { .varValue
= { VT_I4
, { .value_int
= 0 } } },
5228 /*#custdata*/ 0, {},
5229 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5232 /*id*/ 0x40000001, /*name*/ "dd2", /*flags*/ 0, /*kind*/ VAR_CONST
,
5233 { .varValue
= { VT_I4
, { .value_int
= 1 } } },
5234 /*#custdata*/ 0, {},
5235 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5241 "{016fe2ec-b2c8-45f8-b23b-39e53a753970}",
5242 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ TYPE_ALIGNMENT(e
), /*size*/ sizeof(e
),
5243 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
5244 /*#custdata*/ 0, {},
5250 "{00000000-0000-0000-0000-000000000000}",
5251 /*kind*/ TKIND_RECORD
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ TYPE_ALIGNMENT(struct _e
), /*size*/ sizeof(struct _e
),
5252 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 1,
5253 /*#custdata*/ 0, {},
5257 /*id*/ 0x40000000, /*name*/ "e1", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5259 /*#custdata*/ 0, {},
5260 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5266 "{016fe2ec-b2c8-45f8-b23b-39e53a753971}",
5267 /*kind*/ TKIND_RECORD
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ TYPE_ALIGNMENT(struct ee
), /*size*/ sizeof(struct ee
),
5268 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 1,
5269 /*#custdata*/ 0, {},
5273 /*id*/ 0x40000000, /*name*/ "ee1", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5275 /*#custdata*/ 0, {},
5276 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5282 "{016fe2ec-b2c8-45f8-b23b-39e53a753972}",
5283 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ TYPE_ALIGNMENT(f
), /*size*/ sizeof(f
),
5284 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
5285 /*#custdata*/ 0, {},
5291 "{00000000-0000-0000-0000-000000000000}",
5292 /*kind*/ TKIND_UNION
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ TYPE_ALIGNMENT(union _f
), /*size*/ sizeof(union _f
),
5293 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5294 /*#custdata*/ 0, {},
5298 /*id*/ 0x40000000, /*name*/ "f1", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5300 /*#custdata*/ 0, {},
5301 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5304 /*id*/ 0x40000001, /*name*/ "f2", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5306 /*#custdata*/ 0, {},
5307 {VT_PTR
, -1, PARAMFLAG_NONE
}, /* ret */
5313 "{016fe2ec-b2c8-45f8-b23b-39e53a753973}",
5314 /*kind*/ TKIND_UNION
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ TYPE_ALIGNMENT(union ff
), /*size*/ sizeof(union ff
),
5315 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
5316 /*#custdata*/ 0, {},
5320 /*id*/ 0x40000000, /*name*/ "ff1", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5322 /*#custdata*/ 0, {},
5323 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5326 /*id*/ 0x40000001, /*name*/ "ff2", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
5328 /*#custdata*/ 0, {},
5329 {VT_PTR
, -1, PARAMFLAG_NONE
}, /* ret */
5335 "{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac00a}",
5336 /*kind*/ TKIND_INTERFACE
, /*flags*/ TYPEFLAG_FDISPATCHABLE
, /*align*/ TYPE_ALIGNMENT(ITestIface
*), /*size*/ sizeof(ITestIface
*),
5337 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 13, /*#func*/ 6, /*#var*/ 0,
5338 /*#custdata*/ 0, {},
5341 /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5342 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
5343 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5344 /*#custdata*/ 0, {},
5346 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
5356 /*id*/ 0x60020001, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5357 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 8, /*#scodes*/ 0, /*flags*/ 0,
5358 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5359 /*#custdata*/ 0, {},
5361 {VT_USERDEFINED
, TKIND_ENUM
, PARAMFLAG_NONE
},
5371 /*id*/ 0x60020002, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5372 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 9, /*#scodes*/ 0, /*flags*/ 0,
5373 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5374 /*#custdata*/ 0, {},
5376 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
5386 /*id*/ 0x60020003, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5387 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 10, /*#scodes*/ 0, /*flags*/ 0,
5388 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5389 /*#custdata*/ 0, {},
5391 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
5401 /*id*/ 0x60020004, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5402 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 11, /*#scodes*/ 0, /*flags*/ 0,
5403 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5404 /*#custdata*/ 0, {},
5406 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
5416 /*id*/ 0x60020005, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5417 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 12, /*#scodes*/ 0, /*flags*/ 0,
5418 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5419 /*#custdata*/ 0, {},
5421 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
5435 "{2d4430d5-99ea-4645-85f0-c5814b72804b}",
5436 /*kind*/ TKIND_DISPATCH
, /*flags*/ TYPEFLAG_FDISPATCHABLE
, /*align*/ TYPE_ALIGNMENT(ITestDispatch
*), /*size*/ sizeof(ITestDispatch
*),
5437 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 7, /*#func*/ 7, /*#var*/ 2,
5438 /*#custdata*/ 0, {},
5441 /*id*/ 0x1, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5442 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0,
5443 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5444 /*#custdata*/ 0, {},
5454 /*id*/ 0x2, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5455 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0,
5456 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5457 /*#custdata*/ 0, {},
5459 {VT_PTR
, -1, PARAMFLAG_FOUT
|PARAMFLAG_FRETVAL
},
5469 /*id*/ 0x3, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5470 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0,
5471 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5472 /*#custdata*/ 0, {},
5482 /*id*/ 0x4, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5483 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0,
5484 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5485 /*#custdata*/ 0, {},
5487 {VT_PTR
, -1, PARAMFLAG_FOUT
|PARAMFLAG_FRETVAL
},
5491 "test_HRESULT_retval",
5497 /*id*/ 0x5, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5498 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0,
5499 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5500 /*#custdata*/ 0, {},
5510 /*id*/ 0x6, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5511 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0,
5512 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5513 /*#custdata*/ 0, {},
5515 {VT_PTR
, -1, PARAMFLAG_FOUT
|PARAMFLAG_FRETVAL
},
5525 /*id*/ 0x7, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5526 /*#param*/ 2, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0,
5527 {VT_R8
, -1, PARAMFLAG_NONE
}, /* ret */
5528 /*#custdata*/ 0, {},
5530 {VT_BSTR
, -1, PARAMFLAG_FIN
},
5531 {VT_I4
, -1, PARAMFLAG_FLCID
},
5544 /*id*/ 0xa, /*name*/ "property_int", /*flags*/ 0, /*kind*/ VAR_DISPATCH
,
5545 { /* DUMMYUNIONNAME unused*/ },
5546 /*#custdata*/ 0, {},
5547 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5550 /*id*/ 0xb, /*name*/ "property_HRESULT", /*flags*/ 0, /*kind*/ VAR_DISPATCH
,
5551 { /* DUMMYUNIONNAME unused*/ },
5552 /*#custdata*/ 0, {},
5553 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5559 "{79ca07f9-ac22-44ac-9aaf-811f45412293}",
5560 /*kind*/ TKIND_DISPATCH
, /*flags*/ TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
, /*align*/ TYPE_ALIGNMENT(ITestDispDual
*), /*size*/ sizeof(ITestDispDual
*),
5561 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 7, /*#func*/ 14, /*#var*/ 0,
5562 /*#custdata*/ 0, {},
5565 /*id*/ 0x60000000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5566 /*#param*/ 2, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5567 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5568 /*#custdata*/ 0, {},
5570 {VT_PTR
, -1, PARAMFLAG_FIN
},
5571 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5582 /*id*/ 0x60000001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5583 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 1, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5584 {VT_UI4
, -1, PARAMFLAG_NONE
}, /* ret */
5585 /*#custdata*/ 0, {},
5595 /*id*/ 0x60000002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5596 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 2, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5597 {VT_UI4
, -1, PARAMFLAG_NONE
}, /* ret */
5598 /*#custdata*/ 0, {},
5608 /*id*/ 0x60010000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5609 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 3, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5610 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5611 /*#custdata*/ 0, {},
5613 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5623 /*id*/ 0x60010001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5624 /*#param*/ 3, /*#opt*/ 0, /*vtbl*/ 4, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5625 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5626 /*#custdata*/ 0, {},
5628 {VT_UINT
, -1, PARAMFLAG_FIN
},
5629 {VT_UI4
, -1, PARAMFLAG_FIN
},
5630 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5642 /*id*/ 0x60010002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5643 /*#param*/ 5, /*#opt*/ 0, /*vtbl*/ 5, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5644 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5645 /*#custdata*/ 0, {},
5647 {VT_PTR
, -1, PARAMFLAG_FIN
},
5648 {VT_PTR
, -1, PARAMFLAG_FIN
},
5649 {VT_UINT
, -1, PARAMFLAG_FIN
},
5650 {VT_UI4
, -1, PARAMFLAG_FIN
},
5651 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5665 /*id*/ 0x60010003, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5666 /*#param*/ 8, /*#opt*/ 0, /*vtbl*/ 6, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5667 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5668 /*#custdata*/ 0, {},
5670 {VT_I4
, -1, PARAMFLAG_FIN
},
5671 {VT_PTR
, -1, PARAMFLAG_FIN
},
5672 {VT_UI4
, -1, PARAMFLAG_FIN
},
5673 {VT_UI2
, -1, PARAMFLAG_FIN
},
5674 {VT_PTR
, -1, PARAMFLAG_FIN
},
5675 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5676 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5677 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5694 /*id*/ 0x1, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5695 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
5696 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5697 /*#custdata*/ 0, {},
5707 /*id*/ 0x2, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5708 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 8, /*#scodes*/ 0, /*flags*/ 0,
5709 {VT_R8
, -1, PARAMFLAG_NONE
}, /* ret */
5710 /*#custdata*/ 0, {},
5720 /*id*/ 0x3, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5721 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 9, /*#scodes*/ 0, /*flags*/ 0,
5722 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5723 /*#custdata*/ 0, {},
5733 /*id*/ 0x4, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5734 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 10, /*#scodes*/ 0, /*flags*/ 0,
5735 {VT_R8
, -1, PARAMFLAG_NONE
}, /* ret */
5736 /*#custdata*/ 0, {},
5741 "test_HRESULT_retval",
5746 /*id*/ 0x5, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5747 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 11, /*#scodes*/ 0, /*flags*/ 0,
5748 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5749 /*#custdata*/ 0, {},
5759 /*id*/ 0x6, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5760 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 12, /*#scodes*/ 0, /*flags*/ 0,
5761 {VT_R8
, -1, PARAMFLAG_NONE
}, /* ret */
5762 /*#custdata*/ 0, {},
5772 /*id*/ 0x7, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5773 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 13, /*#scodes*/ 0, /*flags*/ 0,
5774 {VT_R8
, -1, PARAMFLAG_NONE
}, /* ret */
5775 /*#custdata*/ 0, {},
5777 {VT_BSTR
, -1, PARAMFLAG_FIN
},
5791 "{79ca07f9-ac22-44ac-9aaf-811f45412293}",
5792 /*kind*/ TKIND_INTERFACE
, /*flags*/ TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FOLEAUTOMATION
|TYPEFLAG_FDUAL
, /*align*/ TYPE_ALIGNMENT(ITestDispDual
*), /*size*/ sizeof(ITestDispDual
*),
5793 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 14, /*#func*/ 7, /*#var*/ 0,
5794 /*#custdata*/ 0, {},
5797 /*id*/ 0x1, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5798 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
5799 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5800 /*#custdata*/ 0, {},
5810 /*id*/ 0x2, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5811 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 8, /*#scodes*/ 0, /*flags*/ 0,
5812 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5813 /*#custdata*/ 0, {},
5815 {VT_PTR
, -1, PARAMFLAG_FOUT
|PARAMFLAG_FRETVAL
},
5825 /*id*/ 0x3, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5826 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 9, /*#scodes*/ 0, /*flags*/ 0,
5827 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5828 /*#custdata*/ 0, {},
5838 /*id*/ 0x4, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5839 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 10, /*#scodes*/ 0, /*flags*/ 0,
5840 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5841 /*#custdata*/ 0, {},
5843 {VT_PTR
, -1, PARAMFLAG_FOUT
|PARAMFLAG_FRETVAL
},
5847 "test_HRESULT_retval",
5853 /*id*/ 0x5, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5854 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 11, /*#scodes*/ 0, /*flags*/ 0,
5855 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5856 /*#custdata*/ 0, {},
5866 /*id*/ 0x6, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5867 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 12, /*#scodes*/ 0, /*flags*/ 0,
5868 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
5869 /*#custdata*/ 0, {},
5871 {VT_PTR
, -1, PARAMFLAG_FOUT
|PARAMFLAG_FRETVAL
},
5881 /*id*/ 0x7, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5882 /*#param*/ 3, /*#opt*/ 0, /*vtbl*/ 13, /*#scodes*/ 0, /*flags*/ 0,
5883 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
5884 /*#custdata*/ 0, {},
5886 {VT_BSTR
, -1, PARAMFLAG_FIN
},
5887 {VT_I4
, -1, PARAMFLAG_FLCID
},
5888 {VT_PTR
, -1, PARAMFLAG_FOUT
|PARAMFLAG_FRETVAL
},
5904 "{cdb105e3-24fb-4ae6-b826-801b7b2a0a07}",
5905 /*kind*/ TKIND_DISPATCH
, /*flags*/ TYPEFLAG_FDISPATCHABLE
, /*align*/ TYPE_ALIGNMENT(ITestDispInherit
*), /*size*/ sizeof(ITestDispInherit
*),
5906 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 7, /*#func*/ 14, /*#var*/ 0,
5907 /*#custdata*/ 0, {},
5910 /*id*/ 0x60000000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5911 /*#param*/ 2, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5912 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5913 /*#custdata*/ 0, {},
5915 {VT_PTR
, -1, PARAMFLAG_FIN
},
5916 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5927 /*id*/ 0x60000001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5928 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 1, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5929 {VT_UI4
, -1, PARAMFLAG_NONE
}, /* ret */
5930 /*#custdata*/ 0, {},
5940 /*id*/ 0x60000002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5941 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 2, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5942 {VT_UI4
, -1, PARAMFLAG_NONE
}, /* ret */
5943 /*#custdata*/ 0, {},
5953 /*id*/ 0x60010000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5954 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 3, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5955 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5956 /*#custdata*/ 0, {},
5958 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5968 /*id*/ 0x60010001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5969 /*#param*/ 3, /*#opt*/ 0, /*vtbl*/ 4, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5970 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5971 /*#custdata*/ 0, {},
5973 {VT_UINT
, -1, PARAMFLAG_FIN
},
5974 {VT_UI4
, -1, PARAMFLAG_FIN
},
5975 {VT_PTR
, -1, PARAMFLAG_FOUT
},
5987 /*id*/ 0x60010002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
5988 /*#param*/ 5, /*#opt*/ 0, /*vtbl*/ 5, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
5989 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
5990 /*#custdata*/ 0, {},
5992 {VT_PTR
, -1, PARAMFLAG_FIN
},
5993 {VT_PTR
, -1, PARAMFLAG_FIN
},
5994 {VT_UINT
, -1, PARAMFLAG_FIN
},
5995 {VT_UI4
, -1, PARAMFLAG_FIN
},
5996 {VT_PTR
, -1, PARAMFLAG_FOUT
},
6010 /*id*/ 0x60010003, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6011 /*#param*/ 8, /*#opt*/ 0, /*vtbl*/ 6, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
6012 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
6013 /*#custdata*/ 0, {},
6015 {VT_I4
, -1, PARAMFLAG_FIN
},
6016 {VT_PTR
, -1, PARAMFLAG_FIN
},
6017 {VT_UI4
, -1, PARAMFLAG_FIN
},
6018 {VT_UI2
, -1, PARAMFLAG_FIN
},
6019 {VT_PTR
, -1, PARAMFLAG_FIN
},
6020 {VT_PTR
, -1, PARAMFLAG_FOUT
},
6021 {VT_PTR
, -1, PARAMFLAG_FOUT
},
6022 {VT_PTR
, -1, PARAMFLAG_FOUT
},
6039 /*id*/ 0x1, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6040 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
6041 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
6042 /*#custdata*/ 0, {},
6052 /*id*/ 0x2, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6053 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 8, /*#scodes*/ 0, /*flags*/ 0,
6054 {VT_R8
, -1, PARAMFLAG_NONE
}, /* ret */
6055 /*#custdata*/ 0, {},
6065 /*id*/ 0x3, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6066 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 9, /*#scodes*/ 0, /*flags*/ 0,
6067 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
6068 /*#custdata*/ 0, {},
6078 /*id*/ 0x4, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6079 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 10, /*#scodes*/ 0, /*flags*/ 0,
6080 {VT_R8
, -1, PARAMFLAG_NONE
}, /* ret */
6081 /*#custdata*/ 0, {},
6086 "test_HRESULT_retval",
6091 /*id*/ 0x5, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6092 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 11, /*#scodes*/ 0, /*flags*/ 0,
6093 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
6094 /*#custdata*/ 0, {},
6104 /*id*/ 0x6, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6105 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 12, /*#scodes*/ 0, /*flags*/ 0,
6106 {VT_R8
, -1, PARAMFLAG_NONE
}, /* ret */
6107 /*#custdata*/ 0, {},
6117 /*id*/ 0x7, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6118 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 13, /*#scodes*/ 0, /*flags*/ 0,
6119 {VT_R8
, -1, PARAMFLAG_NONE
}, /* ret */
6120 /*#custdata*/ 0, {},
6122 {VT_BSTR
, -1, PARAMFLAG_FIN
},
6135 "custdata_interface",
6136 "{786ee4ff-c5dd-4bf4-9578-0d22fb5369cc}",
6137 /*kind*/ TKIND_INTERFACE
, /*flags*/ TYPEFLAG_FDISPATCHABLE
, /*align*/ TYPE_ALIGNMENT(custdata_interface
*), /*size*/ sizeof(custdata_interface
*),
6138 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 8, /*#func*/ 1, /*#var*/ 0,
6140 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetCustData interface" } } },
6144 /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6145 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
6146 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
6148 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetFuncCustData custdata_interface::test_method" } } },
6151 {VT_INT
, -1, PARAMFLAG_FIN
, /*#custdata*/ 1, {
6152 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetParamCustData custdata_interface::test_method(x)" } } },
6167 "{6ca99f5e-c86a-42ad-a5ee-5bd4c8e5553c}",
6168 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
6169 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
6171 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetCustData enum" } } },
6176 /*id*/ 0x40000000, /*name*/ "One", /*flags*/ 0, /*kind*/ VAR_CONST
,
6177 { .varValue
= { VT_I4
, { .value_int
= 0 } } },
6179 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetVarCustData enum" } } },
6181 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
6184 /*id*/ 0x40000001, /*name*/ "Two", /*flags*/ 0, /*kind*/ VAR_CONST
,
6185 { .varValue
= { VT_I4
, { .value_int
= 1 } } },
6186 /*#custdata*/ 0, {},
6187 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
6193 "{62fabe17-f733-4b09-b859-3f455dcda450}",
6194 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct custdata_struct
), /*size*/ sizeof(struct custdata_struct
),
6195 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 1,
6197 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetCustData struct" } } },
6202 /*id*/ 0x40000000, /*name*/ "test_field", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
6205 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetVarCustData struct" } } },
6207 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
6213 "{00000000-0000-0000-0000-000000000000}",
6214 /*kind*/ TKIND_UNION
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(union custdata_union
), /*size*/ sizeof(union custdata_union
),
6215 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 1,
6217 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetCustData union" } } },
6222 /*id*/ 0x40000000, /*name*/ "test_field", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE
,
6225 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetVarCustData union" } } },
6227 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
6233 "{d58744d6-63f9-467c-87e5-c95158098b18}",
6234 /*kind*/ TKIND_ALIAS
, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(custdata_typedef
), /*size*/ sizeof(custdata_typedef
),
6235 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
6237 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetCustData typedef" } } },
6243 "custdata_dispatch",
6244 "{bffc216e-2159-465a-80df-b85fd4f4f122}",
6245 /*kind*/ TKIND_DISPATCH
, /*flags*/ TYPEFLAG_FDISPATCHABLE
, /*align*/ TYPE_ALIGNMENT(custdata_dispatch
*), /*size*/ sizeof(custdata_dispatch
*),
6246 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 7, /*#func*/ 1, /*#var*/ 1,
6248 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetCustData dispinterface" } } },
6252 /*id*/ 0x1, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
6253 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0,
6254 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
6256 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetFuncCustData dispinterface method" } } },
6259 {VT_INT
, -1, PARAMFLAG_FIN
, /*#custdata*/ 1, {
6260 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetParamCustData test_dispatch::test_method(x)" } } },
6273 /*id*/ 0x0, /*name*/ "test_property", /*flags*/ 0, /*kind*/ VAR_DISPATCH
,
6274 { /* DUMMYUNIONNAME unused*/ },
6276 { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR
, { .value_str
= "ITypeInfo2::GetVarCustData dispinterface property" } } },
6278 {VT_INT
, -1, PARAMFLAG_NONE
}, /* ret */
6284 #define check_variant_info(value, expected) { \
6285 expect_int(V_VT(value), (expected)->vt); \
6286 switch(V_VT(value)) { \
6287 case VT_I1: expect_int(V_I1(value), (expected)->value_int); break; \
6288 case VT_I2: expect_int(V_I2(value), (expected)->value_int); break; \
6289 case VT_I4: expect_int(V_I4(value), (expected)->value_int); break; \
6290 case VT_I8: expect_int(V_I8(value), (expected)->value_int); break; \
6291 case VT_BOOL: expect_int(V_BOOL(value), (expected)->value_int); break; \
6292 case VT_INT: expect_int(V_INT(value), (expected)->value_int); break; \
6293 case VT_UI1: expect_int(V_UI1(value), (expected)->value_uint); break; \
6294 case VT_UI2: expect_int(V_UI2(value), (expected)->value_uint); break; \
6295 case VT_UI4: expect_int(V_UI4(value), (expected)->value_uint); break; \
6296 case VT_UI8: expect_int(V_UI8(value), (expected)->value_uint); break; \
6297 case VT_UINT: expect_int(V_UINT(value), (expected)->value_uint); break; \
6298 case VT_BSTR: expect_wstr_acpval(V_BSTR(value), (expected)->value_str); break; \
6299 default: skip("check_variant_info: comparing value not implemented for VARTYPE %d\n",V_VT(value)); \
6302 #define check_type(elem, info) { \
6303 expect_int((elem)->tdesc.vt, (info)->vt); \
6304 expect_hex(U(*(elem)).paramdesc.wParamFlags, (info)->wParamFlags); \
6307 static void parse_guid(LPCSTR strGuid
, GUID
*guid
)
6310 MultiByteToWideChar(CP_ACP
, 0, strGuid
, -1, guidW
, ARRAY_SIZE(guidW
));
6311 ole_check(IIDFromString(guidW
, guid
));
6314 static void test_dump_typelib(const WCHAR
*name
)
6318 int iface
= 0, func
, var
, cust
;
6319 HREFTYPE hRefType
= 0;
6323 const type_info
*ti
;
6325 ole_check(LoadTypeLibEx(name
, REGKIND_NONE
, &typelib
));
6327 ole_check(ITypeLib_GetLibAttr(typelib
, &libattr
));
6328 if(libattr
->syskind
!= info_syskind
) {
6329 /* struct VARDESC::oInst may vary from changes in sizeof(void *) affecting the offset of later fields*/
6330 skip("ignoring VARDESC::oInst, (libattr->syskind expected %d got %d)\n", info_syskind
, libattr
->syskind
);
6333 for (ti
= info
; ti
!= info
+ ARRAY_SIZE(info
); ti
++)
6335 ITypeInfo2
*typeinfo2
;
6336 ITypeInfo
*typeinfo
;
6341 trace("Interface %s\n", ti
->name
);
6342 ole_check(ITypeLib_GetTypeInfo(typelib
, iface
, &typeinfo
));
6346 ole_check(ITypeInfo_GetRefTypeInfo(typeinfo
, hRefType
, &refInfo
));
6347 ITypeInfo_Release(typeinfo
);
6350 ole_check(ITypeLib_GetDocumentation(typelib
, iface
, &bstrIfName
, NULL
, &help_ctx
, NULL
));
6351 expect_wstr_acpval(bstrIfName
, ti
->name
);
6352 SysFreeString(bstrIfName
);
6354 ole_check(ITypeInfo_GetTypeAttr(typeinfo
, &typeattr
));
6355 expect_int(typeattr
->typekind
, ti
->type
);
6356 expect_hex(typeattr
->wTypeFlags
, ti
->wTypeFlags
);
6357 expect_int(typeattr
->cbAlignment
, ti
->cbAlignment
);
6358 expect_int(typeattr
->cbSizeInstance
, ti
->cbSizeInstance
);
6359 expect_int(help_ctx
, ti
->help_ctx
);
6360 expect_int(MAKELONG(typeattr
->wMinorVerNum
, typeattr
->wMajorVerNum
), ti
->version
);
6361 expect_int(typeattr
->cbSizeVft
, ti
->cbSizeVft
* sizeof(void*));
6362 expect_int(typeattr
->cFuncs
, ti
->cFuncs
);
6363 expect_int(typeattr
->cVars
, ti
->cVars
);
6365 /* compare type uuid */
6366 if (ti
->uuid
&& *ti
->uuid
)
6368 ITypeInfo
*typeinfo2
;
6372 parse_guid(ti
->uuid
,&guid
);
6373 expect_guid(&guid
, &typeattr
->guid
);
6375 /* check that it's possible to search using this uuid */
6377 hr
= ITypeLib_GetTypeInfoOfGuid(typelib
, &guid
, &typeinfo2
);
6378 ok(hr
== S_OK
|| (IsEqualGUID(&guid
, &IID_NULL
) && hr
== TYPE_E_ELEMENTNOTFOUND
), "got 0x%08x\n", hr
);
6379 if (hr
== S_OK
) ITypeInfo_Release(typeinfo2
);
6382 ole_check(ITypeInfo_GetTypeAttr(typeinfo
, &typeattr
));
6384 hr
= ITypeInfo_QueryInterface(typeinfo
, &IID_ITypeInfo2
, (void**)&typeinfo2
);
6385 ok(hr
== S_OK
, "Could not get ITypeInfo2: %08x\n", hr
);
6387 memset(&cust_data
, 0, sizeof(cust_data
));
6388 ole_check(ITypeInfo2_GetAllCustData(typeinfo2
,&cust_data
));
6389 expect_int(cust_data
.cCustData
, ti
->cCustData
);
6390 ClearCustData(&cust_data
);
6391 for (cust
= 0; cust
< ti
->cCustData
; cust
++)
6394 parse_guid(ti
->custdata
[cust
].uuid
,&guid
);
6395 /* check that it's possible to search using this uuid */
6396 hr
= ITypeInfo2_GetCustData(typeinfo2
,&guid
,&v
);
6397 ok(hr
== S_OK
, "GetCustDatafailed: %08x\n", hr
);
6398 check_variant_info(&v
,&ti
->custdata
[cust
].value
);
6402 for (func
= 0; func
< typeattr
->cFuncs
; func
++)
6404 const function_info
*fn_info
= &ti
->funcs
[func
];
6410 trace("Function %s\n", fn_info
->names
[0]);
6411 ole_check(ITypeInfo_GetFuncDesc(typeinfo
, func
, &desc
));
6412 expect_int(desc
->memid
, fn_info
->memid
);
6413 expect_int(desc
->funckind
, fn_info
->funckind
);
6414 expect_int(desc
->invkind
, fn_info
->invkind
);
6415 expect_int(desc
->callconv
, fn_info
->callconv
);
6416 expect_int(desc
->cParams
, fn_info
->cParams
);
6417 expect_int(desc
->cParamsOpt
, fn_info
->cParamsOpt
);
6418 expect_int(desc
->oVft
, fn_info
->vtbl_index
* sizeof(void*));
6419 expect_int(desc
->cScodes
, fn_info
->cScodes
);
6420 expect_int(desc
->wFuncFlags
, fn_info
->wFuncFlags
);
6422 memset(&cust_data
, 0, sizeof(cust_data
));
6423 ole_check(ITypeInfo2_GetAllFuncCustData(typeinfo2
,func
,&cust_data
));
6424 expect_int(cust_data
.cCustData
, fn_info
->cCustData
);
6425 ClearCustData(&cust_data
);
6426 for (cust
= 0; cust
< fn_info
->cCustData
; cust
++)
6429 parse_guid(fn_info
->custdata
[cust
].uuid
,&guid
);
6430 /* check that it's possible to search using this uuid */
6431 hr
= ITypeInfo2_GetFuncCustData(typeinfo2
,func
,&guid
,&v
);
6432 ok(hr
== S_OK
, "GetCustDatafailed: %08x\n", hr
);
6433 check_variant_info(&v
,&fn_info
->custdata
[cust
].value
);
6437 ole_check(ITypeInfo_GetNames(typeinfo
, desc
->memid
, namesTab
, 256, &cNames
));
6438 for (i
= 0; i
< cNames
; i
++)
6440 expect_wstr_acpval(namesTab
[i
], fn_info
->names
[i
]);
6441 SysFreeString(namesTab
[i
]);
6443 expect_null(fn_info
->names
[cNames
]);
6445 check_type(&desc
->elemdescFunc
, &fn_info
->ret_type
);
6446 for (i
= 0 ; i
< desc
->cParams
; i
++)
6448 check_type(&desc
->lprgelemdescParam
[i
], &fn_info
->params
[i
]);
6450 memset(&cust_data
, 0, sizeof(cust_data
));
6451 ole_check(ITypeInfo2_GetAllParamCustData(typeinfo2
,func
,i
,&cust_data
));
6452 expect_int(cust_data
.cCustData
, fn_info
->params
[i
].cCustData
);
6453 ClearCustData(&cust_data
);
6454 for (cust
= 0; cust
< fn_info
->params
[i
].cCustData
; cust
++)
6457 parse_guid(fn_info
->params
[i
].custdata
[cust
].uuid
,&guid
);
6458 /* check that it's possible to search using this uuid */
6459 hr
= ITypeInfo2_GetParamCustData(typeinfo2
,func
,i
,&guid
,&v
);
6460 ok(hr
== S_OK
, "GetParamCustDatafailed: %08x\n", hr
);
6461 check_variant_info(&v
,&fn_info
->params
[i
].custdata
[cust
].value
);
6465 if (desc
->lprgelemdescParam
[i
].tdesc
.vt
== VT_USERDEFINED
)
6470 ole_check(ITypeInfo_GetRefTypeInfo(typeinfo
, U(desc
->lprgelemdescParam
[i
].tdesc
).hreftype
, ¶m
));
6471 ole_check(ITypeInfo_GetTypeAttr(param
, &var_attr
));
6473 ok(var_attr
->typekind
== fn_info
->params
[i
].type
, "expected %#x, got %#x\n", fn_info
->params
[i
].type
, var_attr
->typekind
);
6475 ITypeInfo_ReleaseTypeAttr(param
, var_attr
);
6476 ITypeInfo_Release(param
);
6479 expect_int(fn_info
->params
[desc
->cParams
].vt
, (VARTYPE
)-1);
6481 V_VT(&v
) = VT_ERROR
;
6482 hr
= ITypeInfo2_GetFuncCustData(typeinfo2
, func
, &IID_NULL
, &v
);
6483 ok(hr
== S_OK
, "GetFuncCustData failed: %08x\n", hr
);
6484 ok(V_VT(&v
) == VT_EMPTY
, "V_VT(&v) = %d\n", V_VT(&v
));
6487 V_VT(&v
) = VT_ERROR
;
6488 hr
= ITypeInfo2_GetFuncCustData(typeinfo2
, func
, &IID_IBaseIface
, &v
);
6489 ok(hr
== S_OK
, "GetFuncCustData failed: %08x\n", hr
);
6490 ok(V_VT(&v
) == VT_EMPTY
, "V_VT(&v) = %d\n", V_VT(&v
));
6493 memset(&cust_data
, 0, sizeof(cust_data
));
6494 ITypeInfo_ReleaseFuncDesc(typeinfo
, desc
);
6497 for (var
= 0; var
< typeattr
->cVars
; var
++)
6499 const var_info
*var_info
= &ti
->vars
[var
];
6504 trace("Variable %s\n", var_info
->name
);
6505 ole_check(ITypeInfo_GetVarDesc(typeinfo
, var
, &desc
));
6507 expect_int(desc
->memid
, var_info
->memid
);
6509 ole_check(ITypeInfo_GetNames(typeinfo
, desc
->memid
, &varname
, 1, &cNames
));
6510 expect_int(cNames
, 1);
6511 expect_wstr_acpval(varname
, var_info
->name
);
6512 SysFreeString(varname
);
6514 expect_null(desc
->lpstrSchema
); /* Reserved */
6515 expect_int(desc
->wVarFlags
, var_info
->wVarFlags
);
6516 expect_int(desc
->varkind
, var_info
->varkind
);
6517 if (desc
->varkind
== VAR_PERINSTANCE
) {
6518 /* oInst depends on preceding field data sizes (except for unions),
6519 * so it may not be valid to expect it to match info[] on other platforms */
6520 if ((libattr
->syskind
== info_syskind
) || (typeattr
->typekind
== TKIND_UNION
)) {
6521 expect_int(desc
->DUMMYUNIONNAME
.oInst
, var_info
->DUMMYUNIONNAME
.oInst
);
6523 } else if(desc
->varkind
== VAR_CONST
) {
6524 check_variant_info(desc
->DUMMYUNIONNAME
.lpvarValue
, &var_info
->DUMMYUNIONNAME
.varValue
);
6526 expect_null(desc
->DUMMYUNIONNAME
.lpvarValue
);
6528 memset(&cust_data
, 0, sizeof(cust_data
));
6529 ole_check(ITypeInfo2_GetAllVarCustData(typeinfo2
,var
,&cust_data
));
6530 expect_int(cust_data
.cCustData
, var_info
->cCustData
);
6531 ClearCustData(&cust_data
);
6532 for (cust
= 0; cust
< var_info
->cCustData
; cust
++)
6535 parse_guid(var_info
->custdata
[cust
].uuid
,&guid
);
6536 /* check that it's possible to search using this uuid */
6537 hr
= ITypeInfo2_GetVarCustData(typeinfo2
,var
,&guid
,&v
);
6538 ok(hr
== S_OK
, "GetVarCustData failed: %08x\n", hr
);
6539 check_variant_info(&v
,&var_info
->custdata
[cust
].value
);
6543 check_type(&desc
->elemdescVar
, &var_info
->elemdescVar
);
6545 ITypeInfo_ReleaseVarDesc(typeinfo
, desc
);
6548 if ((typeattr
->typekind
== TKIND_DISPATCH
) && (typeattr
->wTypeFlags
& TYPEFLAG_FDUAL
) &&
6549 SUCCEEDED(ITypeInfo_GetRefTypeOfImplType(typeinfo
, -1, &hRefType
)))
6551 /* next iteration dumps hRefType, the TKIND_INTERFACE reference underneath this [dual] TKIND_DISPATCH */
6555 iface
++; /* move to the next item in typelib */
6559 ITypeInfo_ReleaseTypeAttr(typeinfo
, typeattr
);
6561 ITypeInfo2_Release(typeinfo2
);
6562 ITypeInfo_Release(typeinfo
);
6564 expect_eq(ITypeLib_GetTypeInfoCount(typelib
), iface
, UINT
, "%d");
6565 ITypeLib_ReleaseTLibAttr(typelib
, libattr
);
6566 ITypeLib_Release(typelib
);
6571 static void test_create_typelib_lcid(LCID lcid
)
6573 char filename
[MAX_PATH
];
6574 WCHAR name
[MAX_PATH
];
6576 ICreateTypeLib2
*tl
;
6578 DWORD msft_header
[8];
6583 GetTempFileNameA( ".", "tlb", 0, filename
);
6584 MultiByteToWideChar(CP_ACP
, 0, filename
, -1, name
, MAX_PATH
);
6586 hr
= CreateTypeLib2(SYS_WIN32
, name
, &tl
);
6587 ok(hr
== S_OK
, "got %08x\n", hr
);
6589 hr
= ICreateTypeLib2_QueryInterface(tl
, &IID_ITypeLib
, (void**)&typelib
);
6590 ok(hr
== S_OK
, "got %08x\n", hr
);
6592 hr
= ITypeLib_GetLibAttr(typelib
, &attr
);
6593 ok(hr
== S_OK
, "got %08x\n", hr
);
6594 ok(attr
->wLibFlags
== 0, "flags 0x%x\n", attr
->wLibFlags
);
6595 ITypeLib_ReleaseTLibAttr(typelib
, attr
);
6597 hr
= ICreateTypeLib2_SetLcid(tl
, lcid
);
6598 ok(hr
== S_OK
, "got %08x\n", hr
);
6600 hr
= ICreateTypeLib2_SetVersion(tl
, 3, 4);
6601 ok(hr
== S_OK
, "got %08x\n", hr
);
6603 hr
= ICreateTypeLib2_SaveAllChanges(tl
);
6604 ok(hr
== S_OK
, "got %08x\n", hr
);
6606 hr
= ITypeLib_GetLibAttr(typelib
, &attr
);
6607 ok(hr
== S_OK
, "got %08x\n", hr
);
6608 ok(attr
->wLibFlags
== 0, "flags 0x%x\n", attr
->wLibFlags
);
6609 ITypeLib_ReleaseTLibAttr(typelib
, attr
);
6611 ITypeLib_Release(typelib
);
6612 ICreateTypeLib2_Release(tl
);
6614 file
= CreateFileA( filename
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, 0, 0 );
6615 ok( file
!= INVALID_HANDLE_VALUE
, "file creation failed\n" );
6617 ReadFile( file
, msft_header
, sizeof(msft_header
), &read
, NULL
);
6618 ok(read
== sizeof(msft_header
), "read %d\n", read
);
6619 CloseHandle( file
);
6621 ok(msft_header
[0] == 0x5446534d, "got %08x\n", msft_header
[0]);
6622 ok(msft_header
[1] == 0x00010002, "got %08x\n", msft_header
[1]);
6623 ok(msft_header
[2] == 0xffffffff, "got %08x\n", msft_header
[2]);
6624 ok(msft_header
[3] == (lcid
? lcid
: 0x409), "got %08x (lcid %08x)\n", msft_header
[3], lcid
);
6625 ok(msft_header
[4] == lcid
, "got %08x (lcid %08x)\n", msft_header
[4], lcid
);
6626 ok(msft_header
[6] == 0x00040003, "got %08x\n", msft_header
[6]);
6627 ok(msft_header
[7] == 0, "got %08x\n", msft_header
[7]);
6629 /* check flags after loading */
6630 hr
= LoadTypeLib(name
, &typelib
);
6631 ok(hr
== S_OK
, "got %08x\n", hr
);
6633 hr
= ITypeLib_GetLibAttr(typelib
, &attr
);
6634 ok(hr
== S_OK
, "got %08x\n", hr
);
6635 ok(attr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "flags 0x%x\n", attr
->wLibFlags
);
6636 ITypeLib_ReleaseTLibAttr(typelib
, attr
);
6637 ITypeLib_Release(typelib
);
6639 DeleteFileA(filename
);
6642 static void test_create_typelibs(void)
6644 test_create_typelib_lcid(LOCALE_SYSTEM_DEFAULT
);
6645 test_create_typelib_lcid(LOCALE_USER_DEFAULT
);
6646 test_create_typelib_lcid(LOCALE_NEUTRAL
);
6648 test_create_typelib_lcid(0x009);
6649 test_create_typelib_lcid(0x409);
6650 test_create_typelib_lcid(0x809);
6652 test_create_typelib_lcid(0x007);
6653 test_create_typelib_lcid(0x407);
6657 static void test_register_typelib(BOOL system_registration
)
6663 char key_name
[MAX_PATH
], uuid
[40];
6664 LONG ret
, expect_ret
;
6667 REGSAM opposite
= (sizeof(void*) == 8 ? KEY_WOW64_32KEY
: KEY_WOW64_64KEY
);
6668 BOOL is_wow64
= FALSE
;
6676 { TKIND_INTERFACE
, 0 },
6677 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
},
6678 { TKIND_INTERFACE
, TYPEFLAG_FOLEAUTOMATION
},
6679 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FOLEAUTOMATION
},
6680 { TKIND_DISPATCH
, TYPEFLAG_FDUAL
},
6681 { TKIND_DISPATCH
, TYPEFLAG_FDUAL
},
6682 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
},
6683 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
},
6684 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
},
6685 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
},
6686 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
},
6687 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
},
6688 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
},
6689 { TKIND_RECORD
, 0 },
6690 { TKIND_MODULE
, 0 },
6693 trace("Starting %s typelib registration tests\n",
6694 system_registration
? "system" : "user");
6696 if (!system_registration
&& (!pRegisterTypeLibForUser
|| !pUnRegisterTypeLibForUser
))
6698 win_skip("User typelib registration functions are not available\n");
6702 if (pIsWow64Process
)
6703 pIsWow64Process(GetCurrentProcess(), &is_wow64
);
6705 filename
= create_test_typelib(3, L
"TYPELIB");
6707 hr
= LoadTypeLibEx(filename
, REGKIND_NONE
, &typelib
);
6708 ok(hr
== S_OK
, "got %08x\n", hr
);
6710 if (system_registration
)
6711 hr
= RegisterTypeLib(typelib
, filename
, NULL
);
6713 hr
= pRegisterTypeLibForUser(typelib
, filename
, NULL
);
6714 if (hr
== TYPE_E_REGISTRYACCESS
)
6716 win_skip("Insufficient privileges to register typelib in the registry\n");
6717 ITypeLib_Release(typelib
);
6718 DeleteFileW(filename
);
6721 ok(hr
== S_OK
, "got %08x\n", hr
);
6723 count
= ITypeLib_GetTypeInfoCount(typelib
);
6724 ok(count
== 15, "got %d\n", count
);
6726 for(i
= 0; i
< count
; i
++)
6728 ITypeInfo
*typeinfo
;
6731 hr
= ITypeLib_GetTypeInfo(typelib
, i
, &typeinfo
);
6732 ok(hr
== S_OK
, "got %08x\n", hr
);
6734 hr
= ITypeInfo_GetTypeAttr(typeinfo
, &attr
);
6735 ok(hr
== S_OK
, "got %08x\n", hr
);
6737 ok(attr
->typekind
== attrs
[i
].kind
, "%d: got kind %d\n", i
, attr
->typekind
);
6738 ok(attr
->wTypeFlags
== attrs
[i
].flags
, "%d: got flags %04x\n", i
, attr
->wTypeFlags
);
6740 if(attr
->typekind
== TKIND_DISPATCH
&& (attr
->wTypeFlags
& TYPEFLAG_FDUAL
))
6743 ITypeInfo
*dual_info
;
6744 TYPEATTR
*dual_attr
;
6746 hr
= ITypeInfo_GetRefTypeOfImplType(typeinfo
, -1, &reftype
);
6747 ok(hr
== S_OK
, "got %08x\n", hr
);
6749 hr
= ITypeInfo_GetRefTypeInfo(typeinfo
, reftype
, &dual_info
);
6750 ok(hr
== S_OK
, "got %08x\n", hr
);
6752 hr
= ITypeInfo_GetTypeAttr(dual_info
, &dual_attr
);
6753 ok(hr
== S_OK
, "got %08x\n", hr
);
6755 ok(dual_attr
->typekind
== TKIND_INTERFACE
, "%d: got kind %d\n", i
, dual_attr
->typekind
);
6756 ok(dual_attr
->wTypeFlags
== (attrs
[i
].flags
| TYPEFLAG_FOLEAUTOMATION
),
6757 "%d: got flags %04x\n", i
, dual_attr
->wTypeFlags
);
6759 ITypeInfo_ReleaseTypeAttr(dual_info
, dual_attr
);
6760 ITypeInfo_Release(dual_info
);
6764 StringFromGUID2(&attr
->guid
, uuidW
, ARRAY_SIZE(uuidW
));
6765 WideCharToMultiByte(CP_ACP
, 0, uuidW
, -1, uuid
, sizeof(uuid
), NULL
, NULL
);
6766 sprintf(key_name
, "Interface\\%s", uuid
);
6768 /* All dispinterfaces will be registered (this includes dual interfaces) as well
6769 as oleautomation interfaces */
6770 if((attr
->typekind
== TKIND_INTERFACE
&& (attr
->wTypeFlags
& TYPEFLAG_FOLEAUTOMATION
)) ||
6771 attr
->typekind
== TKIND_DISPATCH
)
6772 expect_ret
= ERROR_SUCCESS
;
6774 expect_ret
= ERROR_FILE_NOT_FOUND
;
6776 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
, &hkey
);
6777 ok(ret
== expect_ret
, "%d: got %d\n", i
, ret
);
6778 if (ret
== ERROR_SUCCESS
)
6780 size
= sizeof(uuid
);
6781 ret
= RegQueryValueA(hkey
, "ProxyStubClsid32", uuid
, &size
);
6782 ok(!ret
, "Failed to get proxy GUID, error %u.\n", ret
);
6784 if (attrs
[i
].kind
== TKIND_INTERFACE
|| (attrs
[i
].flags
& TYPEFLAG_FDUAL
))
6786 ok(!strcasecmp(uuid
, "{00020424-0000-0000-c000-000000000046}"),
6787 "Got unexpected proxy CLSID %s.\n", uuid
);
6791 ok(!strcasecmp(uuid
, "{00020420-0000-0000-c000-000000000046}"),
6792 "Got unexpected proxy CLSID %s.\n", uuid
);
6799 /* 32-bit typelibs should be registered into both registry bit modes */
6800 if (is_win64
|| is_wow64
)
6802 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
| opposite
, &hkey
);
6803 ok(ret
== expect_ret
, "%d: got %d\n", i
, ret
);
6804 if(ret
== ERROR_SUCCESS
) RegCloseKey(hkey
);
6807 ITypeInfo_ReleaseTypeAttr(typeinfo
, attr
);
6808 ITypeInfo_Release(typeinfo
);
6811 if (system_registration
)
6812 hr
= UnRegisterTypeLib(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, is_win64
? SYS_WIN64
: SYS_WIN32
);
6814 hr
= pUnRegisterTypeLibForUser(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, is_win64
? SYS_WIN64
: SYS_WIN32
);
6815 ok(hr
== S_OK
, "got %08x\n", hr
);
6817 for(i
= 0; i
< count
; i
++)
6819 ITypeInfo
*typeinfo
;
6822 hr
= ITypeLib_GetTypeInfo(typelib
, i
, &typeinfo
);
6823 ok(hr
== S_OK
, "got %08x\n", hr
);
6825 hr
= ITypeInfo_GetTypeAttr(typeinfo
, &attr
);
6826 ok(hr
== S_OK
, "got %08x\n", hr
);
6828 if((attr
->typekind
== TKIND_INTERFACE
&& (attr
->wTypeFlags
& TYPEFLAG_FOLEAUTOMATION
)) ||
6829 attr
->typekind
== TKIND_DISPATCH
)
6831 StringFromGUID2(&attr
->guid
, uuidW
, ARRAY_SIZE(uuidW
));
6832 WideCharToMultiByte(CP_ACP
, 0, uuidW
, -1, uuid
, sizeof(uuid
), NULL
, NULL
);
6833 sprintf(key_name
, "Interface\\%s", uuid
);
6835 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
, &hkey
);
6836 ok(ret
== ERROR_FILE_NOT_FOUND
, "Interface registry remains in %s (%d)\n", key_name
, i
);
6837 if (is_win64
|| is_wow64
)
6839 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
| opposite
, &hkey
);
6840 ok(ret
== ERROR_FILE_NOT_FOUND
, "Interface registry remains in %s (%d)\n", key_name
, i
);
6843 ITypeInfo_ReleaseTypeAttr(typeinfo
, attr
);
6844 ITypeInfo_Release(typeinfo
);
6847 ITypeLib_Release(typelib
);
6848 DeleteFileW(filename
);
6851 static void test_LoadTypeLib(void)
6856 static const WCHAR kernel32_dllW
[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
6858 hres
= LoadTypeLib(kernel32_dllW
, &tl
);
6859 ok(hres
== TYPE_E_CANTLOADLIBRARY
, "LoadTypeLib returned: %08x, expected TYPE_E_CANTLOADLIBRARY\n", hres
);
6861 hres
= LoadTypeLib(NULL
, NULL
);
6862 ok(hres
== E_INVALIDARG
, "Got %#x.\n", hres
);
6864 tl
= (void *)0xdeadbeef;
6865 hres
= LoadTypeLib(NULL
, &tl
);
6866 ok(hres
== E_INVALIDARG
, "Got %#x.\n", hres
);
6867 ok(tl
== (void *)0xdeadbeef, "Got %p.\n", tl
);
6869 hres
= LoadTypeLibEx(NULL
, REGKIND_NONE
, NULL
);
6870 ok(hres
== E_INVALIDARG
, "Got %#x.\n", hres
);
6872 tl
= (void *)0xdeadbeef;
6873 hres
= LoadTypeLibEx(NULL
, REGKIND_NONE
, &tl
);
6874 ok(hres
== E_INVALIDARG
, "Got %#x.\n", hres
);
6875 ok(tl
== (void *)0xdeadbeef, "Got %p.\n", tl
);
6878 static void test_SetVarHelpContext(void)
6880 static OLECHAR nameW
[] = {'n','a','m','e',0};
6881 CHAR filenameA
[MAX_PATH
];
6882 WCHAR filenameW
[MAX_PATH
];
6883 ICreateTypeLib2
*ctl
;
6884 ICreateTypeInfo
*cti
;
6887 VARDESC desc
, *pdesc
;
6892 GetTempFileNameA(".", "tlb", 0, filenameA
);
6893 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
6895 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
6896 ok(hr
== S_OK
, "got %08x\n", hr
);
6898 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_ENUM
, &cti
);
6899 ok(hr
== S_OK
, "got %08x\n", hr
);
6901 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 0, 0);
6902 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
6904 memset(&desc
, 0, sizeof(desc
));
6905 desc
.memid
= MEMBERID_NIL
;
6906 desc
.elemdescVar
.tdesc
.vt
= VT_INT
;
6907 desc
.varkind
= VAR_CONST
;
6911 U(desc
).lpvarValue
= &v
;
6912 hr
= ICreateTypeInfo_AddVarDesc(cti
, 0, &desc
);
6913 ok(hr
== S_OK
, "got %08x\n", hr
);
6915 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 0, 0);
6916 ok(hr
== S_OK
, "got %08x\n", hr
);
6919 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 0, 1);
6920 ok(hr
== S_OK
, "got %08x\n", hr
);
6922 /* wrong index now */
6923 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 1, 0);
6924 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
6926 ICreateTypeInfo_Release(cti
);
6928 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
6929 ok(hr
== S_OK
, "got: %08x\n", hr
);
6931 ICreateTypeLib2_Release(ctl
);
6933 hr
= LoadTypeLib(filenameW
, &tl
);
6934 ok(hr
== S_OK
, "got: %08x\n", hr
);
6936 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
6937 ok(hr
== S_OK
, "got %08x\n", hr
);
6939 hr
= ITypeInfo_GetVarDesc(ti
, 0, &pdesc
);
6940 ok(hr
== S_OK
, "got %08x\n", hr
);
6941 ok(pdesc
->memid
== 0x40000000, "got wrong memid: %x\n", pdesc
->memid
);
6942 ok(pdesc
->elemdescVar
.tdesc
.vt
== VT_INT
, "got wrong vardesc type: %u\n", pdesc
->elemdescVar
.tdesc
.vt
);
6943 ok(pdesc
->varkind
== VAR_CONST
, "got wrong varkind: %u\n", pdesc
->varkind
);
6944 ok(V_VT(U(*pdesc
).lpvarValue
) == VT_INT
, "got wrong value type: %u\n", V_VT(U(*pdesc
).lpvarValue
));
6945 ok(V_INT(U(*pdesc
).lpvarValue
) == 1, "got wrong value: 0x%x\n", V_INT(U(*pdesc
).lpvarValue
));
6947 hr
= ITypeInfo_GetDocumentation(ti
, pdesc
->memid
, NULL
, NULL
, &ctx
, NULL
);
6948 ok(hr
== S_OK
, "got %08x\n", hr
);
6949 ok(ctx
== 1, "got wrong help context: 0x%x\n", ctx
);
6951 ITypeInfo_ReleaseVarDesc(ti
, pdesc
);
6952 ITypeInfo_Release(ti
);
6953 ITypeLib_Release(tl
);
6955 DeleteFileA(filenameA
);
6958 static void test_SetFuncAndParamNames(void)
6960 static OLECHAR nameW
[] = {'n','a','m','e',0};
6961 static OLECHAR name2W
[] = {'n','a','m','e','2',0};
6962 static OLECHAR prop
[] = {'p','r','o','p',0};
6963 static OLECHAR
*propW
[] = {prop
};
6964 static OLECHAR func
[] = {'f','u','n','c',0};
6965 static OLECHAR
*funcW
[] = {func
, NULL
};
6966 CHAR filenameA
[MAX_PATH
];
6967 WCHAR filenameW
[MAX_PATH
];
6968 ICreateTypeLib2
*ctl
;
6969 ICreateTypeInfo
*cti
;
6971 ITypeInfo
*infos
[3];
6978 GetTempFileNameA(".", "tlb", 0, filenameA
);
6979 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
6981 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
6982 ok(hr
== S_OK
, "got %08x\n", hr
);
6984 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_DISPATCH
, &cti
);
6985 ok(hr
== S_OK
, "got %08x\n", hr
);
6988 memset(&funcdesc
, 0, sizeof(FUNCDESC
));
6989 funcdesc
.funckind
= FUNC_DISPATCH
;
6990 funcdesc
.callconv
= CC_STDCALL
;
6991 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
6992 funcdesc
.wFuncFlags
= FUNCFLAG_FBINDABLE
;
6995 memset(&edesc
, 0, sizeof(edesc
));
6996 edesc
.tdesc
.vt
= VT_BSTR
;
6997 U(edesc
).idldesc
.dwReserved
= 0;
6998 U(edesc
).idldesc
.wIDLFlags
= IDLFLAG_FIN
;
7000 funcdesc
.lprgelemdescParam
= &edesc
;
7001 funcdesc
.invkind
= INVOKE_PROPERTYPUT
;
7002 funcdesc
.cParams
= 1;
7004 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 0, &funcdesc
);
7005 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7008 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 0, propW
, 1);
7009 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7012 funcdesc
.invkind
= INVOKE_PROPERTYPUTREF
;
7013 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 1, &funcdesc
);
7014 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7017 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 1, propW
, 1);
7018 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7020 funcdesc
.invkind
= INVOKE_PROPERTYGET
;
7021 funcdesc
.cParams
= 0;
7022 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 2, &funcdesc
);
7023 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7026 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 2, propW
, 1);
7027 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7029 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 3, &funcdesc
);
7030 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7032 /* getter name again */
7033 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 3, propW
, 1);
7034 ok(hr
== TYPE_E_AMBIGUOUSNAME
, "got 0x%08x\n", hr
);
7036 /* regular function */
7037 funcdesc
.invkind
= INVOKE_FUNC
;
7038 funcdesc
.cParams
= 1;
7039 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 4, &funcdesc
);
7040 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7042 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 4, funcW
, 2);
7043 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7045 ICreateTypeInfo_Release(cti
);
7047 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, name2W
, TKIND_INTERFACE
, &cti
);
7048 ok(hr
== S_OK
, "got %08x\n", hr
);
7050 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
7051 funcdesc
.invkind
= INVOKE_FUNC
;
7052 funcdesc
.cParams
= 0;
7053 funcdesc
.lprgelemdescParam
= NULL
;
7054 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 0, &funcdesc
);
7055 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7057 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 0, funcW
, 1);
7058 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7060 ICreateTypeInfo_Release(cti
);
7062 hr
= ICreateTypeLib2_QueryInterface(ctl
, &IID_ITypeLib
, (void**)&tl
);
7063 ok(hr
== S_OK
, "got %08x\n", hr
);
7066 memset(infos
, 0, sizeof(infos
));
7067 memids
[0] = 0xdeadbeef;
7068 memids
[1] = 0xdeadbeef;
7069 memids
[2] = 0xdeadbeef;
7070 hr
= ITypeLib_FindName(tl
, func
, 0, infos
, memids
, &found
);
7071 ok(hr
== S_OK
, "got %08x\n", hr
);
7072 ok(found
== 1, "got wrong count: %u\n", found
);
7073 ok(infos
[0] && !infos
[1] && !infos
[2], "got wrong typeinfo\n");
7074 ok(memids
[0] == 0, "got wrong memid[0]\n");
7075 ok(memids
[1] == 0xdeadbeef && memids
[2] == 0xdeadbeef, "got wrong memids\n");
7076 ITypeInfo_Release(infos
[0]);
7079 memset(infos
, 0, sizeof(infos
));
7080 memids
[0] = 0xdeadbeef;
7081 memids
[1] = 0xdeadbeef;
7082 memids
[2] = 0xdeadbeef;
7083 hr
= ITypeLib_FindName(tl
, func
, 0, infos
, memids
, &found
);
7084 ok(hr
== S_OK
, "got %08x\n", hr
);
7085 ok(found
== 2, "got wrong count: %u\n", found
);
7086 ok(infos
[0] && infos
[1] && infos
[0] != infos
[1], "got same typeinfo\n");
7087 ok(memids
[0] == 0, "got wrong memid[0]\n");
7088 ok(memids
[1] == 0, "got wrong memid[1]\n");
7089 ITypeInfo_Release(infos
[0]);
7090 ITypeInfo_Release(infos
[1]);
7092 ITypeLib_Release(tl
);
7093 ICreateTypeLib2_Release(ctl
);
7094 DeleteFileA(filenameA
);
7097 static void test_SetDocString(void)
7099 static OLECHAR nameW
[] = {'n','a','m','e',0};
7100 static OLECHAR name2W
[] = {'n','a','m','e','2',0};
7101 static OLECHAR doc1W
[] = {'d','o','c','1',0};
7102 static OLECHAR doc2W
[] = {'d','o','c','2',0};
7103 static OLECHAR var_nameW
[] = {'v','a','r','n','a','m','e',0};
7104 CHAR filenameA
[MAX_PATH
];
7105 WCHAR filenameW
[MAX_PATH
];
7106 ICreateTypeLib2
*ctl
;
7107 ICreateTypeInfo
*cti
;
7110 BSTR namestr
, docstr
;
7111 VARDESC desc
, *pdesc
;
7112 FUNCDESC funcdesc
, *pfuncdesc
;
7116 GetTempFileNameA(".", "tlb", 0, filenameA
);
7117 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
7119 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
7120 ok(hr
== S_OK
, "got %08x\n", hr
);
7122 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_ENUM
, &cti
);
7123 ok(hr
== S_OK
, "got %08x\n", hr
);
7125 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, doc1W
);
7126 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
7128 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, NULL
);
7129 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
7131 memset(&desc
, 0, sizeof(desc
));
7132 desc
.memid
= MEMBERID_NIL
;
7133 desc
.elemdescVar
.tdesc
.vt
= VT_INT
;
7134 desc
.varkind
= VAR_CONST
;
7138 U(desc
).lpvarValue
= &v
;
7139 hr
= ICreateTypeInfo_AddVarDesc(cti
, 0, &desc
);
7140 ok(hr
== S_OK
, "got %08x\n", hr
);
7142 hr
= ICreateTypeInfo_SetVarName(cti
, 0, NULL
);
7143 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
7145 hr
= ICreateTypeInfo_SetVarName(cti
, 1, var_nameW
);
7146 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
7148 hr
= ICreateTypeInfo_SetVarName(cti
, 0, var_nameW
);
7149 ok(hr
== S_OK
, "got %08x\n", hr
);
7151 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, NULL
);
7152 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
7154 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, doc1W
);
7155 ok(hr
== S_OK
, "got %08x\n", hr
);
7158 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, doc2W
);
7159 ok(hr
== S_OK
, "got %08x\n", hr
);
7161 /* wrong index now */
7162 hr
= ICreateTypeInfo_SetVarDocString(cti
, 1, doc1W
);
7163 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
7165 ICreateTypeInfo_Release(cti
);
7167 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, name2W
, TKIND_INTERFACE
, &cti
);
7168 ok(hr
== S_OK
, "got %08x\n", hr
);
7170 hr
= ICreateTypeInfo_SetFuncDocString(cti
, 0, doc1W
);
7171 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
7173 hr
= ICreateTypeInfo_SetFuncDocString(cti
, 0, NULL
);
7174 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
7176 memset(&funcdesc
, 0, sizeof(funcdesc
));
7177 funcdesc
.memid
= MEMBERID_NIL
;
7178 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
7179 funcdesc
.invkind
= INVOKE_FUNC
;
7180 funcdesc
.callconv
= CC_STDCALL
;
7182 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 0, &funcdesc
);
7183 ok(hr
== S_OK
, "got %08x\n", hr
);
7185 hr
= ICreateTypeInfo_SetFuncDocString(cti
, 0, doc1W
);
7186 ok(hr
== S_OK
, "got %08x\n", hr
);
7188 ICreateTypeInfo_Release(cti
);
7190 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
7191 ok(hr
== S_OK
, "got: %08x\n", hr
);
7193 ICreateTypeLib2_Release(ctl
);
7195 hr
= LoadTypeLib(filenameW
, &tl
);
7196 ok(hr
== S_OK
, "got: %08x\n", hr
);
7198 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
7199 ok(hr
== S_OK
, "got %08x\n", hr
);
7201 hr
= ITypeInfo_GetVarDesc(ti
, 0, &pdesc
);
7202 ok(hr
== S_OK
, "got %08x\n", hr
);
7203 ok(pdesc
->memid
== 0x40000000, "got wrong memid: %x\n", pdesc
->memid
);
7204 ok(pdesc
->elemdescVar
.tdesc
.vt
== VT_INT
, "got wrong vardesc type: %u\n", pdesc
->elemdescVar
.tdesc
.vt
);
7205 ok(pdesc
->varkind
== VAR_CONST
, "got wrong varkind: %u\n", pdesc
->varkind
);
7206 ok(V_VT(U(*pdesc
).lpvarValue
) == VT_INT
, "got wrong value type: %u\n", V_VT(U(*pdesc
).lpvarValue
));
7207 ok(V_INT(U(*pdesc
).lpvarValue
) == 1, "got wrong value: 0x%x\n", V_INT(U(*pdesc
).lpvarValue
));
7209 hr
= ITypeInfo_GetDocumentation(ti
, pdesc
->memid
, &namestr
, &docstr
, NULL
, NULL
);
7210 ok(hr
== S_OK
, "got %08x\n", hr
);
7211 ok(memcmp(namestr
, var_nameW
, sizeof(var_nameW
)) == 0, "got wrong name: %s\n", wine_dbgstr_w(namestr
));
7212 ok(memcmp(docstr
, doc2W
, sizeof(doc2W
)) == 0, "got wrong docstring: %s\n", wine_dbgstr_w(docstr
));
7214 SysFreeString(namestr
);
7215 SysFreeString(docstr
);
7217 ITypeInfo_ReleaseVarDesc(ti
, pdesc
);
7218 ITypeInfo_Release(ti
);
7220 hr
= ITypeLib_GetTypeInfo(tl
, 1, &ti
);
7221 ok(hr
== S_OK
, "got %08x\n", hr
);
7223 hr
= ITypeInfo_GetFuncDesc(ti
, 0, &pfuncdesc
);
7224 ok(hr
== S_OK
, "got %08x\n", hr
);
7225 ok(pfuncdesc
->memid
== 0x60000000, "got wrong memid: %x\n", pfuncdesc
->memid
);
7226 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got wrong funckind: %x\n", pfuncdesc
->funckind
);
7227 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got wrong invkind: %x\n", pfuncdesc
->invkind
);
7228 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got wrong callconv: %x\n", pfuncdesc
->callconv
);
7230 hr
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &namestr
, &docstr
, NULL
, NULL
);
7231 ok(hr
== S_OK
, "got %08x\n", hr
);
7232 ok(namestr
== NULL
, "got wrong name: %s\n", wine_dbgstr_w(namestr
));
7233 ok(memcmp(docstr
, doc1W
, sizeof(doc1W
)) == 0, "got wrong docstring: %s\n", wine_dbgstr_w(docstr
));
7235 SysFreeString(docstr
);
7237 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
7238 ITypeInfo_Release(ti
);
7240 ITypeLib_Release(tl
);
7242 DeleteFileA(filenameA
);
7245 static void test_FindName(void)
7247 static const WCHAR invalidW
[] = {'i','n','v','a','l','i','d',0};
7255 hr
= LoadTypeLib(wszStdOle2
, &tl
);
7256 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7258 hr
= ITypeLib_FindName(tl
, NULL
, 0, NULL
, NULL
, NULL
);
7259 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
7261 lstrcpyW(buffW
, wszGUID
);
7262 hr
= ITypeLib_FindName(tl
, buffW
, 0, NULL
, NULL
, NULL
);
7263 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
7266 ti
= (void*)0xdeadbeef;
7267 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, NULL
, &c
);
7268 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
7269 ok(c
== 0, "got %d\n", c
);
7270 ok(ti
== (void*)0xdeadbeef, "got %p\n", ti
);
7273 ti
= (void*)0xdeadbeef;
7274 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, NULL
, &c
);
7275 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
7276 ok(c
== 1, "got %d\n", c
);
7277 ok(ti
== (void*)0xdeadbeef, "got %p\n", ti
);
7281 ti
= (void*)0xdeadbeef;
7282 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, &memid
, &c
);
7283 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7284 ok(memid
== MEMBERID_NIL
, "got %d\n", memid
);
7285 ok(!lstrcmpW(buffW
, wszGUID
), "got %s\n", wine_dbgstr_w(buffW
));
7286 ok(c
== 1, "got %d\n", c
);
7287 ITypeInfo_Release(ti
);
7291 lstrcpyW(buffW
, wszguid
);
7292 ti
= (void*)0xdeadbeef;
7293 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, &memid
, &c
);
7294 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7296 ok(memid
== MEMBERID_NIL
, "got %d\n", memid
);
7297 ok(!lstrcmpW(buffW
, wszGUID
), "got %s\n", wine_dbgstr_w(buffW
));
7298 ok(c
== 1, "got %d\n", c
);
7301 ITypeInfo_Release(ti
);
7305 lstrcpyW(buffW
, invalidW
);
7306 ti
= (void*)0xdeadbeef;
7307 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, &memid
, &c
);
7308 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7309 ok(memid
== MEMBERID_NIL
, "got %d\n", memid
);
7310 ok(!lstrcmpW(buffW
, invalidW
), "got %s\n", wine_dbgstr_w(buffW
));
7311 ok(c
== 0, "got %d\n", c
);
7312 ok(ti
== (void*)0xdeadbeef, "got %p\n", ti
);
7314 ITypeLib_Release(tl
);
7317 static void test_TypeInfo2_GetContainingTypeLib(void)
7319 static const WCHAR test
[] = {'t','e','s','t','.','t','l','b',0};
7320 static OLECHAR testTI
[] = {'t','e','s','t','T','y','p','e','I','n','f','o',0};
7322 ICreateTypeLib2
*ctl2
;
7323 ICreateTypeInfo
*cti
;
7329 hr
= CreateTypeLib2(SYS_WIN32
, test
, &ctl2
);
7330 ok_ole_success(hr
, CreateTypeLib2
);
7332 hr
= ICreateTypeLib2_CreateTypeInfo(ctl2
, testTI
, TKIND_DISPATCH
, &cti
);
7333 ok_ole_success(hr
, ICreateTypeLib2_CreateTypeInfo
);
7335 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo2
, (void**)&ti2
);
7336 ok_ole_success(hr
, ICreateTypeInfo2_QueryInterface
);
7340 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, &tl
, &Index
);
7341 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
7342 ok(tl
!= NULL
, "ITypeInfo2_GetContainingTypeLib returned empty TypeLib\n");
7343 ok(Index
== 0, "ITypeInfo2_GetContainingTypeLib returned Index = %u, expected 0\n", Index
);
7344 if(tl
) ITypeLib_Release(tl
);
7347 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, &tl
, NULL
);
7348 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
7349 ok(tl
!= NULL
, "ITypeInfo2_GetContainingTypeLib returned empty TypeLib\n");
7350 if(tl
) ITypeLib_Release(tl
);
7353 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, NULL
, &Index
);
7354 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
7355 ok(Index
== 0, "ITypeInfo2_GetContainingTypeLib returned Index = %u, expected 0\n", Index
);
7357 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, NULL
, NULL
);
7358 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
7360 ITypeInfo2_Release(ti2
);
7361 ICreateTypeInfo_Release(cti
);
7362 ICreateTypeLib2_Release(ctl2
);
7365 static void create_manifest_file(const char *filename
, const char *manifest
)
7370 file
= CreateFileA(filename
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
7371 FILE_ATTRIBUTE_NORMAL
, NULL
);
7372 ok(file
!= INVALID_HANDLE_VALUE
, "CreateFile failed: %u\n", GetLastError());
7373 WriteFile(file
, manifest
, strlen(manifest
), &size
, NULL
);
7377 static HANDLE
create_actctx(const char *file
)
7379 WCHAR path
[MAX_PATH
];
7383 MultiByteToWideChar(CP_ACP
, 0, file
, -1, path
, MAX_PATH
);
7384 memset(&actctx
, 0, sizeof(ACTCTXW
));
7385 actctx
.cbSize
= sizeof(ACTCTXW
);
7386 actctx
.lpSource
= path
;
7388 handle
= CreateActCtxW(&actctx
);
7389 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
7391 ok(actctx
.cbSize
== sizeof(actctx
), "actctx.cbSize=%d\n", actctx
.cbSize
);
7392 ok(actctx
.dwFlags
== 0, "actctx.dwFlags=%d\n", actctx
.dwFlags
);
7393 ok(actctx
.lpSource
== path
, "actctx.lpSource=%p\n", actctx
.lpSource
);
7394 ok(actctx
.wProcessorArchitecture
== 0, "actctx.wProcessorArchitecture=%d\n", actctx
.wProcessorArchitecture
);
7395 ok(actctx
.wLangId
== 0, "actctx.wLangId=%d\n", actctx
.wLangId
);
7396 ok(actctx
.lpAssemblyDirectory
== NULL
, "actctx.lpAssemblyDirectory=%p\n", actctx
.lpAssemblyDirectory
);
7397 ok(actctx
.lpResourceName
== NULL
, "actctx.lpResourceName=%p\n", actctx
.lpResourceName
);
7398 ok(actctx
.lpApplicationName
== NULL
, "actctx.lpApplicationName=%p\n",
7399 actctx
.lpApplicationName
);
7400 ok(actctx
.hModule
== NULL
, "actctx.hModule=%p\n", actctx
.hModule
);
7405 static const char manifest_dep
[] =
7406 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
7407 "<assemblyIdentity version=\"1.2.3.4\" name=\"testdep\" type=\"win32\" processorArchitecture=\"" ARCH
"\"/>"
7408 "<file name=\"test_actctx_tlb.tlb\">"
7409 " <typelib tlbid=\"{d96d8a3e-78b6-4c8d-8f27-059db959be8a}\" version=\"2.7\" helpdir=\"\" resourceid=\"409\""
7410 " flags=\"Restricted,cONTROL\""
7413 "<file name=\"test_actctx_tlb2.tlb\">"
7414 " <typelib tlbid=\"{a2cfdbd3-2bbf-4b1c-a414-5a5904e634c9}\" version=\"2.0\" helpdir=\"\" resourceid=\"409\""
7415 " flags=\"RESTRICTED,CONTROL\""
7420 static const char manifest_main
[] =
7421 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
7422 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\" />"
7424 " <dependentAssembly>"
7425 " <assemblyIdentity type=\"win32\" name=\"testdep\" version=\"1.2.3.4\" processorArchitecture=\"" ARCH
"\" />"
7426 " </dependentAssembly>"
7430 static void test_LoadRegTypeLib(void)
7432 LCID lcid_en
= MAKELCID(MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_US
), SORT_DEFAULT
);
7433 LCID lcid_ru
= MAKELCID(MAKELANGID(LANG_RUSSIAN
, SUBLANG_NEUTRAL
), SORT_DEFAULT
);
7442 create_manifest_file("testdep.manifest", manifest_dep
);
7443 create_manifest_file("main.manifest", manifest_main
);
7445 handle
= create_actctx("main.manifest");
7446 DeleteFileA("testdep.manifest");
7447 DeleteFileA("main.manifest");
7449 /* create typelib file */
7450 write_typelib(1, L
"test_actctx_tlb.tlb", L
"TYPELIB");
7451 write_typelib(3, L
"test_actctx_tlb2.tlb", L
"TYPELIB");
7453 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 1, 0, LOCALE_NEUTRAL
, &tl
);
7454 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
7456 hr
= LoadRegTypeLib(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, &tl
);
7457 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
7459 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, LOCALE_NEUTRAL
, &path
);
7460 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
7462 ret
= ActivateActCtx(handle
, &cookie
);
7463 ok(ret
, "ActivateActCtx failed: %u\n", GetLastError());
7466 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, LOCALE_NEUTRAL
, &path
);
7467 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7468 SysFreeString(path
);
7471 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_en
, &path
);
7472 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7473 SysFreeString(path
);
7476 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_ru
, &path
);
7477 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7478 SysFreeString(path
);
7480 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 8, LOCALE_NEUTRAL
, &path
);
7481 ok(hr
== TYPE_E_LIBNOTREGISTERED
|| broken(hr
== S_OK
) /* winxp */, "got 0x%08x\n", hr
);
7484 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 7, LOCALE_NEUTRAL
, &path
);
7485 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7486 SysFreeString(path
);
7489 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 1, 0, LOCALE_NEUTRAL
, &path
);
7490 ok(hr
== TYPE_E_LIBNOTREGISTERED
|| broken(hr
== S_OK
) /* winxp */, "got 0x%08x\n", hr
);
7491 SysFreeString(path
);
7494 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 0xffff, 0xffff, LOCALE_NEUTRAL
, &path
);
7495 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7496 SysFreeString(path
);
7498 /* manifest version is 2.0, actual is 1.0 */
7499 hr
= LoadRegTypeLib(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, &tl
);
7500 ok(hr
== TYPE_E_LIBNOTREGISTERED
|| broken(hr
== S_OK
) /* winxp */, "got 0x%08x\n", hr
);
7501 if (hr
== S_OK
) ITypeLib_Release(tl
);
7503 hr
= LoadRegTypeLib(&LIBID_register_test
, 2, 0, LOCALE_NEUTRAL
, &tl
);
7504 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
7506 /* manifest version is 2.7, actual is 2.5 */
7507 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 0, LOCALE_NEUTRAL
, &tl
);
7508 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7509 if (hr
== S_OK
) ITypeLib_Release(tl
);
7511 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 1, LOCALE_NEUTRAL
, &tl
);
7512 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7513 if (hr
== S_OK
) ITypeLib_Release(tl
);
7515 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_en
, &tl
);
7516 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7517 if (hr
== S_OK
) ITypeLib_Release(tl
);
7519 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_ru
, &tl
);
7520 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7521 if (hr
== S_OK
) ITypeLib_Release(tl
);
7523 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 7, LOCALE_NEUTRAL
, &tl
);
7524 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
7526 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 5, LOCALE_NEUTRAL
, &tl
);
7527 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7529 hr
= ITypeLib_GetLibAttr(tl
, &attr
);
7530 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7532 ok(attr
->lcid
== 0, "got %x\n", attr
->lcid
);
7533 ok(attr
->wMajorVerNum
== 2, "got %d\n", attr
->wMajorVerNum
);
7534 ok(attr
->wMinorVerNum
== 5, "got %d\n", attr
->wMinorVerNum
);
7535 ok(attr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "got %x\n", attr
->wLibFlags
);
7537 ITypeLib_ReleaseTLibAttr(tl
, attr
);
7538 ITypeLib_Release(tl
);
7540 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 1, 7, LOCALE_NEUTRAL
, &tl
);
7541 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
7544 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 0xffff, 0xffff, LOCALE_NEUTRAL
, &tl
);
7545 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7549 hr
= ITypeLib_GetLibAttr(tl
, &attr
);
7550 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7552 ok(attr
->lcid
== 0, "got %x\n", attr
->lcid
);
7553 ok(attr
->wMajorVerNum
== 2, "got %d\n", attr
->wMajorVerNum
);
7554 ok(attr
->wMinorVerNum
== 5, "got %d\n", attr
->wMinorVerNum
);
7555 ok(attr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "got %x\n", attr
->wLibFlags
);
7557 ITypeLib_ReleaseTLibAttr(tl
, attr
);
7558 ITypeLib_Release(tl
);
7561 DeleteFileA("test_actctx_tlb.tlb");
7562 DeleteFileA("test_actctx_tlb2.tlb");
7564 ret
= DeactivateActCtx(0, cookie
);
7565 ok(ret
, "DeactivateActCtx failed: %u\n", GetLastError());
7567 ReleaseActCtx(handle
);
7573 static struct _TDATest
{
7575 ULONG size
; /* -1 == typelib ptr size */
7577 WORD align3264
; /* for 32-bit typelibs loaded in 64-bit mode */
7587 { VT_DATE
, 8, 4, 8 },
7588 { VT_BSTR
, -1, 4, 8 },
7589 { VT_DISPATCH
, -1, 4, 8 },
7590 { VT_ERROR
, 4, 4, 4 },
7591 { VT_BOOL
, 2, 2, 2 },
7592 { VT_VARIANT
, 0 /* see code below */, 4, 8 },
7593 { VT_UNKNOWN
, -1, 4, 8 },
7594 { VT_DECIMAL
, 16, 4, 8 },
7596 { VT_UI1
, 1, 1, 1 },
7597 { VT_UI2
, 2, 2, 2 },
7598 { VT_UI4
, 4, 4, 4 },
7600 { VT_UI8
, 8, 4, 8 },
7601 { VT_INT
, 4, 4, 4 },
7602 { VT_UINT
, 4, 4, 4 },
7603 { VT_VOID
, 0, 0, 0 },
7604 { VT_HRESULT
, 4, 4, 4 },
7605 { VT_PTR
, -1, 4, 8, AUX_TDESC
, { { 0 }, VT_INT
} },
7606 { VT_SAFEARRAY
, -1, 4, 8, AUX_TDESC
, { { 0 }, VT_INT
} },
7607 { VT_CARRAY
, 16 /* == 4 * sizeof(int) */, 4, 4, AUX_ADESC
, { { 0 } }, { { { 0 }, VT_INT
}, 1, { { 4, 0 } } } },
7608 { VT_USERDEFINED
, 0, 0, 0, AUX_HREF
},
7609 { VT_LPSTR
, -1, 4, 8 },
7610 { VT_LPWSTR
, -1, 4, 8 },
7614 static void testTDA(ITypeLib
*tl
, struct _TDATest
*TDATest
,
7615 ULONG ptr_size
, HREFTYPE hreftype
, ULONG href_cbSizeInstance
,
7616 WORD href_cbAlignment
, BOOL create
)
7621 ICreateTypeInfo
*cti
;
7622 ICreateTypeLib2
*ctl
;
7628 static const WCHAR name_fmtW
[] = {'a','l','i','a','s','%','0','2','u',0};
7630 wsprintfW(nameW
, name_fmtW
, TDATest
->vt
);
7633 hr
= ITypeLib_QueryInterface(tl
, &IID_ICreateTypeLib2
, (void**)&ctl
);
7634 ok(hr
== S_OK
, "got %08x\n", hr
);
7636 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_ALIAS
, &cti
);
7637 ok(hr
== S_OK
, "got %08x\n", hr
);
7639 tdesc
.vt
= TDATest
->vt
;
7640 if(TDATest
->aux
== AUX_TDESC
)
7641 U(tdesc
).lptdesc
= &TDATest
->tdesc
;
7642 else if(TDATest
->aux
== AUX_ADESC
)
7643 U(tdesc
).lpadesc
= &TDATest
->adesc
;
7644 else if(TDATest
->aux
== AUX_HREF
)
7645 U(tdesc
).hreftype
= hreftype
;
7647 hr
= ICreateTypeInfo_SetTypeDescAlias(cti
, &tdesc
);
7648 ok(hr
== S_OK
, "for VT %u, got %08x\n", TDATest
->vt
, hr
);
7650 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo
, (void**)&ti
);
7651 ok(hr
== S_OK
, "got %08x\n", hr
);
7653 ICreateTypeInfo_Release(cti
);
7654 ICreateTypeLib2_Release(ctl
);
7659 hr
= ITypeLib_FindName(tl
, nameW
, 0, &ti
, &memid
, &found
);
7660 ok(hr
== S_OK
, "for VT %u, got %08x\n", TDATest
->vt
, hr
);
7663 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
7664 ok(hr
== S_OK
, "got %08x\n", hr
);
7666 if(TDATest
->aux
== AUX_HREF
){
7667 size
= href_cbSizeInstance
;
7668 alignment
= href_cbAlignment
;
7670 size
= TDATest
->size
;
7675 size
= sizeof(void*);
7676 }else if(TDATest
->vt
== VT_VARIANT
){
7678 size
= sizeof(VARIANT
);
7680 if(ptr_size
!= sizeof(void*))
7681 size
-= 8; /* 32-bit variant is 4 bytes smaller than 64-bit variant */
7684 size
= sizeof(VARIANT
);
7686 alignment
= TDATest
->align
;
7688 if(!create
&& ptr_size
!= sizeof(void*))
7689 alignment
= TDATest
->align3264
;
7693 ok(typeattr
->cbSizeInstance
== size
, "got wrong size for VT %u: 0x%x\n", TDATest
->vt
, typeattr
->cbSizeInstance
);
7694 ok(typeattr
->cbAlignment
== alignment
, "got wrong alignment for VT %u: 0x%x\n", TDATest
->vt
, typeattr
->cbAlignment
);
7695 ok(typeattr
->tdescAlias
.vt
== TDATest
->vt
, "got wrong VT for VT %u: 0x%x\n", TDATest
->vt
, typeattr
->tdescAlias
.vt
);
7697 switch(TDATest
->aux
){
7699 ok(U(typeattr
->tdescAlias
).hreftype
== hreftype
, "got wrong hreftype for VT %u: 0x%x\n", TDATest
->vt
, U(typeattr
->tdescAlias
).hreftype
);
7702 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
);
7705 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
);
7706 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
);
7707 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
);
7708 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
);
7712 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
7713 ITypeInfo_Release(ti
);
7716 static void test_SetTypeDescAlias(SYSKIND kind
)
7718 CHAR filenameA
[MAX_PATH
];
7719 WCHAR filenameW
[MAX_PATH
];
7721 ICreateTypeLib2
*ctl
;
7723 ICreateTypeInfo
*cti
;
7726 ULONG href_cbSizeInstance
, i
;
7727 WORD href_cbAlignment
, ptr_size
;
7730 static OLECHAR interfaceW
[] = {'i','n','t','e','r','f','a','c','e',0};
7734 trace("testing SYS_WIN32\n");
7738 trace("testing SYS_WIN64\n");
7745 GetTempFileNameA(".", "tlb", 0, filenameA
);
7746 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
7748 hr
= CreateTypeLib2(kind
, filenameW
, &ctl
);
7749 ok(hr
== S_OK
, "got %08x\n", hr
);
7751 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, interfaceW
, TKIND_INTERFACE
, &cti
);
7752 ok(hr
== S_OK
, "got %08x\n", hr
);
7754 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo
, (void**)&ti
);
7755 ok(hr
== S_OK
, "got %08x\n", hr
);
7757 hr
= ICreateTypeInfo_AddRefTypeInfo(cti
, ti
, &hreftype
);
7758 ok(hr
== S_OK
, "got %08x\n", hr
);
7760 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
7761 ok(hr
== S_OK
, "got %08x\n", hr
);
7763 href_cbSizeInstance
= typeattr
->cbSizeInstance
;
7764 href_cbAlignment
= typeattr
->cbAlignment
;
7766 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
7768 ITypeInfo_Release(ti
);
7769 ICreateTypeInfo_Release(cti
);
7771 hr
= ICreateTypeLib2_QueryInterface(ctl
, &IID_ITypeLib
, (void**)&tl
);
7772 ok(hr
== S_OK
, "got %08x\n", hr
);
7774 for(i
= 0; TDATests
[i
].vt
; ++i
)
7775 testTDA(tl
, &TDATests
[i
], ptr_size
, hreftype
, href_cbSizeInstance
, href_cbAlignment
, TRUE
);
7777 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
7778 ok(hr
== S_OK
, "got %08x\n", hr
);
7780 ITypeLib_Release(tl
);
7781 ok(0 == ICreateTypeLib2_Release(ctl
), "typelib should have been released\n");
7783 trace("after save...\n");
7785 hr
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &tl
);
7786 ok(hr
== S_OK
, "got %08x\n", hr
);
7788 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
7789 ok(hr
== S_OK
, "got %08x\n", hr
);
7791 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
7792 ok(hr
== S_OK
, "got %08x\n", hr
);
7794 href_cbSizeInstance
= typeattr
->cbSizeInstance
;
7795 href_cbAlignment
= typeattr
->cbAlignment
;
7797 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
7798 ITypeInfo_Release(ti
);
7800 for(i
= 0; TDATests
[i
].vt
; ++i
)
7801 testTDA(tl
, &TDATests
[i
], ptr_size
, hreftype
, href_cbSizeInstance
, href_cbAlignment
, FALSE
);
7803 ok(0 == ITypeLib_Release(tl
), "typelib should have been released\n");
7805 DeleteFileA(filenameA
);
7808 static void test_GetLibAttr(void)
7815 hr
= LoadTypeLib(wszStdOle2
, &tl
);
7816 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7818 ref1
= ITypeLib_AddRef(tl
);
7819 ITypeLib_Release(tl
);
7821 hr
= ITypeLib_GetLibAttr(tl
, &attr
);
7822 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
7824 ref2
= ITypeLib_AddRef(tl
);
7825 ITypeLib_Release(tl
);
7826 ok(ref2
== ref1
, "got %d, %d\n", ref2
, ref1
);
7828 ITypeLib_ReleaseTLibAttr(tl
, attr
);
7829 ITypeLib_Release(tl
);
7832 static HRESULT WINAPI
uk_QueryInterface(IUnknown
*obj
, REFIID iid
, void **out
)
7834 return E_NOINTERFACE
;
7837 static ULONG WINAPI
uk_AddRef(IUnknown
*obj
)
7842 static ULONG WINAPI
uk_Release(IUnknown
*obj
)
7853 IUnknown uk
= {&vt
};
7855 static void test_stub(void)
7857 BOOL is_wow64
= FALSE
;
7861 ICreateTypeLib2
*ctl
;
7862 ICreateTypeInfo
*cti
;
7864 ITypeInfo
*unk
, *ti
;
7866 char filenameA
[MAX_PATH
];
7867 WCHAR filenameW
[MAX_PATH
];
7870 static const GUID libguid
= {0x3b9ff02e,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
7871 static const GUID interfaceguid
= {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
7872 static const GUID coclassguid
= {0x3b9ff030,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
7873 static OLECHAR interfaceW
[] = {'i','n','t','e','r','f','a','c','e',0};
7874 static OLECHAR classW
[] = {'c','l','a','s','s',0};
7875 static DWORD sam_list32
[] = { 0, ~0 };
7876 static DWORD sam_list64
[] = { 0, KEY_WOW64_32KEY
, KEY_WOW64_64KEY
, ~0 };
7878 if (pIsWow64Process
)
7879 pIsWow64Process(GetCurrentProcess(), &is_wow64
);
7880 if (is_wow64
|| is_win64
)
7881 sam_list
= sam_list64
;
7883 sam_list
= sam_list32
;
7885 CoInitializeEx(NULL
, COINIT_APARTMENTTHREADED
);
7887 hr
= LoadTypeLib(wszStdOle2
, &stdole
);
7888 ok(hr
== S_OK
, "got %08x\n", hr
);
7890 hr
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IUnknown
, &unk
);
7891 ok(hr
== S_OK
, "got %08x\n", hr
);
7893 GetTempFileNameA(".", "tlb", 0, filenameA
);
7894 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
7896 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
7897 ok(hr
== S_OK
, "got %08x\n", hr
);
7899 hr
= ICreateTypeLib2_SetGuid(ctl
, &libguid
);
7900 ok(hr
== S_OK
, "got %08x\n", hr
);
7902 hr
= ICreateTypeLib2_SetLcid(ctl
, LOCALE_NEUTRAL
);
7903 ok(hr
== S_OK
, "got %08x\n", hr
);
7905 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, interfaceW
, TKIND_INTERFACE
, &cti
);
7906 ok(hr
== S_OK
, "got %08x\n", hr
);
7908 hr
= ICreateTypeInfo_SetGuid(cti
, &interfaceguid
);
7909 ok(hr
== S_OK
, "got %08x\n", hr
);
7911 hr
= ICreateTypeInfo_SetTypeFlags(cti
, TYPEFLAG_FOLEAUTOMATION
);
7912 ok(hr
== S_OK
, "got %08x\n", hr
);
7914 hr
= ICreateTypeInfo_AddRefTypeInfo(cti
, unk
, &href
);
7915 ok(hr
== S_OK
, "got %08x\n", hr
);
7917 hr
= ICreateTypeInfo_AddImplType(cti
, 0, href
);
7918 ok(hr
== S_OK
, "got %08x\n", hr
);
7920 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo
, (void**)&ti
);
7921 ok(hr
== S_OK
, "got %08x\n", hr
);
7923 ICreateTypeInfo_Release(cti
);
7924 ITypeInfo_Release(unk
);
7925 ITypeLib_Release(stdole
);
7927 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, classW
, TKIND_COCLASS
, &cti
);
7928 ok(hr
== S_OK
, "got %08x\n", hr
);
7930 hr
= ICreateTypeInfo_SetGuid(cti
, &coclassguid
);
7931 ok(hr
== S_OK
, "got %08x\n", hr
);
7933 hr
= ICreateTypeInfo_AddRefTypeInfo(cti
, ti
, &href
);
7934 ok(hr
== S_OK
, "got %08x\n", hr
);
7936 hr
= ICreateTypeInfo_AddImplType(cti
, 0, href
);
7937 ok(hr
== S_OK
, "got %08x\n", hr
);
7939 ITypeInfo_Release(ti
);
7940 ICreateTypeInfo_Release(cti
);
7942 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
7943 ok(hr
== S_OK
, "got %08x\n", hr
);
7945 hr
= ICreateTypeLib2_QueryInterface(ctl
, &IID_ITypeLib
, (void**)&tl
);
7946 ok(hr
== S_OK
, "got %08x\n", hr
);
7948 for (i
= 0; sam_list
[i
] != ~0; i
++)
7950 IPSFactoryBuffer
*factory
;
7951 IRpcStubBuffer
*base_stub
;
7952 REGSAM side
= sam_list
[i
];
7957 hr
= RegisterTypeLib(tl
, filenameW
, NULL
);
7958 if (hr
== TYPE_E_REGISTRYACCESS
)
7960 win_skip("Insufficient privileges to register typelib in the registry\n");
7963 ok(hr
== S_OK
, "got %08x, side: %04x\n", hr
, side
);
7965 /* SYS_WIN32 typelibs should be registered only as 32-bit */
7966 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "TypeLib\\{3b9ff02e-9675-4861-b781-ceaea4782acc}\\0.0\\0\\win64", 0, KEY_READ
| side
, &hkey
);
7967 ok(lr
== ERROR_FILE_NOT_FOUND
, "got wrong return code: %u, side: %04x\n", lr
, side
);
7969 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "TypeLib\\{3b9ff02e-9675-4861-b781-ceaea4782acc}\\0.0\\0\\win32", 0, KEY_READ
| side
, &hkey
);
7970 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
7973 /* Simulate pre-win7 installers that create interface key on one side */
7977 REGSAM opposite
= side
^ (KEY_WOW64_64KEY
| KEY_WOW64_32KEY
);
7979 StringFromGUID2(&interfaceguid
, guidW
, ARRAY_SIZE(guidW
));
7981 /* Delete the opposite interface key */
7982 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "Interface", 0, KEY_READ
| opposite
, &hkey
);
7983 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
7984 lr
= myRegDeleteTreeW(hkey
, guidW
, opposite
);
7985 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
7988 /* Is our side interface key affected by above operation? */
7989 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "Interface\\{3b9ff02f-9675-4861-b781-ceaea4782acc}", 0, KEY_READ
| side
, &hkey
);
7990 ok(lr
== ERROR_SUCCESS
|| broken(lr
== ERROR_FILE_NOT_FOUND
), "got wrong return code: %u, side: %04x\n", lr
, side
);
7991 if (lr
== ERROR_FILE_NOT_FOUND
)
7993 /* win2k3, vista, 2008 */
7994 win_skip("Registry reflection is enabled on this platform.\n");
7999 /* Opposite side typelib key still exists */
8000 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "TypeLib\\{3b9ff02e-9675-4861-b781-ceaea4782acc}\\0.0\\0\\win32", 0, KEY_READ
| opposite
, &hkey
);
8001 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
8005 hr
= CoGetPSClsid(&interfaceguid
, &clsid
);
8006 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
8008 hr
= CoGetClassObject(&clsid
, CLSCTX_INPROC_SERVER
, NULL
,
8009 &IID_IPSFactoryBuffer
, (void **)&factory
);
8010 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
8012 hr
= IPSFactoryBuffer_CreateStub(factory
, &interfaceguid
, &uk
, &base_stub
);
8013 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
8014 IRpcStubBuffer_Release(base_stub
);
8016 IPSFactoryBuffer_Release(factory
);
8018 hr
= UnRegisterTypeLib(&libguid
, 0, 0, 0, SYS_WIN32
);
8019 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
8022 ITypeLib_Release(tl
);
8023 ok(0 == ICreateTypeLib2_Release(ctl
), "Typelib still has references\n");
8025 DeleteFileW(filenameW
);
8030 static void test_dep(void) {
8032 const WCHAR
*refFilename
;
8034 ITypeInfo
*preftInfo
;
8035 char filename
[MAX_PATH
];
8036 WCHAR filenameW
[MAX_PATH
];
8037 ICreateTypeLib2
*pctLib
;
8038 ICreateTypeInfo
*pctInfo
;
8041 ITypeInfo
*ptInfoExt
= NULL
;
8044 static WCHAR ifacenameW
[] = {'I','T','e','s','t','D','e','p',0};
8046 static const GUID libguid
= {0xe0228f26,0x2946,0x478c,{0xb6,0x4a,0x93,0xfe,0xef,0xa5,0x05,0x32}};
8047 static const GUID ifaceguid
= {0x394376dd,0x3bb8,0x4804,{0x8c,0xcc,0x95,0x59,0x43,0x40,0x04,0xf3}};
8049 trace("Starting typelib dependency tests\n");
8051 refFilename
= create_test_typelib(4, L
"TL");
8052 hr
= LoadTypeLibEx(refFilename
, REGKIND_NONE
, &preftLib
);
8053 ok(hr
== S_OK
, "got %08x\n", hr
);
8055 hr
= ITypeLib_GetTypeInfoOfGuid(preftLib
, &IID_IBaseIface
, &preftInfo
);
8056 ok(hr
== S_OK
, "got %08x\n", hr
);
8058 GetTempFileNameA(".", "tlb", 0, filename
);
8059 MultiByteToWideChar(CP_ACP
, 0, filename
, -1, filenameW
, MAX_PATH
);
8061 if(sizeof(void*) == 8) {
8062 hr
= CreateTypeLib2(SYS_WIN64
, filenameW
, &pctLib
);
8063 ok(hr
== S_OK
, "got %08x\n", hr
);
8065 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &pctLib
);
8066 ok(hr
== S_OK
, "got %08x\n", hr
);
8069 hr
= ICreateTypeLib2_SetGuid(pctLib
, &libguid
);
8070 ok(hr
== S_OK
, "got %08x\n", hr
);
8072 hr
= ICreateTypeLib2_SetLcid(pctLib
, LOCALE_NEUTRAL
);
8073 ok(hr
== S_OK
, "got %08x\n", hr
);
8075 hr
= ICreateTypeLib2_CreateTypeInfo(pctLib
, ifacenameW
, TKIND_INTERFACE
, &pctInfo
);
8076 ok(hr
== S_OK
, "got %08x\n", hr
);
8078 hr
= ICreateTypeInfo_SetGuid(pctInfo
, &ifaceguid
);
8079 ok(hr
== S_OK
, "got %08x\n", hr
);
8081 hr
= ICreateTypeInfo_SetTypeFlags(pctInfo
, TYPEFLAG_FOLEAUTOMATION
);
8082 ok(hr
== S_OK
, "got %08x\n", hr
);
8084 hr
= ICreateTypeInfo_AddRefTypeInfo(pctInfo
, preftInfo
, &refType
);
8085 ok(hr
== S_OK
, "got %08x\n", hr
);
8087 hr
= ICreateTypeInfo_AddImplType(pctInfo
, 0, refType
);
8088 ok(hr
== S_OK
, "got %08x\n", hr
);
8090 ICreateTypeInfo_Release(pctInfo
);
8092 hr
= ICreateTypeLib2_SaveAllChanges(pctLib
);
8093 ok(hr
== S_OK
, "got %08x\n", hr
);
8095 ICreateTypeLib2_Release(pctLib
);
8097 ITypeInfo_Release(preftInfo
);
8098 ITypeLib_Release(preftLib
);
8099 DeleteFileW(refFilename
);
8101 hr
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &ptLib
);
8102 ok(hr
== S_OK
, "got: %x\n", hr
);
8104 hr
= ITypeLib_GetTypeInfoOfGuid(ptLib
, &ifaceguid
, &ptInfo
);
8105 ok(hr
== S_OK
, "got: %x\n", hr
);
8107 hr
= ITypeInfo_GetRefTypeOfImplType(ptInfo
, 0, &refType
);
8108 ok(hr
== S_OK
, "got: %x\n", hr
);
8110 hr
= ITypeInfo_GetRefTypeInfo(ptInfo
, refType
, &ptInfoExt
);
8111 ok(hr
== TYPE_E_CANTLOADLIBRARY
, "got: %x\n", hr
);
8113 ITypeInfo_Release(ptInfo
);
8115 ITypeInfo_Release(ptInfoExt
);
8116 ITypeLib_Release(ptLib
);
8118 hr
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &ptLib
);
8119 ok(hr
== S_OK
, "got %08x\n", hr
);
8121 hr
= ITypeLib_GetTypeInfo(ptLib
, 0, &ptInfo
);
8122 ok(hr
== S_OK
, "GetTypeInfo failed: %08x\n", hr
);
8124 hr
= ITypeInfo_GetRefTypeOfImplType(ptInfo
, 0, &refType
);
8125 ok(hr
== S_OK
, "GetRefTypeOfImplType failed: %08x\n", hr
);
8127 hr
= ITypeInfo_GetRefTypeInfo(ptInfo
, refType
, &ptInfoExt
);
8128 ok(hr
== TYPE_E_CANTLOADLIBRARY
, "got: %x\n", hr
);
8130 refFilename
= create_test_typelib(4, L
"TL");
8131 hr
= LoadTypeLibEx(refFilename
, REGKIND_NONE
, &preftLib
);
8132 ok(hr
== S_OK
, "got %08x\n", hr
);
8134 hr
= ITypeInfo_GetRefTypeInfo(ptInfo
, refType
, &ptInfoExt
);
8135 ok(hr
== S_OK
, "got: %x\n", hr
);
8136 ITypeInfo_Release(ptInfoExt
);
8138 ITypeLib_Release(preftLib
);
8139 DeleteFileW(refFilename
);
8141 ITypeInfo_Release(ptInfo
);
8142 ITypeLib_Release(ptLib
);
8144 DeleteFileW(filenameW
);
8147 static void test_DeleteImplType(void)
8149 static OLECHAR interface1W
[] = L
"interface1";
8150 HREFTYPE hreftype
, hreftype2
;
8151 ICreateTypeInfo2
*createti2
;
8152 ICreateTypeInfo
*createti
;
8153 ICreateTypeLib2
*createtl
;
8154 WCHAR filenameW
[MAX_PATH
];
8155 ITypeInfo
*dispti
, *ti
;
8156 ITypeLib
*stdole
, *tl
;
8161 hr
= LoadTypeLib(L
"stdole2.tlb", &stdole
);
8162 ok(hr
== S_OK
, "Failed to load stdole2, hr %#x.\n", hr
);
8164 hr
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IDispatch
, &dispti
);
8165 ok(hr
== S_OK
, "Failed to get IDispatch typeinfo, hr %#x.\n", hr
);
8167 GetTempFileNameW(L
".", L
"tlb", 0, filenameW
);
8169 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &createtl
);
8170 ok(hr
== S_OK
, "Failed to create instance, hr %#x.\n", hr
);
8172 hr
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, &createti
);
8173 ok(hr
== S_OK
, "Failed to create instance, hr %#x.\n", hr
);
8174 hr
= ICreateTypeInfo_QueryInterface(createti
, &IID_ICreateTypeInfo2
, (void **)&createti2
);
8175 ok(hr
== S_OK
, "Failed to get interface, hr %#x.\n", hr
);
8176 ICreateTypeInfo_Release(createti
);
8178 hr
= ICreateTypeInfo2_AddRefTypeInfo(createti2
, dispti
, &hreftype
);
8179 ok(hr
== S_OK
, "Failed to add referenced typeinfo, hr %#x.\n", hr
);
8181 hr
= ICreateTypeInfo2_QueryInterface(createti2
, &IID_ITypeInfo
, (void **)&ti
);
8182 ok(hr
== S_OK
, "Failed to get interface, hr %#x.\n", hr
);
8184 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
8185 ok(hr
== S_OK
, "Failed to get type attr, hr %#x.\n", hr
);
8186 ok(!(typeattr
->wTypeFlags
& TYPEFLAG_FDISPATCHABLE
), "Unexpected type flags %#x.\n", typeattr
->wTypeFlags
);
8187 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
8189 hr
= ICreateTypeInfo2_AddImplType(createti2
, 0, hreftype
);
8190 ok(hr
== S_OK
, "Failed to add impl type, hr %#x.\n", hr
);
8192 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
8193 ok(hr
== S_OK
, "Failed to get type attr, hr %#x.\n", hr
);
8194 ok(typeattr
->wTypeFlags
& TYPEFLAG_FDISPATCHABLE
, "Unexpected type flags %#x.\n", typeattr
->wTypeFlags
);
8195 ok(typeattr
->cImplTypes
== 1, "Unexpected cImplTypes value.\n");
8196 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
8198 /* Delete impltype, check flags. */
8199 hr
= ICreateTypeInfo2_DeleteImplType(createti2
, 0);
8200 ok(hr
== S_OK
, "Failed to delete impl type, hr %#x.\n", hr
);
8202 hr
= ICreateTypeInfo2_DeleteImplType(createti2
, 0);
8203 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "Unexpected hr %#x.\n", hr
);
8205 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
8206 ok(hr
== S_OK
, "Failed to get type attr, hr %#x.\n", hr
);
8207 ok(typeattr
->wTypeFlags
& TYPEFLAG_FDISPATCHABLE
, "Unexpected type flags %#x.\n", typeattr
->wTypeFlags
);
8208 ok(!typeattr
->cImplTypes
, "Unexpected cImplTypes value.\n");
8209 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
8211 hr
= ITypeInfo_GetImplTypeFlags(ti
, 0, &flags
);
8212 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "Unexpected hr %#x.\n", hr
);
8214 hr
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype2
);
8215 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "Unexpected hr %#x.\n", hr
);
8217 hr
= ICreateTypeLib2_SaveAllChanges(createtl
);
8218 ok(hr
== S_OK
, "Failed to save changes, hr %#x.\n", hr
);
8219 ICreateTypeLib2_Release(createtl
);
8220 ITypeInfo_Release(ti
);
8221 ICreateTypeInfo2_Release(createti2
);
8223 /* Load and check typeinfo. */
8224 hr
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &tl
);
8225 ok(hr
== S_OK
, "Failed to load typelib, hr %#x.\n", hr
);
8227 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
8228 ok(hr
== S_OK
, "Failed to get typeinfo, hr %#x.\n", hr
);
8229 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
8230 ok(hr
== S_OK
, "Failed to get type attr, hr %#x.\n", hr
);
8231 ok(typeattr
->wTypeFlags
& TYPEFLAG_FDISPATCHABLE
, "Unexpected type flags %#x.\n", typeattr
->wTypeFlags
);
8232 ok(!typeattr
->cImplTypes
, "Unexpected cImplTypes value.\n");
8233 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
8234 ITypeInfo_Release(ti
);
8236 ITypeLib_Release(tl
);
8238 ITypeLib_Release(stdole
);
8239 ITypeInfo_Release(dispti
);
8241 DeleteFileW(filenameW
);
8244 static void test_DeleteFuncDesc(void)
8246 OLECHAR interface1W
[] = L
"interface1";
8247 WCHAR filenameW
[MAX_PATH
], temp_path
[MAX_PATH
];
8248 ICreateTypeInfo2
*createti2
;
8249 ICreateTypeInfo
*createti
;
8250 ICreateTypeLib2
*createtl
;
8257 GetTempPathW(ARRAY_SIZE(temp_path
), temp_path
);
8258 GetTempFileNameW(temp_path
, L
"tlb", 0, filenameW
);
8260 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &createtl
);
8261 ok(hr
== S_OK
, "Failed to create instance, hr %#x.\n", hr
);
8263 hr
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, &createti
);
8264 ok(hr
== S_OK
, "Failed to create instance, hr %#x.\n", hr
);
8265 hr
= ICreateTypeInfo_QueryInterface(createti
, &IID_ICreateTypeInfo2
, (void **)&createti2
);
8266 ok(hr
== S_OK
, "Failed to get interface, hr %#x.\n", hr
);
8267 ICreateTypeInfo_Release(createti
);
8269 hr
= ICreateTypeInfo2_QueryInterface(createti2
, &IID_ITypeInfo
, (void **)&ti
);
8270 ok(hr
== S_OK
, "Failed to get typeinfo, hr %#x.\n", hr
);
8272 memset(&funcdesc
, 0, sizeof(FUNCDESC
));
8273 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
8274 funcdesc
.invkind
= INVOKE_PROPERTYGET
;
8275 funcdesc
.callconv
= CC_STDCALL
;
8276 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_BSTR
;
8277 U(funcdesc
.elemdescFunc
).idldesc
.wIDLFlags
= IDLFLAG_NONE
;
8279 hr
= ICreateTypeInfo2_AddFuncDesc(createti2
, 0, &funcdesc
);
8280 ok(hr
== S_OK
, "Failed to add a funcdesc, hr %#x.\n", hr
);
8282 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
8283 ok(hr
== S_OK
, "Failed to get type attr, hr %#x.\n", hr
);
8284 ok(typeattr
->cFuncs
== 1, "Unexpected cFuncs %u.\n", typeattr
->cFuncs
);
8285 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
8287 hr
= ICreateTypeInfo2_DeleteFuncDesc(createti2
, 1);
8288 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "Unexpected hr %#x.\n", hr
);
8290 hr
= ICreateTypeInfo2_DeleteFuncDesc(createti2
, 0);
8291 ok(hr
== S_OK
, "Unexpected hr %#x.\n", hr
);
8293 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
8294 ok(hr
== S_OK
, "Failed to get type attr, hr %#x.\n", hr
);
8295 ok(!typeattr
->cFuncs
, "Unexpected cFuncs %u.\n", typeattr
->cFuncs
);
8296 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
8298 hr
= ICreateTypeLib2_SaveAllChanges(createtl
);
8299 ok(hr
== S_OK
, "Failed to save changes, hr %#x.\n", hr
);
8300 ICreateTypeLib2_Release(createtl
);
8301 ITypeInfo_Release(ti
);
8302 ICreateTypeInfo2_Release(createti2
);
8304 /* Load and check typeinfo. */
8305 hr
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &tl
);
8306 ok(hr
== S_OK
, "Failed to load typelib, hr %#x.\n", hr
);
8308 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
8309 ok(hr
== S_OK
, "Failed to get typeinfo, hr %#x.\n", hr
);
8310 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
8311 ok(hr
== S_OK
, "Failed to get type attr, hr %#x.\n", hr
);
8312 ok(!typeattr
->cFuncs
, "Unexpected cFuncs value.\n");
8313 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
8314 ITypeInfo_Release(ti
);
8316 ITypeLib_Release(tl
);
8318 DeleteFileW(filenameW
);
8323 const WCHAR
*filename
;
8325 init_function_pointers();
8327 ref_count_test(wszStdOle2
);
8329 test_CreateDispTypeInfo();
8331 test_DispCallFunc();
8332 test_QueryPathOfRegTypeLib(32);
8333 if(sizeof(void*) == 8){
8334 test_QueryPathOfRegTypeLib(64);
8335 test_CreateTypeLib(SYS_WIN64
);
8336 test_SetTypeDescAlias(SYS_WIN64
);
8338 test_CreateTypeLib(SYS_WIN32
);
8339 test_SetTypeDescAlias(SYS_WIN32
);
8341 test_SetVarHelpContext();
8342 test_SetFuncAndParamNames();
8343 test_SetDocString();
8346 if ((filename
= create_test_typelib(2, L
"TYPELIB")))
8348 test_dump_typelib( filename
);
8349 DeleteFileW( filename
);
8352 test_register_typelib(TRUE
);
8353 test_register_typelib(FALSE
);
8354 test_create_typelibs();
8356 test_TypeInfo2_GetContainingTypeLib();
8357 test_LoadRegTypeLib();
8361 test_DeleteImplType();
8362 test_DeleteFuncDesc();