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>
45 #define expect_eq(expr, value, type, format) { type _ret = (expr); ok((value) == _ret, #expr " expected " format " got " format "\n", value, _ret); }
46 #define expect_int(expr, value) expect_eq(expr, (int)(value), int, "%d")
47 #define expect_hex(expr, value) expect_eq(expr, (int)(value), int, "0x%x")
48 #define expect_null(expr) expect_eq(expr, NULL, const void *, "%p")
49 #define expect_guid(expected, guid) { ok(IsEqualGUID(expected, guid), "got wrong guid %s\n", wine_dbgstr_guid(guid)); }
51 #define expect_wstr_acpval(expr, value) \
54 expect_eq(!WideCharToMultiByte(CP_ACP, 0, (expr), -1, buf, 260, NULL, NULL), 0, int, "%d"); \
55 ok(strcmp(value, buf) == 0, #expr " expected \"%s\" got \"%s\"\n", value, buf); \
58 #define ole_expect(expr, expect) { \
60 ok(r == (expect), #expr " returned %x, expected %s (%x)\n", r, #expect, expect); \
63 #define ole_check(expr) ole_expect(expr, S_OK);
65 #define ok_ole_success(hr, func) ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)
69 #elif defined __x86_64__
73 #elif defined __aarch64__
79 static HRESULT (WINAPI
*pRegisterTypeLibForUser
)(ITypeLib
*,OLECHAR
*,OLECHAR
*);
80 static HRESULT (WINAPI
*pUnRegisterTypeLibForUser
)(REFGUID
,WORD
,WORD
,LCID
,SYSKIND
);
82 static BOOL (WINAPI
*pActivateActCtx
)(HANDLE
,ULONG_PTR
*);
83 static HANDLE (WINAPI
*pCreateActCtxW
)(PCACTCTXW
);
84 static BOOL (WINAPI
*pDeactivateActCtx
)(DWORD
,ULONG_PTR
);
85 static VOID (WINAPI
*pReleaseActCtx
)(HANDLE
);
86 static BOOL (WINAPI
*pIsWow64Process
)(HANDLE
,LPBOOL
);
87 static LONG (WINAPI
*pRegDeleteKeyExW
)(HKEY
,LPCWSTR
,REGSAM
,DWORD
);
89 static const WCHAR wszStdOle2
[] = {'s','t','d','o','l','e','2','.','t','l','b',0};
90 static WCHAR wszGUID
[] = {'G','U','I','D',0};
91 static WCHAR wszguid
[] = {'g','u','i','d',0};
93 static const BOOL is_win64
= sizeof(void *) > sizeof(int);
96 static const BOOL abi_supports_stdcall
= TRUE
;
98 static const BOOL abi_supports_stdcall
= FALSE
;
101 static HRESULT WINAPI
collection_QueryInterface(ICollection
*iface
, REFIID riid
, void **ret
)
103 if (IsEqualIID(riid
, &IID_IUnknown
) ||
104 IsEqualIID(riid
, &IID_IDispatch
) ||
105 IsEqualIID(riid
, &IID_ICollection
))
111 return E_NOINTERFACE
;
114 static ULONG WINAPI
collection_AddRef(ICollection
*iface
)
119 static ULONG WINAPI
collection_Release(ICollection
*iface
)
124 static HRESULT WINAPI
collection_GetTypeInfoCount(ICollection
*iface
, UINT
*cnt
)
126 ok(0, "unexpected call\n");
131 static HRESULT WINAPI
collection_GetTypeInfo(ICollection
*iface
, UINT index
, LCID lcid
, ITypeInfo
**ti
)
133 ok(0, "unexpected call\n");
137 static HRESULT WINAPI
collection_GetIDsOfNames(ICollection
*iface
, REFIID riid
, LPOLESTR
*names
,
138 UINT cnt
, LCID lcid
, DISPID
*dispid
)
140 ok(0, "unexpected call\n");
144 static HRESULT WINAPI
collection_Invoke(ICollection
*iface
, DISPID dispid
, REFIID riid
,
145 LCID lcid
, WORD flags
, DISPPARAMS
*dispparams
, VARIANT
*res
, EXCEPINFO
*ei
, UINT
*argerr
)
147 if(dispid
!= DISPID_VALUE
) {
148 ok(0, "unexpected call\n");
152 ok(flags
== (DISPATCH_METHOD
|DISPATCH_PROPERTYGET
), "flags = %x\n", flags
);
153 ok(dispparams
!= NULL
, "dispparams == NULL\n");
154 ok(!dispparams
->rgdispidNamedArgs
, "dispparams->rgdispidNamedArgs != NULL\n");
155 ok(dispparams
->cArgs
== 1, "dispparams->cArgs = %d\n", dispparams
->cArgs
);
156 ok(!dispparams
->cNamedArgs
, "dispparams->cNamedArgs = %d\n", dispparams
->cNamedArgs
);
157 ok(V_VT(dispparams
->rgvarg
) == VT_I4
, "V_VT(dispparams->rgvarg) = %d\n", V_VT(dispparams
->rgvarg
));
158 ok(V_I4(dispparams
->rgvarg
) == 7, "V_I4(dispparams->rgvarg) = %d\n", V_I4(dispparams
->rgvarg
));
159 ok(res
!= NULL
, "res == NULL\n");
160 ok(V_VT(res
) == VT_EMPTY
, "V_VT(res) = %d\n", V_VT(res
));
167 static HRESULT WINAPI
collection_Item(ICollection
*iface
, int i
, int *p
)
169 ok(0, "unexpected call\n");
173 static const ICollectionVtbl collectionvtbl
= {
174 collection_QueryInterface
,
177 collection_GetTypeInfoCount
,
178 collection_GetTypeInfo
,
179 collection_GetIDsOfNames
,
184 static ICollection collection
= { &collectionvtbl
};
186 static HRESULT WINAPI
invoketest_QueryInterface(IInvokeTest
*iface
, REFIID riid
, void **ret
)
188 if (IsEqualIID(riid
, &IID_IUnknown
) ||
189 IsEqualIID(riid
, &IID_IDispatch
) ||
190 IsEqualIID(riid
, &IID_IInvokeTest
))
196 return E_NOINTERFACE
;
199 static ULONG WINAPI
invoketest_AddRef(IInvokeTest
*iface
)
204 static ULONG WINAPI
invoketest_Release(IInvokeTest
*iface
)
209 static HRESULT WINAPI
invoketest_GetTypeInfoCount(IInvokeTest
*iface
, UINT
*cnt
)
211 ok(0, "unexpected call\n");
216 static HRESULT WINAPI
invoketest_GetTypeInfo(IInvokeTest
*iface
, UINT index
, LCID lcid
, ITypeInfo
**ti
)
218 ok(0, "unexpected call\n");
222 static HRESULT WINAPI
invoketest_GetIDsOfNames(IInvokeTest
*iface
, REFIID riid
, LPOLESTR
*names
,
223 UINT cnt
, LCID lcid
, DISPID
*dispid
)
225 ok(0, "unexpected call\n");
229 static HRESULT WINAPI
invoketest_Invoke(IInvokeTest
*iface
, DISPID dispid
, REFIID riid
,
230 LCID lcid
, WORD flags
, DISPPARAMS
*dispparams
, VARIANT
*res
, EXCEPINFO
*ei
, UINT
*argerr
)
232 ok(0, "unexpected call\n");
236 static LONG WINAPI
invoketest_get_test(IInvokeTest
*iface
, LONG i
)
241 static LONG WINAPI
invoketest_putref_testprop(IInvokeTest
*iface
, LONG
*i
)
246 static LONG WINAPI
invoketest_putref_testprop2(IInvokeTest
*iface
, IUnknown
*i
)
251 static HRESULT WINAPI
invoketest_testfunc(IInvokeTest
*iface
, int i
, int *p
)
257 static HRESULT WINAPI
invoketest_testget(IInvokeTest
*iface
, ICollection
**p
)
260 ICollection_AddRef(&collection
);
264 static const IInvokeTestVtbl invoketestvtbl
= {
265 invoketest_QueryInterface
,
268 invoketest_GetTypeInfoCount
,
269 invoketest_GetTypeInfo
,
270 invoketest_GetIDsOfNames
,
273 invoketest_putref_testprop
,
274 invoketest_putref_testprop2
,
279 static IInvokeTest invoketest
= { &invoketestvtbl
};
281 static void init_function_pointers(void)
283 HMODULE hmod
= GetModuleHandleA("oleaut32.dll");
284 HMODULE hk32
= GetModuleHandleA("kernel32.dll");
285 HMODULE hadv
= GetModuleHandleA("advapi32.dll");
287 pRegisterTypeLibForUser
= (void *)GetProcAddress(hmod
, "RegisterTypeLibForUser");
288 pUnRegisterTypeLibForUser
= (void *)GetProcAddress(hmod
, "UnRegisterTypeLibForUser");
289 pActivateActCtx
= (void *)GetProcAddress(hk32
, "ActivateActCtx");
290 pCreateActCtxW
= (void *)GetProcAddress(hk32
, "CreateActCtxW");
291 pDeactivateActCtx
= (void *)GetProcAddress(hk32
, "DeactivateActCtx");
292 pReleaseActCtx
= (void *)GetProcAddress(hk32
, "ReleaseActCtx");
293 pIsWow64Process
= (void *)GetProcAddress(hk32
, "IsWow64Process");
294 pRegDeleteKeyExW
= (void*)GetProcAddress(hadv
, "RegDeleteKeyExW");
297 static void ref_count_test(LPCWSTR type_lib
)
300 ITypeInfo
*iti1
, *iti2
;
304 trace("Loading type library\n");
305 hRes
= LoadTypeLib(type_lib
, &iface
);
306 ok(hRes
== S_OK
, "Could not load type library\n");
310 hRes
= ITypeLib_GetTypeInfo(iface
, 1, &iti1
);
311 ok(hRes
== S_OK
, "ITypeLib_GetTypeInfo failed on index = 1\n");
312 ref_count
= ITypeLib_Release(iface
);
313 ok(ref_count
> 0, "ITypeLib destroyed while ITypeInfo has back pointer\n");
317 hRes
= ITypeLib_GetTypeInfo(iface
, 1, &iti2
);
318 ok(hRes
== S_OK
, "ITypeLib_GetTypeInfo failed on index = 1\n");
319 ok(iti1
== iti2
, "ITypeLib_GetTypeInfo returned different pointers for same indexes\n");
321 ITypeLib_AddRef(iface
);
322 ITypeInfo_Release(iti2
);
323 ITypeInfo_Release(iti1
);
324 ok(ITypeLib_Release(iface
) == 0, "ITypeLib should be destroyed here.\n");
327 static void test_TypeComp(void)
329 ITypeComp
*pTypeComp
, *tcomp
, *pTypeComp_tmp
;
330 ITypeInfo
*pTypeInfo
, *ti
, *pFontTypeInfo
;
336 static WCHAR wszStdFunctions
[] = {'S','t','d','F','u','n','c','t','i','o','n','s',0};
337 static WCHAR wszSavePicture
[] = {'S','a','v','e','P','i','c','t','u','r','e',0};
338 static WCHAR wszOLE_TRISTATE
[] = {'O','L','E','_','T','R','I','S','T','A','T','E',0};
339 static WCHAR wszUnchecked
[] = {'U','n','c','h','e','c','k','e','d',0};
340 static WCHAR wszIUnknown
[] = {'I','U','n','k','n','o','w','n',0};
341 static WCHAR wszFont
[] = {'F','o','n','t',0};
342 static WCHAR wszStdPicture
[] = {'S','t','d','P','i','c','t','u','r','e',0};
343 static WCHAR wszOLE_COLOR
[] = {'O','L','E','_','C','O','L','O','R',0};
344 static WCHAR wszClone
[] = {'C','l','o','n','e',0};
345 static WCHAR wszclone
[] = {'c','l','o','n','e',0};
346 static WCHAR wszJunk
[] = {'J','u','n','k',0};
347 static WCHAR wszAddRef
[] = {'A','d','d','R','e','f',0};
349 hr
= LoadTypeLib(wszStdOle2
, &pTypeLib
);
350 ok_ole_success(hr
, LoadTypeLib
);
352 hr
= ITypeLib_GetTypeComp(pTypeLib
, &pTypeComp
);
353 ok_ole_success(hr
, ITypeLib_GetTypeComp
);
355 /* test getting a TKIND_MODULE */
356 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszStdFunctions
);
357 hr
= ITypeComp_Bind(pTypeComp
, wszStdFunctions
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
358 ok_ole_success(hr
, ITypeComp_Bind
);
360 ok(desckind
== DESCKIND_TYPECOMP
,
361 "desckind should have been DESCKIND_TYPECOMP instead of %d\n",
363 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
365 ITypeComp_Release(bindptr
.lptcomp
);
367 /* test getting a TKIND_MODULE with INVOKE_PROPERTYGET */
368 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszStdFunctions
);
369 hr
= ITypeComp_Bind(pTypeComp
, wszStdFunctions
, ulHash
, INVOKE_PROPERTYGET
, &pTypeInfo
, &desckind
, &bindptr
);
370 ok_ole_success(hr
, ITypeComp_Bind
);
372 ok(desckind
== DESCKIND_TYPECOMP
,
373 "desckind should have been DESCKIND_TYPECOMP instead of %d\n",
375 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
376 ITypeComp_Release(bindptr
.lptcomp
);
378 /* test getting a function within a TKIND_MODULE */
379 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszSavePicture
);
380 hr
= ITypeComp_Bind(pTypeComp
, wszSavePicture
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
381 ok_ole_success(hr
, ITypeComp_Bind
);
383 ok(desckind
== DESCKIND_FUNCDESC
,
384 "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
386 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr.lpfuncdesc should not have been set to NULL\n");
387 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
388 ITypeInfo_Release(pTypeInfo
);
390 /* test getting a function within a TKIND_MODULE with INVOKE_PROPERTYGET */
391 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszSavePicture
);
392 hr
= ITypeComp_Bind(pTypeComp
, wszSavePicture
, ulHash
, INVOKE_PROPERTYGET
, &pTypeInfo
, &desckind
, &bindptr
);
393 ok(hr
== TYPE_E_TYPEMISMATCH
,
394 "ITypeComp_Bind should have failed with TYPE_E_TYPEMISMATCH instead of 0x%08x\n",
397 ok(desckind
== DESCKIND_NONE
,
398 "desckind should have been DESCKIND_NONE instead of %d\n",
400 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
401 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
403 /* test getting a TKIND_ENUM */
404 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszOLE_TRISTATE
);
405 hr
= ITypeComp_Bind(pTypeComp
, wszOLE_TRISTATE
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
406 ok_ole_success(hr
, ITypeComp_Bind
);
408 ok(desckind
== DESCKIND_TYPECOMP
,
409 "desckind should have been DESCKIND_TYPECOMP instead of %d\n",
411 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
413 ITypeComp_Release(bindptr
.lptcomp
);
415 /* test getting a value within a TKIND_ENUM */
416 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszUnchecked
);
417 hr
= ITypeComp_Bind(pTypeComp
, wszUnchecked
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
418 ok_ole_success(hr
, ITypeComp_Bind
);
420 ok(desckind
== DESCKIND_VARDESC
,
421 "desckind should have been DESCKIND_VARDESC instead of %d\n",
423 ITypeInfo_ReleaseVarDesc(pTypeInfo
, bindptr
.lpvardesc
);
424 ITypeInfo_Release(pTypeInfo
);
426 /* test getting a TKIND_INTERFACE */
427 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszIUnknown
);
428 hr
= ITypeComp_Bind(pTypeComp
, wszIUnknown
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
429 ok_ole_success(hr
, ITypeComp_Bind
);
431 ok(desckind
== DESCKIND_NONE
,
432 "desckind should have been DESCKIND_NONE instead of %d\n",
434 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
435 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
437 /* test getting a TKIND_DISPATCH */
438 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszFont
);
439 hr
= ITypeComp_Bind(pTypeComp
, wszFont
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
440 ok_ole_success(hr
, ITypeComp_Bind
);
442 ok(desckind
== DESCKIND_NONE
,
443 "desckind should have been DESCKIND_NONE instead of %d\n",
445 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
446 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
448 /* test getting a TKIND_RECORD/TKIND_ALIAS */
449 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
450 hr
= ITypeComp_Bind(pTypeComp
, wszGUID
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
451 ok_ole_success(hr
, ITypeComp_Bind
);
453 ok(desckind
== DESCKIND_NONE
,
454 "desckind should have been DESCKIND_NONE instead of %d\n",
456 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
457 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
459 /* test getting a TKIND_ALIAS */
460 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszOLE_COLOR
);
461 hr
= ITypeComp_Bind(pTypeComp
, wszOLE_COLOR
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
462 ok_ole_success(hr
, ITypeComp_Bind
);
464 ok(desckind
== DESCKIND_NONE
,
465 "desckind should have been DESCKIND_NONE instead of %d\n",
467 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
468 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
470 /* test getting a TKIND_COCLASS */
471 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszStdPicture
);
472 hr
= ITypeComp_Bind(pTypeComp
, wszStdPicture
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
473 ok_ole_success(hr
, ITypeComp_Bind
);
475 ok(desckind
== DESCKIND_NONE
,
476 "desckind should have been DESCKIND_NONE instead of %d\n",
478 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
479 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
481 /* test basic BindType argument handling */
482 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
483 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, NULL
, NULL
);
484 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
486 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
487 pTypeInfo
= (void*)0xdeadbeef;
488 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, &pTypeInfo
, NULL
);
489 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
490 ok(pTypeInfo
== (void*)0xdeadbeef, "Got %p\n", pTypeInfo
);
492 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
493 pTypeComp_tmp
= (void*)0xdeadbeef;
494 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, NULL
, &pTypeComp_tmp
);
495 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
496 ok(pTypeComp_tmp
== (void*)0xdeadbeef, "Got %p\n", pTypeComp_tmp
);
498 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
499 pTypeComp_tmp
= (void*)0xdeadbeef;
500 pTypeInfo
= (void*)0xdeadbeef;
501 hr
= ITypeComp_BindType(pTypeComp
, NULL
, ulHash
, &pTypeInfo
, &pTypeComp_tmp
);
502 ok(hr
== E_INVALIDARG
, "Got %08x\n", hr
);
503 ok(pTypeInfo
== (void*)0xdeadbeef, "Got %p\n", pTypeInfo
);
504 ok(pTypeComp_tmp
== (void*)0xdeadbeef, "Got %p\n", pTypeComp_tmp
);
506 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszGUID
);
507 pTypeComp_tmp
= (void*)0xdeadbeef;
508 pTypeInfo
= (void*)0xdeadbeef;
509 hr
= ITypeComp_BindType(pTypeComp
, wszGUID
, ulHash
, &pTypeInfo
, &pTypeComp_tmp
);
510 ok_ole_success(hr
, ITypeComp_BindType
);
511 ok(pTypeInfo
!= NULL
, "Got NULL pTypeInfo\n");
512 todo_wine
ok(pTypeComp_tmp
== NULL
, "Got pTypeComp_tmp %p\n", pTypeComp_tmp
);
513 ITypeInfo_Release(pTypeInfo
);
514 if(pTypeComp_tmp
) ITypeComp_Release(pTypeComp_tmp
); /* fixme */
516 /* test BindType case-insensitivity */
517 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszguid
);
518 pTypeComp_tmp
= (void*)0xdeadbeef;
519 pTypeInfo
= (void*)0xdeadbeef;
520 hr
= ITypeComp_BindType(pTypeComp
, wszguid
, ulHash
, &pTypeInfo
, &pTypeComp_tmp
);
521 ok_ole_success(hr
, ITypeComp_BindType
);
522 ok(pTypeInfo
!= NULL
, "Got NULL pTypeInfo\n");
523 todo_wine
ok(pTypeComp_tmp
== NULL
, "Got pTypeComp_tmp %p\n", pTypeComp_tmp
);
524 ITypeInfo_Release(pTypeInfo
);
525 if(pTypeComp_tmp
) ITypeComp_Release(pTypeComp_tmp
); /* fixme */
527 ITypeComp_Release(pTypeComp
);
529 /* tests for ITypeComp on an interface */
530 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IFont
, &pFontTypeInfo
);
531 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
533 hr
= ITypeInfo_GetTypeComp(pFontTypeInfo
, &pTypeComp
);
534 ok_ole_success(hr
, ITypeLib_GetTypeComp
);
536 hr
= ITypeInfo_QueryInterface(pFontTypeInfo
, &IID_ITypeComp
, (void**)&tcomp
);
537 ok(hr
== S_OK
, "got %08x\n", hr
);
538 ok(tcomp
== pTypeComp
, "got %p, was %p\n", tcomp
, pTypeComp
);
540 hr
= ITypeComp_QueryInterface(tcomp
, &IID_ITypeInfo
, (void**)&ti
);
541 ok(hr
== S_OK
, "got %08x\n", hr
);
542 ok(ti
== pFontTypeInfo
, "got %p, was %p\n", ti
, pFontTypeInfo
);
543 ITypeInfo_Release(ti
);
545 ITypeComp_Release(tcomp
);
547 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszClone
);
548 hr
= ITypeComp_Bind(pTypeComp
, wszClone
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
549 ok_ole_success(hr
, ITypeComp_Bind
);
551 ok(desckind
== DESCKIND_FUNCDESC
,
552 "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
554 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr.lpfuncdesc should not have been set to NULL\n");
555 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
556 ITypeInfo_Release(pTypeInfo
);
558 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszClone
);
559 hr
= ITypeComp_Bind(pTypeComp
, wszClone
, ulHash
, INVOKE_PROPERTYGET
, &pTypeInfo
, &desckind
, &bindptr
);
560 ok(hr
== TYPE_E_TYPEMISMATCH
, "ITypeComp_Bind should have failed with TYPE_E_TYPEMISMATCH instead of 0x%08x\n", hr
);
562 ok(desckind
== DESCKIND_NONE
,
563 "desckind should have been DESCKIND_NONE instead of %d\n",
565 ok(!pTypeInfo
, "pTypeInfo should have been set to NULL\n");
566 ok(!bindptr
.lptcomp
, "bindptr should have been set to NULL\n");
568 /* tests that the compare is case-insensitive */
569 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszclone
);
570 hr
= ITypeComp_Bind(pTypeComp
, wszclone
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
571 ok_ole_success(hr
, ITypeComp_Bind
);
573 ok(desckind
== DESCKIND_FUNCDESC
,
574 "desckind should have been DESCKIND_FUNCDESC instead of %d\n",
576 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr.lpfuncdesc should not have been set to NULL\n");
577 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
578 ITypeInfo_Release(pTypeInfo
);
580 /* tests nonexistent members */
581 desckind
= 0xdeadbeef;
582 bindptr
.lptcomp
= (ITypeComp
*)0xdeadbeef;
583 pTypeInfo
= (ITypeInfo
*)0xdeadbeef;
584 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszJunk
);
585 hr
= ITypeComp_Bind(pTypeComp
, wszJunk
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
586 ok_ole_success(hr
, ITypeComp_Bind
);
587 ok(desckind
== DESCKIND_NONE
, "desckind should have been DESCKIND_NONE, was: %d\n", desckind
);
588 ok(pTypeInfo
== NULL
, "pTypeInfo should have been NULL, was: %p\n", pTypeInfo
);
589 ok(bindptr
.lptcomp
== NULL
, "bindptr should have been NULL, was: %p\n", bindptr
.lptcomp
);
591 /* tests inherited members */
592 desckind
= 0xdeadbeef;
593 bindptr
.lpfuncdesc
= NULL
;
595 ulHash
= LHashValOfNameSys(SYS_WIN32
, LOCALE_NEUTRAL
, wszAddRef
);
596 hr
= ITypeComp_Bind(pTypeComp
, wszAddRef
, ulHash
, 0, &pTypeInfo
, &desckind
, &bindptr
);
597 ok_ole_success(hr
, ITypeComp_Bind
);
598 ok(desckind
== DESCKIND_FUNCDESC
, "desckind should have been DESCKIND_FUNCDESC, was: %d\n", desckind
);
599 ok(pTypeInfo
!= NULL
, "pTypeInfo should not have been NULL, was: %p\n", pTypeInfo
);
600 ok(bindptr
.lpfuncdesc
!= NULL
, "bindptr should not have been NULL, was: %p\n", bindptr
.lpfuncdesc
);
601 ITypeInfo_ReleaseFuncDesc(pTypeInfo
, bindptr
.lpfuncdesc
);
602 ITypeInfo_Release(pTypeInfo
);
604 ITypeComp_Release(pTypeComp
);
605 ITypeInfo_Release(pFontTypeInfo
);
606 ITypeLib_Release(pTypeLib
);
609 static void test_CreateDispTypeInfo(void)
611 ITypeInfo
*pTypeInfo
, *pTI2
;
613 INTERFACEDATA ifdata
;
614 METHODDATA methdata
[4];
622 static WCHAR func1
[] = {'f','u','n','c','1',0};
623 static const WCHAR func2
[] = {'f','u','n','c','2',0};
624 static const WCHAR func3
[] = {'f','u','n','c','3',0};
625 static const WCHAR parm1
[] = {'p','a','r','m','1',0};
626 static const WCHAR parm2
[] = {'p','a','r','m','2',0};
627 OLECHAR
*name
= func1
;
629 ifdata
.pmethdata
= methdata
;
630 ifdata
.cMembers
= sizeof(methdata
) / sizeof(methdata
[0]);
632 methdata
[0].szName
= SysAllocString(func1
);
633 methdata
[0].ppdata
= parms1
;
634 methdata
[0].dispid
= 0x123;
635 methdata
[0].iMeth
= 0;
636 methdata
[0].cc
= CC_STDCALL
;
637 methdata
[0].cArgs
= 2;
638 methdata
[0].wFlags
= DISPATCH_METHOD
;
639 methdata
[0].vtReturn
= VT_HRESULT
;
640 parms1
[0].szName
= SysAllocString(parm1
);
641 parms1
[0].vt
= VT_I4
;
642 parms1
[1].szName
= SysAllocString(parm2
);
643 parms1
[1].vt
= VT_BSTR
;
645 methdata
[1].szName
= SysAllocString(func2
);
646 methdata
[1].ppdata
= NULL
;
647 methdata
[1].dispid
= 0x124;
648 methdata
[1].iMeth
= 1;
649 methdata
[1].cc
= CC_STDCALL
;
650 methdata
[1].cArgs
= 0;
651 methdata
[1].wFlags
= DISPATCH_PROPERTYGET
;
652 methdata
[1].vtReturn
= VT_I4
;
654 methdata
[2].szName
= SysAllocString(func3
);
655 methdata
[2].ppdata
= parms3
;
656 methdata
[2].dispid
= 0x125;
657 methdata
[2].iMeth
= 3;
658 methdata
[2].cc
= CC_STDCALL
;
659 methdata
[2].cArgs
= 1;
660 methdata
[2].wFlags
= DISPATCH_PROPERTYPUT
;
661 methdata
[2].vtReturn
= VT_HRESULT
;
662 parms3
[0].szName
= SysAllocString(parm1
);
663 parms3
[0].vt
= VT_I4
;
665 methdata
[3].szName
= SysAllocString(func3
);
666 methdata
[3].ppdata
= NULL
;
667 methdata
[3].dispid
= 0x125;
668 methdata
[3].iMeth
= 4;
669 methdata
[3].cc
= CC_STDCALL
;
670 methdata
[3].cArgs
= 0;
671 methdata
[3].wFlags
= DISPATCH_PROPERTYGET
;
672 methdata
[3].vtReturn
= VT_I4
;
674 hr
= CreateDispTypeInfo(&ifdata
, LOCALE_NEUTRAL
, &pTypeInfo
);
675 ok(hr
== S_OK
, "hr %08x\n", hr
);
677 hr
= ITypeInfo_GetTypeAttr(pTypeInfo
, &pTypeAttr
);
678 ok(hr
== S_OK
, "hr %08x\n", hr
);
680 ok(pTypeAttr
->typekind
== TKIND_COCLASS
, "typekind %0x\n", pTypeAttr
->typekind
);
681 ok(pTypeAttr
->cImplTypes
== 1, "cImplTypes %d\n", pTypeAttr
->cImplTypes
);
682 ok(pTypeAttr
->cFuncs
== 0, "cFuncs %d\n", pTypeAttr
->cFuncs
);
683 ok(pTypeAttr
->wTypeFlags
== 0, "wTypeFlags %04x\n", pTypeAttr
->cFuncs
);
684 ITypeInfo_ReleaseTypeAttr(pTypeInfo
, pTypeAttr
);
686 hr
= ITypeInfo_GetRefTypeOfImplType(pTypeInfo
, 0, &href
);
687 ok(hr
== S_OK
, "hr %08x\n", hr
);
688 ok(href
== 0, "href = 0x%x\n", href
);
689 hr
= ITypeInfo_GetRefTypeInfo(pTypeInfo
, href
, &pTI2
);
690 ok(hr
== S_OK
, "hr %08x\n", hr
);
691 hr
= ITypeInfo_GetTypeAttr(pTI2
, &pTypeAttr
);
692 ok(hr
== S_OK
, "hr %08x\n", hr
);
693 ok(pTypeAttr
->typekind
== TKIND_INTERFACE
, "typekind %0x\n", pTypeAttr
->typekind
);
694 ok(pTypeAttr
->cFuncs
== 4, "cFuncs %d\n", pTypeAttr
->cFuncs
);
695 ok(IsEqualGUID(&pTypeAttr
->guid
, &GUID_NULL
), "guid {%08x-...}\n", pTypeAttr
->guid
.Data1
);
696 ok(pTypeAttr
->wTypeFlags
== 0, "typeflags %08x\n", pTypeAttr
->wTypeFlags
);
698 ITypeInfo_ReleaseTypeAttr(pTI2
, pTypeAttr
);
700 hr
= ITypeInfo_GetFuncDesc(pTI2
, 0, &pFuncDesc
);
701 ok(hr
== S_OK
, "hr %08x\n", hr
);
702 ok(pFuncDesc
->memid
== 0x123, "memid %x\n", pFuncDesc
->memid
);
703 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
704 ok(pFuncDesc
->invkind
== methdata
[0].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
705 ok(pFuncDesc
->callconv
== methdata
[0].cc
, "callconv %d\n", pFuncDesc
->callconv
);
706 ok(pFuncDesc
->cParams
== methdata
[0].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
707 ok(pFuncDesc
->oVft
== 0, "oVft %d\n", pFuncDesc
->oVft
);
708 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
709 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_HRESULT
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
710 ok(pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
== VT_I4
, "parm 0 vt %x\n", pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
);
711 ok(U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
== PARAMFLAG_NONE
, "parm 0 flags %x\n", U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
);
713 ok(pFuncDesc
->lprgelemdescParam
[1].tdesc
.vt
== VT_BSTR
, "parm 1 vt %x\n", pFuncDesc
->lprgelemdescParam
[1].tdesc
.vt
);
714 ok(U(pFuncDesc
->lprgelemdescParam
[1]).paramdesc
.wParamFlags
== PARAMFLAG_NONE
, "parm 1 flags %x\n", U(pFuncDesc
->lprgelemdescParam
[1]).paramdesc
.wParamFlags
);
715 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
717 hr
= ITypeInfo_GetFuncDesc(pTI2
, 1, &pFuncDesc
);
718 ok(hr
== S_OK
, "hr %08x\n", hr
);
719 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
720 ok(pFuncDesc
->invkind
== methdata
[1].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
721 ok(pFuncDesc
->callconv
== methdata
[1].cc
, "callconv %d\n", pFuncDesc
->callconv
);
722 ok(pFuncDesc
->cParams
== methdata
[1].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
723 ok(pFuncDesc
->oVft
== sizeof(void *), "oVft %d\n", pFuncDesc
->oVft
);
724 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
725 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_I4
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
726 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
728 hr
= ITypeInfo_GetFuncDesc(pTI2
, 2, &pFuncDesc
);
729 ok(hr
== S_OK
, "hr %08x\n", hr
);
730 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
731 ok(pFuncDesc
->invkind
== methdata
[2].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
732 ok(pFuncDesc
->callconv
== methdata
[2].cc
, "callconv %d\n", pFuncDesc
->callconv
);
733 ok(pFuncDesc
->cParams
== methdata
[2].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
734 ok(pFuncDesc
->oVft
== 3 * sizeof(void *), "oVft %d\n", pFuncDesc
->oVft
);
735 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
736 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_HRESULT
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
737 ok(pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
== VT_I4
, "parm 0 vt %x\n", pFuncDesc
->lprgelemdescParam
[0].tdesc
.vt
);
738 ok(U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
== PARAMFLAG_NONE
, "parm 0 flags %x\n", U(pFuncDesc
->lprgelemdescParam
[0]).paramdesc
.wParamFlags
);
739 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
741 hr
= ITypeInfo_GetFuncDesc(pTI2
, 3, &pFuncDesc
);
742 ok(hr
== S_OK
, "hr %08x\n", hr
);
743 ok(pFuncDesc
->funckind
== FUNC_VIRTUAL
, "funckind %d\n", pFuncDesc
->funckind
);
744 ok(pFuncDesc
->invkind
== methdata
[3].wFlags
, "invkind %d\n", pFuncDesc
->invkind
);
745 ok(pFuncDesc
->callconv
== methdata
[3].cc
, "callconv %d\n", pFuncDesc
->callconv
);
746 ok(pFuncDesc
->cParams
== methdata
[3].cArgs
, "cParams %d\n", pFuncDesc
->cParams
);
747 ok(pFuncDesc
->oVft
== 4 * sizeof(void *), "oVft %d\n", pFuncDesc
->oVft
);
748 ok(pFuncDesc
->wFuncFlags
== 0, "oVft %d\n", pFuncDesc
->wFuncFlags
);
749 ok(pFuncDesc
->elemdescFunc
.tdesc
.vt
== VT_I4
, "ret vt %x\n", pFuncDesc
->elemdescFunc
.tdesc
.vt
);
750 ITypeInfo_ReleaseFuncDesc(pTI2
, pFuncDesc
);
752 /* test GetIDsOfNames on a coclass to see if it searches its interfaces */
753 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &name
, 1, &memid
);
754 ok(hr
== S_OK
, "hr 0x%08x\n", hr
);
755 ok(memid
== 0x123, "memid 0x%08x\n", memid
);
757 ITypeInfo_Release(pTI2
);
758 ITypeInfo_Release(pTypeInfo
);
760 SysFreeString(parms1
[0].szName
);
761 SysFreeString(parms1
[1].szName
);
762 SysFreeString(parms3
[0].szName
);
763 SysFreeString(methdata
[0].szName
);
764 SysFreeString(methdata
[1].szName
);
765 SysFreeString(methdata
[2].szName
);
766 SysFreeString(methdata
[3].szName
);
769 static void write_typelib(int res_no
, const char *filename
)
776 file
= CreateFileA( filename
, GENERIC_READ
|GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
, 0, 0 );
777 ok( file
!= INVALID_HANDLE_VALUE
, "file creation failed\n" );
778 if (file
== INVALID_HANDLE_VALUE
) return;
779 res
= FindResourceA( GetModuleHandleA(NULL
), (LPCSTR
)MAKEINTRESOURCE(res_no
), "TYPELIB" );
780 ok( res
!= 0, "couldn't find resource\n" );
781 ptr
= LockResource( LoadResource( GetModuleHandleA(NULL
), res
));
782 WriteFile( file
, ptr
, SizeofResource( GetModuleHandleA(NULL
), res
), &written
, NULL
);
783 ok( written
== SizeofResource( GetModuleHandleA(NULL
), res
), "couldn't write resource\n" );
787 static void test_invoke_func(ITypeInfo
*typeinfo
)
789 DISPID named_args
[3] = { DISPID_THIS
};
790 VARIANT args
[3], res
;
791 DISPPARAMS dp
= {args
, named_args
, 1, 0};
797 V_VT(&res
) = VT_ERROR
;
798 hres
= ITypeInfo_Invoke(typeinfo
, &invoketest
, 3, DISPATCH_METHOD
, &dp
, &res
, NULL
, &i
);
799 ok(hres
== S_OK
, "got 0x%08x\n", hres
);
800 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
801 ok(V_I4(&res
) == 4, "got %d\n", V_I4(&res
));
803 V_VT(args
) = VT_DISPATCH
;
804 V_DISPATCH(args
) = (IDispatch
*)&invoketest
;
805 V_VT(args
+1) = VT_INT
;
807 V_VT(&res
) = VT_ERROR
;
810 hres
= ITypeInfo_Invoke(typeinfo
, &invoketest
, 3, DISPATCH_METHOD
, &dp
, &res
, NULL
, &i
);
811 ok(hres
== DISP_E_BADPARAMCOUNT
, "got 0x%08x\n", hres
);
814 static const char *create_test_typelib(int res_no
)
816 static char filename
[MAX_PATH
];
818 GetTempFileNameA( ".", "tlb", 0, filename
);
819 write_typelib(res_no
, filename
);
823 static void test_TypeInfo(void)
826 ITypeInfo
*pTypeInfo
, *ti
;
827 ITypeInfo2
*pTypeInfo2
;
829 static WCHAR wszBogus
[] = { 'b','o','g','u','s',0 };
830 static WCHAR wszGetTypeInfo
[] = { 'G','e','t','T','y','p','e','I','n','f','o',0 };
831 static WCHAR wszClone
[] = {'C','l','o','n','e',0};
832 OLECHAR
* bogus
= wszBogus
;
833 OLECHAR
* pwszGetTypeInfo
= wszGetTypeInfo
;
834 OLECHAR
* pwszClone
= wszClone
;
836 DISPPARAMS dispparams
;
837 GUID bogusguid
= {0x806afb4f,0x13f7,0x42d2,{0x89,0x2c,0x6c,0x97,0xc3,0x6a,0x36,0xc1}};
838 VARIANT var
, res
, args
[2];
841 const char *filenameA
;
842 WCHAR filename
[MAX_PATH
];
846 hr
= LoadTypeLib(wszStdOle2
, &pTypeLib
);
847 ok_ole_success(hr
, LoadTypeLib
);
849 count
= ITypeLib_GetTypeInfoCount(pTypeLib
);
850 ok(count
> 0, "got %d\n", count
);
853 hr
= ITypeLib_GetTypeInfo(pTypeLib
, count
, &pTypeInfo
);
854 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got 0x%08x\n", hr
);
856 hr
= ITypeLib_GetTypeInfo(pTypeLib
, 0, NULL
);
857 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
859 hr
= ITypeLib_GetLibAttr(pTypeLib
, NULL
);
860 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
862 hr
= ITypeLib_GetTypeInfoType(pTypeLib
, count
, &kind
);
863 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got 0x%08x\n", hr
);
865 hr
= ITypeLib_GetTypeInfoType(pTypeLib
, count
, NULL
);
866 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
868 hr
= ITypeLib_GetTypeInfoType(pTypeLib
, 0, NULL
);
869 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
871 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IFont
, &pTypeInfo
);
872 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
874 /* test nonexistent method name */
875 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &bogus
, 1, &dispidMember
);
876 ok(hr
== DISP_E_UNKNOWNNAME
,
877 "ITypeInfo_GetIDsOfNames should have returned DISP_E_UNKNOWNNAME instead of 0x%08x\n",
880 dispparams
.cArgs
= 0;
881 dispparams
.rgdispidNamedArgs
= NULL
;
882 dispparams
.rgvarg
= NULL
;
884 /* test dispparams not NULL */
886 /* invalid member id -- wrong flags -- cNamedArgs not bigger than cArgs */
887 dispparams
.cNamedArgs
= 0;
888 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
889 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
890 /* invalid member id -- correct flags -- cNamedArgs not bigger than cArgs */
891 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
892 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
894 /* invalid member id -- wrong flags -- cNamedArgs bigger than cArgs */
895 dispparams
.cNamedArgs
= 1;
896 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
897 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
898 /* invalid member id -- correct flags -- cNamedArgs bigger than cArgs */
899 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, 0xdeadbeef, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
900 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
903 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &pwszClone
, 1, &dispidMember
);
904 ok_ole_success(hr
, ITypeInfo_GetIDsOfNames
);
906 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
907 dispparams
.cNamedArgs
= 0;
908 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
909 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
910 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
911 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
912 ok(hr
== DISP_E_BADPARAMCOUNT
, "ITypeInfo_Invoke should have returned DISP_E_BADPARAMCOUNT instead of 0x%08x\n", hr
);
914 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
915 dispparams
.cNamedArgs
= 1;
916 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
917 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
918 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
919 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
920 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
922 /* test NULL dispparams */
924 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
925 dispparams
.cNamedArgs
= 0;
926 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
927 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
928 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
929 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
930 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
932 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
933 dispparams
.cNamedArgs
= 1;
934 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
935 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
936 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
937 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
938 ok(hr
== E_INVALIDARG
, "ITypeInfo_Invoke should have returned E_INVALIDARG instead of 0x%08x\n", hr
);
940 ITypeInfo_Release(pTypeInfo
);
942 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IDispatch
, &pTypeInfo
);
943 ok_ole_success(hr
, ITypeLib_GetTypeInfoOfGuid
);
945 hr
= ITypeInfo_GetIDsOfNames(pTypeInfo
, &pwszGetTypeInfo
, 1, &dispidMember
);
946 ok_ole_success(hr
, ITypeInfo_GetIDsOfNames
);
948 hr
= ITypeInfo_QueryInterface(pTypeInfo
, &IID_ITypeInfo2
, (void**)&pTypeInfo2
);
949 ok_ole_success(hr
, ITypeInfo_QueryInterface
);
957 /* test unknown guid passed to GetCustData */
958 hr
= ITypeInfo2_GetCustData(pTypeInfo2
, &bogusguid
, &var
);
959 ok_ole_success(hr
, ITypeInfo_GetCustData
);
960 ok(V_VT(&var
) == VT_EMPTY
, "got %i, expected VT_EMPTY\n", V_VT(&var
));
962 ITypeInfo2_Release(pTypeInfo2
);
967 /* Check instance size for IDispatch, typelib is loaded using system SYS_WIN* kind so it always matches
969 hr
= ITypeInfo_GetTypeAttr(pTypeInfo
, &attr
);
970 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
971 ok(attr
->cbSizeInstance
== sizeof(void*), "got size %d\n", attr
->cbSizeInstance
);
972 ok(attr
->typekind
== TKIND_INTERFACE
, "got typekind %d\n", attr
->typekind
);
973 ITypeInfo_ReleaseTypeAttr(pTypeInfo
, attr
);
975 /* same size check with some general interface */
976 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IEnumVARIANT
, &ti
);
977 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
978 hr
= ITypeInfo_GetTypeAttr(ti
, &attr
);
979 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
980 ok(attr
->cbSizeInstance
== sizeof(void*), "got size %d\n", attr
->cbSizeInstance
);
981 ITypeInfo_ReleaseTypeAttr(ti
, attr
);
982 ITypeInfo_Release(ti
);
984 /* test invoking a method with a [restricted] keyword */
986 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
987 dispparams
.cNamedArgs
= 0;
988 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
989 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
990 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
991 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
992 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
994 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
995 dispparams
.cNamedArgs
= 1;
996 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, &dispparams
, NULL
, NULL
, NULL
);
997 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
998 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
999 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, &dispparams
, NULL
, NULL
, NULL
);
1000 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1002 /* test NULL dispparams */
1004 /* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
1005 dispparams
.cNamedArgs
= 0;
1006 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
1007 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1008 /* correct member id -- correct flags -- cNamedArgs not bigger than cArgs */
1009 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
1010 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1012 /* correct member id -- wrong flags -- cNamedArgs bigger than cArgs */
1013 dispparams
.cNamedArgs
= 1;
1014 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_PROPERTYGET
, NULL
, NULL
, NULL
, NULL
);
1015 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1016 /* correct member id -- correct flags -- cNamedArgs bigger than cArgs */
1017 hr
= ITypeInfo_Invoke(pTypeInfo
, (void *)0xdeadbeef, dispidMember
, DISPATCH_METHOD
, NULL
, NULL
, NULL
, NULL
);
1018 ok(hr
== DISP_E_MEMBERNOTFOUND
, "ITypeInfo_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08x\n", hr
);
1020 ITypeInfo_Release(pTypeInfo
);
1021 ITypeLib_Release(pTypeLib
);
1023 filenameA
= create_test_typelib(3);
1024 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filename
, MAX_PATH
);
1025 hr
= LoadTypeLib(filename
, &pTypeLib
);
1026 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1028 hr
= ITypeLib_GetTypeInfoOfGuid(pTypeLib
, &IID_IInvokeTest
, &pTypeInfo
);
1029 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1031 dispparams
.cArgs
= 1;
1032 dispparams
.cNamedArgs
= 0;
1033 dispparams
.rgdispidNamedArgs
= NULL
;
1034 dispparams
.rgvarg
= args
;
1036 V_VT(&args
[0]) = VT_I4
;
1040 V_VT(&res
) = VT_EMPTY
;
1042 /* call propget with DISPATCH_METHOD|DISPATCH_PROPERTYGET flags */
1043 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, DISPID_VALUE
, DISPATCH_METHOD
|DISPATCH_PROPERTYGET
,
1044 &dispparams
, &res
, NULL
, &i
);
1045 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
1046 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1047 ok(V_I4(&res
) == 1, "got %d\n", V_I4(&res
));
1050 /* call propget with DISPATCH_METHOD flags */
1051 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, DISPID_VALUE
, DISPATCH_METHOD
,
1052 &dispparams
, &res
, NULL
, &i
);
1053 ok(hr
== DISP_E_MEMBERNOTFOUND
, "got 0x%08x, %d\n", hr
, i
);
1056 V_VT(&res
) = VT_EMPTY
;
1058 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, DISPID_VALUE
, DISPATCH_PROPERTYGET
,
1059 &dispparams
, &res
, NULL
, &i
);
1060 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
1061 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1062 ok(V_I4(&res
) == 1, "got %d\n", V_I4(&res
));
1064 /* call propget with DISPATCH_METHOD|DISPATCH_PROPERTYGET flags */
1065 V_VT(&args
[0]) = VT_I4
;
1068 dispparams
.cArgs
= 1;
1069 dispparams
.rgvarg
= args
;
1072 V_VT(&res
) = VT_EMPTY
;
1074 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 4, DISPATCH_METHOD
|DISPATCH_PROPERTYGET
, &dispparams
, &res
, NULL
, &i
);
1075 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
1076 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1077 ok(V_I4(&res
) == 15, "got %d\n", V_I4(&res
));
1080 /* DISPATCH_PROPERTYPUTREF */
1082 V_VT(&args
[0]) = VT_I4
|VT_BYREF
;
1083 V_I4REF(&args
[0]) = &l
;
1085 dispidMember
= DISPID_PROPERTYPUT
;
1086 dispparams
.cArgs
= 1;
1087 dispparams
.cNamedArgs
= 1;
1088 dispparams
.rgdispidNamedArgs
= &dispidMember
;
1089 dispparams
.rgvarg
= args
;
1092 V_VT(&res
) = VT_EMPTY
;
1094 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 1, DISPATCH_PROPERTYPUTREF
, &dispparams
, &res
, NULL
, &i
);
1095 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
1096 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1097 ok(V_I4(&res
) == 3, "got %d\n", V_I4(&res
));
1100 V_VT(&res
) = VT_EMPTY
;
1102 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 1, DISPATCH_PROPERTYPUT
, &dispparams
, &res
, NULL
, &i
);
1103 ok(hr
== DISP_E_MEMBERNOTFOUND
, "got 0x%08x, %d\n", hr
, i
);
1106 V_VT(&args
[0]) = VT_UNKNOWN
;
1107 V_UNKNOWN(&args
[0]) = NULL
;
1109 V_VT(&res
) = VT_EMPTY
;
1111 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 2, DISPATCH_PROPERTYPUTREF
, &dispparams
, &res
, NULL
, &i
);
1112 ok(hr
== S_OK
, "got 0x%08x, %d\n", hr
, i
);
1113 ok(V_VT(&res
) == VT_I4
, "got %d\n", V_VT(&res
));
1114 ok(V_I4(&res
) == 6, "got %d\n", V_I4(&res
));
1117 V_VT(&res
) = VT_EMPTY
;
1119 hr
= ITypeInfo_Invoke(pTypeInfo
, &invoketest
, 2, DISPATCH_PROPERTYPUT
, &dispparams
, &res
, NULL
, &i
);
1120 ok(hr
== DISP_E_MEMBERNOTFOUND
, "got 0x%08x, %d\n", hr
, i
);
1122 test_invoke_func(pTypeInfo
);
1124 ITypeInfo_Release(pTypeInfo
);
1125 ITypeLib_Release(pTypeLib
);
1126 DeleteFileA(filenameA
);
1129 static int WINAPI
int_func( int a0
, int a1
, int a2
, int a3
, int a4
)
1131 ok( a0
== 1, "wrong arg0 %x\n", a0
);
1132 ok( a1
== -1, "wrong arg1 %x\n", a1
);
1133 ok( a2
== (0x55550000 | 1234), "wrong arg2 %x\n", a2
);
1134 ok( a3
== 0xdeadbeef, "wrong arg3 %x\n", a3
);
1135 ok( a4
== 0x555555fd, "wrong arg4 %x\n", a4
);
1139 static double WINAPI
double_func( double a0
, float a1
, double a2
, int a3
)
1141 ok( a0
== 1.2, "wrong arg0 %f\n", (double)a0
);
1142 ok( a1
== 3.25, "wrong arg1 %f\n", (double)a1
);
1143 ok( a2
== 1.2e12
, "wrong arg2 %f\n", (double)a2
);
1144 ok( a3
== -4433.0, "wrong arg3 %f\n", (double)a3
);
1148 static LONGLONG WINAPI
longlong_func( LONGLONG a0
, CY a1
)
1150 ok( a0
== (((ULONGLONG
)0xdead << 32) | 0xbeef), "wrong arg0 %08x%08x\n", (DWORD
)(a0
>> 32), (DWORD
)a0
);
1151 ok( a1
.int64
== ((ULONGLONG
)10000 * 12345678), "wrong arg1 %08x%08x\n",
1152 (DWORD
)(a1
.int64
>> 32), (DWORD
)a1
.int64
);
1153 return ((ULONGLONG
)4321 << 32) | 8765;
1156 static VARIANT WINAPI
variant_func( int a0
, BOOL a1
, DECIMAL a2
, VARIANT a3
)
1159 ok( a0
== 2233, "wrong arg0 %x\n", a0
);
1160 ok( a1
== 1 || broken(a1
== 0x55550001), "wrong arg1 %x\n", a1
);
1161 V_VT(&var
) = VT_LPWSTR
;
1162 V_UI4(&var
) = 0xbabe;
1163 ok( a2
.Hi32
== 1122, "wrong arg2.Hi32 %x\n", a2
.Hi32
);
1164 ok( U1(a2
).Lo64
== 3344, "wrong arg2.Lo64 %08x%08x\n", (DWORD
)(U1(a2
).Lo64
>> 32), (DWORD
)U1(a2
).Lo64
);
1165 ok( V_VT(&a3
) == VT_EMPTY
, "wrong arg3 type %x\n", V_VT(&a3
) );
1166 ok( V_UI4(&a3
) == 0xdeadbeef, "wrong arg3 value %x\n", V_UI4(&a3
) );
1170 static int CDECL
void_func( int a0
, int a1
)
1172 if (is_win64
) /* VT_EMPTY is passed as real arg on win64 */
1174 ok( a0
== 0x55555555, "wrong arg0 %x\n", a0
);
1175 ok( a1
== 1111, "wrong arg1 %x\n", a1
);
1179 ok( a0
== 1111, "wrong arg0 %x\n", a0
);
1180 ok( a1
== 0, "wrong arg1 %x\n", a1
);
1185 static int WINAPI
stdcall_func( int a
)
1190 static int WINAPI
inst_func( void *inst
, int a
)
1192 ok( (*(void ***)inst
)[3] == inst_func
, "wrong ptr %p\n", inst
);
1193 ok( a
== 3, "wrong arg %x\n", a
);
1197 static HRESULT WINAPI
ret_false_func(void)
1202 static const void *vtable
[] = { NULL
, NULL
, NULL
, inst_func
};
1204 static void test_DispCallFunc(void)
1206 const void **inst
= vtable
;
1208 VARIANT result
, args
[5];
1209 VARIANTARG
*pargs
[5];
1213 for (i
= 0; i
< 5; i
++) pargs
[i
] = &args
[i
];
1215 memset( args
, 0x55, sizeof(args
) );
1217 V_UI4(&args
[0]) = 1;
1219 V_I4(&args
[1]) = -1;
1221 V_I2(&args
[2]) = 1234;
1223 V_UI4(&args
[3]) = 0xdeadbeef;
1225 V_I1(&args
[4]) = -3;
1226 memset( &result
, 0xcc, sizeof(result
) );
1227 res
= DispCallFunc( NULL
, (ULONG_PTR
)int_func
, CC_STDCALL
, VT_UI4
, 5, types
, pargs
, &result
);
1228 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1229 ok( V_VT(&result
) == VT_UI4
, "wrong result type %d\n", V_VT(&result
) );
1230 ok( V_UI4(&result
) == 4321, "wrong result %u\n", V_UI4(&result
) );
1232 /* the function checks the argument sizes for stdcall */
1233 if (abi_supports_stdcall
)
1235 res
= DispCallFunc( NULL
, (ULONG_PTR
)stdcall_func
, CC_STDCALL
, VT_UI4
, 0, types
, pargs
, &result
);
1236 ok( res
== DISP_E_BADCALLEE
, "DispCallFunc wrong error %x\n", res
);
1237 res
= DispCallFunc( NULL
, (ULONG_PTR
)stdcall_func
, CC_STDCALL
, VT_UI4
, 1, types
, pargs
, &result
);
1238 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1239 res
= DispCallFunc( NULL
, (ULONG_PTR
)stdcall_func
, CC_STDCALL
, VT_UI4
, 2, types
, pargs
, &result
);
1240 ok( res
== DISP_E_BADCALLEE
, "DispCallFunc wrong error %x\n", res
);
1243 memset( args
, 0x55, sizeof(args
) );
1245 V_R8(&args
[0]) = 1.2;
1247 V_R4(&args
[1]) = 3.25;
1249 V_R8(&args
[2]) = 1.2e12
;
1251 V_I4(&args
[3]) = -4433;
1252 memset( &result
, 0xcc, sizeof(result
) );
1253 res
= DispCallFunc( NULL
, (ULONG_PTR
)double_func
, CC_STDCALL
, VT_R8
, 4, types
, pargs
, &result
);
1254 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1255 ok( V_VT(&result
) == VT_R8
, "wrong result type %d\n", V_VT(&result
) );
1256 ok( V_R8(&result
) == 4321, "wrong result %f\n", V_R8(&result
) );
1258 memset( args
, 0x55, sizeof(args
) );
1260 V_I8(&args
[0]) = ((ULONGLONG
)0xdead << 32) | 0xbeef;
1262 V_CY(&args
[1]).int64
= (ULONGLONG
)10000 * 12345678;
1263 memset( &result
, 0xcc, sizeof(result
) );
1264 res
= DispCallFunc( NULL
, (ULONG_PTR
)longlong_func
, CC_STDCALL
, VT_I8
, 2, types
, pargs
, &result
);
1265 ok( res
== S_OK
|| broken(res
== E_INVALIDARG
), /* longlong not supported on <= win2k */
1266 "DispCallFunc failed %x\n", res
);
1269 ok( V_VT(&result
) == VT_I8
, "wrong result type %d\n", V_VT(&result
) );
1270 ok( V_I8(&result
) == (((ULONGLONG
)4321 << 32) | 8765), "wrong result %08x%08x\n",
1271 (DWORD
)(V_I8(&result
) >> 32), (DWORD
)V_I8(&result
) );
1274 memset( args
, 0x55, sizeof(args
) );
1276 V_I4(&args
[0]) = 2233;
1278 V_BOOL(&args
[1]) = 1;
1279 types
[2] = VT_DECIMAL
;
1280 V_DECIMAL(&args
[2]).Hi32
= 1122;
1281 U1(V_DECIMAL(&args
[2])).Lo64
= 3344;
1282 types
[3] = VT_VARIANT
;
1283 V_VT(&args
[3]) = VT_EMPTY
;
1284 V_UI4(&args
[3]) = 0xdeadbeef;
1285 types
[4] = VT_EMPTY
;
1286 memset( &result
, 0xcc, sizeof(result
) );
1287 res
= DispCallFunc( NULL
, (ULONG_PTR
)variant_func
, CC_STDCALL
, VT_VARIANT
, 5, types
, pargs
, &result
);
1288 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1289 ok( V_VT(&result
) == VT_LPWSTR
, "wrong result type %d\n", V_VT(&result
) );
1290 ok( V_UI4(&result
) == 0xbabe, "wrong result %08x\n", V_UI4(&result
) );
1292 memset( args
, 0x55, sizeof(args
) );
1293 types
[0] = VT_EMPTY
;
1295 V_I4(&args
[1]) = 1111;
1296 types
[2] = VT_EMPTY
;
1299 types
[4] = VT_EMPTY
;
1300 memset( &result
, 0xcc, sizeof(result
) );
1301 res
= DispCallFunc( NULL
, (ULONG_PTR
)void_func
, CC_CDECL
, VT_EMPTY
, 5, types
, pargs
, &result
);
1302 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1303 ok( V_VT(&result
) == VT_EMPTY
, "wrong result type %d\n", V_VT(&result
) );
1305 ok( V_UI4(&result
) == 12, "wrong result %08x\n", V_UI4(&result
) );
1307 ok( V_UI4(&result
) == 0xcccccccc, "wrong result %08x\n", V_UI4(&result
) );
1309 memset( args
, 0x55, sizeof(args
) );
1312 memset( &result
, 0xcc, sizeof(result
) );
1313 res
= DispCallFunc( &inst
, 3 * sizeof(void*), CC_STDCALL
, VT_I4
, 1, types
, pargs
, &result
);
1314 ok( res
== S_OK
, "DispCallFunc failed %x\n", res
);
1315 ok( V_VT(&result
) == VT_I4
, "wrong result type %d\n", V_VT(&result
) );
1316 ok( V_I4(&result
) == 6, "wrong result %08x\n", V_I4(&result
) );
1318 memset( &result
, 0xcc, sizeof(result
) );
1319 res
= DispCallFunc(NULL
, (ULONG_PTR
)ret_false_func
, CC_STDCALL
, VT_ERROR
, 0, NULL
, NULL
, &result
);
1320 ok(res
== S_OK
, "DispCallFunc failed: %08x\n", res
);
1321 ok(V_VT(&result
) == VT_ERROR
, "V_VT(result) = %u\n", V_VT(&result
));
1322 ok(V_ERROR(&result
) == S_FALSE
, "V_ERROR(result) = %08x\n", V_ERROR(&result
));
1324 memset( &result
, 0xcc, sizeof(result
) );
1325 res
= DispCallFunc(NULL
, (ULONG_PTR
)ret_false_func
, CC_STDCALL
, VT_HRESULT
, 0, NULL
, NULL
, &result
);
1326 ok(res
== E_INVALIDARG
, "DispCallFunc failed: %08x\n", res
);
1327 ok(V_VT(&result
) == 0xcccc, "V_VT(result) = %u\n", V_VT(&result
));
1330 /* RegDeleteTreeW from dlls/advapi32/registry.c, plus additional view flag */
1331 static LSTATUS
myRegDeleteTreeW(HKEY hKey
, LPCWSTR lpszSubKey
, REGSAM view
)
1334 DWORD dwMaxSubkeyLen
, dwMaxValueLen
;
1335 DWORD dwMaxLen
, dwSize
;
1336 WCHAR szNameBuf
[MAX_PATH
], *lpszName
= szNameBuf
;
1337 HKEY hSubKey
= hKey
;
1338 view
&= (KEY_WOW64_64KEY
| KEY_WOW64_32KEY
);
1342 ret
= RegOpenKeyExW(hKey
, lpszSubKey
, 0, KEY_READ
| view
, &hSubKey
);
1343 if (ret
) return ret
;
1346 ret
= RegQueryInfoKeyW(hSubKey
, NULL
, NULL
, NULL
, NULL
,
1347 &dwMaxSubkeyLen
, NULL
, NULL
, &dwMaxValueLen
, NULL
, NULL
, NULL
);
1348 if (ret
) goto cleanup
;
1352 dwMaxLen
= max(dwMaxSubkeyLen
, dwMaxValueLen
);
1353 if (dwMaxLen
> sizeof(szNameBuf
)/sizeof(WCHAR
))
1355 /* Name too big: alloc a buffer for it */
1356 if (!(lpszName
= HeapAlloc( GetProcessHeap(), 0, dwMaxLen
*sizeof(WCHAR
))))
1358 ret
= ERROR_NOT_ENOUGH_MEMORY
;
1363 /* Recursively delete all the subkeys */
1367 if (RegEnumKeyExW(hSubKey
, 0, lpszName
, &dwSize
, NULL
,
1368 NULL
, NULL
, NULL
)) break;
1370 ret
= myRegDeleteTreeW(hSubKey
, lpszName
, view
);
1371 if (ret
) goto cleanup
;
1375 if (pRegDeleteKeyExW
&& view
!= 0)
1376 ret
= pRegDeleteKeyExW(hKey
, lpszSubKey
, view
, 0);
1378 ret
= RegDeleteKeyW(hKey
, lpszSubKey
);
1383 if (RegEnumValueW(hKey
, 0, lpszName
, &dwSize
,
1384 NULL
, NULL
, NULL
, NULL
)) break;
1386 ret
= RegDeleteValueW(hKey
, lpszName
);
1387 if (ret
) goto cleanup
;
1391 if (lpszName
!= szNameBuf
)
1392 HeapFree(GetProcessHeap(), 0, lpszName
);
1394 RegCloseKey(hSubKey
);
1398 static BOOL
do_typelib_reg_key(GUID
*uid
, WORD maj
, WORD min
, DWORD arch
, LPCWSTR base
, BOOL remove
)
1400 static const WCHAR typelibW
[] = {'T','y','p','e','l','i','b','\\',0};
1401 static const WCHAR formatW
[] = {'\\','%','u','.','%','u','\\','0','\\','w','i','n','%','u',0};
1402 static const WCHAR format2W
[] = {'%','s','_','%','u','_','%','u','.','d','l','l',0};
1408 memcpy(buf
, typelibW
, sizeof(typelibW
));
1409 StringFromGUID2(uid
, buf
+ lstrlenW(buf
), 40);
1413 ok(myRegDeleteTreeW(HKEY_CLASSES_ROOT
, buf
, 0) == ERROR_SUCCESS
, "SHDeleteKey failed\n");
1417 wsprintfW(buf
+ lstrlenW(buf
), formatW
, maj
, min
, arch
);
1419 SetLastError(0xdeadbeef);
1420 res
= RegCreateKeyExW(HKEY_CLASSES_ROOT
, buf
, 0, NULL
, 0,
1421 KEY_WRITE
, NULL
, &hkey
, NULL
);
1422 if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED
)
1424 win_skip("W-calls are not implemented\n");
1428 if (res
!= ERROR_SUCCESS
)
1430 trace("RegCreateKeyExW failed: %u\n", res
);
1434 wsprintfW(buf
, format2W
, base
, maj
, min
);
1435 if (RegSetValueExW(hkey
, NULL
, 0, REG_SZ
,
1436 (BYTE
*)buf
, (lstrlenW(buf
) + 1) * sizeof(WCHAR
)) != ERROR_SUCCESS
)
1438 trace("RegSetValueExW failed\n");
1445 static void test_QueryPathOfRegTypeLib(DWORD arch
)
1447 static const struct test_data
1451 const WCHAR path
[16];
1453 { 1, 0, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1454 { 3, 0, S_OK
, {'f','a','k','e','_','3','_','0','.','d','l','l',0 } },
1455 { 3, 1, S_OK
, {'f','a','k','e','_','3','_','1','.','d','l','l',0 } },
1456 { 3, 22, S_OK
, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
1457 { 3, 37, S_OK
, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
1458 { 3, 40, S_OK
, {'f','a','k','e','_','3','_','3','7','.','d','l','l',0 } },
1459 { 0xffff, 0xffff, S_OK
, {'f','a','k','e','_','5','_','3','7','.','d','l','l',0 } },
1460 { 0xffff, 0, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1461 { 3, 0xffff, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1462 { 5, 0xffff, TYPE_E_LIBNOTREGISTERED
, { 0 } },
1463 { 4, 0, TYPE_E_LIBNOTREGISTERED
, { 0 } }
1465 static const WCHAR base
[] = {'f','a','k','e',0};
1466 static const WCHAR wrongW
[] = {'w','r','o','n','g',0};
1474 status
= UuidCreate(&uid
);
1475 ok(!status
|| status
== RPC_S_UUID_LOCAL_ONLY
, "UuidCreate error %08x\n", status
);
1477 StringFromGUID2(&uid
, uid_str
, 40);
1478 /*trace("GUID: %s\n", wine_dbgstr_w(uid_str));*/
1480 if (!do_typelib_reg_key(&uid
, 3, 0, arch
, base
, FALSE
)) return;
1481 if (!do_typelib_reg_key(&uid
, 3, 1, arch
, base
, FALSE
)) return;
1482 if (!do_typelib_reg_key(&uid
, 3, 37, arch
, base
, FALSE
)) return;
1483 if (!do_typelib_reg_key(&uid
, 5, 37, arch
, base
, FALSE
)) return;
1484 if (arch
== 64 && !do_typelib_reg_key(&uid
, 5, 37, 32, wrongW
, FALSE
)) return;
1486 for (i
= 0; i
< sizeof(td
)/sizeof(td
[0]); i
++)
1488 ret
= QueryPathOfRegTypeLib(&uid
, td
[i
].maj
, td
[i
].min
, LOCALE_NEUTRAL
, &path
);
1489 ok(ret
== td
[i
].ret
, "QueryPathOfRegTypeLib(%u.%u) returned %08x\n", td
[i
].maj
, td
[i
].min
, ret
);
1492 ok(!lstrcmpW(td
[i
].path
, path
), "typelib %u.%u path doesn't match\n", td
[i
].maj
, td
[i
].min
);
1493 SysFreeString(path
);
1497 do_typelib_reg_key(&uid
, 0, 0, arch
, NULL
, TRUE
);
1500 static void test_inheritance(void)
1504 ITypeInfo
*pTI
, *pTI_p
;
1508 WCHAR path
[MAX_PATH
];
1509 CHAR pathA
[MAX_PATH
];
1510 static const WCHAR tl_path
[] = {'.','\\','m','i','d','l','_','t','m','a','r','s','h','a','l','.','t','l','b',0};
1512 BOOL use_midl_tlb
= FALSE
;
1514 GetModuleFileNameA(NULL
, pathA
, MAX_PATH
);
1515 MultiByteToWideChar(CP_ACP
, 0, pathA
, -1, path
, MAX_PATH
);
1518 memcpy(path
, tl_path
, sizeof(tl_path
));
1520 hr
= LoadTypeLib(path
, &pTL
);
1521 if(FAILED(hr
)) return;
1524 /* ItestIF3 is a syntax 2 dispinterface */
1525 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF3
, &pTI
);
1526 ok(hr
== S_OK
, "hr %08x\n", hr
);
1528 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1529 ok(hr
== S_OK
, "hr %08x\n", hr
);
1530 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1531 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1532 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1534 ok(pTA
->cFuncs
== 6, "cfuncs %d\n", pTA
->cFuncs
);
1535 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1537 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1540 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1541 ok(hr
== S_OK
, "hr %08x\n", hr
);
1542 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1543 ok(hr
== S_OK
, "hr %08x\n", hr
);
1544 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1545 ok(hr
== S_OK
, "got %08x\n", hr
);
1546 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1547 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1548 ITypeInfo_Release(pTI_p
);
1550 /* Should have six methods */
1551 hr
= ITypeInfo_GetFuncDesc(pTI
, 6, &pFD
);
1552 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1553 hr
= ITypeInfo_GetFuncDesc(pTI
, 5, &pFD
);
1554 ok(hr
== S_OK
, "hr %08x\n", hr
);
1555 ok(pFD
->memid
== 0x60020000, "memid %08x\n", pFD
->memid
);
1556 ok(pFD
->oVft
== 5 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1557 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1559 ITypeInfo_Release(pTI
);
1562 /* ItestIF4 is a syntax 1 dispinterface */
1563 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF4
, &pTI
);
1564 ok(hr
== S_OK
, "hr %08x\n", hr
);
1566 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1567 ok(hr
== S_OK
, "hr %08x\n", hr
);
1568 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1569 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1570 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1571 ok(pTA
->cFuncs
== 1, "cfuncs %d\n", pTA
->cFuncs
);
1572 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1573 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1575 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1576 ok(hr
== S_OK
, "hr %08x\n", hr
);
1577 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1578 ok(hr
== S_OK
, "hr %08x\n", hr
);
1579 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1580 ok(hr
== S_OK
, "got %08x\n", hr
);
1581 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1582 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1583 ITypeInfo_Release(pTI_p
);
1584 hr
= ITypeInfo_GetFuncDesc(pTI
, 1, &pFD
);
1585 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1586 hr
= ITypeInfo_GetFuncDesc(pTI
, 0, &pFD
);
1587 ok(hr
== S_OK
, "hr %08x\n", hr
);
1588 ok(pFD
->memid
== 0x1c, "memid %08x\n", pFD
->memid
);
1589 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1590 ITypeInfo_Release(pTI
);
1593 /* ItestIF5 is dual with inherited ifaces which derive from IUnknown but not IDispatch */
1594 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF5
, &pTI
);
1595 ok(hr
== S_OK
, "hr %08x\n", hr
);
1597 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1598 ok(hr
== S_OK
, "hr %08x\n", hr
);
1601 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1602 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1604 ok(pTA
->wTypeFlags
== TYPEFLAG_FDUAL
, "typeflags %x\n", pTA
->wTypeFlags
);
1606 ok(pTA
->cFuncs
== 8, "cfuncs %d\n", pTA
->cFuncs
);
1607 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1608 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1610 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1611 ok(hr
== S_OK
, "hr %08x\n", hr
);
1612 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1613 ok(hr
== S_OK
, "hr %08x\n", hr
);
1614 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1615 ok(hr
== S_OK
, "got %08x\n", hr
);
1616 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1617 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1618 ITypeInfo_Release(pTI_p
);
1620 hr
= ITypeInfo_GetFuncDesc(pTI
, 6, &pFD
);
1621 ok(hr
== S_OK
, "hr %08x\n", hr
);
1622 ok(pFD
->memid
== 0x1234, "memid %08x\n", pFD
->memid
);
1623 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1625 ITypeInfo_Release(pTI
);
1627 /* ItestIF7 is dual with inherited ifaces which derive from Dispatch */
1628 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF7
, &pTI
);
1629 ok(hr
== S_OK
, "hr %08x\n", hr
);
1631 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1632 ok(hr
== S_OK
, "hr %08x\n", hr
);
1633 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1634 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1635 ok(pTA
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "typeflags %x\n", pTA
->wTypeFlags
);
1636 ok(pTA
->cFuncs
== 10, "cfuncs %d\n", pTA
->cFuncs
);
1637 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1638 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1640 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1641 ok(hr
== S_OK
, "hr %08x\n", hr
);
1642 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1643 ok(hr
== S_OK
, "hr %08x\n", hr
);
1644 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1645 ok(hr
== S_OK
, "got %08x\n", hr
);
1646 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1647 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1648 ITypeInfo_Release(pTI_p
);
1650 hr
= ITypeInfo_GetFuncDesc(pTI
, 9, &pFD
);
1651 ok(hr
== S_OK
, "hr %08x\n", hr
);
1652 ok(pFD
->memid
== 0x1236, "memid %08x\n", pFD
->memid
);
1653 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1654 ITypeInfo_Release(pTI
);
1656 /* ItestIF10 is a syntax 2 dispinterface which doesn't derive from IUnknown */
1657 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF10
, &pTI
);
1658 ok(hr
== S_OK
, "hr %08x\n", hr
);
1660 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1661 ok(hr
== S_OK
, "hr %08x\n", hr
);
1662 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1663 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1664 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1666 ok(pTA
->cFuncs
== 3, "cfuncs %d\n", pTA
->cFuncs
);
1667 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1669 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1672 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, -1, &href
);
1673 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1674 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1675 ok(hr
== S_OK
, "hr %08x\n", hr
);
1676 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1677 ok(hr
== S_OK
, "hr %08x\n", hr
);
1678 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1679 ok(hr
== S_OK
, "got %08x\n", hr
);
1680 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1681 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1682 ITypeInfo_Release(pTI_p
);
1684 /* Should have three methods */
1685 hr
= ITypeInfo_GetFuncDesc(pTI
, 3, &pFD
);
1686 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1687 hr
= ITypeInfo_GetFuncDesc(pTI
, 2, &pFD
);
1688 ok(hr
== S_OK
, "hr %08x\n", hr
);
1689 ok(pFD
->memid
== 0x60010000, "memid %08x\n", pFD
->memid
);
1690 ok(pFD
->oVft
== 2 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1691 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1693 ITypeInfo_Release(pTI
);
1695 /* ItestIF11 is a syntax 2 dispinterface which derives from IDispatch */
1696 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &DIID_ItestIF11
, &pTI
);
1697 ok(hr
== S_OK
, "hr %08x\n", hr
);
1699 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1700 ok(hr
== S_OK
, "hr %08x\n", hr
);
1701 ok(pTA
->typekind
== TKIND_DISPATCH
, "kind %04x\n", pTA
->typekind
);
1702 ok(pTA
->cbSizeVft
== 7 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1703 ok(pTA
->wTypeFlags
== TYPEFLAG_FDISPATCHABLE
, "typeflags %x\n", pTA
->wTypeFlags
);
1705 ok(pTA
->cFuncs
== 10, "cfuncs %d\n", pTA
->cFuncs
);
1706 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1708 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1711 hr
= ITypeInfo_GetRefTypeOfImplType(pTI
, 0, &href
);
1712 ok(hr
== S_OK
, "hr %08x\n", hr
);
1713 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1714 ok(hr
== S_OK
, "hr %08x\n", hr
);
1715 hr
= ITypeInfo_GetTypeAttr(pTI_p
, &pTA
);
1716 ok(hr
== S_OK
, "got %08x\n", hr
);
1717 ok(IsEqualGUID(&pTA
->guid
, &IID_IDispatch
), "guid {%08x-....\n", pTA
->guid
.Data1
);
1718 ITypeInfo_ReleaseTypeAttr(pTI_p
, pTA
);
1719 ITypeInfo_Release(pTI_p
);
1721 /* Should have ten methods */
1722 hr
= ITypeInfo_GetFuncDesc(pTI
, 10, &pFD
);
1723 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1724 hr
= ITypeInfo_GetFuncDesc(pTI
, 9, &pFD
);
1725 ok(hr
== S_OK
, "hr %08x\n", hr
);
1726 ok(pFD
->memid
== 0x1236, "memid %08x\n", pFD
->memid
);
1727 ok(pFD
->oVft
== 9 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1729 /* first argument to 10th function is an HREFTYPE from the impl type */
1730 ok(pFD
->cParams
== 1, "cParams %i\n", pFD
->cParams
);
1731 ok(pFD
->lprgelemdescParam
[0].tdesc
.vt
== VT_USERDEFINED
,
1732 "vt 0x%x\n", pFD
->lprgelemdescParam
[0].tdesc
.vt
);
1733 href
= U(pFD
->lprgelemdescParam
[0].tdesc
).hreftype
;
1734 ok((href
& 0xff000000) == 0x04000000, "href 0x%08x\n", href
);
1735 hr
= ITypeInfo_GetRefTypeInfo(pTI
, href
, &pTI_p
);
1736 ok(hr
== S_OK
, "hr %08x\n", hr
);
1737 if (SUCCEEDED(hr
)) ITypeInfo_Release(pTI_p
);
1738 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1740 ITypeInfo_Release(pTI
);
1743 /* ItestIF2 is an interface which derives from IUnknown */
1744 hr
= ITypeLib_GetTypeInfoOfGuid(pTL
, &IID_ItestIF2
, &pTI
);
1745 ok(hr
== S_OK
, "hr %08x\n", hr
);
1747 hr
= ITypeInfo_GetTypeAttr(pTI
, &pTA
);
1748 ok(hr
== S_OK
, "hr %08x\n", hr
);
1749 ok(pTA
->typekind
== TKIND_INTERFACE
, "kind %04x\n", pTA
->typekind
);
1750 ok(pTA
->cbSizeVft
== 6 * sizeof(void *), "sizevft %d\n", pTA
->cbSizeVft
);
1751 ok(pTA
->wTypeFlags
== 0, "typeflags %x\n", pTA
->wTypeFlags
);
1753 ok(pTA
->cFuncs
== 1, "cfuncs %d\n", pTA
->cFuncs
);
1754 ok(pTA
->cImplTypes
== 1, "cimpltypes %d\n", pTA
->cImplTypes
);
1756 ITypeInfo_ReleaseTypeAttr(pTI
, pTA
);
1759 /* Should have one method */
1760 hr
= ITypeInfo_GetFuncDesc(pTI
, 1, &pFD
);
1761 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "hr %08x\n", hr
);
1762 hr
= ITypeInfo_GetFuncDesc(pTI
, 0, &pFD
);
1763 ok(hr
== S_OK
, "hr %08x\n", hr
);
1764 ok(pFD
->memid
== 0x60020000, "memid %08x\n", pFD
->memid
);
1765 ok(pFD
->oVft
== 5 * sizeof(void *), "oVft %d\n", pFD
->oVft
);
1766 ITypeInfo_ReleaseFuncDesc(pTI
, pFD
);
1768 ITypeInfo_Release(pTI
);
1770 ITypeLib_Release(pTL
);
1775 static void test_CreateTypeLib(SYSKIND sys
) {
1776 static OLECHAR typelibW
[] = {'t','y','p','e','l','i','b',0};
1777 static OLECHAR helpfileW
[] = {'C',':','\\','b','o','g','u','s','.','h','l','p',0};
1778 static OLECHAR interface1W
[] = {'i','n','t','e','r','f','a','c','e','1',0};
1779 static OLECHAR interface2W
[] = {'i','n','t','e','r','f','a','c','e','2',0};
1780 static OLECHAR interface3W
[] = {'i','n','t','e','r','f','a','c','e','3',0};
1781 static OLECHAR dualW
[] = {'d','u','a','l',0};
1782 static OLECHAR coclassW
[] = {'c','o','c','l','a','s','s',0};
1783 static const WCHAR defaultW
[] = {'d','e','f','a','u','l','t',0x3213,0};
1784 static OLECHAR func1W
[] = {'f','u','n','c','1',0};
1785 static OLECHAR func2W
[] = {'f','u','n','c','2',0};
1786 static OLECHAR prop1W
[] = {'P','r','o','p','1',0};
1787 static OLECHAR param1W
[] = {'p','a','r','a','m','1',0};
1788 static OLECHAR param2W
[] = {'p','a','r','a','m','2',0};
1789 static OLECHAR asdfW
[] = {'A','s','d','f',0};
1790 static OLECHAR aliasW
[] = {'a','l','i','a','s',0};
1791 static OLECHAR invokeW
[] = {'I','n','v','o','k','e',0};
1792 static OLECHAR
*names1
[] = {func1W
, param1W
, param2W
};
1793 static OLECHAR
*names2
[] = {func2W
, param1W
, param2W
};
1794 static OLECHAR
*propname
[] = {prop1W
, param1W
};
1795 static const GUID tlcustguid
= {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x69}};
1796 static const GUID custguid
= {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x70}};
1797 static const GUID bogusguid
= {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x71}};
1798 static const GUID interfaceguid
= {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
1799 static const GUID interface2guid
= {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcd}};
1801 char filename
[MAX_PATH
];
1802 WCHAR filenameW
[MAX_PATH
];
1803 ICreateTypeLib2
*createtl
;
1804 ICreateTypeInfo
*createti
;
1805 ICreateTypeInfo2
*createti2
;
1806 ITypeLib
*tl
, *stdole
;
1808 ITypeInfo
*interface1
, *interface2
, *dual
, *unknown
, *dispatch
, *ti
;
1809 ITypeInfo
*tinfos
[2];
1811 ITypeComp
*tcomp
, *tcomp2
;
1813 FUNCDESC funcdesc
, *pfuncdesc
;
1814 ELEMDESC elemdesc
[5], *edesc
;
1815 PARAMDESCEX paramdescex
;
1816 TYPEDESC typedesc1
, typedesc2
;
1820 BSTR name
, docstring
, helpfile
, names
[3];
1821 DWORD helpcontext
, ptr_size
, alignment
;
1823 unsigned int cnames
;
1835 trace("testing SYS_WIN32\n");
1837 alignment
= sizeof(void*);
1840 trace("testing SYS_WIN64\n");
1848 trace("CreateTypeLib tests\n");
1850 hres
= LoadTypeLib(wszStdOle2
, &stdole
);
1851 ok(hres
== S_OK
, "got %08x\n", hres
);
1853 hres
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IUnknown
, &unknown
);
1854 ok(hres
== S_OK
, "got %08x\n", hres
);
1856 hres
= ITypeInfo_GetTypeAttr(unknown
, &typeattr
);
1857 ok(hres
== S_OK
, "got %08x\n", hres
);
1858 ok(typeattr
->cbSizeVft
== 3 * sizeof(void*), "Got wrong cbSizeVft: %u\n", typeattr
->cbSizeVft
);
1859 ITypeInfo_ReleaseTypeAttr(unknown
, typeattr
);
1861 hres
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IDispatch
, &dispatch
);
1862 ok(hres
== S_OK
, "got %08x\n", hres
);
1864 GetTempFileNameA(".", "tlb", 0, filename
);
1865 MultiByteToWideChar(CP_ACP
, 0, filename
, -1, filenameW
, MAX_PATH
);
1867 hres
= CreateTypeLib2(sys
, filenameW
, &createtl
);
1868 ok(hres
== S_OK
, "got %08x\n", hres
);
1870 hres
= ICreateTypeLib2_QueryInterface(createtl
, &IID_ITypeLib
, (void**)&tl
);
1871 ok(hres
== S_OK
, "got %08x\n", hres
);
1873 hres
= ITypeLib_GetTypeInfo(tl
, 0, NULL
);
1874 ok(hres
== E_INVALIDARG
, "got 0x%08x\n", hres
);
1876 hres
= ITypeLib_GetTypeInfoType(tl
, 0, &kind
);
1877 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got 0x%08x\n", hres
);
1879 hres
= ITypeLib_GetTypeInfoType(tl
, 0, NULL
);
1880 ok(hres
== E_INVALIDARG
, "got 0x%08x\n", hres
);
1882 hres
= ITypeLib_GetTypeInfoType(tl
, 0, NULL
);
1883 ok(hres
== E_INVALIDARG
, "got 0x%08x\n", hres
);
1885 hres
= ITypeLib_GetLibAttr(tl
, NULL
);
1886 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1888 hres
= ITypeLib_GetLibAttr(tl
, &libattr
);
1889 ok(hres
== S_OK
, "got %08x\n", hres
);
1891 ok(libattr
->syskind
== sys
, "syskind = %d\n", libattr
->syskind
);
1892 ok(libattr
->wMajorVerNum
== 0, "wMajorVer = %d\n", libattr
->wMajorVerNum
);
1893 ok(libattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", libattr
->wMinorVerNum
);
1894 ok(libattr
->wLibFlags
== 0, "wLibFlags = %d\n", libattr
->wLibFlags
);
1896 ITypeLib_ReleaseTLibAttr(tl
, libattr
);
1898 name
= (BSTR
)0xdeadbeef;
1899 hres
= ITypeLib_GetDocumentation(tl
, -1, &name
, &docstring
, &helpcontext
, &helpfile
);
1900 ok(hres
== S_OK
, "got %08x\n", hres
);
1901 ok(name
== NULL
, "name != NULL\n");
1902 ok(docstring
== NULL
, "docstring != NULL\n");
1903 ok(helpcontext
== 0, "helpcontext != 0\n");
1904 ok(helpfile
== NULL
, "helpfile != NULL\n");
1906 hres
= ITypeLib_GetDocumentation(tl
, 0, &name
, NULL
, NULL
, NULL
);
1907 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1909 hres
= ICreateTypeLib2_SetName(createtl
, typelibW
);
1910 ok(hres
== S_OK
, "got %08x\n", hres
);
1912 hres
= ICreateTypeLib2_SetHelpFileName(createtl
, helpfileW
);
1913 ok(hres
== S_OK
, "got %08x\n", hres
);
1915 hres
= ITypeLib_GetDocumentation(tl
, -1, NULL
, NULL
, NULL
, NULL
);
1916 ok(hres
== S_OK
, "got %08x\n", hres
);
1918 hres
= ITypeLib_GetDocumentation(tl
, -1, &name
, NULL
, NULL
, &helpfile
);
1919 ok(hres
== S_OK
, "got %08x\n", hres
);
1920 ok(!memcmp(name
, typelibW
, sizeof(typelibW
)), "name = %s\n", wine_dbgstr_w(name
));
1921 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "helpfile = %s\n", wine_dbgstr_w(helpfile
));
1923 SysFreeString(name
);
1924 SysFreeString(helpfile
);
1926 V_VT(&cust_data
) = VT_I4
;
1927 V_I4(&cust_data
) = 1;
1928 hres
= ICreateTypeLib2_SetCustData(createtl
, &tlcustguid
, &cust_data
);
1929 ok(hres
== S_OK
, "got %08x\n", hres
);
1931 hres
= ITypeLib_QueryInterface(tl
, &IID_ITypeLib2
, (void**)&tl2
);
1932 ok(hres
== S_OK
, "no ITypeLib2 interface (%x)\n", hres
);
1934 V_VT(&cust_data
) = VT_EMPTY
;
1935 V_I4(&cust_data
) = 0;
1936 hres
= ITypeLib2_GetCustData(tl2
, &tlcustguid
, &cust_data
);
1937 ok(hres
== S_OK
, "got %08x\n", hres
);
1938 ok(V_VT(&cust_data
) == VT_I4
, "V_VT(&cust_data) = %d\n", V_VT(&cust_data
));
1939 ok(V_I4(&cust_data
) == 1, "V_I4(&cust_data) = %d\n", V_I4(&cust_data
));
1941 ITypeLib2_Release(tl2
);
1943 /* invalid parameters */
1944 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, NULL
, TKIND_INTERFACE
, &createti
);
1945 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1947 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, NULL
);
1948 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1950 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, NULL
, TKIND_INTERFACE
, NULL
);
1951 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1953 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, &createti
);
1954 ok(hres
== S_OK
, "got %08x\n", hres
);
1956 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&interface1
);
1957 ok(hres
== S_OK
, "got %08x\n", hres
);
1959 hres
= ITypeLib_GetDocumentation(tl
, 0, &name
, NULL
, NULL
, NULL
);
1960 ok(hres
== S_OK
, "got %08x\n", hres
);
1961 ok(!memcmp(name
, interface1W
, sizeof(interface1W
)), "name = %s\n", wine_dbgstr_w(name
));
1963 SysFreeString(name
);
1965 ITypeLib_Release(tl
);
1967 name
= (BSTR
)0xdeadbeef;
1968 helpfile
= (BSTR
)0xdeadbeef;
1969 hres
= ITypeInfo_GetDocumentation(interface1
, -1, &name
, &docstring
, &helpcontext
, &helpfile
);
1970 ok(hres
== S_OK
, "got %08x\n", hres
);
1971 ok(!memcmp(name
, interface1W
, sizeof(interface1W
)), "name = %s\n", wine_dbgstr_w(name
));
1972 ok(docstring
== NULL
, "docstring != NULL\n");
1973 ok(helpcontext
== 0, "helpcontext != 0\n");
1974 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "helpfile = %s\n", wine_dbgstr_w(helpfile
));
1976 SysFreeString(name
);
1977 SysFreeString(helpfile
);
1979 hres
= ITypeInfo_GetDocumentation(interface1
, 0, &name
, NULL
, NULL
, NULL
);
1980 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
1982 hres
= ITypeInfo_GetRefTypeInfo(interface1
, 0, NULL
);
1983 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1986 hres
= ICreateTypeInfo_LayOut(createti
);
1987 ok(hres
== S_OK
, "got %08x\n", hres
);
1989 hres
= ICreateTypeInfo_SetGuid(createti
, &interfaceguid
);
1990 ok(hres
== S_OK
, "got %08x\n", hres
);
1992 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, NULL
, &hreftype
);
1993 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1995 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, unknown
, NULL
);
1996 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
1998 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, unknown
, &hreftype
);
1999 ok(hres
== S_OK
, "got %08x\n", hres
);
2001 skip("Skipping some tests\n");
2005 hres
= ICreateTypeInfo_AddImplType(createti
, 1, hreftype
);
2006 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2008 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2009 ok(hres
== S_OK
, "got %08x\n", hres
);
2011 hres
= ITypeInfo_GetRefTypeOfImplType(interface1
, 0, &hreftype
);
2012 ok(hres
== S_OK
, "got %08x\n", hres
);
2013 ok(hreftype
== 3, "hreftype = %d\n", hreftype
);
2015 hres
= ITypeInfo_GetRefTypeInfo(interface1
, hreftype
, &ti
);
2016 ok(hres
== S_OK
, "got %08x\n", hres
);
2018 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
2019 ok(hres
== S_OK
, "got %08x\n", hres
);
2020 ok(typeattr
->cbSizeVft
== 3 * ptr_size
|| broken(sys
== SYS_WIN32
&& typeattr
->cbSizeVft
== 24) /* xp64 */,
2021 "retrieved IUnknown gave wrong cbSizeVft: %u\n", typeattr
->cbSizeVft
);
2022 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
2024 ITypeInfo_Release(ti
);
2026 hres
= ITypeInfo_GetRefTypeOfImplType(interface1
, -1, &hreftype
);
2027 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2029 ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo2
, (void**)&ti2
);
2031 memset(&funcdesc
, 0, sizeof(FUNCDESC
));
2032 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
2033 funcdesc
.invkind
= INVOKE_PROPERTYGET
;
2034 funcdesc
.callconv
= CC_STDCALL
;
2035 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_BSTR
;
2036 U(funcdesc
.elemdescFunc
).idldesc
.wIDLFlags
= IDLFLAG_NONE
;
2038 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, NULL
);
2039 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2041 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2042 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2044 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2045 ok(hres
== S_OK
, "got %08x\n", hres
);
2047 hres
= ITypeInfo2_GetFuncDesc(ti2
, 0, NULL
);
2048 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2050 hres
= ITypeInfo2_GetFuncDesc(ti2
, 1, &pfuncdesc
);
2051 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2053 hres
= ITypeInfo2_GetFuncDesc(ti2
, 0, &pfuncdesc
);
2054 ok(hres
== S_OK
, "got %08x\n", hres
);
2056 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
2057 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2058 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2059 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2060 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYGET
, "got 0x%x\n", pfuncdesc
->invkind
);
2061 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2062 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
2063 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2064 ok(pfuncdesc
->oVft
== 3 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 24) /* xp64 */,
2065 "got %d\n", pfuncdesc
->oVft
);
2066 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2067 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_BSTR
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2068 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2070 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2072 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 0, 0xabcdefab);
2073 ok(hres
== S_OK
, "got %08x\n", hres
);
2075 funcdesc
.invkind
= INVOKE_PROPERTYPUT
;
2076 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2077 ok(hres
== TYPE_E_INCONSISTENTPROPFUNCS
, "got %08x\n", hres
);
2079 funcdesc
.invkind
= INVOKE_PROPERTYPUTREF
;
2080 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2081 ok(hres
== TYPE_E_INCONSISTENTPROPFUNCS
, "got %08x\n", hres
);
2083 elemdesc
[0].tdesc
.vt
= VT_BSTR
;
2084 U(elemdesc
[0]).idldesc
.dwReserved
= 0;
2085 U(elemdesc
[0]).idldesc
.wIDLFlags
= IDLFLAG_FIN
;
2087 funcdesc
.lprgelemdescParam
= elemdesc
;
2088 funcdesc
.invkind
= INVOKE_PROPERTYPUT
;
2089 funcdesc
.cParams
= 1;
2090 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
2092 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2093 ok(hres
== S_OK
, "got %08x\n", hres
);
2095 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 1, 0xabcdefab);
2096 ok(hres
== S_OK
, "got %08x\n", hres
);
2098 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, propname
, 0);
2099 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2101 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, NULL
, 1);
2102 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2104 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, propname
, 1);
2105 ok(hres
== S_OK
, "got %08x\n", hres
);
2107 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1, propname
, 1);
2108 ok(hres
== S_OK
, "got %08x\n", hres
);
2110 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1, propname
, 2);
2111 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2113 hres
= ITypeInfo2_GetFuncDesc(ti2
, 1, &pfuncdesc
);
2114 ok(hres
== S_OK
, "got %08x\n", hres
);
2116 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
2117 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2118 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2119 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2120 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYPUT
, "got 0x%x\n", pfuncdesc
->invkind
);
2121 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2122 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2123 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2124 ok(pfuncdesc
->oVft
== 4 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 28) /* xp64 */,
2125 "got %d\n", pfuncdesc
->oVft
);
2126 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2127 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2128 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2130 edesc
= pfuncdesc
->lprgelemdescParam
;
2131 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2132 ok(U(*edesc
).idldesc
.wIDLFlags
== IDLFLAG_FIN
, "got: %x\n", U(*edesc
).idldesc
.wIDLFlags
);
2134 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2137 funcdesc
.invkind
= INVOKE_PROPERTYPUTREF
;
2138 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2139 ok(hres
== S_OK
, "got %08x\n", hres
);
2141 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 0, 0xabcdefab);
2142 ok(hres
== S_OK
, "got %08x\n", hres
);
2144 hres
= ICreateTypeInfo_SetFuncHelpContext(createti
, 0, 0x201);
2145 ok(hres
== S_OK
, "got %08x\n", hres
);
2148 funcdesc
.lprgelemdescParam
= NULL
;
2149 funcdesc
.invkind
= INVOKE_FUNC
;
2150 funcdesc
.cParams
= 0;
2151 funcdesc
.cScodes
= 1;
2152 funcdesc
.lprgscode
= NULL
;
2153 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2154 ok(hres
== S_OK
, "got %08x\n", hres
);
2156 hres
= ITypeInfo2_GetFuncDesc(ti2
, 1, &pfuncdesc
);
2157 ok(hres
== S_OK
, "got %08x\n", hres
);
2159 ok(pfuncdesc
->memid
== 1, "got %d\n", pfuncdesc
->memid
);
2160 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2161 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2162 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2163 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2164 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2165 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
2166 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2167 ok(pfuncdesc
->oVft
== 4 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 28), /* xp64 */
2168 "got %d\n", pfuncdesc
->oVft
);
2169 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2170 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2171 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2173 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2175 funcdesc
.memid
= MEMBERID_NIL
;
2176 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 1, &funcdesc
);
2177 ok(hres
== S_OK
, "got %08x\n", hres
);
2179 elemdesc
[0].tdesc
.vt
= VT_PTR
;
2180 U(elemdesc
[0].tdesc
).lptdesc
= &typedesc1
;
2181 typedesc1
.vt
= VT_BSTR
;
2182 funcdesc
.cParams
= 1;
2183 funcdesc
.lprgelemdescParam
= elemdesc
;
2184 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 4, &funcdesc
);
2185 ok(hres
== S_OK
, "got %08x\n", hres
);
2187 hres
= ITypeInfo2_GetFuncDesc(ti2
, 4, &pfuncdesc
);
2188 ok(hres
== S_OK
, "got %08x\n", hres
);
2190 ok(pfuncdesc
->memid
== 0x60010004, "got %x\n", pfuncdesc
->memid
);
2191 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2192 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2193 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2194 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2195 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2196 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2197 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2198 ok(pfuncdesc
->oVft
== 7 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 40) /* xp64 */,
2199 "got %d\n", pfuncdesc
->oVft
);
2200 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2201 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2202 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2204 edesc
= pfuncdesc
->lprgelemdescParam
;
2205 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
2206 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2207 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2208 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
2209 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
2211 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2213 U(elemdesc
[0].tdesc
).lptdesc
= &typedesc2
;
2214 typedesc2
.vt
= VT_PTR
;
2215 U(typedesc2
).lptdesc
= &typedesc1
;
2216 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 4, &funcdesc
);
2217 ok(hres
== S_OK
, "got %08x\n", hres
);
2219 hres
= ITypeInfo2_GetFuncDesc(ti2
, 4, &pfuncdesc
);
2220 ok(hres
== S_OK
, "got %08x\n", hres
);
2222 ok(pfuncdesc
->memid
== 0x60010007, "got %x\n", pfuncdesc
->memid
);
2223 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2224 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2225 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2226 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2227 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2228 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2229 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2230 ok(pfuncdesc
->oVft
== 7 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 40) /* xp64 */,
2231 "got %d\n", pfuncdesc
->oVft
);
2232 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2233 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2234 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2236 edesc
= pfuncdesc
->lprgelemdescParam
;
2237 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
2238 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2239 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2240 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
2241 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_PTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
2242 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
!= NULL
, "got: %p\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
);
2243 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
);
2245 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2247 elemdesc
[0].tdesc
.vt
= VT_INT
;
2248 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2249 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2250 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2251 V_INT(¶mdescex
.varDefaultValue
) = 0x123;
2252 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2253 ok(hres
== S_OK
, "got %08x\n", hres
);
2255 hres
= ITypeInfo2_GetFuncDesc(ti2
, 3, &pfuncdesc
);
2256 ok(hres
== S_OK
, "got %08x\n", hres
);
2258 ok(pfuncdesc
->memid
== 0x60010003, "got %x\n", pfuncdesc
->memid
);
2259 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2260 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2261 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2262 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2263 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2264 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2265 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2266 ok(pfuncdesc
->oVft
== 6 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 36) /* xp64 */,
2267 "got %d\n", pfuncdesc
->oVft
);
2268 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2269 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2270 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2272 edesc
= pfuncdesc
->lprgelemdescParam
;
2273 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
2274 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2275 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2276 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2277 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2278 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
2279 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2280 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x123, "got: 0x%x\n",
2281 V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2283 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2285 U(elemdesc
[0]).idldesc
.dwReserved
= 0;
2286 U(elemdesc
[0]).idldesc
.wIDLFlags
= IDLFLAG_FIN
;
2287 elemdesc
[1].tdesc
.vt
= VT_UI2
;
2288 U(elemdesc
[1]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2289 U(elemdesc
[1]).paramdesc
.pparamdescex
= ¶mdescex
;
2290 V_VT(¶mdescex
.varDefaultValue
) = VT_UI2
;
2291 V_UI2(¶mdescex
.varDefaultValue
) = 0xffff;
2292 funcdesc
.cParams
= 2;
2293 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2294 ok(hres
== S_OK
, "got %08x\n", hres
);
2296 hres
= ITypeInfo2_GetFuncDesc(ti2
, 3, &pfuncdesc
);
2297 ok(hres
== S_OK
, "got %08x\n", hres
);
2299 ok(pfuncdesc
->memid
== 0x60010009, "got %x\n", pfuncdesc
->memid
);
2300 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2301 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2302 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2303 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2304 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2305 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
2306 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2307 ok(pfuncdesc
->oVft
== 6 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 36) /* xp64 */,
2308 "got %d\n", pfuncdesc
->oVft
);
2309 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2310 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2311 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2313 edesc
= pfuncdesc
->lprgelemdescParam
;
2314 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
2315 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2316 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2318 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
2319 ok(edesc
->tdesc
.vt
== VT_UI2
, "got: %d\n", edesc
->tdesc
.vt
);
2320 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2321 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2322 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2323 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2324 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_UI2
, "got: %d\n",
2325 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2326 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFF, "got: 0x%x\n",
2327 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2329 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2331 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2332 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2333 elemdesc
[1].tdesc
.vt
= VT_INT
;
2334 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2335 V_INT(¶mdescex
.varDefaultValue
) = 0xffffffff;
2336 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2337 ok(hres
== S_OK
, "got %08x\n", hres
);
2339 elemdesc
[0].tdesc
.vt
= VT_BSTR
;
2340 elemdesc
[1].tdesc
.vt
= VT_BSTR
;
2341 V_VT(¶mdescex
.varDefaultValue
) = VT_BSTR
;
2342 V_BSTR(¶mdescex
.varDefaultValue
) = SysAllocString(defaultW
);
2343 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 3, &funcdesc
);
2344 ok(hres
== S_OK
, "got %08x\n", hres
);
2345 SysFreeString(V_BSTR(¶mdescex
.varDefaultValue
));
2347 WideCharToMultiByte(CP_ACP
, 0, defaultW
, -1, nameA
, sizeof(nameA
), NULL
, NULL
);
2348 MultiByteToWideChar(CP_ACP
, 0, nameA
, -1, nameW
, sizeof(nameW
)/sizeof(nameW
[0]));
2350 hres
= ITypeInfo2_GetFuncDesc(ti2
, 3, &pfuncdesc
);
2351 ok(hres
== S_OK
, "got %08x\n", hres
);
2353 ok(pfuncdesc
->memid
== 0x6001000b, "got %x\n", pfuncdesc
->memid
);
2354 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2355 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2356 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2357 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2358 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2359 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
2360 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2361 ok(pfuncdesc
->oVft
== 6 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 36) /* xp64 */,
2362 "got %d\n", pfuncdesc
->oVft
);
2363 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2364 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2365 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2367 edesc
= pfuncdesc
->lprgelemdescParam
;
2368 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2369 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2370 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2371 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2372 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2373 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
2374 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2375 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), nameW
),
2377 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
2379 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
2380 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
2381 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "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
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
2384 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
2385 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
2386 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2387 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), nameW
),
2389 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
2391 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2393 elemdesc
[0].tdesc
.vt
= VT_USERDEFINED
;
2394 U(elemdesc
[0].tdesc
).hreftype
= hreftype
;
2395 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2396 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2397 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2398 V_INT(¶mdescex
.varDefaultValue
) = 0x789;
2400 funcdesc
.lprgelemdescParam
= elemdesc
;
2401 funcdesc
.invkind
= INVOKE_FUNC
;
2402 funcdesc
.cParams
= 1;
2403 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
2405 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 5, &funcdesc
);
2406 ok(hres
== S_OK
, "got %08x\n", hres
);
2408 hres
= ITypeInfo2_GetFuncDesc(ti2
, 5, &pfuncdesc
);
2409 ok(hres
== S_OK
, "got %08x\n", hres
);
2411 ok(pfuncdesc
->memid
== 0x60010005, "got %x\n", pfuncdesc
->memid
);
2412 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2413 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2414 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2415 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2416 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2417 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2418 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2419 ok(pfuncdesc
->oVft
== 8 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 44), /* xp64 */
2420 "got %d\n", pfuncdesc
->oVft
);
2421 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2422 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2423 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2425 edesc
= pfuncdesc
->lprgelemdescParam
;
2426 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2427 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
2428 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2429 ok(edesc
->tdesc
.vt
== VT_USERDEFINED
, "got: %d\n", edesc
->tdesc
.vt
);
2430 ok(U(edesc
->tdesc
).hreftype
== hreftype
, "got: 0x%x\n", U(edesc
->tdesc
).hreftype
);
2431 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
2432 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2433 ok(V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x789, "got: %d\n",
2434 V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2436 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2438 elemdesc
[0].tdesc
.vt
= VT_VARIANT
;
2439 U(elemdesc
[0]).paramdesc
.pparamdescex
= ¶mdescex
;
2440 U(elemdesc
[0]).paramdesc
.wParamFlags
= PARAMFLAG_FHASDEFAULT
;
2441 V_VT(¶mdescex
.varDefaultValue
) = VT_INT
;
2442 V_INT(¶mdescex
.varDefaultValue
) = 3;
2444 funcdesc
.lprgelemdescParam
= elemdesc
;
2445 funcdesc
.invkind
= INVOKE_FUNC
;
2446 funcdesc
.cParams
= 1;
2447 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VARIANT
;
2449 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 6, &funcdesc
);
2450 ok(hres
== S_OK
, "got %08x\n", hres
);
2452 hres
= ITypeInfo2_GetFuncDesc(ti2
, 6, &pfuncdesc
);
2453 ok(hres
== S_OK
, "got %08x\n", hres
);
2455 ok(pfuncdesc
->memid
== 0x60010006, "got %x\n", pfuncdesc
->memid
);
2456 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2457 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2458 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2459 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2460 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2461 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2462 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2463 ok(pfuncdesc
->oVft
== 9 * ptr_size
|| broken(sys
== SYS_WIN32
&& pfuncdesc
->oVft
== 48), /* xp64 */
2464 "got %d\n", pfuncdesc
->oVft
);
2465 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2466 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VARIANT
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2467 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2469 edesc
= pfuncdesc
->lprgelemdescParam
;
2470 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
2471 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
2472 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
2473 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
2474 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
2475 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2476 ok(V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 3, "got: %d\n",
2477 V_INT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
2479 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2481 hres
= ITypeInfo_GetDocumentation(interface1
, 0, &name
, &docstring
, &helpcontext
, &helpfile
);
2482 ok(hres
== S_OK
, "got %08x\n", hres
);
2483 ok(name
== NULL
, "name != NULL\n");
2484 ok(docstring
== NULL
, "docstring != NULL\n");
2485 ok(helpcontext
== 0x201, "helpcontext != 0x201\n");
2486 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "helpfile = %s\n", wine_dbgstr_w(helpfile
));
2488 SysFreeString(helpfile
);
2490 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1000, NULL
, 1);
2491 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2493 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 1000, names1
, 1);
2494 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2496 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, names1
, 2);
2497 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2499 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, names2
, 1);
2500 ok(hres
== S_OK
, "got %08x\n", hres
);
2502 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 0, names1
, 1);
2503 ok(hres
== S_OK
, "got %08x\n", hres
);
2505 hres
= ITypeInfo_GetDocumentation(interface1
, 0, &name
, NULL
, NULL
, NULL
);
2506 ok(hres
== S_OK
, "got %08x\n", hres
);
2507 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "name = %s\n", wine_dbgstr_w(name
));
2509 SysFreeString(name
);
2511 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 3, names2
, 3);
2512 ok(hres
== S_OK
, "got %08x\n", hres
);
2514 hres
= ICreateTypeInfo_SetFuncAndParamNames(createti
, 3, names1
, 3);
2515 ok(hres
== TYPE_E_AMBIGUOUSNAME
, "got %08x\n", hres
);
2517 ITypeInfo2_Release(ti2
);
2518 ICreateTypeInfo_Release(createti
);
2520 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface1W
, TKIND_INTERFACE
, &createti
);
2521 ok(hres
== TYPE_E_NAMECONFLICT
, "got %08x\n", hres
);
2523 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface2W
, TKIND_INTERFACE
, &createti
);
2524 ok(hres
== S_OK
, "got %08x\n", hres
);
2526 hres
= ICreateTypeInfo_SetGuid(createti
, &interface2guid
);
2527 ok(hres
== S_OK
, "got %08x\n", hres
);
2529 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&interface2
);
2530 ok(hres
== S_OK
, "got %08x\n", hres
);
2532 hres
= ITypeInfo_GetRefTypeOfImplType(interface2
, 0, &hreftype
);
2533 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2535 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, interface1
, &hreftype
);
2536 ok(hres
== S_OK
, "got %08x\n", hres
);
2538 hres
= ITypeInfo_GetRefTypeInfo(interface2
, 0, &ti
);
2539 ok(hres
== S_OK
, "got %08x\n", hres
);
2540 ok(ti
== interface1
, "Received and added interfaces are different\n");
2542 ITypeInfo_Release(ti
);
2544 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2545 ok(hres
== S_OK
, "got %08x\n", hres
);
2547 hres
= ITypeInfo_GetRefTypeOfImplType(interface2
, 0, &hreftype
);
2548 ok(hres
== S_OK
, "got %08x\n", hres
);
2549 ok(hreftype
== 2, "hreftype = %d\n", hreftype
);
2551 hres
= ITypeInfo_GetRefTypeOfImplType(interface2
, -1, &hreftype
);
2552 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2554 hres
= ICreateTypeInfo_SetImplTypeFlags(createti
, 0, IMPLTYPEFLAG_FDEFAULT
);
2555 ok(hres
== TYPE_E_BADMODULEKIND
, "got %08x\n", hres
);
2557 hres
= ITypeInfo_GetImplTypeFlags(interface2
, 0, &impltypeflags
);
2558 ok(hres
== S_OK
, "got %08x\n", hres
);
2559 ok(impltypeflags
== 0, "impltypeflags = %x\n", impltypeflags
);
2561 hres
= ITypeInfo_GetImplTypeFlags(interface2
, 1, &impltypeflags
);
2562 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2564 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
2565 funcdesc
.oVft
= 0xaaac;
2566 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2567 if(sys
== SYS_WIN64
){
2568 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2569 funcdesc
.oVft
= 0xaab0;
2570 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2572 ok(hres
== S_OK
, "got %08x\n", hres
);
2573 funcdesc
.oVft
= 0xaaa8;
2574 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2575 ok(hres
== S_OK
, "got %08x\n", hres
);
2577 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&ti2
);
2578 ok(hres
== S_OK
, "got %08x\n", hres
);
2580 hres
= ITypeInfo2_GetFuncDesc(ti2
, 0, &pfuncdesc
);
2581 ok(hres
== S_OK
, "got %08x\n", hres
);
2583 ok(pfuncdesc
->memid
== 0x60020000, "got %x\n", pfuncdesc
->memid
);
2584 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
2585 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
2586 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
2587 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
2588 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
2589 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
2590 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
2591 ok(pfuncdesc
->oVft
== (short)0xaaa8, "got %d\n", pfuncdesc
->oVft
);
2592 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
2593 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
2594 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
2596 ITypeInfo2_ReleaseFuncDesc(ti2
, pfuncdesc
);
2597 ITypeInfo2_Release(ti2
);
2601 ICreateTypeInfo_Release(createti
);
2603 VariantInit(&cust_data
);
2605 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, interface3W
, TKIND_INTERFACE
, &createti
);
2606 ok(hres
== S_OK
, "got %08x\n", hres
);
2608 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ICreateTypeInfo2
, (void**)&createti2
);
2609 ok(hres
== S_OK
, "got %08x\n", hres
);
2611 hres
= ICreateTypeInfo2_QueryInterface(createti2
, &IID_ITypeInfo2
, (void**)&ti2
);
2612 ok(hres
== S_OK
, "got %08x\n", hres
);
2614 hres
= ITypeInfo2_GetCustData(ti2
, NULL
, NULL
);
2615 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2617 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, NULL
);
2618 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2620 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2621 ok(hres
== S_OK
, "got %08x\n", hres
);
2623 hres
= ICreateTypeInfo2_SetCustData(createti2
, NULL
, NULL
);
2624 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2626 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, NULL
);
2627 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2629 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2630 ok(hres
== DISP_E_BADVARTYPE
, "got %08x\n", hres
);
2632 V_VT(&cust_data
) = VT_UI4
;
2633 V_I4(&cust_data
) = 0xdeadbeef;
2635 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2636 ok(hres
== S_OK
, "got %08x\n", hres
);
2638 V_I4(&cust_data
) = 0;
2639 V_VT(&cust_data
) = VT_EMPTY
;
2641 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2642 ok(hres
== S_OK
, "got %08x\n", hres
);
2644 ok(V_VT(&cust_data
) == VT_UI4
, "got %d\n", V_VT(&cust_data
));
2645 ok(V_I4(&cust_data
) == 0xdeadbeef, "got 0x%08x\n", V_I4(&cust_data
));
2647 V_VT(&cust_data
) = VT_UI4
;
2648 V_I4(&cust_data
) = 12345678;
2650 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2651 ok(hres
== S_OK
, "got %08x\n", hres
);
2653 V_I4(&cust_data
) = 0;
2654 V_VT(&cust_data
) = VT_EMPTY
;
2656 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2657 ok(hres
== S_OK
, "got %08x\n", hres
);
2659 ok(V_VT(&cust_data
) == VT_UI4
, "got %d\n", V_VT(&cust_data
));
2660 ok(V_I4(&cust_data
) == 12345678, "got 0x%08x\n", V_I4(&cust_data
));
2662 V_VT(&cust_data
) = VT_BSTR
;
2663 V_BSTR(&cust_data
) = SysAllocString(asdfW
);
2665 hres
= ICreateTypeInfo2_SetCustData(createti2
, &custguid
, &cust_data
);
2666 ok(hres
== S_OK
, "got %08x\n", hres
);
2668 SysFreeString(V_BSTR(&cust_data
));
2669 V_I4(&cust_data
) = 0;
2670 V_VT(&cust_data
) = VT_EMPTY
;
2672 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
2673 ok(hres
== S_OK
, "got %08x\n", hres
);
2675 ok(V_VT(&cust_data
) == VT_BSTR
, "got %d\n", V_VT(&cust_data
));
2676 ok(!lstrcmpW(V_BSTR(&cust_data
), asdfW
), "got %s\n", wine_dbgstr_w(V_BSTR(&cust_data
)));
2677 SysFreeString(V_BSTR(&cust_data
));
2679 V_VT(&cust_data
) = VT_UI4
;
2680 V_UI4(&cust_data
) = 17;
2682 hres
= ITypeInfo2_GetCustData(ti2
, &bogusguid
, &cust_data
);
2683 ok(hres
== S_OK
, "got %08x\n", hres
);
2685 ok(V_VT(&cust_data
) == VT_EMPTY
, "got: %d\n", V_VT(&cust_data
));
2687 ITypeInfo2_Release(ti2
);
2688 ICreateTypeInfo2_Release(createti2
);
2689 ICreateTypeInfo_Release(createti
);
2691 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, coclassW
, TKIND_COCLASS
, &createti
);
2692 ok(hres
== S_OK
, "got %08x\n", hres
);
2694 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, interface1
, &hreftype
);
2695 ok(hres
== S_OK
, "got %08x\n", hres
);
2697 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2698 ok(hres
== S_OK
, "got %08x\n", hres
);
2700 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2701 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2703 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, unknown
, &hreftype
);
2704 ok(hres
== S_OK
, "got %08x\n", hres
);
2706 hres
= ICreateTypeInfo_AddImplType(createti
, 1, hreftype
);
2707 ok(hres
== S_OK
, "got %08x\n", hres
);
2709 hres
= ICreateTypeInfo_AddImplType(createti
, 1, hreftype
);
2710 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2712 hres
= ICreateTypeInfo_AddImplType(createti
, 2, hreftype
);
2713 ok(hres
== S_OK
, "got %08x\n", hres
);
2715 hres
= ICreateTypeInfo_SetImplTypeFlags(createti
, 0, IMPLTYPEFLAG_FDEFAULT
);
2716 ok(hres
== S_OK
, "got %08x\n", hres
);
2718 hres
= ICreateTypeInfo_SetImplTypeFlags(createti
, 1, IMPLTYPEFLAG_FRESTRICTED
);
2719 ok(hres
== S_OK
, "got %08x\n", hres
);
2721 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&ti
);
2722 ok(hres
== S_OK
, "got %08x\n", hres
);
2724 hres
= ITypeInfo_GetImplTypeFlags(ti
, 0, NULL
);
2725 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2727 hres
= ITypeInfo_GetImplTypeFlags(ti
, 0, &impltypeflags
);
2728 ok(hres
== S_OK
, "got %08x\n", hres
);
2729 ok(impltypeflags
== IMPLTYPEFLAG_FDEFAULT
, "impltypeflags = %x\n", impltypeflags
);
2731 hres
= ITypeInfo_GetImplTypeFlags(ti
, 1, &impltypeflags
);
2732 ok(hres
== S_OK
, "got %08x\n", hres
);
2733 ok(impltypeflags
== IMPLTYPEFLAG_FRESTRICTED
, "impltypeflags = %x\n", impltypeflags
);
2735 hres
= ITypeInfo_GetImplTypeFlags(ti
, 2, &impltypeflags
);
2736 ok(hres
== S_OK
, "got %08x\n", hres
);
2737 ok(impltypeflags
== 0, "impltypeflags = %x\n", impltypeflags
);
2739 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
2740 ok(hres
== S_OK
, "got %08x\n", hres
);
2741 ok(hreftype
== 0, "hreftype = %d\n", hreftype
);
2743 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 1, &hreftype
);
2744 ok(hres
== S_OK
, "got %08x\n", hres
);
2745 ok(hreftype
== 1, "hreftype = %d\n", hreftype
);
2747 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 2, &hreftype
);
2748 ok(hres
== S_OK
, "got %08x\n", hres
);
2749 ok(hreftype
== 1, "hreftype = %d\n", hreftype
);
2751 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, -1, &hreftype
);
2752 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
2754 ITypeInfo_Release(ti
);
2756 ICreateTypeInfo_Release(createti
);
2758 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, dualW
, TKIND_INTERFACE
, &createti
);
2759 ok(hres
== S_OK
, "got %08x\n", hres
);
2761 hres
= ICreateTypeInfo_SetTypeFlags(createti
, TYPEFLAG_FDUAL
);
2762 ok(hres
== S_OK
, "got %08x\n", hres
);
2764 hres
= ICreateTypeInfo_AddFuncDesc(createti
, 0, &funcdesc
);
2765 ok(hres
== S_OK
, "got %08x\n", hres
);
2767 hres
= ICreateTypeInfo_AddRefTypeInfo(createti
, dispatch
, &hreftype
);
2768 ok(hres
== S_OK
, "got %08x\n", hres
);
2770 hres
= ICreateTypeInfo_AddImplType(createti
, 0, hreftype
);
2771 ok(hres
== S_OK
, "got %08x\n", hres
);
2773 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&dual
);
2774 ok(hres
== S_OK
, "got %08x\n", hres
);
2776 hres
= ITypeInfo_GetTypeAttr(dual
, &typeattr
);
2777 ok(hres
== S_OK
, "got %08x\n", hres
);
2778 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2779 ok(typeattr
->typekind
== 3, "typekind = %d\n", typeattr
->typekind
);
2780 ok(typeattr
->cFuncs
== 1, "cFuncs = %d\n", typeattr
->cFuncs
);
2781 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2782 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2783 ok(typeattr
->cbSizeVft
== 8 * ptr_size
|| broken(sys
== SYS_WIN32
&& typeattr
->cbSizeVft
== 7 * sizeof(void *) + 4), /* xp64 */
2784 "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2785 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2786 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2787 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2788 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2790 ITypeInfo_ReleaseTypeAttr(dual
, typeattr
);
2792 hres
= ITypeInfo_GetRefTypeOfImplType(dual
, -1, &hreftype
);
2793 ok(hres
== S_OK
, "got %08x\n", hres
);
2794 ok(hreftype
== -2, "got %08x\n", hreftype
);
2796 hres
= ITypeInfo_GetRefTypeInfo(dual
, -2, &ti
);
2797 ok(hres
== S_OK
, "got %08x\n", hres
);
2799 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
2800 ok(hres
== S_OK
, "got %08x\n", hres
);
2801 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2802 ok(typeattr
->typekind
== 4, "typekind = %d\n", typeattr
->typekind
);
2803 ok(typeattr
->cFuncs
== 8, "cFuncs = %d\n", typeattr
->cFuncs
);
2804 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2805 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2806 ok(typeattr
->cbSizeVft
== 7 * sizeof(void *), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2807 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2808 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
), "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2809 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2810 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2812 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
2814 ITypeInfo_Release(ti
);
2816 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, &typedesc1
);
2817 ok(hres
== TYPE_E_BADMODULEKIND
, "got %08x\n", hres
);
2819 ICreateTypeInfo_Release(createti
);
2821 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
2822 ok(hres
== S_OK
, "got %08x\n", hres
);
2823 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2824 ok(typeattr
->typekind
== 3, "typekind = %d\n", typeattr
->typekind
);
2825 ok(typeattr
->cFuncs
== 13, "cFuncs = %d\n", typeattr
->cFuncs
);
2826 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2827 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2828 ok(typeattr
->cbSizeVft
== 16 * ptr_size
|| broken(sys
== SYS_WIN32
&& typeattr
->cbSizeVft
== 3 * sizeof(void *) + 52), /* xp64 */
2829 "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2830 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2831 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2832 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2833 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2835 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
2837 hres
= ITypeInfo_GetTypeAttr(interface2
, &typeattr
);
2838 ok(hres
== S_OK
, "got %08x\n", hres
);
2839 ok(typeattr
->cbSizeInstance
== ptr_size
, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2840 ok(typeattr
->typekind
== 3, "typekind = %d\n", typeattr
->typekind
);
2841 ok(typeattr
->cFuncs
== 2, "cFuncs = %d\n", typeattr
->cFuncs
);
2842 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2843 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2844 ok((sys
== SYS_WIN32
&& typeattr
->cbSizeVft
== 0xaab0) ||
2845 (sys
== SYS_WIN64
&& typeattr
->cbSizeVft
== 0xaab8),
2846 "cbSizeVft = 0x%x\n", typeattr
->cbSizeVft
);
2847 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2848 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2849 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2850 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2852 ITypeInfo_ReleaseTypeAttr(interface2
, typeattr
);
2854 ok(ITypeInfo_Release(interface2
)==0, "Object should be freed\n");
2855 ok(ITypeInfo_Release(interface1
)==0, "Object should be freed\n");
2856 ok(ITypeInfo_Release(dual
)==0, "Object should be freed\n");
2858 hres
= ICreateTypeLib2_CreateTypeInfo(createtl
, aliasW
, TKIND_ALIAS
, &createti
);
2859 ok(hres
== S_OK
, "got %08x\n", hres
);
2861 hres
= ICreateTypeInfo_QueryInterface(createti
, &IID_ITypeInfo
, (void**)&interface1
);
2862 ok(hres
== S_OK
, "got %08x\n", hres
);
2865 /* windows gives invalid values here, and even breaks the typeinfo permanently
2866 * on winxp. only call GetTypeAttr() on a TKIND_ALIAS after SetTypeDescAlias. */
2867 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
2868 ok(hres
== S_OK
, "got %08x\n", hres
);
2869 ok(typeattr
->cbSizeInstance
== 0xffffffb4, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2870 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
2871 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
2872 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2873 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2874 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2875 ok(typeattr
->cbAlignment
== 0, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2876 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2877 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2878 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2879 ok(typeattr
->tdescAlias
.vt
== VT_EMPTY
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
2880 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
2883 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, NULL
);
2884 ok(hres
== E_INVALIDARG
, "got %08x\n", hres
);
2886 typedesc1
.vt
= VT_I1
;
2887 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, &typedesc1
);
2888 ok(hres
== S_OK
, "got %08x\n", hres
);
2890 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
2891 ok(hres
== S_OK
, "got %08x\n", hres
);
2892 ok(typeattr
->cbSizeInstance
== 1, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2893 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
2894 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
2895 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2896 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2897 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2898 ok(typeattr
->cbAlignment
== 1, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2899 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2900 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2901 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2902 ok(typeattr
->tdescAlias
.vt
== VT_I1
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
2903 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
2905 typedesc1
.vt
= VT_R8
;
2906 hres
= ICreateTypeInfo_SetTypeDescAlias(createti
, &typedesc1
);
2907 ok(hres
== S_OK
, "got %08x\n", hres
);
2909 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
2910 ok(hres
== S_OK
, "got %08x\n", hres
);
2911 ok(typeattr
->cbSizeInstance
== 8, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
2912 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
2913 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
2914 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
2915 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
2916 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
2917 ok(typeattr
->cbAlignment
== 4, "cbAlignment = %d\n", typeattr
->cbAlignment
);
2918 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
2919 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
2920 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
2921 ok(typeattr
->tdescAlias
.vt
== VT_R8
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
2922 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
2924 ITypeInfo_Release(interface1
);
2925 ICreateTypeInfo_Release(createti
);
2927 hres
= ICreateTypeLib2_SaveAllChanges(createtl
);
2928 ok(hres
== S_OK
, "got %08x\n", hres
);
2930 ok(ICreateTypeLib2_Release(createtl
)==0, "Object should be freed\n");
2932 ok(ITypeInfo_Release(dispatch
)==0, "Object should be freed\n");
2933 ok(ITypeInfo_Release(unknown
)==0, "Object should be freed\n");
2934 ok(ITypeLib_Release(stdole
)==0, "Object should be freed\n");
2936 hres
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &tl
);
2937 ok(hres
== S_OK
, "got %08x\n", hres
);
2939 hres
= ITypeLib_GetLibAttr(tl
, &libattr
);
2940 ok(hres
== S_OK
, "got %08x\n", hres
);
2941 ok(libattr
->syskind
== sys
, "syskind = %d\n", libattr
->syskind
);
2942 ok(libattr
->wMajorVerNum
== 0, "wMajorVer = %d\n", libattr
->wMajorVerNum
);
2943 ok(libattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", libattr
->wMinorVerNum
);
2944 ok(libattr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "wLibFlags = %d\n", libattr
->wLibFlags
);
2945 ITypeLib_ReleaseTLibAttr(tl
, libattr
);
2948 memset(tinfos
, 0, sizeof(tinfos
));
2949 memids
[0] = 0xdeadbeef;
2950 memids
[1] = 0xdeadbeef;
2951 hres
= ITypeLib_FindName(tl
, param1W
, 0, tinfos
, memids
, &found
);
2952 ok(hres
== S_OK
, "got: %08x\n", hres
);
2953 ok(found
== 0, "got wrong count: %u\n", found
);
2954 ok(tinfos
[0] == NULL
, "got invalid typeinfo[0]\n");
2955 ok(tinfos
[1] == NULL
, "got invalid typeinfo[1]\n");
2956 ok(memids
[0] == 0xdeadbeef, "got invalid memid[0]\n");
2957 ok(memids
[1] == 0xdeadbeef, "got invalid memid[1]\n");
2960 memset(tinfos
, 0, sizeof(tinfos
));
2961 memids
[0] = 0xdeadbeef;
2962 memids
[1] = 0xdeadbeef;
2963 hres
= ITypeLib_FindName(tl
, func1W
, 0, tinfos
, memids
, &found
);
2964 ok(hres
== S_OK
, "got: %08x\n", hres
);
2965 ok(found
== 1, "got wrong count: %u\n", found
);
2966 ok(tinfos
[0] != NULL
, "got invalid typeinfo[0]\n");
2967 ok(tinfos
[1] == NULL
, "got invalid typeinfo[1]\n");
2968 ok(memids
[0] == 0, "got invalid memid[0]\n");
2969 ok(memids
[1] == 0xdeadbeef, "got invalid memid[1]\n");
2971 ITypeInfo_Release(tinfos
[0]);
2974 memset(tinfos
, 0, sizeof(tinfos
));
2975 memids
[0] = 0xdeadbeef;
2976 memids
[1] = 0xdeadbeef;
2977 hres
= ITypeLib_FindName(tl
, interface1W
, 0, tinfos
, memids
, &found
);
2978 ok(hres
== S_OK
, "got: %08x\n", hres
);
2979 ok(found
== 1, "got wrong count: %u\n", found
);
2980 ok(tinfos
[0] != NULL
, "got invalid typeinfo[0]\n");
2981 ok(tinfos
[1] == NULL
, "got invalid typeinfo[1]\n");
2982 ok(memids
[0] == MEMBERID_NIL
, "got invalid memid[0]: %x\n", memids
[0]);
2983 ok(memids
[1] == 0xdeadbeef, "got invalid memid[1]\n");
2985 ITypeInfo_Release(tinfos
[0]);
2987 hres
= ITypeLib_GetDocumentation(tl
, -1, &name
, &docstring
, &helpcontext
, &helpfile
);
2988 ok(hres
== S_OK
, "got %08x\n", hres
);
2989 ok(memcmp(typelibW
, name
, sizeof(typelibW
)) == 0, "got wrong typelib name: %s\n",
2990 wine_dbgstr_w(name
));
2991 ok(docstring
== NULL
, "got wrong docstring: %s\n", wine_dbgstr_w(docstring
));
2992 ok(helpcontext
== 0, "got wrong helpcontext: 0x%x\n", helpcontext
);
2993 ok(memcmp(helpfileW
, helpfile
, sizeof(helpfileW
)) == 0,
2994 "got wrong helpfile: %s\n", wine_dbgstr_w(helpfile
));
2995 SysFreeString(name
);
2996 SysFreeString(helpfile
);
2998 hres
= ITypeLib_GetDocumentation(tl
, 0, &name
, &docstring
, &helpcontext
, &helpfile
);
2999 ok(hres
== S_OK
, "got %08x\n", hres
);
3000 ok(memcmp(interface1W
, name
, sizeof(interface1W
)) == 0, "got wrong typeinfo name: %s\n",
3001 wine_dbgstr_w(name
));
3002 ok(docstring
== NULL
, "got wrong docstring: %s\n", wine_dbgstr_w(docstring
));
3003 ok(helpcontext
== 0, "got wrong helpcontext: 0x%x\n", helpcontext
);
3004 ok(memcmp(helpfileW
, helpfile
, sizeof(helpfileW
)) == 0,
3005 "got wrong helpfile: %s\n", wine_dbgstr_w(helpfile
));
3006 SysFreeString(name
);
3007 SysFreeString(helpfile
);
3009 hres
= ITypeLib_QueryInterface(tl
, &IID_ITypeLib2
, (void**)&tl2
);
3010 ok(hres
== S_OK
, "no ITypeLib2 interface (%x)\n", hres
);
3011 V_VT(&cust_data
) = VT_EMPTY
;
3012 V_I4(&cust_data
) = 0;
3013 hres
= ITypeLib2_GetCustData(tl2
, &tlcustguid
, &cust_data
);
3014 ok(hres
== S_OK
, "got %08x\n", hres
);
3015 ok(V_VT(&cust_data
) == VT_I4
, "V_VT(&cust_data) = %d\n", V_VT(&cust_data
));
3016 ok(V_I4(&cust_data
) == 1, "V_I4(&cust_data) = %d\n", V_I4(&cust_data
));
3017 ITypeLib2_Release(tl2
);
3019 hres
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
3020 ok(hres
== S_OK
, "got %08x\n", hres
);
3022 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3023 ok(hres
== S_OK
, "got %08x\n", hres
);
3024 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3025 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3026 ok(typeattr
->cFuncs
== 13, "cFuncs = %d\n", typeattr
->cFuncs
);
3027 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3028 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3029 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3030 ok(typeattr
->cbSizeVft
== 16 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3031 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3032 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3033 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3034 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3035 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3037 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
3038 ok(hres
== S_OK
, "got %08x\n", hres
);
3039 ok(hreftype
== 3, "hreftype = %d\n", hreftype
);
3041 hres
= ITypeInfo_GetRefTypeInfo(ti
, hreftype
, &unknown
);
3042 ok(hres
== S_OK
, "got %08x\n", hres
);
3044 hres
= ITypeInfo_GetTypeAttr(unknown
, &typeattr
);
3045 ok(hres
== S_OK
, "got %08x\n", hres
);
3046 ok(IsEqualGUID(&typeattr
->guid
, &IID_IUnknown
), "got wrong reftypeinfo\n");
3047 ITypeInfo_ReleaseTypeAttr(unknown
, typeattr
);
3049 ITypeInfo_Release(unknown
);
3051 hres
= ITypeInfo_GetFuncDesc(ti
, 0, &pfuncdesc
);
3052 ok(hres
== S_OK
, "got %08x\n", hres
);
3053 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
3054 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3055 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3056 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3057 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYPUTREF
, "got 0x%x\n", pfuncdesc
->invkind
);
3058 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3059 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3060 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3061 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3062 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3063 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3064 edesc
= pfuncdesc
->lprgelemdescParam
;
3065 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
3066 ok(U(*edesc
).idldesc
.wIDLFlags
== IDLFLAG_FIN
, "got: %x\n", U(*edesc
).idldesc
.wIDLFlags
);
3068 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3069 ok(hres
== S_OK
, "got: %08x\n", hres
);
3070 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "got name: %s\n", wine_dbgstr_w(name
));
3071 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3072 ok(helpcontext
== 0x201, "got helpcontext: 0x%x\n", helpcontext
);
3073 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3074 SysFreeString(name
);
3075 SysFreeString(helpfile
);
3077 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, NULL
, 0, &cnames
);
3078 ok(hres
== E_INVALIDARG
, "got: %08x\n", hres
);
3081 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, 0, &cnames
);
3082 ok(hres
== S_OK
, "got: %08x\n", hres
);
3083 ok(cnames
== 0, "got: %u\n", cnames
);
3085 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, sizeof(names
) / sizeof(*names
), &cnames
);
3086 ok(hres
== S_OK
, "got: %08x\n", hres
);
3087 ok(cnames
== 1, "got: %u\n", cnames
);
3088 ok(!memcmp(names
[0], func1W
, sizeof(func1W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3089 SysFreeString(names
[0]);
3091 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3093 hres
= ITypeInfo_GetFuncDesc(ti
, 1, &pfuncdesc
);
3094 ok(hres
== S_OK
, "got %08x\n", hres
);
3095 ok(pfuncdesc
->memid
== 0x60010001, "got %x\n", pfuncdesc
->memid
);
3096 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3097 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3098 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3099 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3100 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3101 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
3102 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3103 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3104 ok(pfuncdesc
->oVft
== 4 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3105 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3106 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3107 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3109 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3110 ok(hres
== S_OK
, "got: %08x\n", hres
);
3111 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3112 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3113 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3114 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3115 SysFreeString(helpfile
);
3116 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3118 hres
= ITypeInfo_GetFuncDesc(ti
, 2, &pfuncdesc
);
3119 ok(hres
== S_OK
, "got %08x\n", hres
);
3120 ok(pfuncdesc
->memid
== 0x1, "got %x\n", pfuncdesc
->memid
);
3121 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3122 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3123 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3124 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3125 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3126 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
3127 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3128 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3129 ok(pfuncdesc
->oVft
== 5 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3130 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3131 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3132 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3134 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3135 ok(hres
== S_OK
, "got: %08x\n", hres
);
3136 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3137 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3138 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3139 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3140 SysFreeString(helpfile
);
3141 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3143 hres
= ITypeInfo_GetFuncDesc(ti
, 3, &pfuncdesc
);
3144 ok(hres
== S_OK
, "got %08x\n", hres
);
3145 ok(pfuncdesc
->memid
== 0x6001000b, "got %x\n", pfuncdesc
->memid
);
3146 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3147 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3148 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3149 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3150 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3151 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
3152 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3153 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3154 ok(pfuncdesc
->oVft
== 6 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3155 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3156 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3157 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3159 edesc
= pfuncdesc
->lprgelemdescParam
;
3160 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
3161 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3162 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3163 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3164 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3165 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
3166 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3167 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), nameW
),
3169 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
3171 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
3172 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
3173 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3174 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3175 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3176 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3177 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_BSTR
, "got: %d\n",
3178 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3179 ok(!lstrcmpW(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
), nameW
),
3181 wine_dbgstr_w(V_BSTR(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
)));
3183 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3184 ok(hres
== S_OK
, "got: %08x\n", hres
);
3185 ok(!memcmp(name
, func2W
, sizeof(func2W
)), "got name: %s\n", wine_dbgstr_w(name
));
3186 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3187 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3188 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3189 SysFreeString(name
);
3190 SysFreeString(helpfile
);
3192 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, sizeof(names
) / sizeof(*names
), &cnames
);
3193 ok(hres
== S_OK
, "got: %08x\n", hres
);
3194 ok(cnames
== 3, "got: %u\n", cnames
);
3195 ok(!memcmp(names
[0], func2W
, sizeof(func2W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3196 ok(!memcmp(names
[1], param1W
, sizeof(func2W
)), "got names[1]: %s\n", wine_dbgstr_w(names
[1]));
3197 ok(!memcmp(names
[2], param2W
, sizeof(func2W
)), "got names[2]: %s\n", wine_dbgstr_w(names
[2]));
3198 SysFreeString(names
[0]);
3199 SysFreeString(names
[1]);
3200 SysFreeString(names
[2]);
3201 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3203 hres
= ITypeInfo_GetFuncDesc(ti
, 4, &pfuncdesc
);
3204 ok(hres
== S_OK
, "got %08x\n", hres
);
3205 ok(pfuncdesc
->memid
== 0x6001000c, "got %x\n", pfuncdesc
->memid
);
3206 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3207 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3208 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3209 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3210 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3211 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
3212 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3213 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3214 ok(pfuncdesc
->oVft
== 7 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3215 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3216 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3217 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3219 edesc
= pfuncdesc
->lprgelemdescParam
;
3220 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3221 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3222 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3223 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3224 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3225 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
3226 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3227 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFFFFFF,
3228 "got: 0x%x\n", V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3230 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
3231 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3232 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3233 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3234 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3235 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3236 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
3237 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3238 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFFFFFF,
3239 "got: 0x%x\n", V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3241 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3242 ok(hres
== S_OK
, "got: %08x\n", hres
);
3243 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3244 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3245 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3246 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3247 SysFreeString(helpfile
);
3248 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3250 hres
= ITypeInfo_GetFuncDesc(ti
, 5, &pfuncdesc
);
3251 ok(hres
== S_OK
, "got %08x\n", hres
);
3252 ok(pfuncdesc
->memid
== 0x60010005, "got %x\n", pfuncdesc
->memid
);
3253 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3254 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3255 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3256 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3257 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3258 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3259 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3260 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3261 ok(pfuncdesc
->oVft
== 8 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3262 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3263 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3264 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3266 edesc
= pfuncdesc
->lprgelemdescParam
;
3267 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3268 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3269 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3270 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3271 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3272 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x789, "got: 0x%x\n",
3273 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3274 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3275 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3276 ok(edesc
->tdesc
.vt
== VT_USERDEFINED
, "got: %d\n", edesc
->tdesc
.vt
);
3277 ok(U(edesc
->tdesc
).hreftype
== hreftype
, "got: 0x%x\n", U(edesc
->tdesc
).hreftype
);
3279 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3280 ok(hres
== S_OK
, "got: %08x\n", hres
);
3281 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3282 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3283 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3284 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3285 SysFreeString(helpfile
);
3286 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3288 hres
= ITypeInfo_GetFuncDesc(ti
, 6, &pfuncdesc
);
3289 ok(hres
== S_OK
, "got %08x\n", hres
);
3290 ok(pfuncdesc
->memid
== 0x60010006, "got %x\n", pfuncdesc
->memid
);
3291 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3292 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3293 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3294 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3295 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3296 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3297 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3298 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3299 ok(pfuncdesc
->oVft
== 9 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3300 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3301 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VARIANT
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3302 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3304 edesc
= pfuncdesc
->lprgelemdescParam
;
3305 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3306 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3307 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3308 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3309 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3310 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x3, "got: 0x%x\n",
3311 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3312 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3313 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3314 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
3315 ok(U(edesc
->tdesc
).hreftype
== 0, "got: 0x%x\n", U(edesc
->tdesc
).hreftype
);
3317 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3318 ok(hres
== S_OK
, "got: %08x\n", hres
);
3319 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3320 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3321 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3322 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3323 SysFreeString(helpfile
);
3324 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3326 hres
= ITypeInfo_GetFuncDesc(ti
, 7, &pfuncdesc
);
3327 ok(hres
== S_OK
, "got %08x\n", hres
);
3328 ok(pfuncdesc
->memid
== 0x60010009, "got %x\n", pfuncdesc
->memid
);
3329 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3330 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3331 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3332 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3333 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3334 ok(pfuncdesc
->cParams
== 2, "got %d\n", pfuncdesc
->cParams
);
3335 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3336 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3337 ok(pfuncdesc
->oVft
== 10 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3338 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3339 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3340 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3342 edesc
= pfuncdesc
->lprgelemdescParam
;
3343 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3344 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3345 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3347 edesc
= pfuncdesc
->lprgelemdescParam
+ 1;
3348 ok(edesc
->tdesc
.vt
== VT_UI2
, "got: %d\n", edesc
->tdesc
.vt
);
3349 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3350 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3351 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3352 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3353 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_UI2
, "got: %d\n",
3354 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3355 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0xFFFF, "got: 0x%x\n",
3356 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3358 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3359 ok(hres
== S_OK
, "got: %08x\n", hres
);
3360 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3361 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3362 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3363 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3364 SysFreeString(helpfile
);
3365 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3367 hres
= ITypeInfo_GetFuncDesc(ti
, 8, &pfuncdesc
);
3368 ok(hres
== S_OK
, "got %08x\n", hres
);
3369 ok(pfuncdesc
->memid
== 0x60010003, "got %x\n", pfuncdesc
->memid
);
3370 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3371 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3372 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3373 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3374 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3375 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3376 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3377 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3378 ok(pfuncdesc
->oVft
== 11 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3379 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3380 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3381 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3383 edesc
= pfuncdesc
->lprgelemdescParam
;
3384 ok(edesc
->tdesc
.vt
== VT_INT
, "got: %d\n", edesc
->tdesc
.vt
);
3385 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3386 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3387 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3388 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3389 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_I4
, "got: %d\n",
3390 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3391 ok(V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x123, "got: 0x%x\n",
3392 V_I4(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3394 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3395 ok(hres
== S_OK
, "got: %08x\n", hres
);
3396 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3397 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3398 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3399 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3400 SysFreeString(helpfile
);
3401 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3403 hres
= ITypeInfo_GetFuncDesc(ti
, 9, &pfuncdesc
);
3404 ok(hres
== S_OK
, "got %08x\n", hres
);
3405 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
3406 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3407 ok(pfuncdesc
->lprgelemdescParam
== NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3408 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3409 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYGET
, "got 0x%x\n", pfuncdesc
->invkind
);
3410 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3411 ok(pfuncdesc
->cParams
== 0, "got %d\n", pfuncdesc
->cParams
);
3412 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3413 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3414 ok(pfuncdesc
->oVft
== 12 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3415 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3416 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_BSTR
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3417 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3419 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3420 ok(hres
== S_OK
, "got: %08x\n", hres
);
3421 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "got name: %s\n", wine_dbgstr_w(name
));
3422 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3423 ok(helpcontext
== 0x201, "got helpcontext: 0x%x\n", helpcontext
);
3424 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3425 SysFreeString(name
);
3426 SysFreeString(helpfile
);
3428 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, sizeof(names
) / sizeof(*names
), &cnames
);
3429 ok(hres
== S_OK
, "got: %08x\n", hres
);
3430 ok(cnames
== 1, "got: %u\n", cnames
);
3431 ok(!memcmp(names
[0], func1W
, sizeof(func1W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3432 SysFreeString(names
[0]);
3433 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3435 hres
= ITypeInfo_GetFuncDesc(ti
, 10, &pfuncdesc
);
3436 ok(hres
== S_OK
, "got %08x\n", hres
);
3437 ok(pfuncdesc
->memid
== 0x60010007, "got %x\n", pfuncdesc
->memid
);
3438 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3439 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3440 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3441 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3442 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3443 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3444 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3445 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3446 ok(pfuncdesc
->oVft
== 13 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3447 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3448 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3449 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3451 edesc
= pfuncdesc
->lprgelemdescParam
;
3452 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
3453 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3454 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3455 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3456 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_PTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
3457 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
!= NULL
, "got: %p\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
);
3458 ok(U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(*U(edesc
->tdesc
).lptdesc
).lptdesc
->vt
);
3460 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3461 ok(hres
== S_OK
, "got: %08x\n", hres
);
3462 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3463 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3464 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3465 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3466 SysFreeString(helpfile
);
3467 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3469 hres
= ITypeInfo_GetFuncDesc(ti
, 11, &pfuncdesc
);
3470 ok(hres
== S_OK
, "got %08x\n", hres
);
3471 ok(pfuncdesc
->memid
== 0x60010004, "got %x\n", pfuncdesc
->memid
);
3472 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3473 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3474 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3475 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3476 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3477 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3478 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3479 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3480 ok(pfuncdesc
->oVft
== 14 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3481 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3482 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3483 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3485 edesc
= pfuncdesc
->lprgelemdescParam
;
3486 ok(edesc
->tdesc
.vt
== VT_PTR
, "got: %d\n", edesc
->tdesc
.vt
);
3487 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FIN
, "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3488 ok(U(*edesc
).paramdesc
.pparamdescex
== NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3489 ok(U(edesc
->tdesc
).lptdesc
!= NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3490 ok(U(edesc
->tdesc
).lptdesc
->vt
== VT_BSTR
, "got: %d\n", U(edesc
->tdesc
).lptdesc
->vt
);
3492 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3493 ok(hres
== S_OK
, "got: %08x\n", hres
);
3494 ok(name
== NULL
, "got name: %s\n", wine_dbgstr_w(name
));
3495 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3496 ok(helpcontext
== 0, "got helpcontext: 0x%x\n", helpcontext
);
3497 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3498 SysFreeString(helpfile
);
3499 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3501 hres
= ITypeInfo_GetFuncDesc(ti
, 12, &pfuncdesc
);
3502 ok(hres
== S_OK
, "got %08x\n", hres
);
3503 ok(pfuncdesc
->memid
== 0, "got %x\n", pfuncdesc
->memid
);
3504 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3505 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3506 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3507 ok(pfuncdesc
->invkind
== INVOKE_PROPERTYPUT
, "got 0x%x\n", pfuncdesc
->invkind
);
3508 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3509 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3510 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3511 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3512 ok(pfuncdesc
->oVft
== 15 * sizeof(void*), "got %d\n", pfuncdesc
->oVft
);
3513 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3514 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3515 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3517 edesc
= pfuncdesc
->lprgelemdescParam
;
3518 ok(edesc
->tdesc
.vt
== VT_BSTR
, "got: %d\n", edesc
->tdesc
.vt
);
3519 ok(U(*edesc
).idldesc
.wIDLFlags
== IDLFLAG_FIN
, "got: %x\n", U(*edesc
).idldesc
.wIDLFlags
);
3521 hres
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &name
, &docstring
, &helpcontext
, &helpfile
);
3522 ok(hres
== S_OK
, "got: %08x\n", hres
);
3523 ok(!memcmp(name
, func1W
, sizeof(func1W
)), "got name: %s\n", wine_dbgstr_w(name
));
3524 ok(docstring
== NULL
, "got docstring: %s\n", wine_dbgstr_w(docstring
));
3525 ok(helpcontext
== 0x201, "got helpcontext: 0x%x\n", helpcontext
);
3526 ok(!memcmp(helpfile
, helpfileW
, sizeof(helpfileW
)), "got helpfile: %s\n", wine_dbgstr_w(helpfile
));
3527 SysFreeString(name
);
3528 SysFreeString(helpfile
);
3530 hres
= ITypeInfo_GetNames(ti
, pfuncdesc
->memid
, names
, sizeof(names
) / sizeof(*names
), &cnames
);
3531 ok(hres
== S_OK
, "got: %08x\n", hres
);
3532 ok(cnames
== 1, "got: %u\n", cnames
);
3533 ok(!memcmp(names
[0], func1W
, sizeof(func1W
)), "got names[0]: %s\n", wine_dbgstr_w(names
[0]));
3534 SysFreeString(names
[0]);
3535 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3537 hres
= ITypeInfo_GetFuncDesc(ti
, 13, &pfuncdesc
);
3538 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
3540 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3542 hres
= ITypeLib_GetTypeInfo(tl
, 1, &ti
);
3543 ok(hres
== S_OK
, "got %08x\n", hres
);
3545 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3546 ok(hres
== S_OK
, "got %08x\n", hres
);
3547 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3548 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3549 ok(typeattr
->cFuncs
== 2, "cFuncs = %d\n", typeattr
->cFuncs
);
3550 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3551 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3552 ok(typeattr
->cbSizeVft
== 0xaab8 || typeattr
->cbSizeVft
== 0xaab0 ||
3553 typeattr
->cbSizeVft
== 0x5560, "cbSizeVft = 0x%x\n", typeattr
->cbSizeVft
);
3554 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3555 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3556 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3557 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3558 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3560 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
3561 ok(hres
== S_OK
, "got %08x\n", hres
);
3563 hres
= ITypeInfo_GetFuncDesc(ti
, 0, &pfuncdesc
);
3564 ok(hres
== S_OK
, "got %08x\n", hres
);
3565 ok(pfuncdesc
->memid
== 0x60020000, "got %x\n", pfuncdesc
->memid
);
3566 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3567 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3568 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3569 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3570 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3571 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3572 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3573 ok(pfuncdesc
->oVft
== 0xffffaaa8 ||
3574 pfuncdesc
->oVft
== 0x5550, "got %x\n", pfuncdesc
->oVft
);
3575 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3576 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3577 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3579 edesc
= pfuncdesc
->lprgelemdescParam
;
3580 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
3581 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3582 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3583 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3584 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3585 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3586 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3587 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3588 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x3, "got: 0x%x\n",
3589 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3590 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3591 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3592 ok(U(edesc
->tdesc
).lptdesc
== NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3593 ok(U(edesc
->tdesc
).hreftype
== 0, "got: %d\n", U(edesc
->tdesc
).hreftype
);
3594 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3596 hres
= ITypeInfo_GetFuncDesc(ti
, 1, &pfuncdesc
);
3597 ok(hres
== S_OK
, "got %08x\n", hres
);
3598 ok(pfuncdesc
->memid
== 0x60020001, "got %x\n", pfuncdesc
->memid
);
3599 ok(pfuncdesc
->lprgscode
== NULL
, "got %p\n", pfuncdesc
->lprgscode
);
3600 ok(pfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", pfuncdesc
->lprgelemdescParam
);
3601 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got 0x%x\n", pfuncdesc
->funckind
);
3602 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", pfuncdesc
->invkind
);
3603 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", pfuncdesc
->callconv
);
3604 ok(pfuncdesc
->cParams
== 1, "got %d\n", pfuncdesc
->cParams
);
3605 ok(pfuncdesc
->cParamsOpt
== 0, "got %d\n", pfuncdesc
->cParamsOpt
);
3606 ok(pfuncdesc
->oVft
== 0xffffaaac ||
3607 pfuncdesc
->oVft
== 0xffffaab0 ||
3608 pfuncdesc
->oVft
== 0x5558, "got %x\n", pfuncdesc
->oVft
);
3609 ok(pfuncdesc
->cScodes
== 0, "got %d\n", pfuncdesc
->cScodes
);
3610 ok(pfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", pfuncdesc
->elemdescFunc
.tdesc
.vt
);
3611 ok(pfuncdesc
->wFuncFlags
== 0, "got 0x%x\n", pfuncdesc
->wFuncFlags
);
3613 edesc
= pfuncdesc
->lprgelemdescParam
;
3614 ok(edesc
->tdesc
.vt
== VT_VARIANT
, "got: %d\n", edesc
->tdesc
.vt
);
3615 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3616 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3617 ok(U(*edesc
).paramdesc
.pparamdescex
!= NULL
, "got: %p\n", U(*edesc
).paramdesc
.pparamdescex
);
3618 ok(U(*edesc
).paramdesc
.pparamdescex
->cBytes
== sizeof(PARAMDESCEX
), "got: %d\n",
3619 U(*edesc
).paramdesc
.pparamdescex
->cBytes
);
3620 ok(V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == VT_INT
, "got: %d\n",
3621 V_VT(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3622 ok(V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
) == 0x3, "got: 0x%x\n",
3623 V_UI2(&U(*edesc
).paramdesc
.pparamdescex
->varDefaultValue
));
3624 ok(U(*edesc
).paramdesc
.wParamFlags
== PARAMFLAG_FHASDEFAULT
,
3625 "got: 0x%x\n", U(*edesc
).paramdesc
.wParamFlags
);
3626 ok(U(edesc
->tdesc
).lptdesc
== NULL
, "got: %p\n", U(edesc
->tdesc
).lptdesc
);
3627 ok(U(edesc
->tdesc
).hreftype
== 0, "got: %d\n", U(edesc
->tdesc
).hreftype
);
3628 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
3630 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3632 hres
= ITypeLib_GetTypeInfo(tl
, 2, &ti
);
3633 ok(hres
== S_OK
, "got %08x\n", hres
);
3635 hres
= ITypeInfo_QueryInterface(ti
, &IID_ITypeInfo2
, (void**)&ti2
);
3636 ok(hres
== S_OK
, "got %08x\n", hres
);
3638 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3639 ok(hres
== S_OK
, "got %08x\n", hres
);
3640 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3641 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3642 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3643 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3644 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3645 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3646 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3647 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3648 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3649 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3650 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3652 VariantClear(&cust_data
);
3653 hres
= ITypeInfo2_GetCustData(ti2
, &custguid
, &cust_data
);
3654 ok(hres
== S_OK
, "got %08x\n", hres
);
3655 ok(V_VT(&cust_data
) == VT_BSTR
, "got wrong custdata type: %u\n", V_VT(&cust_data
));
3656 ok(!lstrcmpW(V_BSTR(&cust_data
), asdfW
), "got wrong custdata value: %s\n", wine_dbgstr_w(V_BSTR(&cust_data
)));
3657 SysFreeString(V_BSTR(&cust_data
));
3659 ITypeInfo2_Release(ti2
);
3660 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3662 hres
= ITypeLib_GetTypeInfo(tl
, 3, &ti
);
3663 ok(hres
== S_OK
, "got %08x\n", hres
);
3665 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3666 ok(hres
== S_OK
, "got %08x\n", hres
);
3667 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3668 ok(typeattr
->typekind
== TKIND_COCLASS
, "typekind = %d\n", typeattr
->typekind
);
3669 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3670 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3671 ok(typeattr
->cImplTypes
== 3, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3672 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3673 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3674 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = %d\n", typeattr
->wTypeFlags
);
3675 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3676 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3677 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3679 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 0, &hreftype
);
3680 ok(hres
== S_OK
, "got %08x\n", hres
);
3681 ok(hreftype
== 0, "got wrong hreftype: %x\n", hreftype
);
3683 hres
= ITypeInfo_GetImplTypeFlags(ti
, 0, &impltypeflags
);
3684 ok(hres
== S_OK
, "got %08x\n", hres
);
3685 ok(impltypeflags
== IMPLTYPEFLAG_FDEFAULT
, "got wrong flag: %x\n", impltypeflags
);
3687 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 1, &hreftype
);
3688 ok(hres
== S_OK
, "got %08x\n", hres
);
3689 ok(hreftype
== 1, "got wrong hreftype: %x\n", hreftype
);
3691 hres
= ITypeInfo_GetImplTypeFlags(ti
, 1, &impltypeflags
);
3692 ok(hres
== S_OK
, "got %08x\n", hres
);
3693 ok(impltypeflags
== IMPLTYPEFLAG_FRESTRICTED
, "got wrong flag: %x\n", impltypeflags
);
3695 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 2, &hreftype
);
3696 ok(hres
== S_OK
, "got %08x\n", hres
);
3697 ok(hreftype
== 1, "got wrong hreftype: %x\n", hreftype
);
3699 hres
= ITypeInfo_GetImplTypeFlags(ti
, 2, &impltypeflags
);
3700 ok(hres
== S_OK
, "got %08x\n", hres
);
3701 ok(impltypeflags
== 0, "got wrong flag: %x\n", impltypeflags
);
3703 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, 3, &hreftype
);
3704 ok(hres
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hres
);
3706 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3708 hres
= ITypeLib_GetTypeInfo(tl
, 4, &ti
);
3709 ok(hres
== S_OK
, "got %08x\n", hres
);
3711 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3712 ok(hres
== S_OK
, "got %08x\n", hres
);
3713 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3714 ok(typeattr
->typekind
== TKIND_DISPATCH
, "typekind = %d\n", typeattr
->typekind
);
3715 ok(typeattr
->cFuncs
== 8, "cFuncs = %d\n", typeattr
->cFuncs
);
3716 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3717 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3718 ok(typeattr
->cbSizeVft
== 7 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3719 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3720 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
), "wTypeFlags = 0x%x\n", typeattr
->wTypeFlags
);
3721 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3722 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3723 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3725 hres
= ITypeInfo_GetTypeComp(ti
, &tcomp
);
3726 ok(hres
== S_OK
, "got %08x\n", hres
);
3728 hres
= ITypeInfo_QueryInterface(ti
, &IID_ITypeComp
, (void**)&tcomp2
);
3729 ok(hres
== S_OK
, "got %08x\n", hres
);
3730 ok(tcomp
== tcomp2
, "got %p, was %p\n", tcomp2
, tcomp
);
3731 ITypeComp_Release(tcomp2
);
3733 hres
= ITypeComp_Bind(tcomp
, invokeW
, 0, INVOKE_FUNC
, &interface1
, &desckind
, &bindptr
);
3734 ok(hres
== S_OK
, "got %08x\n", hres
);
3735 ok(desckind
== DESCKIND_FUNCDESC
, "got wrong desckind: 0x%x\n", desckind
);
3736 ok(bindptr
.lpfuncdesc
->memid
== 0x60010003, "got %x\n", bindptr
.lpfuncdesc
->memid
);
3737 ok(bindptr
.lpfuncdesc
->lprgscode
== NULL
, "got %p\n", bindptr
.lpfuncdesc
->lprgscode
);
3738 ok(bindptr
.lpfuncdesc
->lprgelemdescParam
!= NULL
, "got %p\n", bindptr
.lpfuncdesc
->lprgelemdescParam
);
3739 ok(bindptr
.lpfuncdesc
->funckind
== FUNC_DISPATCH
, "got 0x%x\n", bindptr
.lpfuncdesc
->funckind
);
3740 ok(bindptr
.lpfuncdesc
->invkind
== INVOKE_FUNC
, "got 0x%x\n", bindptr
.lpfuncdesc
->invkind
);
3741 ok(bindptr
.lpfuncdesc
->callconv
== CC_STDCALL
, "got 0x%x\n", bindptr
.lpfuncdesc
->callconv
);
3742 ok(bindptr
.lpfuncdesc
->cParams
== 8, "got %d\n", bindptr
.lpfuncdesc
->cParams
);
3743 ok(bindptr
.lpfuncdesc
->cParamsOpt
== 0, "got %d\n", bindptr
.lpfuncdesc
->cParamsOpt
);
3744 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3745 ok(bindptr
.lpfuncdesc
->oVft
== 6 * sizeof(void*), "got %x\n", bindptr
.lpfuncdesc
->oVft
);
3746 ok(bindptr
.lpfuncdesc
->cScodes
== 0, "got %d\n", bindptr
.lpfuncdesc
->cScodes
);
3747 ok(bindptr
.lpfuncdesc
->elemdescFunc
.tdesc
.vt
== VT_VOID
, "got %d\n", bindptr
.lpfuncdesc
->elemdescFunc
.tdesc
.vt
);
3748 ok(bindptr
.lpfuncdesc
->wFuncFlags
== FUNCFLAG_FRESTRICTED
, "got 0x%x\n", bindptr
.lpfuncdesc
->wFuncFlags
);
3750 ITypeInfo_ReleaseFuncDesc(interface1
, bindptr
.lpfuncdesc
);
3751 ITypeInfo_Release(interface1
);
3752 ITypeComp_Release(tcomp
);
3754 hres
= ITypeInfo_GetRefTypeOfImplType(ti
, -1, &hreftype
);
3755 ok(hres
== S_OK
, "got %08x\n", hres
);
3756 ok(hreftype
== -2, "got wrong hreftype: %x\n", hreftype
);
3758 hres
= ITypeInfo_GetRefTypeInfo(ti
, hreftype
, &interface1
);
3759 ok(hres
== S_OK
, "got %08x\n", hres
);
3761 hres
= ITypeInfo_GetTypeAttr(interface1
, &typeattr
);
3762 ok(hres
== S_OK
, "got %08x\n", hres
);
3763 ok(typeattr
->cbSizeInstance
== sizeof(void*), "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3764 ok(typeattr
->typekind
== TKIND_INTERFACE
, "typekind = %d\n", typeattr
->typekind
);
3765 ok(typeattr
->cFuncs
== 1, "cFuncs = %d\n", typeattr
->cFuncs
);
3766 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3767 ok(typeattr
->cImplTypes
== 1, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3768 todo_wine_if(is_win64
&& sys
== SYS_WIN32
)
3769 ok(typeattr
->cbSizeVft
== 8 * sizeof(void*), "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3770 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3771 ok(typeattr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
), "wTypeFlags = 0x%x\n", typeattr
->wTypeFlags
);
3772 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3773 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3774 ITypeInfo_ReleaseTypeAttr(interface1
, typeattr
);
3776 ITypeInfo_Release(interface1
);
3778 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3780 hres
= ITypeLib_GetTypeInfo(tl
, 5, &ti
);
3781 ok(hres
== S_OK
, "got %08x\n", hres
);
3783 hres
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
3784 ok(hres
== S_OK
, "got %08x\n", hres
);
3785 ok(typeattr
->cbSizeInstance
== 8, "cbSizeInstance = %d\n", typeattr
->cbSizeInstance
);
3786 ok(typeattr
->typekind
== TKIND_ALIAS
, "typekind = %d\n", typeattr
->typekind
);
3787 ok(typeattr
->cFuncs
== 0, "cFuncs = %d\n", typeattr
->cFuncs
);
3788 ok(typeattr
->cVars
== 0, "cVars = %d\n", typeattr
->cVars
);
3789 ok(typeattr
->cImplTypes
== 0, "cImplTypes = %d\n", typeattr
->cImplTypes
);
3790 ok(typeattr
->cbSizeVft
== 0, "cbSizeVft = %d\n", typeattr
->cbSizeVft
);
3791 ok(typeattr
->cbAlignment
== alignment
, "cbAlignment = %d\n", typeattr
->cbAlignment
);
3792 ok(typeattr
->wTypeFlags
== 0, "wTypeFlags = 0x%x\n", typeattr
->wTypeFlags
);
3793 ok(typeattr
->wMajorVerNum
== 0, "wMajorVerNum = %d\n", typeattr
->wMajorVerNum
);
3794 ok(typeattr
->wMinorVerNum
== 0, "wMinorVerNum = %d\n", typeattr
->wMinorVerNum
);
3795 ok(typeattr
->tdescAlias
.vt
== VT_R8
, "Got wrong tdescAlias.vt: %u\n", typeattr
->tdescAlias
.vt
);
3796 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
3798 ok(ITypeInfo_Release(ti
) == 0, "Object should be freed\n");
3800 ok(ITypeLib_Release(tl
)==0, "Object should be freed\n");
3802 DeleteFileA(filename
);
3805 #if 0 /* use this to generate more tests */
3807 #define OLE_CHECK(x) { HRESULT hr = x; if (FAILED(hr)) { printf(#x "failed - %x\n", hr); return; } }
3809 static char *dump_string(LPWSTR wstr
)
3811 int size
= lstrlenW(wstr
)+1;
3812 char *out
= CoTaskMemAlloc(size
);
3813 WideCharToMultiByte(20127, 0, wstr
, -1, out
, size
, NULL
, NULL
);
3823 #define MAP_ENTRY(x) { x, #x }
3824 static const struct map_entry tkind_map
[] = {
3825 MAP_ENTRY(TKIND_ENUM
),
3826 MAP_ENTRY(TKIND_RECORD
),
3827 MAP_ENTRY(TKIND_MODULE
),
3828 MAP_ENTRY(TKIND_INTERFACE
),
3829 MAP_ENTRY(TKIND_DISPATCH
),
3830 MAP_ENTRY(TKIND_COCLASS
),
3831 MAP_ENTRY(TKIND_ALIAS
),
3832 MAP_ENTRY(TKIND_UNION
),
3833 MAP_ENTRY(TKIND_MAX
),
3837 static const struct map_entry funckind_map
[] = {
3838 MAP_ENTRY(FUNC_VIRTUAL
),
3839 MAP_ENTRY(FUNC_PUREVIRTUAL
),
3840 MAP_ENTRY(FUNC_NONVIRTUAL
),
3841 MAP_ENTRY(FUNC_STATIC
),
3842 MAP_ENTRY(FUNC_DISPATCH
),
3846 static const struct map_entry invkind_map
[] = {
3847 MAP_ENTRY(INVOKE_FUNC
),
3848 MAP_ENTRY(INVOKE_PROPERTYGET
),
3849 MAP_ENTRY(INVOKE_PROPERTYPUT
),
3850 MAP_ENTRY(INVOKE_PROPERTYPUTREF
),
3854 static const struct map_entry callconv_map
[] = {
3855 MAP_ENTRY(CC_FASTCALL
),
3856 MAP_ENTRY(CC_CDECL
),
3857 MAP_ENTRY(CC_PASCAL
),
3858 MAP_ENTRY(CC_MACPASCAL
),
3859 MAP_ENTRY(CC_STDCALL
),
3860 MAP_ENTRY(CC_FPFASTCALL
),
3861 MAP_ENTRY(CC_SYSCALL
),
3862 MAP_ENTRY(CC_MPWCDECL
),
3863 MAP_ENTRY(CC_MPWPASCAL
),
3867 static const struct map_entry vt_map
[] = {
3868 MAP_ENTRY(VT_EMPTY
),
3877 MAP_ENTRY(VT_DISPATCH
),
3878 MAP_ENTRY(VT_ERROR
),
3880 MAP_ENTRY(VT_VARIANT
),
3881 MAP_ENTRY(VT_UNKNOWN
),
3882 MAP_ENTRY(VT_DECIMAL
),
3893 MAP_ENTRY(VT_HRESULT
),
3895 MAP_ENTRY(VT_SAFEARRAY
),
3896 MAP_ENTRY(VT_CARRAY
),
3897 MAP_ENTRY(VT_USERDEFINED
),
3898 MAP_ENTRY(VT_LPSTR
),
3899 MAP_ENTRY(VT_LPWSTR
),
3900 MAP_ENTRY(VT_RECORD
),
3901 MAP_ENTRY(VT_INT_PTR
),
3902 MAP_ENTRY(VT_UINT_PTR
),
3928 MAP_ENTRY(VT_FILETIME
),
3930 MAP_ENTRY(VT_STREAM
),
3931 MAP_ENTRY(VT_STORAGE
),
3932 MAP_ENTRY(VT_STREAMED_OBJECT
),
3933 MAP_ENTRY(VT_STORED_OBJECT
),
3934 MAP_ENTRY(VT_BLOB_OBJECT
),
3936 MAP_ENTRY(VT_CLSID
),
3942 static const char *map_value(int val
, const struct map_entry
*map
)
3945 static char bufs
[16][256];
3950 if (map
->value
== val
)
3955 buf
= bufs
[(map_id
++)%16];
3956 sprintf(buf
, "%d", val
);
3960 static const char *dump_type_flags(DWORD flags
)
3962 static char buf
[256];
3964 if (!flags
) return "0";
3968 #define ADD_FLAG(x) if (flags & x) { if (buf[0]) strcat(buf, "|"); strcat(buf, #x); flags &= ~x; }
3969 ADD_FLAG(TYPEFLAG_FPROXY
)
3970 ADD_FLAG(TYPEFLAG_FREVERSEBIND
)
3971 ADD_FLAG(TYPEFLAG_FDISPATCHABLE
)
3972 ADD_FLAG(TYPEFLAG_FREPLACEABLE
)
3973 ADD_FLAG(TYPEFLAG_FAGGREGATABLE
)
3974 ADD_FLAG(TYPEFLAG_FRESTRICTED
)
3975 ADD_FLAG(TYPEFLAG_FOLEAUTOMATION
)
3976 ADD_FLAG(TYPEFLAG_FNONEXTENSIBLE
)
3977 ADD_FLAG(TYPEFLAG_FDUAL
)
3978 ADD_FLAG(TYPEFLAG_FCONTROL
)
3979 ADD_FLAG(TYPEFLAG_FHIDDEN
)
3980 ADD_FLAG(TYPEFLAG_FPREDECLID
)
3981 ADD_FLAG(TYPEFLAG_FLICENSED
)
3982 ADD_FLAG(TYPEFLAG_FCANCREATE
)
3983 ADD_FLAG(TYPEFLAG_FAPPOBJECT
)
3987 assert(strlen(buf
) < sizeof(buf
));
3992 static char *print_size(BSTR name
, TYPEATTR
*attr
)
3994 static char buf
[256];
3996 switch (attr
->typekind
)
3998 case TKIND_DISPATCH
:
3999 case TKIND_INTERFACE
:
4000 sprintf(buf
, "sizeof(%s*)", dump_string(name
));
4004 sprintf(buf
, "sizeof(struct %s)", dump_string(name
));
4008 sprintf(buf
, "sizeof(union %s)", dump_string(name
));
4024 static const char *dump_param_flags(DWORD flags
)
4026 static char buf
[256];
4028 if (!flags
) return "PARAMFLAG_NONE";
4032 #define ADD_FLAG(x) if (flags & x) { if (buf[0]) strcat(buf, "|"); strcat(buf, #x); flags &= ~x; }
4033 ADD_FLAG(PARAMFLAG_FIN
)
4034 ADD_FLAG(PARAMFLAG_FOUT
)
4035 ADD_FLAG(PARAMFLAG_FLCID
)
4036 ADD_FLAG(PARAMFLAG_FRETVAL
)
4037 ADD_FLAG(PARAMFLAG_FOPT
)
4038 ADD_FLAG(PARAMFLAG_FHASDEFAULT
)
4039 ADD_FLAG(PARAMFLAG_FHASCUSTDATA
)
4043 assert(strlen(buf
) < sizeof(buf
));
4048 static const char *dump_func_flags(DWORD flags
)
4050 static char buf
[256];
4052 if (!flags
) return "0";
4056 #define ADD_FLAG(x) if (flags & x) { if (buf[0]) strcat(buf, "|"); strcat(buf, #x); flags &= ~x; }
4057 ADD_FLAG(FUNCFLAG_FRESTRICTED
)
4058 ADD_FLAG(FUNCFLAG_FSOURCE
)
4059 ADD_FLAG(FUNCFLAG_FBINDABLE
)
4060 ADD_FLAG(FUNCFLAG_FREQUESTEDIT
)
4061 ADD_FLAG(FUNCFLAG_FDISPLAYBIND
)
4062 ADD_FLAG(FUNCFLAG_FDEFAULTBIND
)
4063 ADD_FLAG(FUNCFLAG_FHIDDEN
)
4064 ADD_FLAG(FUNCFLAG_FUSESGETLASTERROR
)
4065 ADD_FLAG(FUNCFLAG_FDEFAULTCOLLELEM
)
4066 ADD_FLAG(FUNCFLAG_FUIDEFAULT
)
4067 ADD_FLAG(FUNCFLAG_FNONBROWSABLE
)
4068 ADD_FLAG(FUNCFLAG_FREPLACEABLE
)
4069 ADD_FLAG(FUNCFLAG_FIMMEDIATEBIND
)
4073 assert(strlen(buf
) < sizeof(buf
));
4078 static int get_href_type(ITypeInfo
*info
, TYPEDESC
*tdesc
)
4082 if (tdesc
->vt
== VT_USERDEFINED
)
4088 hr
= ITypeInfo_GetRefTypeInfo(info
, U(*tdesc
).hreftype
, ¶m
);
4089 ok(hr
== S_OK
, "GetRefTypeInfo error %#x\n", hr
);
4090 hr
= ITypeInfo_GetTypeAttr(param
, &attr
);
4091 ok(hr
== S_OK
, "GetTypeAttr error %#x\n", hr
);
4093 href_type
= attr
->typekind
;
4095 ITypeInfo_ReleaseTypeAttr(param
, attr
);
4096 ITypeInfo_Release(param
);
4102 static void test_dump_typelib(const char *name
)
4104 WCHAR wszString
[260];
4110 MultiByteToWideChar(CP_ACP
, 0, name
, -1, wszString
, 260);
4111 OLE_CHECK(LoadTypeLib(wszString
, &lib
));
4113 printf("/*** Autogenerated data. Do not edit, change the generator above instead. ***/\n");
4115 count
= ITypeLib_GetTypeInfoCount(lib
);
4116 for (i
= 0; i
< count
; i
++)
4123 OLE_CHECK(ITypeLib_GetDocumentation(lib
, i
, &name
, NULL
, &help_ctx
, NULL
));
4125 " \"%s\",\n", dump_string(name
));
4127 OLE_CHECK(ITypeLib_GetTypeInfo(lib
, i
, &info
));
4128 OLE_CHECK(ITypeInfo_GetTypeAttr(info
, &attr
));
4130 printf(" \"%s\",\n", wine_dbgstr_guid(&attr
->guid
));
4132 printf(" /*kind*/ %s, /*flags*/ %s, /*align*/ %d, /*size*/ %s,\n"
4133 " /*helpctx*/ 0x%04x, /*version*/ 0x%08x, /*#vtbl*/ %d, /*#func*/ %d",
4134 map_value(attr
->typekind
, tkind_map
), dump_type_flags(attr
->wTypeFlags
),
4135 attr
->cbAlignment
, print_size(name
, attr
),
4136 help_ctx
, MAKELONG(attr
->wMinorVerNum
, attr
->wMajorVerNum
),
4137 attr
->cbSizeVft
/sizeof(void*), attr
->cFuncs
);
4139 if (attr
->cFuncs
) printf(",\n {\n");
4149 if (FAILED(ITypeInfo_GetFuncDesc(info
, f
, &desc
)))
4152 " /*id*/ 0x%x, /*func*/ %s, /*inv*/ %s, /*call*/ %s,\n",
4153 desc
->memid
, map_value(desc
->funckind
, funckind_map
), map_value(desc
->invkind
, invkind_map
),
4154 map_value(desc
->callconv
, callconv_map
));
4155 printf(" /*#param*/ %d, /*#opt*/ %d, /*vtbl*/ %d, /*#scodes*/ %d, /*flags*/ %s,\n",
4156 desc
->cParams
, desc
->cParamsOpt
, desc
->oVft
/sizeof(void*), desc
->cScodes
, dump_func_flags(desc
->wFuncFlags
));
4157 printf(" {%s, %s, %s}, /* ret */\n", map_value(desc
->elemdescFunc
.tdesc
.vt
, vt_map
),
4158 map_value(get_href_type(info
, &desc
->elemdescFunc
.tdesc
), tkind_map
), dump_param_flags(U(desc
->elemdescFunc
).paramdesc
.wParamFlags
));
4159 printf(" { /* params */\n");
4160 for (p
= 0; p
< desc
->cParams
; p
++)
4162 ELEMDESC e
= desc
->lprgelemdescParam
[p
];
4163 printf(" {%s, %s, %s},\n", map_value(e
.tdesc
.vt
, vt_map
),
4164 map_value(get_href_type(info
, &e
.tdesc
), tkind_map
), dump_param_flags(U(e
).paramdesc
.wParamFlags
));
4166 printf(" {-1, 0, 0}\n");
4168 printf(" { /* names */\n");
4169 OLE_CHECK(ITypeInfo_GetNames(info
, desc
->memid
, tab
, 256, &cNames
));
4170 for (p
= 0; p
< cNames
; p
++)
4172 printf(" \"%s\",\n", dump_string(tab
[p
]));
4173 SysFreeString(tab
[p
]);
4178 ITypeInfo_ReleaseFuncDesc(info
, desc
);
4181 if (attr
->cFuncs
) printf(" }\n");
4183 ITypeInfo_ReleaseTypeAttr(info
, attr
);
4184 ITypeInfo_Release(info
);
4185 SysFreeString(name
);
4187 ITypeLib_Release(lib
);
4192 typedef struct _element_info
4199 typedef struct _function_info
4210 element_info ret_type
;
4211 element_info params
[15];
4215 typedef struct _type_info
4222 USHORT cbSizeInstance
;
4227 function_info funcs
[20];
4230 static const type_info info
[] = {
4231 /*** Autogenerated data. Do not edit, change the generator above instead. ***/
4234 "{b14b6bb5-904e-4ff9-b247-bd361f7a0001}",
4235 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct g
),
4236 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4240 "{b14b6bb5-904e-4ff9-b247-bd361f7a0002}",
4241 /*kind*/ TKIND_INTERFACE
, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(test_iface
*),
4242 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 4, /*#func*/ 1,
4245 /*id*/ 0x60010000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4246 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 3, /*#scodes*/ 0, /*flags*/ 0,
4247 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4249 {VT_PTR
, -1, PARAMFLAG_FIN
},
4262 "{b14b6bb5-904e-4ff9-b247-bd361f7aa001}",
4263 /*kind*/ TKIND_INTERFACE
, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(parent_iface
*),
4264 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 4, /*#func*/ 1,
4267 /*id*/ 0x60010000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4268 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 3, /*#scodes*/ 0, /*flags*/ 0,
4269 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4271 {VT_PTR
, -1, PARAMFLAG_FOUT
|PARAMFLAG_FRETVAL
},
4284 "{b14b6bb5-904e-4ff9-b247-bd361f7aa002}",
4285 /*kind*/ TKIND_INTERFACE
, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(child_iface
*),
4286 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 5, /*#func*/ 1,
4289 /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4290 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 4, /*#scodes*/ 0, /*flags*/ 0,
4291 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4304 "{016fe2ec-b2c8-45f8-b23b-39e53a753903}",
4305 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct _n
),
4306 /*helpctx*/ 0x0003, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0
4310 "{016fe2ec-b2c8-45f8-b23b-39e53a753902}",
4311 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ 4,
4312 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4316 "{00000000-0000-0000-0000-000000000000}",
4317 /*kind*/ TKIND_ALIAS
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4318 /*helpctx*/ 0x0003, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0
4322 "{016fe2ec-b2c8-45f8-b23b-39e53a753906}",
4323 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct _m
),
4324 /*helpctx*/ 0x0003, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4328 "{016fe2ec-b2c8-45f8-b23b-39e53a753905}",
4329 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ 4,
4330 /*helpctx*/ 0x0000, /*version*/ 0x00010002, /*#vtbl*/ 0, /*#func*/ 0
4334 "{00000000-0000-0000-0000-000000000000}",
4335 /*kind*/ TKIND_ALIAS
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4336 /*helpctx*/ 0x0003, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4340 "{b14b6bb5-904e-4ff9-b247-bd361f7aaedd}",
4341 /*kind*/ TKIND_DISPATCH
, /*flags*/ TYPEFLAG_FDISPATCHABLE
|TYPEFLAG_FDUAL
, /*align*/ 4, /*size*/ sizeof(IDualIface
*),
4342 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 7, /*#func*/ 8,
4345 /*id*/ 0x60000000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4346 /*#param*/ 2, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4347 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4349 {VT_PTR
, -1, PARAMFLAG_FIN
},
4350 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4361 /*id*/ 0x60000001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4362 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 1, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4363 {VT_UI4
, -1, PARAMFLAG_NONE
}, /* ret */
4373 /*id*/ 0x60000002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4374 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 2, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4375 {VT_UI4
, -1, PARAMFLAG_NONE
}, /* ret */
4385 /*id*/ 0x60010000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4386 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 3, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4387 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4389 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4399 /*id*/ 0x60010001, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4400 /*#param*/ 3, /*#opt*/ 0, /*vtbl*/ 4, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4401 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4403 {VT_UINT
, -1, PARAMFLAG_FIN
},
4404 {VT_UI4
, -1, PARAMFLAG_FIN
},
4405 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4417 /*id*/ 0x60010002, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4418 /*#param*/ 5, /*#opt*/ 0, /*vtbl*/ 5, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4419 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4421 {VT_PTR
, -1, PARAMFLAG_FIN
},
4422 {VT_PTR
, -1, PARAMFLAG_FIN
},
4423 {VT_UINT
, -1, PARAMFLAG_FIN
},
4424 {VT_UI4
, -1, PARAMFLAG_FIN
},
4425 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4439 /*id*/ 0x60010003, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4440 /*#param*/ 8, /*#opt*/ 0, /*vtbl*/ 6, /*#scodes*/ 0, /*flags*/ FUNCFLAG_FRESTRICTED
,
4441 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4443 {VT_I4
, -1, PARAMFLAG_FIN
},
4444 {VT_PTR
, -1, PARAMFLAG_FIN
},
4445 {VT_UI4
, -1, PARAMFLAG_FIN
},
4446 {VT_UI2
, -1, PARAMFLAG_FIN
},
4447 {VT_PTR
, -1, PARAMFLAG_FIN
},
4448 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4449 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4450 {VT_PTR
, -1, PARAMFLAG_FOUT
},
4467 /*id*/ 0x60020000, /*func*/ FUNC_DISPATCH
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4468 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
4469 {VT_VOID
, -1, PARAMFLAG_NONE
}, /* ret */
4482 "{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac009}",
4483 /*kind*/ TKIND_INTERFACE
, /*flags*/ TYPEFLAG_FDISPATCHABLE
, /*align*/ 4, /*size*/ sizeof(ISimpleIface
*),
4484 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 8, /*#func*/ 1,
4487 /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4488 /*#param*/ 0, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
4489 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4502 "{4029f190-ca4a-4611-aeb9-673983cb96dd}",
4503 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct
),
4504 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4508 "{4029f190-ca4a-4611-aeb9-673983cb96de}",
4509 /*kind*/ TKIND_RECORD
, /*flags*/ 0, /*align*/ 4, /*size*/ sizeof(struct test_struct2
),
4510 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4514 "{016fe2ec-b2c8-45f8-b23b-39e53a75396a}",
4515 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FRESTRICTED
, /*align*/ 4, /*size*/ 4,
4516 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4520 "{00000000-0000-0000-0000-000000000000}",
4521 /*kind*/ TKIND_ALIAS
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4522 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4526 "{00000000-0000-0000-0000-000000000000}",
4527 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4528 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4532 "{00000000-0000-0000-0000-000000000000}",
4533 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4534 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4538 "{00000000-0000-0000-0000-000000000000}",
4539 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4540 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4544 "{00000000-0000-0000-0000-000000000000}",
4545 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4546 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4550 "{016fe2ec-b2c8-45f8-b23b-39e53a75396b}",
4551 /*kind*/ TKIND_ALIAS
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4552 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4556 "{00000000-0000-0000-0000-000000000000}",
4557 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4558 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4562 "{016fe2ec-b2c8-45f8-b23b-39e53a75396c}",
4563 /*kind*/ TKIND_ENUM
, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
4564 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4568 "{016fe2ec-b2c8-45f8-b23b-39e53a75396d}",
4569 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ 4,
4570 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4574 "{00000000-0000-0000-0000-000000000000}",
4575 /*kind*/ TKIND_ENUM
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ 4,
4576 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4580 "{016fe2ec-b2c8-45f8-b23b-39e53a75396e}",
4581 /*kind*/ TKIND_ENUM
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ 4,
4582 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4586 "{016fe2ec-b2c8-45f8-b23b-39e53a753970}",
4587 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ 4,
4588 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4592 "{00000000-0000-0000-0000-000000000000}",
4593 /*kind*/ TKIND_RECORD
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ sizeof(struct _e
),
4594 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4598 "{016fe2ec-b2c8-45f8-b23b-39e53a753971}",
4599 /*kind*/ TKIND_RECORD
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ sizeof(struct ee
),
4600 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4604 "{016fe2ec-b2c8-45f8-b23b-39e53a753972}",
4605 /*kind*/ TKIND_ALIAS
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ 4,
4606 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4610 "{00000000-0000-0000-0000-000000000000}",
4611 /*kind*/ TKIND_UNION
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ sizeof(union _f
),
4612 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4616 "{016fe2ec-b2c8-45f8-b23b-39e53a753973}",
4617 /*kind*/ TKIND_UNION
, /*flags*/ TYPEFLAG_FRESTRICTED
|TYPEFLAG_FHIDDEN
, /*align*/ 4, /*size*/ sizeof(union ff
),
4618 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0
4622 "{ec5dfcd6-eeb0-4cd6-b51e-8030e1dac00a}",
4623 /*kind*/ TKIND_INTERFACE
, /*flags*/ TYPEFLAG_FDISPATCHABLE
, /*align*/ 4, /*size*/ sizeof(ITestIface
*),
4624 /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 13, /*#func*/ 6,
4627 /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4628 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
4629 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4631 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
4641 /*id*/ 0x60020001, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4642 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 8, /*#scodes*/ 0, /*flags*/ 0,
4643 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4645 {VT_USERDEFINED
, TKIND_ENUM
, PARAMFLAG_NONE
},
4655 /*id*/ 0x60020002, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4656 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 9, /*#scodes*/ 0, /*flags*/ 0,
4657 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4659 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
4669 /*id*/ 0x60020003, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4670 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 10, /*#scodes*/ 0, /*flags*/ 0,
4671 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4673 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
4683 /*id*/ 0x60020004, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4684 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 11, /*#scodes*/ 0, /*flags*/ 0,
4685 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4687 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
4697 /*id*/ 0x60020005, /*func*/ FUNC_PUREVIRTUAL
, /*inv*/ INVOKE_FUNC
, /*call*/ CC_STDCALL
,
4698 /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 12, /*#scodes*/ 0, /*flags*/ 0,
4699 {VT_HRESULT
, -1, PARAMFLAG_NONE
}, /* ret */
4701 {VT_USERDEFINED
, TKIND_ALIAS
, PARAMFLAG_NONE
},
4714 #define check_type(elem, info) { \
4715 expect_int((elem)->tdesc.vt, (info)->vt); \
4716 expect_hex(U(*(elem)).paramdesc.wParamFlags, (info)->wParamFlags); \
4719 static void test_dump_typelib(const char *name
)
4721 WCHAR wszName
[MAX_PATH
];
4723 int ticount
= sizeof(info
)/sizeof(info
[0]);
4726 MultiByteToWideChar(CP_ACP
, 0, name
, -1, wszName
, MAX_PATH
);
4727 ole_check(LoadTypeLibEx(wszName
, REGKIND_NONE
, &typelib
));
4728 expect_eq(ITypeLib_GetTypeInfoCount(typelib
), ticount
, UINT
, "%d");
4729 for (iface
= 0; iface
< ticount
; iface
++)
4731 const type_info
*ti
= &info
[iface
];
4732 ITypeInfo
*typeinfo
;
4737 trace("Interface %s\n", ti
->name
);
4738 ole_check(ITypeLib_GetTypeInfo(typelib
, iface
, &typeinfo
));
4739 ole_check(ITypeLib_GetDocumentation(typelib
, iface
, &bstrIfName
, NULL
, &help_ctx
, NULL
));
4740 expect_wstr_acpval(bstrIfName
, ti
->name
);
4741 SysFreeString(bstrIfName
);
4743 ole_check(ITypeInfo_GetTypeAttr(typeinfo
, &typeattr
));
4744 expect_int(typeattr
->typekind
, ti
->type
);
4745 expect_hex(typeattr
->wTypeFlags
, ti
->wTypeFlags
);
4746 /* FIXME: remove once widl is fixed */
4747 if (typeattr
->typekind
== TKIND_ALIAS
&& typeattr
->cbAlignment
!= ti
->cbAlignment
)
4749 todo_wine
/* widl generates broken typelib and typeattr just reflects that */
4750 ok(typeattr
->cbAlignment
== ti
->cbAlignment
|| broken(typeattr
->cbAlignment
== 1),
4751 "expected %d, got %d\n", ti
->cbAlignment
, typeattr
->cbAlignment
);
4752 todo_wine
/* widl generates broken typelib and typeattr just reflects that */
4753 ok(typeattr
->cbSizeInstance
== ti
->cbSizeInstance
|| broken(typeattr
->cbSizeInstance
== 0),
4754 "expected %d, got %d\n", ti
->cbSizeInstance
, typeattr
->cbSizeInstance
);
4758 expect_int(typeattr
->cbAlignment
, ti
->cbAlignment
);
4759 expect_int(typeattr
->cbSizeInstance
, ti
->cbSizeInstance
);
4761 expect_int(help_ctx
, ti
->help_ctx
);
4762 expect_int(MAKELONG(typeattr
->wMinorVerNum
, typeattr
->wMajorVerNum
), ti
->version
);
4763 expect_int(typeattr
->cbSizeVft
, ti
->cbSizeVft
* sizeof(void*));
4764 expect_int(typeattr
->cFuncs
, ti
->cFuncs
);
4766 /* compare type uuid */
4767 if (ti
->uuid
&& *ti
->uuid
)
4770 ITypeInfo
*typeinfo2
;
4774 MultiByteToWideChar(CP_ACP
, 0, ti
->uuid
, -1, guidW
, sizeof(guidW
)/sizeof(guidW
[0]));
4775 IIDFromString(guidW
, &guid
);
4776 expect_guid(&guid
, &typeattr
->guid
);
4778 /* check that it's possible to search using this uuid */
4780 hr
= ITypeLib_GetTypeInfoOfGuid(typelib
, &guid
, &typeinfo2
);
4781 ok(hr
== S_OK
|| (IsEqualGUID(&guid
, &IID_NULL
) && hr
== TYPE_E_ELEMENTNOTFOUND
), "got 0x%08x\n", hr
);
4782 if (hr
== S_OK
) ITypeInfo_Release(typeinfo2
);
4785 for (func
= 0; func
< typeattr
->cFuncs
; func
++)
4787 function_info
*fn_info
= (function_info
*)&ti
->funcs
[func
];
4793 trace("Function %s\n", fn_info
->names
[0]);
4794 ole_check(ITypeInfo_GetFuncDesc(typeinfo
, func
, &desc
));
4795 expect_int(desc
->memid
, fn_info
->memid
);
4796 expect_int(desc
->funckind
, fn_info
->funckind
);
4797 expect_int(desc
->invkind
, fn_info
->invkind
);
4798 expect_int(desc
->callconv
, fn_info
->callconv
);
4799 expect_int(desc
->cParams
, fn_info
->cParams
);
4800 expect_int(desc
->cParamsOpt
, fn_info
->cParamsOpt
);
4801 ok( desc
->oVft
== fn_info
->vtbl_index
* sizeof(void*) ||
4802 broken(desc
->oVft
== fn_info
->vtbl_index
* 4), /* xp64 */
4803 "desc->oVft got %u\n", desc
->oVft
);
4804 expect_int(desc
->cScodes
, fn_info
->cScodes
);
4805 expect_int(desc
->wFuncFlags
, fn_info
->wFuncFlags
);
4806 ole_check(ITypeInfo_GetNames(typeinfo
, desc
->memid
, namesTab
, 256, &cNames
));
4807 for (i
= 0; i
< cNames
; i
++)
4809 expect_wstr_acpval(namesTab
[i
], fn_info
->names
[i
]);
4810 SysFreeString(namesTab
[i
]);
4812 expect_null(fn_info
->names
[cNames
]);
4814 check_type(&desc
->elemdescFunc
, &fn_info
->ret_type
);
4815 for (i
= 0 ; i
< desc
->cParams
; i
++)
4817 check_type(&desc
->lprgelemdescParam
[i
], &fn_info
->params
[i
]);
4819 if (desc
->lprgelemdescParam
[i
].tdesc
.vt
== VT_USERDEFINED
)
4824 ole_check(ITypeInfo_GetRefTypeInfo(typeinfo
, U(desc
->lprgelemdescParam
[i
].tdesc
).hreftype
, ¶m
));
4825 ole_check(ITypeInfo_GetTypeAttr(param
, &var_attr
));
4827 ok(var_attr
->typekind
== fn_info
->params
[i
].type
, "expected %#x, got %#x\n", fn_info
->params
[i
].type
, var_attr
->typekind
);
4829 ITypeInfo_ReleaseTypeAttr(param
, var_attr
);
4830 ITypeInfo_Release(param
);
4833 expect_int(fn_info
->params
[desc
->cParams
].vt
, (VARTYPE
)-1);
4835 ITypeInfo_ReleaseFuncDesc(typeinfo
, desc
);
4838 ITypeInfo_ReleaseTypeAttr(typeinfo
, typeattr
);
4839 ITypeInfo_Release(typeinfo
);
4841 ITypeLib_Release(typelib
);
4846 static void test_create_typelib_lcid(LCID lcid
)
4848 char filename
[MAX_PATH
];
4849 WCHAR name
[MAX_PATH
];
4851 ICreateTypeLib2
*tl
;
4853 DWORD msft_header
[8];
4858 GetTempFileNameA( ".", "tlb", 0, filename
);
4859 MultiByteToWideChar(CP_ACP
, 0, filename
, -1, name
, MAX_PATH
);
4861 hr
= CreateTypeLib2(SYS_WIN32
, name
, &tl
);
4862 ok(hr
== S_OK
, "got %08x\n", hr
);
4864 hr
= ICreateTypeLib2_QueryInterface(tl
, &IID_ITypeLib
, (void**)&typelib
);
4865 ok(hr
== S_OK
, "got %08x\n", hr
);
4867 hr
= ITypeLib_GetLibAttr(typelib
, &attr
);
4868 ok(hr
== S_OK
, "got %08x\n", hr
);
4869 ok(attr
->wLibFlags
== 0, "flags 0x%x\n", attr
->wLibFlags
);
4870 ITypeLib_ReleaseTLibAttr(typelib
, attr
);
4872 hr
= ICreateTypeLib2_SetLcid(tl
, lcid
);
4873 ok(hr
== S_OK
, "got %08x\n", hr
);
4875 hr
= ICreateTypeLib2_SetVersion(tl
, 3, 4);
4876 ok(hr
== S_OK
, "got %08x\n", hr
);
4878 hr
= ICreateTypeLib2_SaveAllChanges(tl
);
4879 ok(hr
== S_OK
, "got %08x\n", hr
);
4881 hr
= ITypeLib_GetLibAttr(typelib
, &attr
);
4882 ok(hr
== S_OK
, "got %08x\n", hr
);
4883 ok(attr
->wLibFlags
== 0, "flags 0x%x\n", attr
->wLibFlags
);
4884 ITypeLib_ReleaseTLibAttr(typelib
, attr
);
4886 ITypeLib_Release(typelib
);
4887 ICreateTypeLib2_Release(tl
);
4889 file
= CreateFileA( filename
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
, 0, 0 );
4890 ok( file
!= INVALID_HANDLE_VALUE
, "file creation failed\n" );
4892 ReadFile( file
, msft_header
, sizeof(msft_header
), &read
, NULL
);
4893 ok(read
== sizeof(msft_header
), "read %d\n", read
);
4894 CloseHandle( file
);
4896 ok(msft_header
[0] == 0x5446534d, "got %08x\n", msft_header
[0]);
4897 ok(msft_header
[1] == 0x00010002, "got %08x\n", msft_header
[1]);
4898 ok(msft_header
[2] == 0xffffffff, "got %08x\n", msft_header
[2]);
4899 ok(msft_header
[3] == (lcid
? lcid
: 0x409), "got %08x (lcid %08x)\n", msft_header
[3], lcid
);
4900 ok(msft_header
[4] == lcid
, "got %08x (lcid %08x)\n", msft_header
[4], lcid
);
4901 ok(msft_header
[6] == 0x00040003, "got %08x\n", msft_header
[6]);
4902 ok(msft_header
[7] == 0, "got %08x\n", msft_header
[7]);
4904 /* check flags after loading */
4905 hr
= LoadTypeLib(name
, &typelib
);
4906 ok(hr
== S_OK
, "got %08x\n", hr
);
4908 hr
= ITypeLib_GetLibAttr(typelib
, &attr
);
4909 ok(hr
== S_OK
, "got %08x\n", hr
);
4910 ok(attr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "flags 0x%x\n", attr
->wLibFlags
);
4911 ITypeLib_ReleaseTLibAttr(typelib
, attr
);
4912 ITypeLib_Release(typelib
);
4914 DeleteFileA(filename
);
4917 static void test_create_typelibs(void)
4919 test_create_typelib_lcid(LOCALE_SYSTEM_DEFAULT
);
4920 test_create_typelib_lcid(LOCALE_USER_DEFAULT
);
4921 test_create_typelib_lcid(LOCALE_NEUTRAL
);
4923 test_create_typelib_lcid(0x009);
4924 test_create_typelib_lcid(0x409);
4925 test_create_typelib_lcid(0x809);
4927 test_create_typelib_lcid(0x007);
4928 test_create_typelib_lcid(0x407);
4932 static void test_register_typelib(BOOL system_registration
)
4935 WCHAR filename
[MAX_PATH
];
4936 const char *filenameA
;
4939 char key_name
[MAX_PATH
], uuid
[40];
4940 LONG ret
, expect_ret
;
4943 REGSAM opposite
= (sizeof(void*) == 8 ? KEY_WOW64_32KEY
: KEY_WOW64_64KEY
);
4944 BOOL is_wow64
= FALSE
;
4951 { TKIND_INTERFACE
, 0 },
4952 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
},
4953 { TKIND_INTERFACE
, TYPEFLAG_FOLEAUTOMATION
},
4954 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FOLEAUTOMATION
},
4955 { TKIND_DISPATCH
, 0 /* TYPEFLAG_FDUAL - widl clears this flag for non-IDispatch derived interfaces */ },
4956 { TKIND_DISPATCH
, 0 /* TYPEFLAG_FDUAL - widl clears this flag for non-IDispatch derived interfaces */ },
4957 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
},
4958 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FDUAL
},
4959 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
},
4960 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
},
4961 { TKIND_DISPATCH
, TYPEFLAG_FDISPATCHABLE
},
4962 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
},
4963 { TKIND_INTERFACE
, TYPEFLAG_FDISPATCHABLE
},
4967 trace("Starting %s typelib registration tests\n",
4968 system_registration
? "system" : "user");
4970 if (!system_registration
&& (!pRegisterTypeLibForUser
|| !pUnRegisterTypeLibForUser
))
4972 win_skip("User typelib registration functions are not available\n");
4976 if (pIsWow64Process
)
4977 pIsWow64Process(GetCurrentProcess(), &is_wow64
);
4979 filenameA
= create_test_typelib(3);
4980 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filename
, MAX_PATH
);
4982 hr
= LoadTypeLibEx(filename
, REGKIND_NONE
, &typelib
);
4983 ok(hr
== S_OK
, "got %08x\n", hr
);
4985 if (system_registration
)
4986 hr
= RegisterTypeLib(typelib
, filename
, NULL
);
4988 hr
= pRegisterTypeLibForUser(typelib
, filename
, NULL
);
4989 if (hr
== TYPE_E_REGISTRYACCESS
)
4991 win_skip("Insufficient privileges to register typelib in the registry\n");
4992 ITypeLib_Release(typelib
);
4993 DeleteFileA(filenameA
);
4996 ok(hr
== S_OK
, "got %08x\n", hr
);
4998 count
= ITypeLib_GetTypeInfoCount(typelib
);
4999 ok(count
== 14, "got %d\n", count
);
5001 for(i
= 0; i
< count
; i
++)
5003 ITypeInfo
*typeinfo
;
5006 hr
= ITypeLib_GetTypeInfo(typelib
, i
, &typeinfo
);
5007 ok(hr
== S_OK
, "got %08x\n", hr
);
5009 hr
= ITypeInfo_GetTypeAttr(typeinfo
, &attr
);
5010 ok(hr
== S_OK
, "got %08x\n", hr
);
5012 ok(attr
->typekind
== attrs
[i
].kind
, "%d: got kind %d\n", i
, attr
->typekind
);
5013 ok(attr
->wTypeFlags
== attrs
[i
].flags
, "%d: got flags %04x\n", i
, attr
->wTypeFlags
);
5015 if(attr
->typekind
== TKIND_DISPATCH
&& (attr
->wTypeFlags
& TYPEFLAG_FDUAL
))
5018 ITypeInfo
*dual_info
;
5019 TYPEATTR
*dual_attr
;
5021 hr
= ITypeInfo_GetRefTypeOfImplType(typeinfo
, -1, &reftype
);
5022 ok(hr
== S_OK
, "got %08x\n", hr
);
5024 hr
= ITypeInfo_GetRefTypeInfo(typeinfo
, reftype
, &dual_info
);
5025 ok(hr
== S_OK
, "got %08x\n", hr
);
5027 hr
= ITypeInfo_GetTypeAttr(dual_info
, &dual_attr
);
5028 ok(hr
== S_OK
, "got %08x\n", hr
);
5030 ok(dual_attr
->typekind
== TKIND_INTERFACE
, "%d: got kind %d\n", i
, dual_attr
->typekind
);
5031 ok(dual_attr
->wTypeFlags
== (TYPEFLAG_FDISPATCHABLE
| TYPEFLAG_FOLEAUTOMATION
| TYPEFLAG_FDUAL
), "%d: got flags %04x\n", i
, dual_attr
->wTypeFlags
);
5033 ITypeInfo_ReleaseTypeAttr(dual_info
, dual_attr
);
5034 ITypeInfo_Release(dual_info
);
5038 StringFromGUID2(&attr
->guid
, uuidW
, sizeof(uuidW
) / sizeof(uuidW
[0]));
5039 WideCharToMultiByte(CP_ACP
, 0, uuidW
, -1, uuid
, sizeof(uuid
), NULL
, NULL
);
5040 sprintf(key_name
, "Interface\\%s", uuid
);
5042 /* All dispinterfaces will be registered (this includes dual interfaces) as well
5043 as oleautomation interfaces */
5044 if((attr
->typekind
== TKIND_INTERFACE
&& (attr
->wTypeFlags
& TYPEFLAG_FOLEAUTOMATION
)) ||
5045 attr
->typekind
== TKIND_DISPATCH
)
5046 expect_ret
= ERROR_SUCCESS
;
5048 expect_ret
= ERROR_FILE_NOT_FOUND
;
5050 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
, &hkey
);
5051 ok(ret
== expect_ret
, "%d: got %d\n", i
, ret
);
5052 if(ret
== ERROR_SUCCESS
) RegCloseKey(hkey
);
5054 /* 32-bit typelibs should be registered into both registry bit modes */
5055 if (is_win64
|| is_wow64
)
5057 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
| opposite
, &hkey
);
5058 ok(ret
== expect_ret
, "%d: got %d\n", i
, ret
);
5059 if(ret
== ERROR_SUCCESS
) RegCloseKey(hkey
);
5062 ITypeInfo_ReleaseTypeAttr(typeinfo
, attr
);
5063 ITypeInfo_Release(typeinfo
);
5066 if (system_registration
)
5067 hr
= UnRegisterTypeLib(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, is_win64
? SYS_WIN64
: SYS_WIN32
);
5069 hr
= pUnRegisterTypeLibForUser(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, is_win64
? SYS_WIN64
: SYS_WIN32
);
5070 ok(hr
== S_OK
, "got %08x\n", hr
);
5072 for(i
= 0; i
< count
; i
++)
5074 ITypeInfo
*typeinfo
;
5077 hr
= ITypeLib_GetTypeInfo(typelib
, i
, &typeinfo
);
5078 ok(hr
== S_OK
, "got %08x\n", hr
);
5080 hr
= ITypeInfo_GetTypeAttr(typeinfo
, &attr
);
5081 ok(hr
== S_OK
, "got %08x\n", hr
);
5083 if((attr
->typekind
== TKIND_INTERFACE
&& (attr
->wTypeFlags
& TYPEFLAG_FOLEAUTOMATION
)) ||
5084 attr
->typekind
== TKIND_DISPATCH
)
5086 StringFromGUID2(&attr
->guid
, uuidW
, sizeof(uuidW
) / sizeof(uuidW
[0]));
5087 WideCharToMultiByte(CP_ACP
, 0, uuidW
, -1, uuid
, sizeof(uuid
), NULL
, NULL
);
5088 sprintf(key_name
, "Interface\\%s", uuid
);
5090 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
, &hkey
);
5091 ok(ret
== ERROR_FILE_NOT_FOUND
, "Interface registry remains in %s (%d)\n", key_name
, i
);
5092 if (is_win64
|| is_wow64
)
5094 ret
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, key_name
, 0, KEY_READ
| opposite
, &hkey
);
5095 ok(ret
== ERROR_FILE_NOT_FOUND
, "Interface registry remains in %s (%d)\n", key_name
, i
);
5098 ITypeInfo_ReleaseTypeAttr(typeinfo
, attr
);
5099 ITypeInfo_Release(typeinfo
);
5102 ITypeLib_Release(typelib
);
5103 DeleteFileA( filenameA
);
5106 static void test_LoadTypeLib(void)
5111 static const WCHAR kernel32_dllW
[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
5113 hres
= LoadTypeLib(kernel32_dllW
, &tl
);
5114 ok(hres
== TYPE_E_CANTLOADLIBRARY
, "LoadTypeLib returned: %08x, expected TYPE_E_CANTLOADLIBRARY\n", hres
);
5116 hres
= LoadTypeLib(NULL
, NULL
);
5117 ok(hres
== E_INVALIDARG
, "Got %#x.\n", hres
);
5119 tl
= (void *)0xdeadbeef;
5120 hres
= LoadTypeLib(NULL
, &tl
);
5121 ok(hres
== E_INVALIDARG
, "Got %#x.\n", hres
);
5122 ok(tl
== (void *)0xdeadbeef, "Got %p.\n", tl
);
5124 hres
= LoadTypeLibEx(NULL
, REGKIND_NONE
, NULL
);
5125 ok(hres
== E_INVALIDARG
, "Got %#x.\n", hres
);
5127 tl
= (void *)0xdeadbeef;
5128 hres
= LoadTypeLibEx(NULL
, REGKIND_NONE
, &tl
);
5129 ok(hres
== E_INVALIDARG
, "Got %#x.\n", hres
);
5130 ok(tl
== (void *)0xdeadbeef, "Got %p.\n", tl
);
5133 static void test_SetVarHelpContext(void)
5135 static OLECHAR nameW
[] = {'n','a','m','e',0};
5136 CHAR filenameA
[MAX_PATH
];
5137 WCHAR filenameW
[MAX_PATH
];
5138 ICreateTypeLib2
*ctl
;
5139 ICreateTypeInfo
*cti
;
5142 VARDESC desc
, *pdesc
;
5147 GetTempFileNameA(".", "tlb", 0, filenameA
);
5148 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
5150 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
5151 ok(hr
== S_OK
, "got %08x\n", hr
);
5153 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_ENUM
, &cti
);
5154 ok(hr
== S_OK
, "got %08x\n", hr
);
5156 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 0, 0);
5157 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
5159 memset(&desc
, 0, sizeof(desc
));
5160 desc
.memid
= MEMBERID_NIL
;
5161 desc
.elemdescVar
.tdesc
.vt
= VT_INT
;
5162 desc
.varkind
= VAR_CONST
;
5166 U(desc
).lpvarValue
= &v
;
5167 hr
= ICreateTypeInfo_AddVarDesc(cti
, 0, &desc
);
5168 ok(hr
== S_OK
, "got %08x\n", hr
);
5170 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 0, 0);
5171 ok(hr
== S_OK
, "got %08x\n", hr
);
5174 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 0, 1);
5175 ok(hr
== S_OK
, "got %08x\n", hr
);
5177 /* wrong index now */
5178 hr
= ICreateTypeInfo_SetVarHelpContext(cti
, 1, 0);
5179 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
5181 ICreateTypeInfo_Release(cti
);
5183 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
5184 ok(hr
== S_OK
, "got: %08x\n", hr
);
5186 ICreateTypeLib2_Release(ctl
);
5188 hr
= LoadTypeLib(filenameW
, &tl
);
5189 ok(hr
== S_OK
, "got: %08x\n", hr
);
5191 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
5192 ok(hr
== S_OK
, "got %08x\n", hr
);
5194 hr
= ITypeInfo_GetVarDesc(ti
, 0, &pdesc
);
5195 ok(hr
== S_OK
, "got %08x\n", hr
);
5196 ok(pdesc
->memid
== 0x40000000, "got wrong memid: %x\n", pdesc
->memid
);
5197 ok(pdesc
->elemdescVar
.tdesc
.vt
== VT_INT
, "got wrong vardesc type: %u\n", pdesc
->elemdescVar
.tdesc
.vt
);
5198 ok(pdesc
->varkind
== VAR_CONST
, "got wrong varkind: %u\n", pdesc
->varkind
);
5199 ok(V_VT(U(*pdesc
).lpvarValue
) == VT_INT
, "got wrong value type: %u\n", V_VT(U(*pdesc
).lpvarValue
));
5200 ok(V_INT(U(*pdesc
).lpvarValue
) == 1, "got wrong value: 0x%x\n", V_INT(U(*pdesc
).lpvarValue
));
5202 hr
= ITypeInfo_GetDocumentation(ti
, pdesc
->memid
, NULL
, NULL
, &ctx
, NULL
);
5203 ok(hr
== S_OK
, "got %08x\n", hr
);
5204 ok(ctx
== 1, "got wrong help context: 0x%x\n", ctx
);
5206 ITypeInfo_ReleaseVarDesc(ti
, pdesc
);
5207 ITypeInfo_Release(ti
);
5208 ITypeLib_Release(tl
);
5210 DeleteFileA(filenameA
);
5213 static void test_SetFuncAndParamNames(void)
5215 static OLECHAR nameW
[] = {'n','a','m','e',0};
5216 static OLECHAR name2W
[] = {'n','a','m','e','2',0};
5217 static OLECHAR prop
[] = {'p','r','o','p',0};
5218 static OLECHAR
*propW
[] = {prop
};
5219 static OLECHAR func
[] = {'f','u','n','c',0};
5220 static OLECHAR
*funcW
[] = {func
, NULL
};
5221 CHAR filenameA
[MAX_PATH
];
5222 WCHAR filenameW
[MAX_PATH
];
5223 ICreateTypeLib2
*ctl
;
5224 ICreateTypeInfo
*cti
;
5226 ITypeInfo
*infos
[3];
5233 GetTempFileNameA(".", "tlb", 0, filenameA
);
5234 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
5236 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
5237 ok(hr
== S_OK
, "got %08x\n", hr
);
5239 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_DISPATCH
, &cti
);
5240 ok(hr
== S_OK
, "got %08x\n", hr
);
5243 memset(&funcdesc
, 0, sizeof(FUNCDESC
));
5244 funcdesc
.funckind
= FUNC_DISPATCH
;
5245 funcdesc
.callconv
= CC_STDCALL
;
5246 funcdesc
.elemdescFunc
.tdesc
.vt
= VT_VOID
;
5247 funcdesc
.wFuncFlags
= FUNCFLAG_FBINDABLE
;
5250 memset(&edesc
, 0, sizeof(edesc
));
5251 edesc
.tdesc
.vt
= VT_BSTR
;
5252 U(edesc
).idldesc
.dwReserved
= 0;
5253 U(edesc
).idldesc
.wIDLFlags
= IDLFLAG_FIN
;
5255 funcdesc
.lprgelemdescParam
= &edesc
;
5256 funcdesc
.invkind
= INVOKE_PROPERTYPUT
;
5257 funcdesc
.cParams
= 1;
5259 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 0, &funcdesc
);
5260 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5263 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 0, propW
, 1);
5264 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5267 funcdesc
.invkind
= INVOKE_PROPERTYPUTREF
;
5268 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 1, &funcdesc
);
5269 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5272 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 1, propW
, 1);
5273 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5275 funcdesc
.invkind
= INVOKE_PROPERTYGET
;
5276 funcdesc
.cParams
= 0;
5277 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 2, &funcdesc
);
5278 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5281 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 2, propW
, 1);
5282 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5284 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 3, &funcdesc
);
5285 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5287 /* getter name again */
5288 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 3, propW
, 1);
5289 ok(hr
== TYPE_E_AMBIGUOUSNAME
, "got 0x%08x\n", hr
);
5291 /* regular function */
5292 funcdesc
.invkind
= INVOKE_FUNC
;
5293 funcdesc
.cParams
= 1;
5294 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 4, &funcdesc
);
5295 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5297 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 4, funcW
, 2);
5298 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5300 ICreateTypeInfo_Release(cti
);
5302 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, name2W
, TKIND_INTERFACE
, &cti
);
5303 ok(hr
== S_OK
, "got %08x\n", hr
);
5305 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
5306 funcdesc
.invkind
= INVOKE_FUNC
;
5307 funcdesc
.cParams
= 0;
5308 funcdesc
.lprgelemdescParam
= NULL
;
5309 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 0, &funcdesc
);
5310 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5312 hr
= ICreateTypeInfo_SetFuncAndParamNames(cti
, 0, funcW
, 1);
5313 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5315 ICreateTypeInfo_Release(cti
);
5317 hr
= ICreateTypeLib2_QueryInterface(ctl
, &IID_ITypeLib
, (void**)&tl
);
5318 ok(hr
== S_OK
, "got %08x\n", hr
);
5321 memset(infos
, 0, sizeof(infos
));
5322 memids
[0] = 0xdeadbeef;
5323 memids
[1] = 0xdeadbeef;
5324 memids
[2] = 0xdeadbeef;
5325 hr
= ITypeLib_FindName(tl
, func
, 0, infos
, memids
, &found
);
5326 ok(hr
== S_OK
, "got %08x\n", hr
);
5327 ok(found
== 1, "got wrong count: %u\n", found
);
5328 ok(infos
[0] && !infos
[1] && !infos
[2], "got wrong typeinfo\n");
5329 ok(memids
[0] == 0, "got wrong memid[0]\n");
5330 ok(memids
[1] == 0xdeadbeef && memids
[2] == 0xdeadbeef, "got wrong memids\n");
5331 ITypeInfo_Release(infos
[0]);
5334 memset(infos
, 0, sizeof(infos
));
5335 memids
[0] = 0xdeadbeef;
5336 memids
[1] = 0xdeadbeef;
5337 memids
[2] = 0xdeadbeef;
5338 hr
= ITypeLib_FindName(tl
, func
, 0, infos
, memids
, &found
);
5339 ok(hr
== S_OK
, "got %08x\n", hr
);
5340 ok(found
== 2, "got wrong count: %u\n", found
);
5341 ok(infos
[0] && infos
[1] && infos
[0] != infos
[1], "got same typeinfo\n");
5342 ok(memids
[0] == 0, "got wrong memid[0]\n");
5343 ok(memids
[1] == 0, "got wrong memid[1]\n");
5344 ITypeInfo_Release(infos
[0]);
5345 ITypeInfo_Release(infos
[1]);
5347 ITypeLib_Release(tl
);
5348 ICreateTypeLib2_Release(ctl
);
5349 DeleteFileA(filenameA
);
5352 static void test_SetDocString(void)
5354 static OLECHAR nameW
[] = {'n','a','m','e',0};
5355 static OLECHAR name2W
[] = {'n','a','m','e','2',0};
5356 static OLECHAR doc1W
[] = {'d','o','c','1',0};
5357 static OLECHAR doc2W
[] = {'d','o','c','2',0};
5358 static OLECHAR var_nameW
[] = {'v','a','r','n','a','m','e',0};
5359 CHAR filenameA
[MAX_PATH
];
5360 WCHAR filenameW
[MAX_PATH
];
5361 ICreateTypeLib2
*ctl
;
5362 ICreateTypeInfo
*cti
;
5365 BSTR namestr
, docstr
;
5366 VARDESC desc
, *pdesc
;
5367 FUNCDESC funcdesc
, *pfuncdesc
;
5371 GetTempFileNameA(".", "tlb", 0, filenameA
);
5372 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
5374 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
5375 ok(hr
== S_OK
, "got %08x\n", hr
);
5377 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_ENUM
, &cti
);
5378 ok(hr
== S_OK
, "got %08x\n", hr
);
5380 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, doc1W
);
5381 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
5383 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, NULL
);
5384 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
5386 memset(&desc
, 0, sizeof(desc
));
5387 desc
.memid
= MEMBERID_NIL
;
5388 desc
.elemdescVar
.tdesc
.vt
= VT_INT
;
5389 desc
.varkind
= VAR_CONST
;
5393 U(desc
).lpvarValue
= &v
;
5394 hr
= ICreateTypeInfo_AddVarDesc(cti
, 0, &desc
);
5395 ok(hr
== S_OK
, "got %08x\n", hr
);
5397 hr
= ICreateTypeInfo_SetVarName(cti
, 0, NULL
);
5398 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
5400 hr
= ICreateTypeInfo_SetVarName(cti
, 1, var_nameW
);
5401 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
5403 hr
= ICreateTypeInfo_SetVarName(cti
, 0, var_nameW
);
5404 ok(hr
== S_OK
, "got %08x\n", hr
);
5406 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, NULL
);
5407 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
5409 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, doc1W
);
5410 ok(hr
== S_OK
, "got %08x\n", hr
);
5413 hr
= ICreateTypeInfo_SetVarDocString(cti
, 0, doc2W
);
5414 ok(hr
== S_OK
, "got %08x\n", hr
);
5416 /* wrong index now */
5417 hr
= ICreateTypeInfo_SetVarDocString(cti
, 1, doc1W
);
5418 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
5420 ICreateTypeInfo_Release(cti
);
5422 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, name2W
, TKIND_INTERFACE
, &cti
);
5423 ok(hr
== S_OK
, "got %08x\n", hr
);
5425 hr
= ICreateTypeInfo_SetFuncDocString(cti
, 0, doc1W
);
5426 ok(hr
== TYPE_E_ELEMENTNOTFOUND
, "got %08x\n", hr
);
5428 hr
= ICreateTypeInfo_SetFuncDocString(cti
, 0, NULL
);
5429 ok(hr
== E_INVALIDARG
, "got %08x\n", hr
);
5431 memset(&funcdesc
, 0, sizeof(funcdesc
));
5432 funcdesc
.memid
= MEMBERID_NIL
;
5433 funcdesc
.funckind
= FUNC_PUREVIRTUAL
;
5434 funcdesc
.invkind
= INVOKE_FUNC
;
5435 funcdesc
.callconv
= CC_STDCALL
;
5437 hr
= ICreateTypeInfo_AddFuncDesc(cti
, 0, &funcdesc
);
5438 ok(hr
== S_OK
, "got %08x\n", hr
);
5440 hr
= ICreateTypeInfo_SetFuncDocString(cti
, 0, doc1W
);
5441 ok(hr
== S_OK
, "got %08x\n", hr
);
5443 ICreateTypeInfo_Release(cti
);
5445 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
5446 ok(hr
== S_OK
, "got: %08x\n", hr
);
5448 ICreateTypeLib2_Release(ctl
);
5450 hr
= LoadTypeLib(filenameW
, &tl
);
5451 ok(hr
== S_OK
, "got: %08x\n", hr
);
5453 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
5454 ok(hr
== S_OK
, "got %08x\n", hr
);
5456 hr
= ITypeInfo_GetVarDesc(ti
, 0, &pdesc
);
5457 ok(hr
== S_OK
, "got %08x\n", hr
);
5458 ok(pdesc
->memid
== 0x40000000, "got wrong memid: %x\n", pdesc
->memid
);
5459 ok(pdesc
->elemdescVar
.tdesc
.vt
== VT_INT
, "got wrong vardesc type: %u\n", pdesc
->elemdescVar
.tdesc
.vt
);
5460 ok(pdesc
->varkind
== VAR_CONST
, "got wrong varkind: %u\n", pdesc
->varkind
);
5461 ok(V_VT(U(*pdesc
).lpvarValue
) == VT_INT
, "got wrong value type: %u\n", V_VT(U(*pdesc
).lpvarValue
));
5462 ok(V_INT(U(*pdesc
).lpvarValue
) == 1, "got wrong value: 0x%x\n", V_INT(U(*pdesc
).lpvarValue
));
5464 hr
= ITypeInfo_GetDocumentation(ti
, pdesc
->memid
, &namestr
, &docstr
, NULL
, NULL
);
5465 ok(hr
== S_OK
, "got %08x\n", hr
);
5466 ok(memcmp(namestr
, var_nameW
, sizeof(var_nameW
)) == 0, "got wrong name: %s\n", wine_dbgstr_w(namestr
));
5467 ok(memcmp(docstr
, doc2W
, sizeof(doc2W
)) == 0, "got wrong docstring: %s\n", wine_dbgstr_w(docstr
));
5469 SysFreeString(namestr
);
5470 SysFreeString(docstr
);
5472 ITypeInfo_ReleaseVarDesc(ti
, pdesc
);
5473 ITypeInfo_Release(ti
);
5475 hr
= ITypeLib_GetTypeInfo(tl
, 1, &ti
);
5476 ok(hr
== S_OK
, "got %08x\n", hr
);
5478 hr
= ITypeInfo_GetFuncDesc(ti
, 0, &pfuncdesc
);
5479 ok(hr
== S_OK
, "got %08x\n", hr
);
5480 ok(pfuncdesc
->memid
== 0x60000000, "got wrong memid: %x\n", pfuncdesc
->memid
);
5481 ok(pfuncdesc
->funckind
== FUNC_PUREVIRTUAL
, "got wrong funckind: %x\n", pfuncdesc
->funckind
);
5482 ok(pfuncdesc
->invkind
== INVOKE_FUNC
, "got wrong invkind: %x\n", pfuncdesc
->invkind
);
5483 ok(pfuncdesc
->callconv
== CC_STDCALL
, "got wrong callconv: %x\n", pfuncdesc
->callconv
);
5485 hr
= ITypeInfo_GetDocumentation(ti
, pfuncdesc
->memid
, &namestr
, &docstr
, NULL
, NULL
);
5486 ok(hr
== S_OK
, "got %08x\n", hr
);
5487 ok(namestr
== NULL
, "got wrong name: %s\n", wine_dbgstr_w(namestr
));
5488 ok(memcmp(docstr
, doc1W
, sizeof(doc1W
)) == 0, "got wrong docstring: %s\n", wine_dbgstr_w(docstr
));
5490 SysFreeString(docstr
);
5492 ITypeInfo_ReleaseFuncDesc(ti
, pfuncdesc
);
5493 ITypeInfo_Release(ti
);
5495 ITypeLib_Release(tl
);
5497 DeleteFileA(filenameA
);
5500 static void test_FindName(void)
5502 static const WCHAR invalidW
[] = {'i','n','v','a','l','i','d',0};
5510 hr
= LoadTypeLib(wszStdOle2
, &tl
);
5511 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5513 hr
= ITypeLib_FindName(tl
, NULL
, 0, NULL
, NULL
, NULL
);
5514 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
5516 lstrcpyW(buffW
, wszGUID
);
5517 hr
= ITypeLib_FindName(tl
, buffW
, 0, NULL
, NULL
, NULL
);
5518 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
5521 ti
= (void*)0xdeadbeef;
5522 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, NULL
, &c
);
5523 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
5524 ok(c
== 0, "got %d\n", c
);
5525 ok(ti
== (void*)0xdeadbeef, "got %p\n", ti
);
5528 ti
= (void*)0xdeadbeef;
5529 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, NULL
, &c
);
5530 ok(hr
== E_INVALIDARG
, "got 0x%08x\n", hr
);
5531 ok(c
== 1, "got %d\n", c
);
5532 ok(ti
== (void*)0xdeadbeef, "got %p\n", ti
);
5536 ti
= (void*)0xdeadbeef;
5537 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, &memid
, &c
);
5538 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5539 ok(memid
== MEMBERID_NIL
, "got %d\n", memid
);
5540 ok(!lstrcmpW(buffW
, wszGUID
), "got %s\n", wine_dbgstr_w(buffW
));
5541 ok(c
== 1, "got %d\n", c
);
5542 ITypeInfo_Release(ti
);
5546 lstrcpyW(buffW
, wszguid
);
5547 ti
= (void*)0xdeadbeef;
5548 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, &memid
, &c
);
5549 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5551 ok(memid
== MEMBERID_NIL
, "got %d\n", memid
);
5552 ok(!lstrcmpW(buffW
, wszGUID
), "got %s\n", wine_dbgstr_w(buffW
));
5553 ok(c
== 1, "got %d\n", c
);
5556 ITypeInfo_Release(ti
);
5560 lstrcpyW(buffW
, invalidW
);
5561 ti
= (void*)0xdeadbeef;
5562 hr
= ITypeLib_FindName(tl
, buffW
, 0, &ti
, &memid
, &c
);
5563 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5564 ok(memid
== MEMBERID_NIL
, "got %d\n", memid
);
5565 ok(!lstrcmpW(buffW
, invalidW
), "got %s\n", wine_dbgstr_w(buffW
));
5566 ok(c
== 0, "got %d\n", c
);
5567 ok(ti
== (void*)0xdeadbeef, "got %p\n", ti
);
5569 ITypeLib_Release(tl
);
5572 static void test_TypeInfo2_GetContainingTypeLib(void)
5574 static const WCHAR test
[] = {'t','e','s','t','.','t','l','b',0};
5575 static OLECHAR testTI
[] = {'t','e','s','t','T','y','p','e','I','n','f','o',0};
5577 ICreateTypeLib2
*ctl2
;
5578 ICreateTypeInfo
*cti
;
5584 hr
= CreateTypeLib2(SYS_WIN32
, test
, &ctl2
);
5585 ok_ole_success(hr
, CreateTypeLib2
);
5587 hr
= ICreateTypeLib2_CreateTypeInfo(ctl2
, testTI
, TKIND_DISPATCH
, &cti
);
5588 ok_ole_success(hr
, ICreateTypeLib2_CreateTypeInfo
);
5590 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo2
, (void**)&ti2
);
5591 ok_ole_success(hr
, ICreateTypeInfo2_QueryInterface
);
5595 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, &tl
, &Index
);
5596 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
5597 ok(tl
!= NULL
, "ITypeInfo2_GetContainingTypeLib returned empty TypeLib\n");
5598 ok(Index
== 0, "ITypeInfo2_GetContainingTypeLib returned Index = %u, expected 0\n", Index
);
5599 if(tl
) ITypeLib_Release(tl
);
5602 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, &tl
, NULL
);
5603 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
5604 ok(tl
!= NULL
, "ITypeInfo2_GetContainingTypeLib returned empty TypeLib\n");
5605 if(tl
) ITypeLib_Release(tl
);
5608 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, NULL
, &Index
);
5609 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
5610 ok(Index
== 0, "ITypeInfo2_GetContainingTypeLib returned Index = %u, expected 0\n", Index
);
5612 hr
= ITypeInfo2_GetContainingTypeLib(ti2
, NULL
, NULL
);
5613 ok_ole_success(hr
, ITypeInfo2_GetContainingTypeLib
);
5615 ITypeInfo2_Release(ti2
);
5616 ICreateTypeInfo_Release(cti
);
5617 ICreateTypeLib2_Release(ctl2
);
5620 static void create_manifest_file(const char *filename
, const char *manifest
)
5625 file
= CreateFileA(filename
, GENERIC_WRITE
, 0, NULL
, CREATE_ALWAYS
,
5626 FILE_ATTRIBUTE_NORMAL
, NULL
);
5627 ok(file
!= INVALID_HANDLE_VALUE
, "CreateFile failed: %u\n", GetLastError());
5628 WriteFile(file
, manifest
, strlen(manifest
), &size
, NULL
);
5632 static HANDLE
create_actctx(const char *file
)
5634 WCHAR path
[MAX_PATH
];
5638 MultiByteToWideChar(CP_ACP
, 0, file
, -1, path
, MAX_PATH
);
5639 memset(&actctx
, 0, sizeof(ACTCTXW
));
5640 actctx
.cbSize
= sizeof(ACTCTXW
);
5641 actctx
.lpSource
= path
;
5643 handle
= pCreateActCtxW(&actctx
);
5644 ok(handle
!= INVALID_HANDLE_VALUE
, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
5646 ok(actctx
.cbSize
== sizeof(actctx
), "actctx.cbSize=%d\n", actctx
.cbSize
);
5647 ok(actctx
.dwFlags
== 0, "actctx.dwFlags=%d\n", actctx
.dwFlags
);
5648 ok(actctx
.lpSource
== path
, "actctx.lpSource=%p\n", actctx
.lpSource
);
5649 ok(actctx
.wProcessorArchitecture
== 0, "actctx.wProcessorArchitecture=%d\n", actctx
.wProcessorArchitecture
);
5650 ok(actctx
.wLangId
== 0, "actctx.wLangId=%d\n", actctx
.wLangId
);
5651 ok(actctx
.lpAssemblyDirectory
== NULL
, "actctx.lpAssemblyDirectory=%p\n", actctx
.lpAssemblyDirectory
);
5652 ok(actctx
.lpResourceName
== NULL
, "actctx.lpResourceName=%p\n", actctx
.lpResourceName
);
5653 ok(actctx
.lpApplicationName
== NULL
, "actctx.lpApplicationName=%p\n",
5654 actctx
.lpApplicationName
);
5655 ok(actctx
.hModule
== NULL
, "actctx.hModule=%p\n", actctx
.hModule
);
5660 static const char manifest_dep
[] =
5661 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
5662 "<assemblyIdentity version=\"1.2.3.4\" name=\"testdep\" type=\"win32\" processorArchitecture=\"" ARCH
"\"/>"
5663 "<file name=\"test_actctx_tlb.tlb\">"
5664 " <typelib tlbid=\"{d96d8a3e-78b6-4c8d-8f27-059db959be8a}\" version=\"2.7\" helpdir=\"\" resourceid=\"409\""
5665 " flags=\"Restricted,cONTROL\""
5668 "<file name=\"test_actctx_tlb2.tlb\">"
5669 " <typelib tlbid=\"{a2cfdbd3-2bbf-4b1c-a414-5a5904e634c9}\" version=\"2.0\" helpdir=\"\" resourceid=\"409\""
5670 " flags=\"RESTRICTED,CONTROL\""
5675 static const char manifest_main
[] =
5676 "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
5677 "<assemblyIdentity version=\"1.2.3.4\" name=\"Wine.Test\" type=\"win32\" />"
5679 " <dependentAssembly>"
5680 " <assemblyIdentity type=\"win32\" name=\"testdep\" version=\"1.2.3.4\" processorArchitecture=\"" ARCH
"\" />"
5681 " </dependentAssembly>"
5685 static void test_LoadRegTypeLib(void)
5687 LCID lcid_en
= MAKELCID(MAKELANGID(LANG_ENGLISH
, SUBLANG_ENGLISH_US
), SORT_DEFAULT
);
5688 LCID lcid_ru
= MAKELCID(MAKELANGID(LANG_RUSSIAN
, SUBLANG_NEUTRAL
), SORT_DEFAULT
);
5697 if (!pActivateActCtx
)
5699 win_skip("Activation contexts not supported, skipping LoadRegTypeLib tests\n");
5703 create_manifest_file("testdep.manifest", manifest_dep
);
5704 create_manifest_file("main.manifest", manifest_main
);
5706 handle
= create_actctx("main.manifest");
5707 DeleteFileA("testdep.manifest");
5708 DeleteFileA("main.manifest");
5710 /* create typelib file */
5711 write_typelib(1, "test_actctx_tlb.tlb");
5712 write_typelib(3, "test_actctx_tlb2.tlb");
5714 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 1, 0, LOCALE_NEUTRAL
, &tl
);
5715 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
5717 hr
= LoadRegTypeLib(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, &tl
);
5718 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
5720 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, LOCALE_NEUTRAL
, &path
);
5721 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
5723 ret
= pActivateActCtx(handle
, &cookie
);
5724 ok(ret
, "ActivateActCtx failed: %u\n", GetLastError());
5727 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, LOCALE_NEUTRAL
, &path
);
5728 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5729 SysFreeString(path
);
5732 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_en
, &path
);
5733 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5734 SysFreeString(path
);
5737 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_ru
, &path
);
5738 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5739 SysFreeString(path
);
5741 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 8, LOCALE_NEUTRAL
, &path
);
5742 ok(hr
== TYPE_E_LIBNOTREGISTERED
|| broken(hr
== S_OK
) /* winxp */, "got 0x%08x\n", hr
);
5745 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 2, 7, LOCALE_NEUTRAL
, &path
);
5746 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5747 SysFreeString(path
);
5750 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 1, 0, LOCALE_NEUTRAL
, &path
);
5751 ok(hr
== TYPE_E_LIBNOTREGISTERED
|| broken(hr
== S_OK
) /* winxp */, "got 0x%08x\n", hr
);
5752 SysFreeString(path
);
5755 hr
= QueryPathOfRegTypeLib(&LIBID_TestTypelib
, 0xffff, 0xffff, LOCALE_NEUTRAL
, &path
);
5756 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5757 SysFreeString(path
);
5759 /* manifest version is 2.0, actual is 1.0 */
5760 hr
= LoadRegTypeLib(&LIBID_register_test
, 1, 0, LOCALE_NEUTRAL
, &tl
);
5761 ok(hr
== TYPE_E_LIBNOTREGISTERED
|| broken(hr
== S_OK
) /* winxp */, "got 0x%08x\n", hr
);
5762 if (hr
== S_OK
) ITypeLib_Release(tl
);
5764 hr
= LoadRegTypeLib(&LIBID_register_test
, 2, 0, LOCALE_NEUTRAL
, &tl
);
5765 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
5767 /* manifest version is 2.7, actual is 2.5 */
5768 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 0, LOCALE_NEUTRAL
, &tl
);
5769 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5770 if (hr
== S_OK
) ITypeLib_Release(tl
);
5772 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 1, LOCALE_NEUTRAL
, &tl
);
5773 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5774 if (hr
== S_OK
) ITypeLib_Release(tl
);
5776 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_en
, &tl
);
5777 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5778 if (hr
== S_OK
) ITypeLib_Release(tl
);
5780 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 0, lcid_ru
, &tl
);
5781 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5782 if (hr
== S_OK
) ITypeLib_Release(tl
);
5784 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 7, LOCALE_NEUTRAL
, &tl
);
5785 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
5787 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 2, 5, LOCALE_NEUTRAL
, &tl
);
5788 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5790 hr
= ITypeLib_GetLibAttr(tl
, &attr
);
5791 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5793 ok(attr
->lcid
== 0, "got %x\n", attr
->lcid
);
5794 ok(attr
->wMajorVerNum
== 2, "got %d\n", attr
->wMajorVerNum
);
5795 ok(attr
->wMinorVerNum
== 5, "got %d\n", attr
->wMinorVerNum
);
5796 ok(attr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "got %x\n", attr
->wLibFlags
);
5798 ITypeLib_ReleaseTLibAttr(tl
, attr
);
5799 ITypeLib_Release(tl
);
5801 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 1, 7, LOCALE_NEUTRAL
, &tl
);
5802 ok(hr
== TYPE_E_LIBNOTREGISTERED
, "got 0x%08x\n", hr
);
5805 hr
= LoadRegTypeLib(&LIBID_TestTypelib
, 0xffff, 0xffff, LOCALE_NEUTRAL
, &tl
);
5806 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5810 hr
= ITypeLib_GetLibAttr(tl
, &attr
);
5811 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
5813 ok(attr
->lcid
== 0, "got %x\n", attr
->lcid
);
5814 ok(attr
->wMajorVerNum
== 2, "got %d\n", attr
->wMajorVerNum
);
5815 ok(attr
->wMinorVerNum
== 5, "got %d\n", attr
->wMinorVerNum
);
5816 ok(attr
->wLibFlags
== LIBFLAG_FHASDISKIMAGE
, "got %x\n", attr
->wLibFlags
);
5818 ITypeLib_ReleaseTLibAttr(tl
, attr
);
5819 ITypeLib_Release(tl
);
5822 DeleteFileA("test_actctx_tlb.tlb");
5823 DeleteFileA("test_actctx_tlb2.tlb");
5825 ret
= pDeactivateActCtx(0, cookie
);
5826 ok(ret
, "DeactivateActCtx failed: %u\n", GetLastError());
5828 pReleaseActCtx(handle
);
5834 static struct _TDATest
{
5836 ULONG size
; /* -1 == typelib ptr size */
5838 WORD align3264
; /* for 32-bit typelibs loaded in 64-bit mode */
5848 { VT_DATE
, 8, 4, 8 },
5849 { VT_BSTR
, -1, 4, 8 },
5850 { VT_DISPATCH
, -1, 4, 8 },
5851 { VT_ERROR
, 4, 4, 4 },
5852 { VT_BOOL
, 2, 2, 2 },
5853 { VT_VARIANT
, 0 /* see code below */, 4, 8 },
5854 { VT_UNKNOWN
, -1, 4, 8 },
5855 { VT_DECIMAL
, 16, 4, 8 },
5857 { VT_UI1
, 1, 1, 1 },
5858 { VT_UI2
, 2, 2, 2 },
5859 { VT_UI4
, 4, 4, 4 },
5861 { VT_UI8
, 8, 4, 8 },
5862 { VT_INT
, 4, 4, 4 },
5863 { VT_UINT
, 4, 4, 4 },
5864 { VT_VOID
, 0, 0, 0 },
5865 { VT_HRESULT
, 4, 4, 4 },
5866 { VT_PTR
, -1, 4, 8, AUX_TDESC
, { { 0 }, VT_INT
} },
5867 { VT_SAFEARRAY
, -1, 4, 8, AUX_TDESC
, { { 0 }, VT_INT
} },
5868 { VT_CARRAY
, 16 /* == 4 * sizeof(int) */, 4, 4, AUX_ADESC
, { { 0 } }, { { { 0 }, VT_INT
}, 1, { { 4, 0 } } } },
5869 { VT_USERDEFINED
, 0, 0, 0, AUX_HREF
},
5870 { VT_LPSTR
, -1, 4, 8 },
5871 { VT_LPWSTR
, -1, 4, 8 },
5875 static void testTDA(ITypeLib
*tl
, struct _TDATest
*TDATest
,
5876 ULONG ptr_size
, HREFTYPE hreftype
, ULONG href_cbSizeInstance
,
5877 WORD href_cbAlignment
, BOOL create
)
5882 ICreateTypeInfo
*cti
;
5883 ICreateTypeLib2
*ctl
;
5889 static const WCHAR name_fmtW
[] = {'a','l','i','a','s','%','0','2','u',0};
5891 wsprintfW(nameW
, name_fmtW
, TDATest
->vt
);
5894 hr
= ITypeLib_QueryInterface(tl
, &IID_ICreateTypeLib2
, (void**)&ctl
);
5895 ok(hr
== S_OK
, "got %08x\n", hr
);
5897 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, nameW
, TKIND_ALIAS
, &cti
);
5898 ok(hr
== S_OK
, "got %08x\n", hr
);
5900 tdesc
.vt
= TDATest
->vt
;
5901 if(TDATest
->aux
== AUX_TDESC
)
5902 U(tdesc
).lptdesc
= &TDATest
->tdesc
;
5903 else if(TDATest
->aux
== AUX_ADESC
)
5904 U(tdesc
).lpadesc
= &TDATest
->adesc
;
5905 else if(TDATest
->aux
== AUX_HREF
)
5906 U(tdesc
).hreftype
= hreftype
;
5908 hr
= ICreateTypeInfo_SetTypeDescAlias(cti
, &tdesc
);
5909 ok(hr
== S_OK
, "for VT %u, got %08x\n", TDATest
->vt
, hr
);
5911 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo
, (void**)&ti
);
5912 ok(hr
== S_OK
, "got %08x\n", hr
);
5914 ICreateTypeInfo_Release(cti
);
5915 ICreateTypeLib2_Release(ctl
);
5920 hr
= ITypeLib_FindName(tl
, nameW
, 0, &ti
, &memid
, &found
);
5921 ok(hr
== S_OK
, "for VT %u, got %08x\n", TDATest
->vt
, hr
);
5924 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
5925 ok(hr
== S_OK
, "got %08x\n", hr
);
5927 if(TDATest
->aux
== AUX_HREF
){
5928 size
= href_cbSizeInstance
;
5929 alignment
= href_cbAlignment
;
5931 size
= TDATest
->size
;
5936 size
= sizeof(void*);
5937 }else if(TDATest
->vt
== VT_VARIANT
){
5939 size
= sizeof(VARIANT
);
5941 if(ptr_size
!= sizeof(void*))
5942 size
-= 8; /* 32-bit variant is 4 bytes smaller than 64-bit variant */
5945 size
= sizeof(VARIANT
);
5947 alignment
= TDATest
->align
;
5949 if(!create
&& ptr_size
!= sizeof(void*))
5950 alignment
= TDATest
->align3264
;
5954 ok(typeattr
->cbSizeInstance
== size
||
5955 broken(TDATest
->vt
== VT_VARIANT
&& ptr_size
!= sizeof(void*) && typeattr
->cbSizeInstance
== sizeof(VARIANT
)) /* winxp64 */,
5956 "got wrong size for VT %u: 0x%x\n", TDATest
->vt
, typeattr
->cbSizeInstance
);
5957 ok(typeattr
->cbAlignment
== alignment
, "got wrong alignment for VT %u: 0x%x\n", TDATest
->vt
, typeattr
->cbAlignment
);
5958 ok(typeattr
->tdescAlias
.vt
== TDATest
->vt
, "got wrong VT for VT %u: 0x%x\n", TDATest
->vt
, typeattr
->tdescAlias
.vt
);
5960 switch(TDATest
->aux
){
5962 ok(U(typeattr
->tdescAlias
).hreftype
== hreftype
, "got wrong hreftype for VT %u: 0x%x\n", TDATest
->vt
, U(typeattr
->tdescAlias
).hreftype
);
5965 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
);
5968 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
);
5969 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
);
5970 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
);
5971 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
);
5975 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
5976 ITypeInfo_Release(ti
);
5979 static void test_SetTypeDescAlias(SYSKIND kind
)
5981 CHAR filenameA
[MAX_PATH
];
5982 WCHAR filenameW
[MAX_PATH
];
5984 ICreateTypeLib2
*ctl
;
5986 ICreateTypeInfo
*cti
;
5989 ULONG href_cbSizeInstance
, i
;
5990 WORD href_cbAlignment
, ptr_size
;
5993 static OLECHAR interfaceW
[] = {'i','n','t','e','r','f','a','c','e',0};
5997 trace("testing SYS_WIN32\n");
6001 trace("testing SYS_WIN64\n");
6008 GetTempFileNameA(".", "tlb", 0, filenameA
);
6009 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
6011 hr
= CreateTypeLib2(kind
, filenameW
, &ctl
);
6012 ok(hr
== S_OK
, "got %08x\n", hr
);
6014 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, interfaceW
, TKIND_INTERFACE
, &cti
);
6015 ok(hr
== S_OK
, "got %08x\n", hr
);
6017 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo
, (void**)&ti
);
6018 ok(hr
== S_OK
, "got %08x\n", hr
);
6020 hr
= ICreateTypeInfo_AddRefTypeInfo(cti
, ti
, &hreftype
);
6021 ok(hr
== S_OK
, "got %08x\n", hr
);
6023 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
6024 ok(hr
== S_OK
, "got %08x\n", hr
);
6026 href_cbSizeInstance
= typeattr
->cbSizeInstance
;
6027 href_cbAlignment
= typeattr
->cbAlignment
;
6029 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
6031 ITypeInfo_Release(ti
);
6032 ICreateTypeInfo_Release(cti
);
6034 hr
= ICreateTypeLib2_QueryInterface(ctl
, &IID_ITypeLib
, (void**)&tl
);
6035 ok(hr
== S_OK
, "got %08x\n", hr
);
6037 for(i
= 0; TDATests
[i
].vt
; ++i
)
6038 testTDA(tl
, &TDATests
[i
], ptr_size
, hreftype
, href_cbSizeInstance
, href_cbAlignment
, TRUE
);
6040 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
6041 ok(hr
== S_OK
, "got %08x\n", hr
);
6043 ITypeLib_Release(tl
);
6044 ok(0 == ICreateTypeLib2_Release(ctl
), "typelib should have been released\n");
6046 trace("after save...\n");
6048 hr
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &tl
);
6049 ok(hr
== S_OK
, "got %08x\n", hr
);
6051 hr
= ITypeLib_GetTypeInfo(tl
, 0, &ti
);
6052 ok(hr
== S_OK
, "got %08x\n", hr
);
6054 hr
= ITypeInfo_GetTypeAttr(ti
, &typeattr
);
6055 ok(hr
== S_OK
, "got %08x\n", hr
);
6057 href_cbSizeInstance
= typeattr
->cbSizeInstance
;
6058 href_cbAlignment
= typeattr
->cbAlignment
;
6060 ITypeInfo_ReleaseTypeAttr(ti
, typeattr
);
6061 ITypeInfo_Release(ti
);
6063 for(i
= 0; TDATests
[i
].vt
; ++i
)
6064 testTDA(tl
, &TDATests
[i
], ptr_size
, hreftype
, href_cbSizeInstance
, href_cbAlignment
, FALSE
);
6066 ok(0 == ITypeLib_Release(tl
), "typelib should have been released\n");
6068 DeleteFileA(filenameA
);
6071 static void test_GetLibAttr(void)
6078 hr
= LoadTypeLib(wszStdOle2
, &tl
);
6079 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
6081 ref1
= ITypeLib_AddRef(tl
);
6082 ITypeLib_Release(tl
);
6084 hr
= ITypeLib_GetLibAttr(tl
, &attr
);
6085 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
6087 ref2
= ITypeLib_AddRef(tl
);
6088 ITypeLib_Release(tl
);
6089 ok(ref2
== ref1
, "got %d, %d\n", ref2
, ref1
);
6091 ITypeLib_ReleaseTLibAttr(tl
, attr
);
6092 ITypeLib_Release(tl
);
6095 static HRESULT WINAPI
uk_QueryInterface(IUnknown
*obj
, REFIID iid
, void **out
)
6097 return E_NOINTERFACE
;
6100 static ULONG WINAPI
uk_AddRef(IUnknown
*obj
)
6105 static ULONG WINAPI
uk_Release(IUnknown
*obj
)
6116 IUnknown uk
= {&vt
};
6118 static void test_stub(void)
6120 BOOL is_wow64
= FALSE
;
6124 ICreateTypeLib2
*ctl
;
6125 ICreateTypeInfo
*cti
;
6127 ITypeInfo
*unk
, *ti
;
6129 char filenameA
[MAX_PATH
];
6130 WCHAR filenameW
[MAX_PATH
];
6133 static const GUID libguid
= {0x3b9ff02e,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
6134 static const GUID interfaceguid
= {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
6135 static const GUID coclassguid
= {0x3b9ff030,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
6136 static OLECHAR interfaceW
[] = {'i','n','t','e','r','f','a','c','e',0};
6137 static OLECHAR classW
[] = {'c','l','a','s','s',0};
6138 static DWORD sam_list32
[] = { 0, ~0 };
6139 static DWORD sam_list64
[] = { 0, KEY_WOW64_32KEY
, KEY_WOW64_64KEY
, ~0 };
6141 if (pIsWow64Process
)
6142 pIsWow64Process(GetCurrentProcess(), &is_wow64
);
6143 if (is_wow64
|| is_win64
)
6144 sam_list
= sam_list64
;
6146 sam_list
= sam_list32
;
6148 CoInitializeEx(NULL
, COINIT_APARTMENTTHREADED
);
6150 hr
= LoadTypeLib(wszStdOle2
, &stdole
);
6151 ok(hr
== S_OK
, "got %08x\n", hr
);
6153 hr
= ITypeLib_GetTypeInfoOfGuid(stdole
, &IID_IUnknown
, &unk
);
6154 ok(hr
== S_OK
, "got %08x\n", hr
);
6156 GetTempFileNameA(".", "tlb", 0, filenameA
);
6157 MultiByteToWideChar(CP_ACP
, 0, filenameA
, -1, filenameW
, MAX_PATH
);
6159 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &ctl
);
6160 ok(hr
== S_OK
, "got %08x\n", hr
);
6162 hr
= ICreateTypeLib2_SetGuid(ctl
, &libguid
);
6163 ok(hr
== S_OK
, "got %08x\n", hr
);
6165 hr
= ICreateTypeLib2_SetLcid(ctl
, LOCALE_NEUTRAL
);
6166 ok(hr
== S_OK
, "got %08x\n", hr
);
6168 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, interfaceW
, TKIND_INTERFACE
, &cti
);
6169 ok(hr
== S_OK
, "got %08x\n", hr
);
6171 hr
= ICreateTypeInfo_SetGuid(cti
, &interfaceguid
);
6172 ok(hr
== S_OK
, "got %08x\n", hr
);
6174 hr
= ICreateTypeInfo_SetTypeFlags(cti
, TYPEFLAG_FOLEAUTOMATION
);
6175 ok(hr
== S_OK
, "got %08x\n", hr
);
6177 hr
= ICreateTypeInfo_AddRefTypeInfo(cti
, unk
, &href
);
6178 ok(hr
== S_OK
, "got %08x\n", hr
);
6180 hr
= ICreateTypeInfo_AddImplType(cti
, 0, href
);
6181 ok(hr
== S_OK
, "got %08x\n", hr
);
6183 hr
= ICreateTypeInfo_QueryInterface(cti
, &IID_ITypeInfo
, (void**)&ti
);
6184 ok(hr
== S_OK
, "got %08x\n", hr
);
6186 ICreateTypeInfo_Release(cti
);
6187 ITypeInfo_Release(unk
);
6188 ITypeLib_Release(stdole
);
6190 hr
= ICreateTypeLib2_CreateTypeInfo(ctl
, classW
, TKIND_COCLASS
, &cti
);
6191 ok(hr
== S_OK
, "got %08x\n", hr
);
6193 hr
= ICreateTypeInfo_SetGuid(cti
, &coclassguid
);
6194 ok(hr
== S_OK
, "got %08x\n", hr
);
6196 hr
= ICreateTypeInfo_AddRefTypeInfo(cti
, ti
, &href
);
6197 ok(hr
== S_OK
, "got %08x\n", hr
);
6199 hr
= ICreateTypeInfo_AddImplType(cti
, 0, href
);
6200 ok(hr
== S_OK
, "got %08x\n", hr
);
6202 ITypeInfo_Release(ti
);
6203 ICreateTypeInfo_Release(cti
);
6205 hr
= ICreateTypeLib2_SaveAllChanges(ctl
);
6206 ok(hr
== S_OK
, "got %08x\n", hr
);
6208 hr
= ICreateTypeLib2_QueryInterface(ctl
, &IID_ITypeLib
, (void**)&tl
);
6209 ok(hr
== S_OK
, "got %08x\n", hr
);
6211 for (i
= 0; sam_list
[i
] != ~0; i
++)
6213 IPSFactoryBuffer
*factory
;
6214 IRpcStubBuffer
*base_stub
;
6215 REGSAM side
= sam_list
[i
];
6220 hr
= RegisterTypeLib(tl
, filenameW
, NULL
);
6221 if (hr
== TYPE_E_REGISTRYACCESS
)
6223 win_skip("Insufficient privileges to register typelib in the registry\n");
6226 ok(hr
== S_OK
, "got %08x, side: %04x\n", hr
, side
);
6228 /* SYS_WIN32 typelibs should be registered only as 32-bit */
6229 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "TypeLib\\{3b9ff02e-9675-4861-b781-ceaea4782acc}\\0.0\\0\\win64", 0, KEY_READ
| side
, &hkey
);
6230 ok(lr
== ERROR_FILE_NOT_FOUND
, "got wrong return code: %u, side: %04x\n", lr
, side
);
6232 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "TypeLib\\{3b9ff02e-9675-4861-b781-ceaea4782acc}\\0.0\\0\\win32", 0, KEY_READ
| side
, &hkey
);
6233 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
6236 /* Simulate pre-win7 installers that create interface key on one side */
6240 REGSAM opposite
= side
^ (KEY_WOW64_64KEY
| KEY_WOW64_32KEY
);
6242 StringFromGUID2(&interfaceguid
, guidW
, sizeof(guidW
)/sizeof(guidW
[0]));
6244 /* Delete the opposite interface key */
6245 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "Interface", 0, KEY_READ
| opposite
, &hkey
);
6246 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
6247 lr
= myRegDeleteTreeW(hkey
, guidW
, opposite
);
6248 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
6251 /* Is our side interface key affected by above operation? */
6252 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "Interface\\{3b9ff02f-9675-4861-b781-ceaea4782acc}", 0, KEY_READ
| side
, &hkey
);
6253 ok(lr
== ERROR_SUCCESS
|| broken(lr
== ERROR_FILE_NOT_FOUND
), "got wrong return code: %u, side: %04x\n", lr
, side
);
6254 if (lr
== ERROR_FILE_NOT_FOUND
)
6256 /* win2k3, vista, 2008 */
6257 win_skip("Registry reflection is enabled on this platform.\n");
6262 /* Opposite side typelib key still exists */
6263 lr
= RegOpenKeyExA(HKEY_CLASSES_ROOT
, "TypeLib\\{3b9ff02e-9675-4861-b781-ceaea4782acc}\\0.0\\0\\win32", 0, KEY_READ
| opposite
, &hkey
);
6264 ok(lr
== ERROR_SUCCESS
, "got wrong return code: %u, side: %04x\n", lr
, side
);
6268 hr
= CoGetPSClsid(&interfaceguid
, &clsid
);
6269 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
6271 hr
= CoGetClassObject(&clsid
, CLSCTX_INPROC_SERVER
, NULL
,
6272 &IID_IPSFactoryBuffer
, (void **)&factory
);
6273 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
6275 hr
= IPSFactoryBuffer_CreateStub(factory
, &interfaceguid
, &uk
, &base_stub
);
6276 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
6277 IRpcStubBuffer_Release(base_stub
);
6279 IPSFactoryBuffer_Release(factory
);
6281 hr
= UnRegisterTypeLib(&libguid
, 0, 0, 0, SYS_WIN32
);
6282 ok(hr
== S_OK
, "got: %x, side: %04x\n", hr
, side
);
6285 ITypeLib_Release(tl
);
6286 ok(0 == ICreateTypeLib2_Release(ctl
), "Typelib still has references\n");
6288 DeleteFileW(filenameW
);
6293 static void test_dep(void) {
6295 const char *refFilename
;
6296 WCHAR refFilenameW
[MAX_PATH
];
6298 ITypeInfo
*preftInfo
;
6299 char filename
[MAX_PATH
];
6300 WCHAR filenameW
[MAX_PATH
];
6301 ICreateTypeLib2
*pctLib
;
6302 ICreateTypeInfo
*pctInfo
;
6305 ITypeInfo
*ptInfoExt
= NULL
;
6308 static WCHAR ifacenameW
[] = {'I','T','e','s','t','D','e','p',0};
6310 static const GUID libguid
= {0xe0228f26,0x2946,0x478c,{0xb6,0x4a,0x93,0xfe,0xef,0xa5,0x05,0x32}};
6311 static const GUID ifaceguid
= {0x394376dd,0x3bb8,0x4804,{0x8c,0xcc,0x95,0x59,0x43,0x40,0x04,0xf3}};
6313 trace("Starting typelib dependency tests\n");
6315 refFilename
= create_test_typelib(2);
6316 MultiByteToWideChar(CP_ACP
, 0, refFilename
, -1, refFilenameW
, MAX_PATH
);
6318 hr
= LoadTypeLibEx(refFilenameW
, REGKIND_NONE
, &preftLib
);
6319 ok(hr
== S_OK
, "got %08x\n", hr
);
6321 hr
= ITypeLib_GetTypeInfoOfGuid(preftLib
, &IID_ISimpleIface
, &preftInfo
);
6322 ok(hr
== S_OK
, "got %08x\n", hr
);
6324 GetTempFileNameA(".", "tlb", 0, filename
);
6325 MultiByteToWideChar(CP_ACP
, 0, filename
, -1, filenameW
, MAX_PATH
);
6327 if(sizeof(void*) == 8) {
6328 hr
= CreateTypeLib2(SYS_WIN64
, filenameW
, &pctLib
);
6329 ok(hr
== S_OK
, "got %08x\n", hr
);
6331 hr
= CreateTypeLib2(SYS_WIN32
, filenameW
, &pctLib
);
6332 ok(hr
== S_OK
, "got %08x\n", hr
);
6335 hr
= ICreateTypeLib2_SetGuid(pctLib
, &libguid
);
6336 ok(hr
== S_OK
, "got %08x\n", hr
);
6338 hr
= ICreateTypeLib2_SetLcid(pctLib
, LOCALE_NEUTRAL
);
6339 ok(hr
== S_OK
, "got %08x\n", hr
);
6341 hr
= ICreateTypeLib2_CreateTypeInfo(pctLib
, ifacenameW
, TKIND_INTERFACE
, &pctInfo
);
6342 ok(hr
== S_OK
, "got %08x\n", hr
);
6344 hr
= ICreateTypeInfo_SetGuid(pctInfo
, &ifaceguid
);
6345 ok(hr
== S_OK
, "got %08x\n", hr
);
6347 hr
= ICreateTypeInfo_SetTypeFlags(pctInfo
, TYPEFLAG_FOLEAUTOMATION
);
6348 ok(hr
== S_OK
, "got %08x\n", hr
);
6350 hr
= ICreateTypeInfo_AddRefTypeInfo(pctInfo
, preftInfo
, &refType
);
6351 ok(hr
== S_OK
, "got %08x\n", hr
);
6353 hr
= ICreateTypeInfo_AddImplType(pctInfo
, 0, refType
);
6354 ok(hr
== S_OK
, "got %08x\n", hr
);
6356 ICreateTypeInfo_Release(pctInfo
);
6358 hr
= ICreateTypeLib2_SaveAllChanges(pctLib
);
6359 ok(hr
== S_OK
, "got %08x\n", hr
);
6361 ICreateTypeLib2_Release(pctLib
);
6363 ITypeInfo_Release(preftInfo
);
6364 ITypeLib_Release(preftLib
);
6366 DeleteFileW(refFilenameW
);
6368 hr
= LoadTypeLibEx(filenameW
, REGKIND_NONE
, &ptLib
);
6369 ok(hr
== S_OK
, "got: %x\n", hr
);
6371 hr
= ITypeLib_GetTypeInfoOfGuid(ptLib
, &ifaceguid
, &ptInfo
);
6372 ok(hr
== S_OK
, "got: %x\n", hr
);
6374 hr
= ITypeInfo_GetRefTypeOfImplType(ptInfo
, 0, &refType
);
6375 ok(hr
== S_OK
, "got: %x\n", hr
);
6377 hr
= ITypeInfo_GetRefTypeInfo(ptInfo
, refType
, &ptInfoExt
);
6378 ok(hr
== S_OK
|| broken(hr
== TYPE_E_CANTLOADLIBRARY
) /* win 2000 */, "got: %x\n", hr
);
6380 ITypeInfo_Release(ptInfo
);
6382 ITypeInfo_Release(ptInfoExt
);
6383 ITypeLib_Release(ptLib
);
6385 DeleteFileW(filenameW
);
6390 const char *filename
;
6392 init_function_pointers();
6394 ref_count_test(wszStdOle2
);
6396 test_CreateDispTypeInfo();
6398 test_DispCallFunc();
6399 test_QueryPathOfRegTypeLib(32);
6400 if(sizeof(void*) == 8){
6401 test_QueryPathOfRegTypeLib(64);
6402 test_CreateTypeLib(SYS_WIN64
);
6403 test_SetTypeDescAlias(SYS_WIN64
);
6405 test_CreateTypeLib(SYS_WIN32
);
6406 test_SetTypeDescAlias(SYS_WIN32
);
6408 test_SetVarHelpContext();
6409 test_SetFuncAndParamNames();
6410 test_SetDocString();
6413 if ((filename
= create_test_typelib(2)))
6415 test_dump_typelib( filename
);
6416 DeleteFileA( filename
);
6419 test_register_typelib(TRUE
);
6420 test_register_typelib(FALSE
);
6421 test_create_typelibs();
6423 test_TypeInfo2_GetContainingTypeLib();
6424 test_LoadRegTypeLib();