ReactOS 0.4.15-dev-7712-gbbbcd8e
typelib.c File Reference
#include <wine/test.h>
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "oleauto.h"
#include "ocidl.h"
#include "shlwapi.h"
#include "tmarshal.h"
#include "olectl.h"
#include "test_reg.h"
#include "test_tlb.h"
Include dependency graph for typelib.c:

Go to the source code of this file.

Classes

struct  _element_info
 
struct  _function_info
 
struct  _type_info
 
struct  _TDATest
 

Macros

#define NONAMELESSSTRUCT
 
#define NONAMELESSUNION
 
#define COBJMACROS
 
#define CONST_VTABLE
 
#define expect_eq(expr, value, type, format)   { type _ret = (expr); ok((value) == _ret, #expr " expected " format " got " format "\n", value, _ret); }
 
#define expect_int(expr, value)   expect_eq(expr, (int)(value), int, "%d")
 
#define expect_hex(expr, value)   expect_eq(expr, (int)(value), int, "0x%x")
 
#define expect_null(expr)   expect_eq(expr, NULL, const void *, "%p")
 
#define expect_guid(expected, guid)   { ok(IsEqualGUID(expected, guid), "got wrong guid %s\n", wine_dbgstr_guid(guid)); }
 
#define expect_wstr_acpval(expr, value)
 
#define ole_expect(expr, expect)
 
#define ole_check(expr)   ole_expect(expr, S_OK);
 
#define ok_ole_success(hr, func)   ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)
 
#define ARCH   "none"
 
#define check_type(elem, info)
 
#define AUX_HREF   1
 
#define AUX_TDESC   2
 
#define AUX_ADESC   3
 

Typedefs

typedef struct _element_info element_info
 
typedef struct _function_info function_info
 
typedef struct _type_info type_info
 

Functions

static HRESULT (WINAPI *pRegisterTypeLibForUser)(ITypeLib *
 
static BOOL (WINAPI *pActivateActCtx)(HANDLE
 
static ULONG_PTR *static HANDLE (WINAPI *pCreateActCtxW)(PCACTCTXW)
 
static VOID (WINAPI *pReleaseActCtx)(HANDLE)
 
static LONG (WINAPI *pRegDeleteKeyExW)(HKEY
 
static HRESULT WINAPI collection_QueryInterface (ICollection *iface, REFIID riid, void **ret)
 
static ULONG WINAPI collection_AddRef (ICollection *iface)
 
static ULONG WINAPI collection_Release (ICollection *iface)
 
static HRESULT WINAPI collection_GetTypeInfoCount (ICollection *iface, UINT *cnt)
 
static HRESULT WINAPI collection_GetTypeInfo (ICollection *iface, UINT index, LCID lcid, ITypeInfo **ti)
 
static HRESULT WINAPI collection_GetIDsOfNames (ICollection *iface, REFIID riid, LPOLESTR *names, UINT cnt, LCID lcid, DISPID *dispid)
 
static HRESULT WINAPI collection_Invoke (ICollection *iface, DISPID dispid, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *dispparams, VARIANT *res, EXCEPINFO *ei, UINT *argerr)
 
static HRESULT WINAPI collection_Item (ICollection *iface, int i, int *p)
 
static HRESULT WINAPI invoketest_QueryInterface (IInvokeTest *iface, REFIID riid, void **ret)
 
static ULONG WINAPI invoketest_AddRef (IInvokeTest *iface)
 
static ULONG WINAPI invoketest_Release (IInvokeTest *iface)
 
static HRESULT WINAPI invoketest_GetTypeInfoCount (IInvokeTest *iface, UINT *cnt)
 
static HRESULT WINAPI invoketest_GetTypeInfo (IInvokeTest *iface, UINT index, LCID lcid, ITypeInfo **ti)
 
static HRESULT WINAPI invoketest_GetIDsOfNames (IInvokeTest *iface, REFIID riid, LPOLESTR *names, UINT cnt, LCID lcid, DISPID *dispid)
 
static HRESULT WINAPI invoketest_Invoke (IInvokeTest *iface, DISPID dispid, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *dispparams, VARIANT *res, EXCEPINFO *ei, UINT *argerr)
 
static LONG WINAPI invoketest_get_test (IInvokeTest *iface, LONG i)
 
static LONG WINAPI invoketest_putref_testprop (IInvokeTest *iface, LONG *i)
 
static LONG WINAPI invoketest_putref_testprop2 (IInvokeTest *iface, IUnknown *i)
 
static HRESULT WINAPI invoketest_testfunc (IInvokeTest *iface, int i, int *p)
 
static HRESULT WINAPI invoketest_testget (IInvokeTest *iface, ICollection **p)
 
static void init_function_pointers (void)
 
static void ref_count_test (LPCWSTR type_lib)
 
static void test_TypeComp (void)
 
static void test_CreateDispTypeInfo (void)
 
static void write_typelib (int res_no, const char *filename)
 
static void test_invoke_func (ITypeInfo *typeinfo)
 
static const charcreate_test_typelib (int res_no)
 
static void test_TypeInfo (void)
 
static int WINAPI int_func (int a0, int a1, int a2, int a3, int a4)
 
static double WINAPI double_func (double a0, float a1, double a2, int a3)
 
static LONGLONG WINAPI longlong_func (LONGLONG a0, CY a1)
 
static VARIANT WINAPI variant_func (int a0, BOOL a1, DECIMAL a2, VARIANT a3)
 
static int CDECL void_func (int a0, int a1)
 
static int WINAPI stdcall_func (int a)
 
static int WINAPI inst_func (void *inst, int a)
 
static HRESULT WINAPI ret_false_func (void)
 
static void WINAPI variant_func2 (VARIANT *ret, VARIANT v1, VARIANT v2)
 
static void WINAPI inst_func2 (void *inst, VARIANT *ret, VARIANT v1, VARIANT v2)
 
static void test_DispCallFunc (void)
 
static LSTATUS myRegDeleteTreeW (HKEY hKey, LPCWSTR lpszSubKey, REGSAM view)
 
static BOOL do_typelib_reg_key (GUID *uid, WORD maj, WORD min, DWORD arch, LPCWSTR base, BOOL remove)
 
static void test_QueryPathOfRegTypeLib (DWORD arch)
 
static void test_inheritance (void)
 
static void test_CreateTypeLib (SYSKIND sys)
 
static void test_dump_typelib (const char *name)
 
static void test_create_typelib_lcid (LCID lcid)
 
static void test_create_typelibs (void)
 
static void test_register_typelib (BOOL system_registration)
 
static void test_LoadTypeLib (void)
 
static void test_SetVarHelpContext (void)
 
static void test_SetFuncAndParamNames (void)
 
static void test_SetDocString (void)
 
static void test_FindName (void)
 
static void test_TypeInfo2_GetContainingTypeLib (void)
 
static void create_manifest_file (const char *filename, const char *manifest)
 
static HANDLE create_actctx (const char *file)
 
static void test_LoadRegTypeLib (void)
 
static void testTDA (ITypeLib *tl, struct _TDATest *TDATest, ULONG ptr_size, HREFTYPE hreftype, ULONG href_cbSizeInstance, WORD href_cbAlignment, BOOL create)
 
static void test_SetTypeDescAlias (SYSKIND kind)
 
static void test_GetLibAttr (void)
 
static HRESULT WINAPI uk_QueryInterface (IUnknown *obj, REFIID iid, void **out)
 
static ULONG WINAPI uk_AddRef (IUnknown *obj)
 
static ULONG WINAPI uk_Release (IUnknown *obj)
 
static void test_stub (void)
 
static void test_dep (void)
 
 START_TEST (typelib)
 

Variables

static OLECHAR OLECHAR *static WORD
 
static OLECHAR OLECHAR *static LCID
 
static OLECHAR OLECHAR *static SYSKIND
 
static ULONG_PTR
 
static LPBOOL
 
static LPCWSTR
 
static REGSAM
 
static DWORD
 
static const WCHAR wszStdOle2 [] = {'s','t','d','o','l','e','2','.','t','l','b',0}
 
static WCHAR wszGUID [] = {'G','U','I','D',0}
 
static WCHAR wszguid [] = {'g','u','i','d',0}
 
static const BOOL is_win64 = sizeof(void *) > sizeof(int)
 
static const BOOL abi_supports_stdcall = FALSE
 
static const ICollectionVtbl collectionvtbl
 
static ICollection collection = { &collectionvtbl }
 
static const IInvokeTestVtbl invoketestvtbl
 
static IInvokeTest invoketest = { &invoketestvtbl }
 
static const WCHAR testW [] = { 'T','e','s','t',0 }
 
static voidvtable [] = { NULL, NULL, NULL, inst_func }
 
static voidvtable2 [] = { NULL, NULL, NULL, inst_func2 }
 
static const type_info info []
 
static const char manifest_dep []
 
static const char manifest_main []
 
static struct _TDATest TDATests []
 
IUnknownVtbl vt
 
IUnknown uk = {&vt}
 

Macro Definition Documentation

◆ ARCH

#define ARCH   "none"

Definition at line 76 of file typelib.c.

◆ AUX_ADESC

#define AUX_ADESC   3

Definition at line 5875 of file typelib.c.

◆ AUX_HREF

#define AUX_HREF   1

Definition at line 5873 of file typelib.c.

◆ AUX_TDESC

#define AUX_TDESC   2

Definition at line 5874 of file typelib.c.

◆ check_type

#define check_type (   elem,
  info 
)
Value:
{ \
expect_int((elem)->tdesc.vt, (info)->vt); \
expect_hex(U(*(elem)).paramdesc.wParamFlags, (info)->wParamFlags); \
}
#define U(x)
Definition: wordpad.c:45
static size_t elem
Definition: string.c:68

Definition at line 4750 of file typelib.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file typelib.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 26 of file typelib.c.

◆ expect_eq

#define expect_eq (   expr,
  value,
  type,
  format 
)    { type _ret = (expr); ok((value) == _ret, #expr " expected " format " got " format "\n", value, _ret); }

Definition at line 45 of file typelib.c.

◆ expect_guid

#define expect_guid (   expected,
  guid 
)    { ok(IsEqualGUID(expected, guid), "got wrong guid %s\n", wine_dbgstr_guid(guid)); }

Definition at line 49 of file typelib.c.

◆ expect_hex

#define expect_hex (   expr,
  value 
)    expect_eq(expr, (int)(value), int, "0x%x")

Definition at line 47 of file typelib.c.

◆ expect_int

#define expect_int (   expr,
  value 
)    expect_eq(expr, (int)(value), int, "%d")

Definition at line 46 of file typelib.c.

◆ expect_null

#define expect_null (   expr)    expect_eq(expr, NULL, const void *, "%p")

Definition at line 48 of file typelib.c.

◆ expect_wstr_acpval

#define expect_wstr_acpval (   expr,
  value 
)
Value:
{ \
CHAR buf[260]; \
expect_eq(!WideCharToMultiByte(CP_ACP, 0, (expr), -1, buf, 260, NULL, NULL), 0, int, "%d"); \
ok(strcmp(value, buf) == 0, #expr " expected \"%s\" got \"%s\"\n", value, buf); \
}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: query.h:87
Definition: pdh_main.c:94
char CHAR
Definition: xmlstorage.h:175

Definition at line 51 of file typelib.c.

◆ NONAMELESSSTRUCT

#define NONAMELESSSTRUCT

Definition at line 22 of file typelib.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 23 of file typelib.c.

◆ ok_ole_success

#define ok_ole_success (   hr,
  func 
)    ok(hr == S_OK, #func " failed with error 0x%08x\n", hr)

Definition at line 65 of file typelib.c.

◆ ole_check

#define ole_check (   expr)    ole_expect(expr, S_OK);

Definition at line 63 of file typelib.c.

◆ ole_expect

#define ole_expect (   expr,
  expect 
)
Value:
{ \
HRESULT r = expr; \
ok(r == (expect), #expr " returned %x, expected %s (%x)\n", r, #expect, expect); \
}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
GLdouble GLdouble GLdouble r
Definition: gl.h:2055

Definition at line 58 of file typelib.c.

Typedef Documentation

◆ element_info

◆ function_info

◆ type_info

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pActivateActCtx)
static

◆ collection_AddRef()

static ULONG WINAPI collection_AddRef ( ICollection *  iface)
static

Definition at line 114 of file typelib.c.

115{
116 return 2;
117}

◆ collection_GetIDsOfNames()

static HRESULT WINAPI collection_GetIDsOfNames ( ICollection *  iface,
REFIID  riid,
LPOLESTR names,
UINT  cnt,
LCID  lcid,
DISPID dispid 
)
static

Definition at line 137 of file typelib.c.

139{
140 ok(0, "unexpected call\n");
141 return E_NOTIMPL;
142}
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ collection_GetTypeInfo()

static HRESULT WINAPI collection_GetTypeInfo ( ICollection *  iface,
UINT  index,
LCID  lcid,
ITypeInfo **  ti 
)
static

Definition at line 131 of file typelib.c.

132{
133 ok(0, "unexpected call\n");
134 return E_NOTIMPL;
135}

◆ collection_GetTypeInfoCount()

static HRESULT WINAPI collection_GetTypeInfoCount ( ICollection *  iface,
UINT cnt 
)
static

Definition at line 124 of file typelib.c.

125{
126 ok(0, "unexpected call\n");
127 *cnt = 0;
128 return E_NOTIMPL;
129}

◆ collection_Invoke()

static HRESULT WINAPI collection_Invoke ( ICollection *  iface,
DISPID  dispid,
REFIID  riid,
LCID  lcid,
WORD  flags,
DISPPARAMS *  dispparams,
VARIANT res,
EXCEPINFO *  ei,
UINT argerr 
)
static

Definition at line 144 of file typelib.c.

146{
147 if(dispid != DISPID_VALUE) {
148 ok(0, "unexpected call\n");
149 return E_NOTIMPL;
150 }
151
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));
161
162 V_VT(res) = VT_I4;
163 V_I4(res) = 15;
164 return S_OK;
165}
@ VT_I4
Definition: compat.h:2298
@ VT_EMPTY
Definition: compat.h:2295
GLuint res
Definition: glext.h:9613
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:52
#define DISPATCH_METHOD
Definition: oleauto.h:1006
#define V_VT(A)
Definition: oleauto.h:211
#define V_I4(A)
Definition: oleauto.h:247
#define DISPATCH_PROPERTYGET
Definition: oleauto.h:1007

◆ collection_Item()

static HRESULT WINAPI collection_Item ( ICollection *  iface,
int  i,
int p 
)
static

Definition at line 167 of file typelib.c.

168{
169 ok(0, "unexpected call\n");
170 return E_NOTIMPL;
171}

◆ collection_QueryInterface()

static HRESULT WINAPI collection_QueryInterface ( ICollection *  iface,
REFIID  riid,
void **  ret 
)
static

Definition at line 101 of file typelib.c.

102{
105 IsEqualIID(riid, &IID_ICollection))
106 {
107 *ret = iface;
108 return S_OK;
109 }
110
111 return E_NOINTERFACE;
112}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
const GUID IID_IDispatch
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
int ret
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ collection_Release()

static ULONG WINAPI collection_Release ( ICollection *  iface)
static

Definition at line 119 of file typelib.c.

120{
121 return 1;
122}

◆ create_actctx()

static HANDLE create_actctx ( const char file)
static

Definition at line 5674 of file typelib.c.

5675{
5677 ACTCTXW actctx;
5678 HANDLE handle;
5679
5681 memset(&actctx, 0, sizeof(ACTCTXW));
5682 actctx.cbSize = sizeof(ACTCTXW);
5683 actctx.lpSource = path;
5684
5685 handle = pCreateActCtxW(&actctx);
5686 ok(handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError());
5687
5688 ok(actctx.cbSize == sizeof(actctx), "actctx.cbSize=%d\n", actctx.cbSize);
5689 ok(actctx.dwFlags == 0, "actctx.dwFlags=%d\n", actctx.dwFlags);
5690 ok(actctx.lpSource == path, "actctx.lpSource=%p\n", actctx.lpSource);
5691 ok(actctx.wProcessorArchitecture == 0, "actctx.wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
5692 ok(actctx.wLangId == 0, "actctx.wLangId=%d\n", actctx.wLangId);
5693 ok(actctx.lpAssemblyDirectory == NULL, "actctx.lpAssemblyDirectory=%p\n", actctx.lpAssemblyDirectory);
5694 ok(actctx.lpResourceName == NULL, "actctx.lpResourceName=%p\n", actctx.lpResourceName);
5695 ok(actctx.lpApplicationName == NULL, "actctx.lpApplicationName=%p\n",
5696 actctx.lpApplicationName);
5697 ok(actctx.hModule == NULL, "actctx.hModule=%p\n", actctx.hModule);
5698
5699 return handle;
5700}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define MAX_PATH
Definition: compat.h:34
#define MultiByteToWideChar
Definition: compat.h:110
#define actctx
Definition: kernel32.h:8
#define memset(x, y, z)
Definition: compat.h:39
Definition: fci.c:127
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_LoadRegTypeLib().

◆ create_manifest_file()

static void create_manifest_file ( const char filename,
const char manifest 
)
static

Definition at line 5662 of file typelib.c.

5663{
5664 HANDLE file;
5665 DWORD size;
5666
5669 ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
5672}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CloseHandle
Definition: compat.h:739
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
const char * filename
Definition: ioapi.h:137
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
static const CHAR manifest[]
Definition: v6util.h:39

◆ create_test_typelib()

static const char * create_test_typelib ( int  res_no)
static

Definition at line 814 of file typelib.c.

815{
816 static char filename[MAX_PATH];
817
818 GetTempFileNameA( ".", "tlb", 0, filename );
819 write_typelib(res_no, filename);
820 return filename;
821}
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
static void write_typelib(int res_no, const char *filename)
Definition: typelib.c:769

Referenced by START_TEST(), test_dep(), test_register_typelib(), and test_TypeInfo().

◆ do_typelib_reg_key()

static BOOL do_typelib_reg_key ( GUID uid,
WORD  maj,
WORD  min,
DWORD  arch,
LPCWSTR  base,
BOOL  remove 
)
static

Definition at line 1453 of file typelib.c.

1454{
1455 static const WCHAR typelibW[] = {'T','y','p','e','l','i','b','\\',0};
1456 static const WCHAR formatW[] = {'\\','%','u','.','%','u','\\','0','\\','w','i','n','%','u',0};
1457 static const WCHAR format2W[] = {'%','s','_','%','u','_','%','u','.','d','l','l',0};
1458 WCHAR buf[128];
1459 HKEY hkey;
1460 BOOL ret = TRUE;
1461 DWORD res;
1462
1463 memcpy(buf, typelibW, sizeof(typelibW));
1464 StringFromGUID2(uid, buf + lstrlenW(buf), 40);
1465
1466 if (remove)
1467 {
1468 ok(myRegDeleteTreeW(HKEY_CLASSES_ROOT, buf, 0) == ERROR_SUCCESS, "SHDeleteKey failed\n");
1469 return TRUE;
1470 }
1471
1472 wsprintfW(buf + lstrlenW(buf), formatW, maj, min, arch);
1473
1474 SetLastError(0xdeadbeef);
1476 KEY_WRITE, NULL, &hkey, NULL);
1478 {
1479 win_skip("W-calls are not implemented\n");
1480 return FALSE;
1481 }
1482
1483 if (res != ERROR_SUCCESS)
1484 {
1485 trace("RegCreateKeyExW failed: %u\n", res);
1486 return FALSE;
1487 }
1488
1489 wsprintfW(buf, format2W, base, maj, min);
1490 if (RegSetValueExW(hkey, NULL, 0, REG_SZ,
1491 (BYTE *)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)) != ERROR_SUCCESS)
1492 {
1493 trace("RegSetValueExW failed\n");
1494 ret = FALSE;
1495 }
1496 RegCloseKey(hkey);
1497 return ret;
1498}
#define trace
Definition: atltest.h:70
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4911
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752
#define lstrlenW
Definition: compat.h:750
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
unsigned int BOOL
Definition: ntddk_ex.h:94
#define REG_SZ
Definition: layer.c:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static LSTATUS myRegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM view)
Definition: typelib.c:1386
#define min(a, b)
Definition: monoChain.cc:55
int remove
Definition: msacm.c:1366
#define KEY_WRITE
Definition: nt_native.h:1031
#define win_skip
Definition: test.h:160
static const WCHAR typelibW[]
Definition: actctx.c:632
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_QueryPathOfRegTypeLib().

◆ double_func()

static double WINAPI double_func ( double  a0,
float  a1,
double  a2,
int  a3 
)
static

Definition at line 1139 of file typelib.c.

1140{
1141 ok( a0 == 1.2, "wrong arg0 %f\n", a0 );
1142 ok( a1 == 3.25, "wrong arg1 %f\n", (double)a1 );
1143 ok( a2 == 1.2e12, "wrong arg2 %f\n", a2);
1144 ok( a3 == -4433.0, "wrong arg3 %f\n", (double)a3 );
1145 return 4321;
1146}
static const struct update_accum a1
Definition: msg.c:578
static const struct update_accum a2
Definition: msg.c:586
static const struct update_accum a3
Definition: msg.c:600

Referenced by test_DispCallFunc().

◆ HANDLE()

static ULONG_PTR *static HANDLE ( WINAPI pCreateActCtxW)
static

◆ HRESULT()

static HRESULT ( WINAPI pRegisterTypeLibForUser)
static

◆ init_function_pointers()

static void init_function_pointers ( void  )
static

Definition at line 281 of file typelib.c.

282{
283 HMODULE hmod = GetModuleHandleA("oleaut32.dll");
284 HMODULE hk32 = GetModuleHandleA("kernel32.dll");
285 HMODULE hadv = GetModuleHandleA("advapi32.dll");
286
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");
295}
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:143

◆ inst_func()

static int WINAPI inst_func ( void inst,
int  a 
)
static

Definition at line 1190 of file typelib.c.

1191{
1192 ok( (*(void ***)inst)[3] == inst_func, "wrong ptr %p\n", inst );
1193 ok( a == 3, "wrong arg %x\n", a );
1194 return a * 2;
1195}
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static int WINAPI inst_func(void *inst, int a)
Definition: typelib.c:1190

Referenced by inst_func().

◆ inst_func2()

static void WINAPI inst_func2 ( void inst,
VARIANT ret,
VARIANT  v1,
VARIANT  v2 
)
static

Definition at line 1215 of file typelib.c.

1216{
1217 ok( (*(void ***)inst)[3] == inst_func2, "wrong ptr %p\n", inst );
1218
1219 ok(V_VT(ret) == VT_I4 || broken(V_VT(ret) == VT_VARIANT) /* win64 */, "unexpected %d\n", V_VT(ret));
1220 ok(V_I4(ret) == 1234, "unexpected %d\n", V_I4(ret));
1221
1222 ok(V_VT(&v1) == VT_I4, "unexpected %d\n", V_VT(&v1));
1223 ok(V_I4(&v1) == 2, "unexpected %d\n", V_I4(&v1));
1224 ok(V_VT(&v2) == VT_BSTR, "unexpected %d\n", V_VT(&v2));
1225 ok(lstrcmpW(V_BSTR(&v2), testW) == 0, "unexpected %s\n", wine_dbgstr_w(V_BSTR(&v2)));
1226
1227 V_VT(ret) = VT_UI4;
1228 V_I4(ret) = 4321;
1229}
#define broken(x)
Definition: _sntprintf.h:21
@ VT_BSTR
Definition: compat.h:2303
@ VT_VARIANT
Definition: compat.h:2307
@ VT_UI4
Definition: compat.h:2313
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
#define wine_dbgstr_w
Definition: kernel32.h:34
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
static const WCHAR testW[]
Definition: typelib.c:1202
static void WINAPI inst_func2(void *inst, VARIANT *ret, VARIANT v1, VARIANT v2)
Definition: typelib.c:1215
#define V_BSTR(A)
Definition: oleauto.h:226

Referenced by inst_func2().

◆ int_func()

static int WINAPI int_func ( int  a0,
int  a1,
int  a2,
int  a3,
int  a4 
)
static

Definition at line 1129 of file typelib.c.

1130{
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 );
1136 return 4321;
1137}
static const struct update_accum a4
Definition: msg.c:2285

Referenced by test_DispCallFunc().

◆ invoketest_AddRef()

static ULONG WINAPI invoketest_AddRef ( IInvokeTest *  iface)
static

Definition at line 199 of file typelib.c.

200{
201 return 2;
202}

◆ invoketest_get_test()

static LONG WINAPI invoketest_get_test ( IInvokeTest *  iface,
LONG  i 
)
static

Definition at line 236 of file typelib.c.

237{
238 return i+1;
239}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

◆ invoketest_GetIDsOfNames()

static HRESULT WINAPI invoketest_GetIDsOfNames ( IInvokeTest *  iface,
REFIID  riid,
LPOLESTR names,
UINT  cnt,
LCID  lcid,
DISPID dispid 
)
static

Definition at line 222 of file typelib.c.

224{
225 ok(0, "unexpected call\n");
226 return E_NOTIMPL;
227}

◆ invoketest_GetTypeInfo()

static HRESULT WINAPI invoketest_GetTypeInfo ( IInvokeTest *  iface,
UINT  index,
LCID  lcid,
ITypeInfo **  ti 
)
static

Definition at line 216 of file typelib.c.

217{
218 ok(0, "unexpected call\n");
219 return E_NOTIMPL;
220}

◆ invoketest_GetTypeInfoCount()

static HRESULT WINAPI invoketest_GetTypeInfoCount ( IInvokeTest *  iface,
UINT cnt 
)
static

Definition at line 209 of file typelib.c.

210{
211 ok(0, "unexpected call\n");
212 *cnt = 0;
213 return E_NOTIMPL;
214}

◆ invoketest_Invoke()

static HRESULT WINAPI invoketest_Invoke ( IInvokeTest *  iface,
DISPID  dispid,
REFIID  riid,
LCID  lcid,
WORD  flags,
DISPPARAMS *  dispparams,
VARIANT res,
EXCEPINFO *  ei,
UINT argerr 
)
static

Definition at line 229 of file typelib.c.

231{
232 ok(0, "unexpected call\n");
233 return E_NOTIMPL;
234}

◆ invoketest_putref_testprop()

static LONG WINAPI invoketest_putref_testprop ( IInvokeTest *  iface,
LONG i 
)
static

Definition at line 241 of file typelib.c.

242{
243 return *i+2;
244}

◆ invoketest_putref_testprop2()

static LONG WINAPI invoketest_putref_testprop2 ( IInvokeTest *  iface,
IUnknown i 
)
static

Definition at line 246 of file typelib.c.

247{
248 return 6;
249}

◆ invoketest_QueryInterface()

static HRESULT WINAPI invoketest_QueryInterface ( IInvokeTest *  iface,
REFIID  riid,
void **  ret 
)
static

Definition at line 186 of file typelib.c.

187{
190 IsEqualIID(riid, &IID_IInvokeTest))
191 {
192 *ret = iface;
193 return S_OK;
194 }
195
196 return E_NOINTERFACE;
197}

◆ invoketest_Release()

static ULONG WINAPI invoketest_Release ( IInvokeTest *  iface)
static

Definition at line 204 of file typelib.c.

205{
206 return 1;
207}

◆ invoketest_testfunc()

static HRESULT WINAPI invoketest_testfunc ( IInvokeTest *  iface,
int  i,
int p 
)
static

Definition at line 251 of file typelib.c.

252{
253 *p = i+1;
254 return S_OK;
255}
GLfloat GLfloat p
Definition: glext.h:8902

◆ invoketest_testget()

static HRESULT WINAPI invoketest_testget ( IInvokeTest *  iface,
ICollection **  p 
)
static

Definition at line 257 of file typelib.c.

258{
259 *p = &collection;
260 ICollection_AddRef(&collection);
261 return S_OK;
262}
static ICollection collection
Definition: typelib.c:184

◆ LONG()

static LONG ( WINAPI pRegDeleteKeyExW)
static

◆ longlong_func()

static LONGLONG WINAPI longlong_func ( LONGLONG  a0,
CY  a1 
)
static

Definition at line 1148 of file typelib.c.

1149{
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;
1154}
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by test_DispCallFunc().

◆ myRegDeleteTreeW()

static LSTATUS myRegDeleteTreeW ( HKEY  hKey,
LPCWSTR  lpszSubKey,
REGSAM  view 
)
static

Definition at line 1386 of file typelib.c.

1387{
1388 LONG ret;
1389 DWORD dwMaxSubkeyLen, dwMaxValueLen;
1390 DWORD dwMaxLen, dwSize;
1391 WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
1392 HKEY hSubKey = hKey;
1394
1395 if(lpszSubKey)
1396 {
1397 ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ | view, &hSubKey);
1398 if (ret) return ret;
1399 }
1400
1401 ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
1402 &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
1403 if (ret) goto cleanup;
1404
1405 dwMaxSubkeyLen++;
1406 dwMaxValueLen++;
1407 dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
1408 if (dwMaxLen > ARRAY_SIZE(szNameBuf))
1409 {
1410 /* Name too big: alloc a buffer for it */
1411 if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
1412 {
1414 goto cleanup;
1415 }
1416 }
1417
1418 /* Recursively delete all the subkeys */
1419 while (TRUE)
1420 {
1421 dwSize = dwMaxLen;
1422 if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
1423 NULL, NULL, NULL)) break;
1424
1425 ret = myRegDeleteTreeW(hSubKey, lpszName, view);
1426 if (ret) goto cleanup;
1427 }
1428
1429 if (lpszSubKey)
1430 if (pRegDeleteKeyExW && view != 0)
1431 ret = pRegDeleteKeyExW(hKey, lpszSubKey, view, 0);
1432 else
1433 ret = RegDeleteKeyW(hKey, lpszSubKey);
1434 else
1435 while (TRUE)
1436 {
1437 dwSize = dwMaxLen;
1438 if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
1439 NULL, NULL, NULL, NULL)) break;
1440
1441 ret = RegDeleteValueW(hKey, lpszName);
1442 if (ret) goto cleanup;
1443 }
1444
1445cleanup:
1446 if (lpszName != szNameBuf)
1447 HeapFree(GetProcessHeap(), 0, lpszName);
1448 if(lpszSubKey)
1449 RegCloseKey(hSubKey);
1450 return ret;
1451}
#define ARRAY_SIZE(A)
Definition: main.h:33
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3362
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2533
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1239
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2361
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2859
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3691
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
static void cleanup(void)
Definition: main.c:1335
FxAutoRegKey hKey
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define KEY_READ
Definition: nt_native.h:1023
long LONG
Definition: pedump.c:60
#define max(a, b)
Definition: svc.c:63
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46

Referenced by do_typelib_reg_key(), myRegDeleteTreeW(), and test_stub().

◆ ref_count_test()

static void ref_count_test ( LPCWSTR  type_lib)
static

Definition at line 297 of file typelib.c.

298{
299 ITypeLib *iface;
300 ITypeInfo *iti1, *iti2;
301 HRESULT hRes;
302 int ref_count;
303
304 trace("Loading type library\n");
305 hRes = LoadTypeLib(type_lib, &iface);
306 ok(hRes == S_OK, "Could not load type library\n");
307 if(hRes != S_OK)
308 return;
309
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");
314 if(!ref_count)
315 return;
316
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");
320
321 ITypeLib_AddRef(iface);
322 ITypeInfo_Release(iti2);
323 ITypeInfo_Release(iti1);
324 ok(ITypeLib_Release(iface) == 0, "ITypeLib should be destroyed here.\n");
325}
HRESULT WINAPI LoadTypeLib(const OLECHAR *szFile, ITypeLib **pptLib)
Definition: typelib.c:458

Referenced by START_TEST().

◆ ret_false_func()

static HRESULT WINAPI ret_false_func ( void  )
static

Definition at line 1197 of file typelib.c.

1198{
1199 return S_FALSE;
1200}
#define S_FALSE
Definition: winerror.h:2357

Referenced by test_DispCallFunc().

◆ START_TEST()

START_TEST ( typelib  )

Definition at line 6428 of file typelib.c.

6429{
6430 const char *filename;
6431
6433
6435 test_TypeComp();
6437 test_TypeInfo();
6440 if(sizeof(void*) == 8){
6444 }
6451 test_FindName();
6452
6453 if ((filename = create_test_typelib(2)))
6454 {
6457 }
6458
6466 test_stub();
6467 test_dep();
6468}
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void test_register_typelib(void)
Definition: action.c:5651
static void test_dump_typelib(const char *name)
Definition: typelib.c:4755
static void test_LoadTypeLib(void)
Definition: typelib.c:5148
static const char * create_test_typelib(int res_no)
Definition: typelib.c:814
static void test_dep(void)
Definition: typelib.c:6333
static void test_QueryPathOfRegTypeLib(DWORD arch)
Definition: typelib.c:1500
static const WCHAR wszStdOle2[]
Definition: typelib.c:89
static void init_function_pointers(void)
Definition: typelib.c:281
static void test_stub(void)
Definition: typelib.c:6158
static void test_CreateTypeLib(SYSKIND sys)
Definition: typelib.c:1802
static void test_SetDocString(void)
Definition: typelib.c:5394
static void test_GetLibAttr(void)
Definition: typelib.c:6111
static void test_LoadRegTypeLib(void)
Definition: typelib.c:5727
static void test_SetFuncAndParamNames(void)
Definition: typelib.c:5255
static void test_DispCallFunc(void)
Definition: typelib.c:1234
static void test_TypeInfo(void)
Definition: typelib.c:823
static void test_TypeComp(void)
Definition: typelib.c:327
static void test_create_typelibs(void)
Definition: typelib.c:4938
static void test_CreateDispTypeInfo(void)
Definition: typelib.c:609
static void test_FindName(void)
Definition: typelib.c:5542
static void test_SetTypeDescAlias(SYSKIND kind)
Definition: typelib.c:6019
static void test_TypeInfo2_GetContainingTypeLib(void)
Definition: typelib.c:5614
static void ref_count_test(LPCWSTR type_lib)
Definition: typelib.c:297
static void test_inheritance(void)
Definition: typelib.c:1555
static void test_SetVarHelpContext(void)
Definition: typelib.c:5175
@ SYS_WIN32
Definition: widltypes.h:552
@ SYS_WIN64
Definition: widltypes.h:554

◆ stdcall_func()

static int WINAPI stdcall_func ( int  a)
static

Definition at line 1185 of file typelib.c.

1186{
1187 return 0;
1188}

Referenced by test_DispCallFunc().

◆ test_create_typelib_lcid()

static void test_create_typelib_lcid ( LCID  lcid)
static

Definition at line 4867 of file typelib.c.

4868{
4869 char filename[MAX_PATH];
4871 HRESULT hr;
4872 ICreateTypeLib2 *tl;
4873 HANDLE file;
4874 DWORD msft_header[8];
4876 TLIBATTR *attr;
4877 DWORD read;
4878
4879 GetTempFileNameA( ".", "tlb", 0, filename );
4881
4883 ok(hr == S_OK, "got %08x\n", hr);
4884
4885 hr = ICreateTypeLib2_QueryInterface(tl, &IID_ITypeLib, (void**)&typelib);
4886 ok(hr == S_OK, "got %08x\n", hr);
4887
4888 hr = ITypeLib_GetLibAttr(typelib, &attr);
4889 ok(hr == S_OK, "got %08x\n", hr);
4890 ok(attr->wLibFlags == 0, "flags 0x%x\n", attr->wLibFlags);
4891 ITypeLib_ReleaseTLibAttr(typelib, attr);
4892
4893 hr = ICreateTypeLib2_SetLcid(tl, lcid);
4894 ok(hr == S_OK, "got %08x\n", hr);
4895
4896 hr = ICreateTypeLib2_SetVersion(tl, 3, 4);
4897 ok(hr == S_OK, "got %08x\n", hr);
4898
4899 hr = ICreateTypeLib2_SaveAllChanges(tl);
4900 ok(hr == S_OK, "got %08x\n", hr);
4901
4902 hr = ITypeLib_GetLibAttr(typelib, &attr);
4903 ok(hr == S_OK, "got %08x\n", hr);
4904 ok(attr->wLibFlags == 0, "flags 0x%x\n", attr->wLibFlags);
4905 ITypeLib_ReleaseTLibAttr(typelib, attr);
4906
4907 ITypeLib_Release(typelib);
4908 ICreateTypeLib2_Release(tl);
4909
4911 ok( file != INVALID_HANDLE_VALUE, "file creation failed\n" );
4912
4913 ReadFile( file, msft_header, sizeof(msft_header), &read, NULL );
4914 ok(read == sizeof(msft_header), "read %d\n", read);
4915 CloseHandle( file );
4916
4917 ok(msft_header[0] == 0x5446534d, "got %08x\n", msft_header[0]);
4918 ok(msft_header[1] == 0x00010002, "got %08x\n", msft_header[1]);
4919 ok(msft_header[2] == 0xffffffff, "got %08x\n", msft_header[2]);
4920 ok(msft_header[3] == (lcid ? lcid : 0x409), "got %08x (lcid %08x)\n", msft_header[3], lcid);
4921 ok(msft_header[4] == lcid, "got %08x (lcid %08x)\n", msft_header[4], lcid);
4922 ok(msft_header[6] == 0x00040003, "got %08x\n", msft_header[6]);
4923 ok(msft_header[7] == 0, "got %08x\n", msft_header[7]);
4924
4925 /* check flags after loading */
4927 ok(hr == S_OK, "got %08x\n", hr);
4928
4929 hr = ITypeLib_GetLibAttr(typelib, &attr);
4930 ok(hr == S_OK, "got %08x\n", hr);
4931 ok(attr->wLibFlags == LIBFLAG_FHASDISKIMAGE, "flags 0x%x\n", attr->wLibFlags);
4932 ITypeLib_ReleaseTLibAttr(typelib, attr);
4933 ITypeLib_Release(typelib);
4934
4936}
#define read
Definition: acwin.h:96
static ITypeLib * typelib
Definition: apps.c:108
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define GENERIC_READ
Definition: compat.h:135
HRESULT WINAPI CreateTypeLib2(SYSKIND syskind, LPCOLESTR szFile, ICreateTypeLib2 **ppctlib)
Definition: typelib.c:9043
HRESULT hr
Definition: shlfolder.c:183
Definition: cookie.c:202
Definition: name.c:39

Referenced by test_create_typelibs().

◆ test_create_typelibs()

static void test_create_typelibs ( void  )
static

Definition at line 4938 of file typelib.c.

4939{
4943
4947
4950}
static void test_create_typelib_lcid(LCID lcid)
Definition: typelib.c:4867
#define LOCALE_NEUTRAL
#define LOCALE_USER_DEFAULT
#define LOCALE_SYSTEM_DEFAULT

Referenced by START_TEST().

◆ test_CreateDispTypeInfo()

static void test_CreateDispTypeInfo ( void  )
static

Definition at line 609 of file typelib.c.

610{
611 ITypeInfo *pTypeInfo, *pTI2;
612 HRESULT hr;
613 INTERFACEDATA ifdata;
614 METHODDATA methdata[4];
615 PARAMDATA parms1[2];
616 PARAMDATA parms3[1];
617 TYPEATTR *pTypeAttr;
618 HREFTYPE href;
619 FUNCDESC *pFuncDesc;
620 MEMBERID memid;
621
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;
628
629 ifdata.pmethdata = methdata;
630 ifdata.cMembers = ARRAY_SIZE(methdata);
631
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;
644
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;
653
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;
664
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;
673
674 hr = CreateDispTypeInfo(&ifdata, LOCALE_NEUTRAL, &pTypeInfo);
675 ok(hr == S_OK, "hr %08x\n", hr);
676
677 hr = ITypeInfo_GetTypeAttr(pTypeInfo, &pTypeAttr);
678 ok(hr == S_OK, "hr %08x\n", hr);
679
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);
685
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);
697
698 ITypeInfo_ReleaseTypeAttr(pTI2, pTypeAttr);
699
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);
712
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);
716
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);
727
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);
740
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);
751
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);
756
757 ITypeInfo_Release(pTI2);
758 ITypeInfo_Release(pTypeInfo);
759
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);
767}
WCHAR OLECHAR
Definition: compat.h:2292
@ VT_HRESULT
Definition: compat.h:2319
HRESULT WINAPI CreateDispTypeInfo(INTERFACEDATA *pidata, LCID lcid, ITypeInfo **pptinfo)
Definition: typelib.c:8792
#define GUID_NULL
Definition: ks.h:106
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define DISPATCH_PROPERTYPUT
Definition: oleauto.h:1008
static const WCHAR szName[]
Definition: powrprof.c:45
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
@ CC_STDCALL
Definition: spec2def.c:92
METHODDATA * pmethdata
Definition: oleauto.h:919
DISPID dispid
Definition: oleauto.h:908
UINT iMeth
Definition: oleauto.h:909
VARTYPE vtReturn
Definition: oleauto.h:913
PARAMDATA * ppdata
Definition: oleauto.h:907
UINT cArgs
Definition: oleauto.h:911
WORD wFlags
Definition: oleauto.h:912
CALLCONV cc
Definition: oleauto.h:910
OLECHAR * szName
Definition: oleauto.h:906
OLECHAR * szName
Definition: oleauto.h:899
VARTYPE vt
Definition: oleauto.h:900
@ TKIND_COCLASS
Definition: widltypes.h:224
@ TKIND_INTERFACE
Definition: widltypes.h:222

Referenced by START_TEST().

◆ test_CreateTypeLib()

static void test_CreateTypeLib ( SYSKIND  sys)
static

Definition at line 1802 of file typelib.c.

1802 {
1803 static OLECHAR typelibW[] = {'t','y','p','e','l','i','b',0};
1804 static OLECHAR helpfileW[] = {'C',':','\\','b','o','g','u','s','.','h','l','p',0};
1805 static OLECHAR interface1W[] = {'i','n','t','e','r','f','a','c','e','1',0};
1806 static OLECHAR interface2W[] = {'i','n','t','e','r','f','a','c','e','2',0};
1807 static OLECHAR interface3W[] = {'i','n','t','e','r','f','a','c','e','3',0};
1808 static OLECHAR dualW[] = {'d','u','a','l',0};
1809 static OLECHAR coclassW[] = {'c','o','c','l','a','s','s',0};
1810 static const WCHAR defaultW[] = {'d','e','f','a','u','l','t',0x3213,0};
1811 static OLECHAR func1W[] = {'f','u','n','c','1',0};
1812 static OLECHAR func2W[] = {'f','u','n','c','2',0};
1813 static OLECHAR prop1W[] = {'P','r','o','p','1',0};
1814 static OLECHAR param1W[] = {'p','a','r','a','m','1',0};
1815 static OLECHAR param2W[] = {'p','a','r','a','m','2',0};
1816 static OLECHAR asdfW[] = {'A','s','d','f',0};
1817 static OLECHAR aliasW[] = {'a','l','i','a','s',0};
1818 static OLECHAR invokeW[] = {'I','n','v','o','k','e',0};
1819 static OLECHAR *names1[] = {func1W, param1W, param2W};
1820 static OLECHAR *names2[] = {func2W, param1W, param2W};
1821 static OLECHAR *propname[] = {prop1W, param1W};
1822 static const GUID tlcustguid = {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x69}};
1823 static const GUID custguid = {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x70}};
1824 static const GUID bogusguid = {0xbf611abe,0x5b38,0x11df,{0x91,0x5c,0x08,0x02,0x79,0x79,0x94,0x71}};
1825 static const GUID interfaceguid = {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcc}};
1826 static const GUID interface2guid = {0x3b9ff02f,0x9675,0x4861,{0xb7,0x81,0xce,0xae,0xa4,0x78,0x2a,0xcd}};
1827
1828 char filename[MAX_PATH];
1830 ICreateTypeLib2 *createtl;
1831 ICreateTypeInfo *createti;
1832 ICreateTypeInfo2 *createti2;
1833 ITypeLib *tl, *stdole;
1834 ITypeLib2 *tl2;
1835 ITypeInfo *interface1, *interface2, *dual, *unknown, *dispatch, *ti;
1836 ITypeInfo *tinfos[2];
1837 ITypeInfo2 *ti2;
1838 ITypeComp *tcomp, *tcomp2;
1839 MEMBERID memids[2];
1840 FUNCDESC funcdesc, *pfuncdesc;
1841 ELEMDESC elemdesc[5], *edesc;
1842 PARAMDESCEX paramdescex;
1843 TYPEDESC typedesc1, typedesc2;
1844 TYPEATTR *typeattr;
1845 TLIBATTR *libattr;
1846 HREFTYPE hreftype;
1847 BSTR name, docstring, helpfile, names[3];
1848 DWORD helpcontext, ptr_size, alignment;
1849 int impltypeflags;
1850 unsigned int cnames;
1851 USHORT found;
1852 VARIANT cust_data;
1853 HRESULT hres;
1854 TYPEKIND kind;
1855 DESCKIND desckind;
1856 BINDPTR bindptr;
1857 char nameA[16];
1858 WCHAR nameW[16];
1859
1860 switch(sys){
1861 case SYS_WIN32:
1862 trace("testing SYS_WIN32\n");
1863 ptr_size = 4;
1864 alignment = sizeof(void*);
1865 break;
1866 case SYS_WIN64:
1867 trace("testing SYS_WIN64\n");
1868 ptr_size = 8;
1869 alignment = 4;
1870 break;
1871 default:
1872 return;
1873 }
1874
1875 trace("CreateTypeLib tests\n");
1876
1878 ok(hres == S_OK, "got %08x\n", hres);
1879
1880 hres = ITypeLib_GetTypeInfoOfGuid(stdole, &IID_IUnknown, &unknown);
1881 ok(hres == S_OK, "got %08x\n", hres);
1882
1883 hres = ITypeInfo_GetTypeAttr(unknown, &typeattr);
1884 ok(hres == S_OK, "got %08x\n", hres);
1885 ok(typeattr->cbSizeVft == 3 * sizeof(void*), "Got wrong cbSizeVft: %u\n", typeattr->cbSizeVft);
1886 ITypeInfo_ReleaseTypeAttr(unknown, typeattr);
1887
1888 hres = ITypeLib_GetTypeInfoOfGuid(stdole, &IID_IDispatch, &dispatch);
1889 ok(hres == S_OK, "got %08x\n", hres);
1890
1891 GetTempFileNameA(".", "tlb", 0, filename);
1893
1894 hres = CreateTypeLib2(sys, filenameW, &createtl);
1895 ok(hres == S_OK, "got %08x\n", hres);
1896
1897 hres = ICreateTypeLib2_QueryInterface(createtl, &IID_ITypeLib, (void**)&tl);
1898 ok(hres == S_OK, "got %08x\n", hres);
1899
1900 hres = ITypeLib_GetTypeInfo(tl, 0, NULL);
1901 ok(hres == E_INVALIDARG, "got 0x%08x\n", hres);
1902
1903 hres = ITypeLib_GetTypeInfoType(tl, 0, &kind);
1904 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got 0x%08x\n", hres);
1905
1906 hres = ITypeLib_GetTypeInfoType(tl, 0, NULL);
1907 ok(hres == E_INVALIDARG, "got 0x%08x\n", hres);
1908
1909 hres = ITypeLib_GetTypeInfoType(tl, 0, NULL);
1910 ok(hres == E_INVALIDARG, "got 0x%08x\n", hres);
1911
1912 hres = ITypeLib_GetLibAttr(tl, NULL);
1913 ok(hres == E_INVALIDARG, "got %08x\n", hres);
1914
1915 hres = ITypeLib_GetLibAttr(tl, &libattr);
1916 ok(hres == S_OK, "got %08x\n", hres);
1917
1918 ok(libattr->syskind == sys, "syskind = %d\n", libattr->syskind);
1919 ok(libattr->wMajorVerNum == 0, "wMajorVer = %d\n", libattr->wMajorVerNum);
1920 ok(libattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", libattr->wMinorVerNum);
1921 ok(libattr->wLibFlags == 0, "wLibFlags = %d\n", libattr->wLibFlags);
1922
1923 ITypeLib_ReleaseTLibAttr(tl, libattr);
1924
1925 name = (BSTR)0xdeadbeef;
1926 hres = ITypeLib_GetDocumentation(tl, -1, &name, &docstring, &helpcontext, &helpfile);
1927 ok(hres == S_OK, "got %08x\n", hres);
1928 ok(name == NULL, "name != NULL\n");
1929 ok(docstring == NULL, "docstring != NULL\n");
1930 ok(helpcontext == 0, "helpcontext != 0\n");
1931 ok(helpfile == NULL, "helpfile != NULL\n");
1932
1933 hres = ITypeLib_GetDocumentation(tl, 0, &name, NULL, NULL, NULL);
1934 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
1935
1936 hres = ICreateTypeLib2_SetName(createtl, typelibW);
1937 ok(hres == S_OK, "got %08x\n", hres);
1938
1939 hres = ICreateTypeLib2_SetHelpFileName(createtl, helpfileW);
1940 ok(hres == S_OK, "got %08x\n", hres);
1941
1942 hres = ITypeLib_GetDocumentation(tl, -1, NULL, NULL, NULL, NULL);
1943 ok(hres == S_OK, "got %08x\n", hres);
1944
1945 hres = ITypeLib_GetDocumentation(tl, -1, &name, NULL, NULL, &helpfile);
1946 ok(hres == S_OK, "got %08x\n", hres);
1947 ok(!memcmp(name, typelibW, sizeof(typelibW)), "name = %s\n", wine_dbgstr_w(name));
1948 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "helpfile = %s\n", wine_dbgstr_w(helpfile));
1949
1952
1953 V_VT(&cust_data) = VT_I4;
1954 V_I4(&cust_data) = 1;
1955 hres = ICreateTypeLib2_SetCustData(createtl, &tlcustguid, &cust_data);
1956 ok(hres == S_OK, "got %08x\n", hres);
1957
1958 hres = ITypeLib_QueryInterface(tl, &IID_ITypeLib2, (void**)&tl2);
1959 ok(hres == S_OK, "no ITypeLib2 interface (%x)\n", hres);
1960
1961 V_VT(&cust_data) = VT_EMPTY;
1962 V_I4(&cust_data) = 0;
1963 hres = ITypeLib2_GetCustData(tl2, &tlcustguid, &cust_data);
1964 ok(hres == S_OK, "got %08x\n", hres);
1965 ok(V_VT(&cust_data) == VT_I4, "V_VT(&cust_data) = %d\n", V_VT(&cust_data));
1966 ok(V_I4(&cust_data) == 1, "V_I4(&cust_data) = %d\n", V_I4(&cust_data));
1967
1968 ITypeLib2_Release(tl2);
1969
1970 /* invalid parameters */
1971 hres = ICreateTypeLib2_CreateTypeInfo(createtl, NULL, TKIND_INTERFACE, &createti);
1972 ok(hres == E_INVALIDARG, "got %08x\n", hres);
1973
1974 hres = ICreateTypeLib2_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, NULL);
1975 ok(hres == E_INVALIDARG, "got %08x\n", hres);
1976
1977 hres = ICreateTypeLib2_CreateTypeInfo(createtl, NULL, TKIND_INTERFACE, NULL);
1978 ok(hres == E_INVALIDARG, "got %08x\n", hres);
1979
1980 hres = ICreateTypeLib2_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti);
1981 ok(hres == S_OK, "got %08x\n", hres);
1982
1983 hres = ICreateTypeInfo_QueryInterface(createti, &IID_ITypeInfo, (void**)&interface1);
1984 ok(hres == S_OK, "got %08x\n", hres);
1985
1986 hres = ITypeLib_GetDocumentation(tl, 0, &name, NULL, NULL, NULL);
1987 ok(hres == S_OK, "got %08x\n", hres);
1988 ok(!memcmp(name, interface1W, sizeof(interface1W)), "name = %s\n", wine_dbgstr_w(name));
1989
1991
1992 ITypeLib_Release(tl);
1993
1994 name = (BSTR)0xdeadbeef;
1995 helpfile = (BSTR)0xdeadbeef;
1996 hres = ITypeInfo_GetDocumentation(interface1, -1, &name, &docstring, &helpcontext, &helpfile);
1997 ok(hres == S_OK, "got %08x\n", hres);
1998 ok(!memcmp(name, interface1W, sizeof(interface1W)), "name = %s\n", wine_dbgstr_w(name));
1999 ok(docstring == NULL, "docstring != NULL\n");
2000 ok(helpcontext == 0, "helpcontext != 0\n");
2001 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "helpfile = %s\n", wine_dbgstr_w(helpfile));
2002
2005
2006 hres = ITypeInfo_GetDocumentation(interface1, 0, &name, NULL, NULL, NULL);
2007 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2008
2009 hres = ITypeInfo_GetRefTypeInfo(interface1, 0, NULL);
2010 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2011
2012
2013 hres = ICreateTypeInfo_LayOut(createti);
2014 ok(hres == S_OK, "got %08x\n", hres);
2015
2016 hres = ICreateTypeInfo_SetGuid(createti, &interfaceguid);
2017 ok(hres == S_OK, "got %08x\n", hres);
2018
2019 hres = ICreateTypeInfo_AddRefTypeInfo(createti, NULL, &hreftype);
2020 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2021
2022 hres = ICreateTypeInfo_AddRefTypeInfo(createti, unknown, NULL);
2023 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2024
2025 hres = ICreateTypeInfo_AddRefTypeInfo(createti, unknown, &hreftype);
2026 ok(hres == S_OK, "got %08x\n", hres);
2027 if(hres != S_OK) {
2028 skip("Skipping some tests\n");
2029 return;
2030 }
2031
2032 hres = ICreateTypeInfo_AddImplType(createti, 1, hreftype);
2033 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2034
2035 hres = ICreateTypeInfo_AddImplType(createti, 0, hreftype);
2036 ok(hres == S_OK, "got %08x\n", hres);
2037
2038 hres = ITypeInfo_GetRefTypeOfImplType(interface1, 0, &hreftype);
2039 ok(hres == S_OK, "got %08x\n", hres);
2040 ok(hreftype == 3, "hreftype = %d\n", hreftype);
2041
2042 hres = ITypeInfo_GetRefTypeInfo(interface1, hreftype, &ti);
2043 ok(hres == S_OK, "got %08x\n", hres);
2044
2045 hres = ITypeInfo_GetTypeAttr(ti, &typeattr);
2046 ok(hres == S_OK, "got %08x\n", hres);
2047 ok(typeattr->cbSizeVft == 3 * ptr_size, "retrieved IUnknown gave wrong cbSizeVft: %u\n", typeattr->cbSizeVft);
2048 ITypeInfo_ReleaseTypeAttr(ti, typeattr);
2049
2050 ITypeInfo_Release(ti);
2051
2052 hres = ITypeInfo_GetRefTypeOfImplType(interface1, -1, &hreftype);
2053 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2054
2055 ICreateTypeInfo_QueryInterface(createti, &IID_ITypeInfo2, (void**)&ti2);
2056
2057 memset(&funcdesc, 0, sizeof(FUNCDESC));
2058 funcdesc.funckind = FUNC_PUREVIRTUAL;
2059 funcdesc.invkind = INVOKE_PROPERTYGET;
2060 funcdesc.callconv = CC_STDCALL;
2061 funcdesc.elemdescFunc.tdesc.vt = VT_BSTR;
2062 U(funcdesc.elemdescFunc).idldesc.wIDLFlags = IDLFLAG_NONE;
2063
2064 hres = ICreateTypeInfo_AddFuncDesc(createti, 0, NULL);
2065 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2066
2067 hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc);
2068 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2069
2070 hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc);
2071 ok(hres == S_OK, "got %08x\n", hres);
2072
2073 hres = ITypeInfo2_GetFuncDesc(ti2, 0, NULL);
2074 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2075
2076 hres = ITypeInfo2_GetFuncDesc(ti2, 1, &pfuncdesc);
2077 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2078
2079 hres = ITypeInfo2_GetFuncDesc(ti2, 0, &pfuncdesc);
2080 ok(hres == S_OK, "got %08x\n", hres);
2081
2082 ok(pfuncdesc->memid == 0, "got %x\n", pfuncdesc->memid);
2083 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2084 ok(pfuncdesc->lprgelemdescParam == NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2085 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2086 ok(pfuncdesc->invkind == INVOKE_PROPERTYGET, "got 0x%x\n", pfuncdesc->invkind);
2087 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2088 ok(pfuncdesc->cParams == 0, "got %d\n", pfuncdesc->cParams);
2089 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2090 ok(pfuncdesc->oVft == 3 * ptr_size, "got %d\n", pfuncdesc->oVft);
2091 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2092 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_BSTR, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2093 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2094
2095 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2096
2097 hres = ICreateTypeInfo_SetFuncHelpContext(createti, 0, 0xabcdefab);
2098 ok(hres == S_OK, "got %08x\n", hres);
2099
2100 funcdesc.invkind = INVOKE_PROPERTYPUT;
2101 hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc);
2102 ok(hres == TYPE_E_INCONSISTENTPROPFUNCS, "got %08x\n", hres);
2103
2104 funcdesc.invkind = INVOKE_PROPERTYPUTREF;
2105 hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc);
2106 ok(hres == TYPE_E_INCONSISTENTPROPFUNCS, "got %08x\n", hres);
2107
2108 elemdesc[0].tdesc.vt = VT_BSTR;
2109 U(elemdesc[0]).idldesc.dwReserved = 0;
2110 U(elemdesc[0]).idldesc.wIDLFlags = IDLFLAG_FIN;
2111
2112 funcdesc.lprgelemdescParam = elemdesc;
2113 funcdesc.invkind = INVOKE_PROPERTYPUT;
2114 funcdesc.cParams = 1;
2115 funcdesc.elemdescFunc.tdesc.vt = VT_VOID;
2116
2117 hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc);
2118 ok(hres == S_OK, "got %08x\n", hres);
2119
2120 hres = ICreateTypeInfo_SetFuncHelpContext(createti, 1, 0xabcdefab);
2121 ok(hres == S_OK, "got %08x\n", hres);
2122
2123 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, propname, 0);
2124 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2125
2126 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, NULL, 1);
2127 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2128
2129 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, propname, 1);
2130 ok(hres == S_OK, "got %08x\n", hres);
2131
2132 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 1, propname, 1);
2133 ok(hres == S_OK, "got %08x\n", hres);
2134
2135 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 1, propname, 2);
2136 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2137
2138 hres = ITypeInfo2_GetFuncDesc(ti2, 1, &pfuncdesc);
2139 ok(hres == S_OK, "got %08x\n", hres);
2140
2141 ok(pfuncdesc->memid == 0, "got %x\n", pfuncdesc->memid);
2142 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2143 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2144 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2145 ok(pfuncdesc->invkind == INVOKE_PROPERTYPUT, "got 0x%x\n", pfuncdesc->invkind);
2146 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2147 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
2148 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2149 ok(pfuncdesc->oVft == 4 * ptr_size, "got %d\n", pfuncdesc->oVft);
2150 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2151 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2152 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2153
2154 edesc = pfuncdesc->lprgelemdescParam;
2155 ok(edesc->tdesc.vt == VT_BSTR, "got: %d\n", edesc->tdesc.vt);
2156 ok(U(*edesc).idldesc.wIDLFlags == IDLFLAG_FIN, "got: %x\n", U(*edesc).idldesc.wIDLFlags);
2157
2158 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2159
2160
2161 funcdesc.invkind = INVOKE_PROPERTYPUTREF;
2162 hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc);
2163 ok(hres == S_OK, "got %08x\n", hres);
2164
2165 hres = ICreateTypeInfo_SetFuncHelpContext(createti, 0, 0xabcdefab);
2166 ok(hres == S_OK, "got %08x\n", hres);
2167
2168 hres = ICreateTypeInfo_SetFuncHelpContext(createti, 0, 0x201);
2169 ok(hres == S_OK, "got %08x\n", hres);
2170
2171 funcdesc.memid = 1;
2172 funcdesc.lprgelemdescParam = NULL;
2173 funcdesc.invkind = INVOKE_FUNC;
2174 funcdesc.cParams = 0;
2175 funcdesc.cScodes = 1;
2176 funcdesc.lprgscode = NULL;
2177 hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc);
2178 ok(hres == S_OK, "got %08x\n", hres);
2179
2180 hres = ITypeInfo2_GetFuncDesc(ti2, 1, &pfuncdesc);
2181 ok(hres == S_OK, "got %08x\n", hres);
2182
2183 ok(pfuncdesc->memid == 1, "got %d\n", pfuncdesc->memid);
2184 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2185 ok(pfuncdesc->lprgelemdescParam == NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2186 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2187 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
2188 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2189 ok(pfuncdesc->cParams == 0, "got %d\n", pfuncdesc->cParams);
2190 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2191 ok(pfuncdesc->oVft == 4 * ptr_size, "got %d\n", pfuncdesc->oVft);
2192 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2193 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2194 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2195
2196 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2197
2198 funcdesc.memid = MEMBERID_NIL;
2199 hres = ICreateTypeInfo_AddFuncDesc(createti, 1, &funcdesc);
2200 ok(hres == S_OK, "got %08x\n", hres);
2201
2202 elemdesc[0].tdesc.vt = VT_PTR;
2203 U(elemdesc[0].tdesc).lptdesc = &typedesc1;
2204 typedesc1.vt = VT_BSTR;
2205 funcdesc.cParams = 1;
2206 funcdesc.lprgelemdescParam = elemdesc;
2207 hres = ICreateTypeInfo_AddFuncDesc(createti, 4, &funcdesc);
2208 ok(hres == S_OK, "got %08x\n", hres);
2209
2210 hres = ITypeInfo2_GetFuncDesc(ti2, 4, &pfuncdesc);
2211 ok(hres == S_OK, "got %08x\n", hres);
2212
2213 ok(pfuncdesc->memid == 0x60010004, "got %x\n", pfuncdesc->memid);
2214 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2215 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2216 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2217 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
2218 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2219 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
2220 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2221 ok(pfuncdesc->oVft == 7 * ptr_size, "got %d\n", pfuncdesc->oVft);
2222 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2223 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2224 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2225
2226 edesc = pfuncdesc->lprgelemdescParam;
2227 ok(edesc->tdesc.vt == VT_PTR, "got: %d\n", edesc->tdesc.vt);
2228 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FIN, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
2229 ok(U(*edesc).paramdesc.pparamdescex == NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
2230 ok(U(edesc->tdesc).lptdesc != NULL, "got: %p\n", U(edesc->tdesc).lptdesc);
2231 ok(U(edesc->tdesc).lptdesc->vt == VT_BSTR, "got: %d\n", U(edesc->tdesc).lptdesc->vt);
2232
2233 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2234
2235 U(elemdesc[0].tdesc).lptdesc = &typedesc2;
2236 typedesc2.vt = VT_PTR;
2237 U(typedesc2).lptdesc = &typedesc1;
2238 hres = ICreateTypeInfo_AddFuncDesc(createti, 4, &funcdesc);
2239 ok(hres == S_OK, "got %08x\n", hres);
2240
2241 hres = ITypeInfo2_GetFuncDesc(ti2, 4, &pfuncdesc);
2242 ok(hres == S_OK, "got %08x\n", hres);
2243
2244 ok(pfuncdesc->memid == 0x60010007, "got %x\n", pfuncdesc->memid);
2245 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2246 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2247 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2248 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
2249 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2250 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
2251 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2252 ok(pfuncdesc->oVft == 7 * ptr_size, "got %d\n", pfuncdesc->oVft);
2253 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2254 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2255 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2256
2257 edesc = pfuncdesc->lprgelemdescParam;
2258 ok(edesc->tdesc.vt == VT_PTR, "got: %d\n", edesc->tdesc.vt);
2259 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FIN, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
2260 ok(U(*edesc).paramdesc.pparamdescex == NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
2261 ok(U(edesc->tdesc).lptdesc != NULL, "got: %p\n", U(edesc->tdesc).lptdesc);
2262 ok(U(edesc->tdesc).lptdesc->vt == VT_PTR, "got: %d\n", U(edesc->tdesc).lptdesc->vt);
2263 ok(U(*U(edesc->tdesc).lptdesc).lptdesc != NULL, "got: %p\n", U(*U(edesc->tdesc).lptdesc).lptdesc);
2264 ok(U(*U(edesc->tdesc).lptdesc).lptdesc->vt == VT_BSTR, "got: %d\n", U(*U(edesc->tdesc).lptdesc).lptdesc->vt);
2265
2266 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2267
2268 elemdesc[0].tdesc.vt = VT_INT;
2269 U(elemdesc[0]).paramdesc.wParamFlags = PARAMFLAG_FHASDEFAULT;
2270 U(elemdesc[0]).paramdesc.pparamdescex = &paramdescex;
2271 V_VT(&paramdescex.varDefaultValue) = VT_INT;
2272 V_INT(&paramdescex.varDefaultValue) = 0x123;
2273 hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc);
2274 ok(hres == S_OK, "got %08x\n", hres);
2275
2276 hres = ITypeInfo2_GetFuncDesc(ti2, 3, &pfuncdesc);
2277 ok(hres == S_OK, "got %08x\n", hres);
2278
2279 ok(pfuncdesc->memid == 0x60010003, "got %x\n", pfuncdesc->memid);
2280 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2281 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2282 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2283 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
2284 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2285 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
2286 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2287 ok(pfuncdesc->oVft == 6 * ptr_size, "got %d\n", pfuncdesc->oVft);
2288 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2289 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2290 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2291
2292 edesc = pfuncdesc->lprgelemdescParam;
2293 ok(edesc->tdesc.vt == VT_INT, "got: %d\n", edesc->tdesc.vt);
2294 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
2295 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
2296 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
2297 U(*edesc).paramdesc.pparamdescex->cBytes);
2298 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_I4, "got: %d\n",
2299 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2300 ok(V_I4(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0x123, "got: 0x%x\n",
2301 V_I4(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2302
2303 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2304
2305 U(elemdesc[0]).idldesc.dwReserved = 0;
2306 U(elemdesc[0]).idldesc.wIDLFlags = IDLFLAG_FIN;
2307 elemdesc[1].tdesc.vt = VT_UI2;
2308 U(elemdesc[1]).paramdesc.wParamFlags = PARAMFLAG_FHASDEFAULT;
2309 U(elemdesc[1]).paramdesc.pparamdescex = &paramdescex;
2310 V_VT(&paramdescex.varDefaultValue) = VT_UI2;
2311 V_UI2(&paramdescex.varDefaultValue) = 0xffff;
2312 funcdesc.cParams = 2;
2313 hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc);
2314 ok(hres == S_OK, "got %08x\n", hres);
2315
2316 hres = ITypeInfo2_GetFuncDesc(ti2, 3, &pfuncdesc);
2317 ok(hres == S_OK, "got %08x\n", hres);
2318
2319 ok(pfuncdesc->memid == 0x60010009, "got %x\n", pfuncdesc->memid);
2320 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2321 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2322 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2323 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
2324 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2325 ok(pfuncdesc->cParams == 2, "got %d\n", pfuncdesc->cParams);
2326 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2327 ok(pfuncdesc->oVft == 6 * ptr_size, "got %d\n", pfuncdesc->oVft);
2328 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2329 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2330 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2331
2332 edesc = pfuncdesc->lprgelemdescParam;
2333 ok(edesc->tdesc.vt == VT_INT, "got: %d\n", edesc->tdesc.vt);
2334 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FIN, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
2335 ok(U(*edesc).paramdesc.pparamdescex == NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
2336
2337 edesc = pfuncdesc->lprgelemdescParam + 1;
2338 ok(edesc->tdesc.vt == VT_UI2, "got: %d\n", edesc->tdesc.vt);
2339 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
2340 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
2341 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
2342 U(*edesc).paramdesc.pparamdescex->cBytes);
2343 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_UI2, "got: %d\n",
2344 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2345 ok(V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0xFFFF, "got: 0x%x\n",
2346 V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2347
2348 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2349
2350 U(elemdesc[0]).paramdesc.wParamFlags = PARAMFLAG_FHASDEFAULT;
2351 U(elemdesc[0]).paramdesc.pparamdescex = &paramdescex;
2352 elemdesc[1].tdesc.vt = VT_INT;
2353 V_VT(&paramdescex.varDefaultValue) = VT_INT;
2354 V_INT(&paramdescex.varDefaultValue) = 0xffffffff;
2355 hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc);
2356 ok(hres == S_OK, "got %08x\n", hres);
2357
2358 elemdesc[0].tdesc.vt = VT_BSTR;
2359 elemdesc[1].tdesc.vt = VT_BSTR;
2360 V_VT(&paramdescex.varDefaultValue) = VT_BSTR;
2361 V_BSTR(&paramdescex.varDefaultValue) = SysAllocString(defaultW);
2362 hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc);
2363 ok(hres == S_OK, "got %08x\n", hres);
2364 SysFreeString(V_BSTR(&paramdescex.varDefaultValue));
2365
2366 WideCharToMultiByte(CP_ACP, 0, defaultW, -1, nameA, sizeof(nameA), NULL, NULL);
2368
2369 hres = ITypeInfo2_GetFuncDesc(ti2, 3, &pfuncdesc);
2370 ok(hres == S_OK, "got %08x\n", hres);
2371
2372 ok(pfuncdesc->memid == 0x6001000b, "got %x\n", pfuncdesc->memid);
2373 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2374 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2375 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2376 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
2377 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2378 ok(pfuncdesc->cParams == 2, "got %d\n", pfuncdesc->cParams);
2379 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2380 ok(pfuncdesc->oVft == 6 * ptr_size, "got %d\n", pfuncdesc->oVft);
2381 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2382 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2383 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2384
2385 edesc = pfuncdesc->lprgelemdescParam;
2386 ok(edesc->tdesc.vt == VT_BSTR, "got: %d\n", edesc->tdesc.vt);
2387 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
2388 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
2389 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
2390 U(*edesc).paramdesc.pparamdescex->cBytes);
2391 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_BSTR, "got: %d\n",
2392 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2393 ok(!lstrcmpW(V_BSTR(&U(*edesc).paramdesc.pparamdescex->varDefaultValue), nameW),
2394 "got: %s\n",
2395 wine_dbgstr_w(V_BSTR(&U(*edesc).paramdesc.pparamdescex->varDefaultValue)));
2396
2397 edesc = pfuncdesc->lprgelemdescParam + 1;
2398 ok(edesc->tdesc.vt == VT_BSTR, "got: %d\n", edesc->tdesc.vt);
2399 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
2400 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
2401 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
2402 U(*edesc).paramdesc.pparamdescex->cBytes);
2403 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_BSTR, "got: %d\n",
2404 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2405 ok(!lstrcmpW(V_BSTR(&U(*edesc).paramdesc.pparamdescex->varDefaultValue), nameW),
2406 "got: %s\n",
2407 wine_dbgstr_w(V_BSTR(&U(*edesc).paramdesc.pparamdescex->varDefaultValue)));
2408
2409 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2410
2411 elemdesc[0].tdesc.vt = VT_USERDEFINED;
2412 U(elemdesc[0].tdesc).hreftype = hreftype;
2413 U(elemdesc[0]).paramdesc.pparamdescex = &paramdescex;
2414 U(elemdesc[0]).paramdesc.wParamFlags = PARAMFLAG_FHASDEFAULT;
2415 V_VT(&paramdescex.varDefaultValue) = VT_INT;
2416 V_INT(&paramdescex.varDefaultValue) = 0x789;
2417
2418 funcdesc.lprgelemdescParam = elemdesc;
2419 funcdesc.invkind = INVOKE_FUNC;
2420 funcdesc.cParams = 1;
2421 funcdesc.elemdescFunc.tdesc.vt = VT_VOID;
2422
2423 hres = ICreateTypeInfo_AddFuncDesc(createti, 5, &funcdesc);
2424 ok(hres == S_OK, "got %08x\n", hres);
2425
2426 hres = ITypeInfo2_GetFuncDesc(ti2, 5, &pfuncdesc);
2427 ok(hres == S_OK, "got %08x\n", hres);
2428
2429 ok(pfuncdesc->memid == 0x60010005, "got %x\n", pfuncdesc->memid);
2430 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2431 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2432 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2433 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
2434 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2435 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
2436 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2437 ok(pfuncdesc->oVft == 8 * ptr_size, "got %d\n", pfuncdesc->oVft);
2438 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2439 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2440 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2441
2442 edesc = pfuncdesc->lprgelemdescParam;
2443 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
2444 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT,
2445 "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
2446 ok(edesc->tdesc.vt == VT_USERDEFINED, "got: %d\n", edesc->tdesc.vt);
2447 ok(U(edesc->tdesc).hreftype == hreftype, "got: 0x%x\n", U(edesc->tdesc).hreftype);
2448 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_INT, "got: %d\n",
2449 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2450 ok(V_INT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0x789, "got: %d\n",
2451 V_INT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2452
2453 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2454
2455 elemdesc[0].tdesc.vt = VT_VARIANT;
2456 U(elemdesc[0]).paramdesc.pparamdescex = &paramdescex;
2457 U(elemdesc[0]).paramdesc.wParamFlags = PARAMFLAG_FHASDEFAULT;
2458 V_VT(&paramdescex.varDefaultValue) = VT_INT;
2459 V_INT(&paramdescex.varDefaultValue) = 3;
2460
2461 funcdesc.lprgelemdescParam = elemdesc;
2462 funcdesc.invkind = INVOKE_FUNC;
2463 funcdesc.cParams = 1;
2464 funcdesc.elemdescFunc.tdesc.vt = VT_VARIANT;
2465
2466 hres = ICreateTypeInfo_AddFuncDesc(createti, 6, &funcdesc);
2467 ok(hres == S_OK, "got %08x\n", hres);
2468
2469 hres = ITypeInfo2_GetFuncDesc(ti2, 6, &pfuncdesc);
2470 ok(hres == S_OK, "got %08x\n", hres);
2471
2472 ok(pfuncdesc->memid == 0x60010006, "got %x\n", pfuncdesc->memid);
2473 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2474 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2475 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2476 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
2477 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2478 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
2479 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2480 ok(pfuncdesc->oVft == 9 * ptr_size, "got %d\n", pfuncdesc->oVft);
2481 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2482 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VARIANT, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2483 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2484
2485 edesc = pfuncdesc->lprgelemdescParam;
2486 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
2487 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT,
2488 "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
2489 ok(edesc->tdesc.vt == VT_VARIANT, "got: %d\n", edesc->tdesc.vt);
2490 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_INT, "got: %d\n",
2491 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2492 ok(V_INT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 3, "got: %d\n",
2493 V_INT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
2494
2495 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2496
2497 hres = ITypeInfo_GetDocumentation(interface1, 0, &name, &docstring, &helpcontext, &helpfile);
2498 ok(hres == S_OK, "got %08x\n", hres);
2499 ok(name == NULL, "name != NULL\n");
2500 ok(docstring == NULL, "docstring != NULL\n");
2501 ok(helpcontext == 0x201, "helpcontext != 0x201\n");
2502 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "helpfile = %s\n", wine_dbgstr_w(helpfile));
2503
2505
2506 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 1000, NULL, 1);
2507 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2508
2509 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 1000, names1, 1);
2510 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2511
2512 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, names1, 2);
2513 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2514
2515 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, names2, 1);
2516 ok(hres == S_OK, "got %08x\n", hres);
2517
2518 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 0, names1, 1);
2519 ok(hres == S_OK, "got %08x\n", hres);
2520
2521 hres = ITypeInfo_GetDocumentation(interface1, 0, &name, NULL, NULL, NULL);
2522 ok(hres == S_OK, "got %08x\n", hres);
2523 ok(!memcmp(name, func1W, sizeof(func1W)), "name = %s\n", wine_dbgstr_w(name));
2524
2526
2527 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 3, names2, 3);
2528 ok(hres == S_OK, "got %08x\n", hres);
2529
2530 hres = ICreateTypeInfo_SetFuncAndParamNames(createti, 3, names1, 3);
2531 ok(hres == TYPE_E_AMBIGUOUSNAME, "got %08x\n", hres);
2532
2533 ITypeInfo2_Release(ti2);
2534 ICreateTypeInfo_Release(createti);
2535
2536 hres = ICreateTypeLib2_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti);
2537 ok(hres == TYPE_E_NAMECONFLICT, "got %08x\n", hres);
2538
2539 hres = ICreateTypeLib2_CreateTypeInfo(createtl, interface2W, TKIND_INTERFACE, &createti);
2540 ok(hres == S_OK, "got %08x\n", hres);
2541
2542 hres = ICreateTypeInfo_SetGuid(createti, &interface2guid);
2543 ok(hres == S_OK, "got %08x\n", hres);
2544
2545 hres = ICreateTypeInfo_QueryInterface(createti, &IID_ITypeInfo, (void**)&interface2);
2546 ok(hres == S_OK, "got %08x\n", hres);
2547
2548 hres = ITypeInfo_GetRefTypeOfImplType(interface2, 0, &hreftype);
2549 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2550
2551 hres = ICreateTypeInfo_AddRefTypeInfo(createti, interface1, &hreftype);
2552 ok(hres == S_OK, "got %08x\n", hres);
2553
2554 hres = ITypeInfo_GetRefTypeInfo(interface2, 0, &ti);
2555 ok(hres == S_OK, "got %08x\n", hres);
2556 ok(ti == interface1, "Received and added interfaces are different\n");
2557
2558 ITypeInfo_Release(ti);
2559
2560 hres = ICreateTypeInfo_AddImplType(createti, 0, hreftype);
2561 ok(hres == S_OK, "got %08x\n", hres);
2562
2563 hres = ITypeInfo_GetRefTypeOfImplType(interface2, 0, &hreftype);
2564 ok(hres == S_OK, "got %08x\n", hres);
2565 ok(hreftype == 2, "hreftype = %d\n", hreftype);
2566
2567 hres = ITypeInfo_GetRefTypeOfImplType(interface2, -1, &hreftype);
2568 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2569
2570 hres = ICreateTypeInfo_SetImplTypeFlags(createti, 0, IMPLTYPEFLAG_FDEFAULT);
2571 ok(hres == TYPE_E_BADMODULEKIND, "got %08x\n", hres);
2572
2573 hres = ITypeInfo_GetImplTypeFlags(interface2, 0, &impltypeflags);
2574 ok(hres == S_OK, "got %08x\n", hres);
2575 ok(impltypeflags == 0, "impltypeflags = %x\n", impltypeflags);
2576
2577 hres = ITypeInfo_GetImplTypeFlags(interface2, 1, &impltypeflags);
2578 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2579
2580 funcdesc.elemdescFunc.tdesc.vt = VT_VOID;
2581 funcdesc.oVft = 0xaaac;
2582 hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc);
2583 if(sys == SYS_WIN64){
2584 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2585 funcdesc.oVft = 0xaab0;
2586 hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc);
2587 }
2588 ok(hres == S_OK, "got %08x\n", hres);
2589 funcdesc.oVft = 0xaaa8;
2590 hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc);
2591 ok(hres == S_OK, "got %08x\n", hres);
2592
2593 hres = ICreateTypeInfo_QueryInterface(createti, &IID_ITypeInfo, (void**)&ti2);
2594 ok(hres == S_OK, "got %08x\n", hres);
2595
2596 hres = ITypeInfo2_GetFuncDesc(ti2, 0, &pfuncdesc);
2597 ok(hres == S_OK, "got %08x\n", hres);
2598
2599 ok(pfuncdesc->memid == 0x60020000, "got %x\n", pfuncdesc->memid);
2600 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
2601 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
2602 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
2603 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
2604 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
2605 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
2606 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
2607 ok(pfuncdesc->oVft == (short)0xaaa8, "got %d\n", pfuncdesc->oVft);
2608 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
2609 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
2610 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
2611
2612 ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
2613 ITypeInfo2_Release(ti2);
2614
2615 funcdesc.oVft = 0;
2616
2617 ICreateTypeInfo_Release(createti);
2618
2619 VariantInit(&cust_data);
2620
2621 hres = ICreateTypeLib2_CreateTypeInfo(createtl, interface3W, TKIND_INTERFACE, &createti);
2622 ok(hres == S_OK, "got %08x\n", hres);
2623
2624 hres = ICreateTypeInfo_QueryInterface(createti, &IID_ICreateTypeInfo2, (void**)&createti2);
2625 ok(hres == S_OK, "got %08x\n", hres);
2626
2627 hres = ICreateTypeInfo2_QueryInterface(createti2, &IID_ITypeInfo2, (void**)&ti2);
2628 ok(hres == S_OK, "got %08x\n", hres);
2629
2630 hres = ITypeInfo2_GetCustData(ti2, NULL, NULL);
2631 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2632
2633 hres = ITypeInfo2_GetCustData(ti2, &custguid, NULL);
2634 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2635
2636 hres = ITypeInfo2_GetCustData(ti2, &custguid, &cust_data);
2637 ok(hres == S_OK, "got %08x\n", hres);
2638
2639 hres = ICreateTypeInfo2_SetCustData(createti2, NULL, NULL);
2640 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2641
2642 hres = ICreateTypeInfo2_SetCustData(createti2, &custguid, NULL);
2643 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2644
2645 hres = ICreateTypeInfo2_SetCustData(createti2, &custguid, &cust_data);
2646 ok(hres == DISP_E_BADVARTYPE, "got %08x\n", hres);
2647
2648 V_VT(&cust_data) = VT_UI4;
2649 V_I4(&cust_data) = 0xdeadbeef;
2650
2651 hres = ICreateTypeInfo2_SetCustData(createti2, &custguid, &cust_data);
2652 ok(hres == S_OK, "got %08x\n", hres);
2653
2654 V_I4(&cust_data) = 0;
2655 V_VT(&cust_data) = VT_EMPTY;
2656
2657 hres = ITypeInfo2_GetCustData(ti2, &custguid, &cust_data);
2658 ok(hres == S_OK, "got %08x\n", hres);
2659
2660 ok(V_VT(&cust_data) == VT_UI4, "got %d\n", V_VT(&cust_data));
2661 ok(V_I4(&cust_data) == 0xdeadbeef, "got 0x%08x\n", V_I4(&cust_data));
2662
2663 V_VT(&cust_data) = VT_UI4;
2664 V_I4(&cust_data) = 12345678;
2665
2666 hres = ICreateTypeInfo2_SetCustData(createti2, &custguid, &cust_data);
2667 ok(hres == S_OK, "got %08x\n", hres);
2668
2669 V_I4(&cust_data) = 0;
2670 V_VT(&cust_data) = VT_EMPTY;
2671
2672 hres = ITypeInfo2_GetCustData(ti2, &custguid, &cust_data);
2673 ok(hres == S_OK, "got %08x\n", hres);
2674
2675 ok(V_VT(&cust_data) == VT_UI4, "got %d\n", V_VT(&cust_data));
2676 ok(V_I4(&cust_data) == 12345678, "got 0x%08x\n", V_I4(&cust_data));
2677
2678 V_VT(&cust_data) = VT_BSTR;
2679 V_BSTR(&cust_data) = SysAllocString(asdfW);
2680
2681 hres = ICreateTypeInfo2_SetCustData(createti2, &custguid, &cust_data);
2682 ok(hres == S_OK, "got %08x\n", hres);
2683
2684 SysFreeString(V_BSTR(&cust_data));
2685 V_I4(&cust_data) = 0;
2686 V_VT(&cust_data) = VT_EMPTY;
2687
2688 hres = ITypeInfo2_GetCustData(ti2, &custguid, &cust_data);
2689 ok(hres == S_OK, "got %08x\n", hres);
2690
2691 ok(V_VT(&cust_data) == VT_BSTR, "got %d\n", V_VT(&cust_data));
2692 ok(!lstrcmpW(V_BSTR(&cust_data), asdfW), "got %s\n", wine_dbgstr_w(V_BSTR(&cust_data)));
2693 SysFreeString(V_BSTR(&cust_data));
2694
2695 V_VT(&cust_data) = VT_UI4;
2696 V_UI4(&cust_data) = 17;
2697
2698 hres = ITypeInfo2_GetCustData(ti2, &bogusguid, &cust_data);
2699 ok(hres == S_OK, "got %08x\n", hres);
2700
2701 ok(V_VT(&cust_data) == VT_EMPTY, "got: %d\n", V_VT(&cust_data));
2702
2703 ITypeInfo2_Release(ti2);
2704 ICreateTypeInfo2_Release(createti2);
2705 ICreateTypeInfo_Release(createti);
2706
2707 hres = ICreateTypeLib2_CreateTypeInfo(createtl, coclassW, TKIND_COCLASS, &createti);
2708 ok(hres == S_OK, "got %08x\n", hres);
2709
2710 hres = ICreateTypeInfo_AddRefTypeInfo(createti, interface1, &hreftype);
2711 ok(hres == S_OK, "got %08x\n", hres);
2712
2713 hres = ICreateTypeInfo_AddImplType(createti, 0, hreftype);
2714 ok(hres == S_OK, "got %08x\n", hres);
2715
2716 hres = ICreateTypeInfo_AddImplType(createti, 0, hreftype);
2717 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2718
2719 hres = ICreateTypeInfo_AddRefTypeInfo(createti, unknown, &hreftype);
2720 ok(hres == S_OK, "got %08x\n", hres);
2721
2722 hres = ICreateTypeInfo_AddImplType(createti, 1, hreftype);
2723 ok(hres == S_OK, "got %08x\n", hres);
2724
2725 hres = ICreateTypeInfo_AddImplType(createti, 1, hreftype);
2726 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2727
2728 hres = ICreateTypeInfo_AddImplType(createti, 2, hreftype);
2729 ok(hres == S_OK, "got %08x\n", hres);
2730
2731 hres = ICreateTypeInfo_SetImplTypeFlags(createti, 0, IMPLTYPEFLAG_FDEFAULT);
2732 ok(hres == S_OK, "got %08x\n", hres);
2733
2734 hres = ICreateTypeInfo_SetImplTypeFlags(createti, 1, IMPLTYPEFLAG_FRESTRICTED);
2735 ok(hres == S_OK, "got %08x\n", hres);
2736
2737 hres = ICreateTypeInfo_QueryInterface(createti, &IID_ITypeInfo, (void**)&ti);
2738 ok(hres == S_OK, "got %08x\n", hres);
2739
2740 hres = ITypeInfo_GetImplTypeFlags(ti, 0, NULL);
2741 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2742
2743 hres = ITypeInfo_GetImplTypeFlags(ti, 0, &impltypeflags);
2744 ok(hres == S_OK, "got %08x\n", hres);
2745 ok(impltypeflags == IMPLTYPEFLAG_FDEFAULT, "impltypeflags = %x\n", impltypeflags);
2746
2747 hres = ITypeInfo_GetImplTypeFlags(ti, 1, &impltypeflags);
2748 ok(hres == S_OK, "got %08x\n", hres);
2749 ok(impltypeflags == IMPLTYPEFLAG_FRESTRICTED, "impltypeflags = %x\n", impltypeflags);
2750
2751 hres = ITypeInfo_GetImplTypeFlags(ti, 2, &impltypeflags);
2752 ok(hres == S_OK, "got %08x\n", hres);
2753 ok(impltypeflags == 0, "impltypeflags = %x\n", impltypeflags);
2754
2755 hres = ITypeInfo_GetRefTypeOfImplType(ti, 0, &hreftype);
2756 ok(hres == S_OK, "got %08x\n", hres);
2757 ok(hreftype == 0, "hreftype = %d\n", hreftype);
2758
2759 hres = ITypeInfo_GetRefTypeOfImplType(ti, 1, &hreftype);
2760 ok(hres == S_OK, "got %08x\n", hres);
2761 ok(hreftype == 1, "hreftype = %d\n", hreftype);
2762
2763 hres = ITypeInfo_GetRefTypeOfImplType(ti, 2, &hreftype);
2764 ok(hres == S_OK, "got %08x\n", hres);
2765 ok(hreftype == 1, "hreftype = %d\n", hreftype);
2766
2767 hres = ITypeInfo_GetRefTypeOfImplType(ti, -1, &hreftype);
2768 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
2769
2770 ITypeInfo_Release(ti);
2771
2772 ICreateTypeInfo_Release(createti);
2773
2774 hres = ICreateTypeLib2_CreateTypeInfo(createtl, dualW, TKIND_INTERFACE, &createti);
2775 ok(hres == S_OK, "got %08x\n", hres);
2776
2777 hres = ICreateTypeInfo_SetTypeFlags(createti, TYPEFLAG_FDUAL);
2778 ok(hres == S_OK, "got %08x\n", hres);
2779
2780 hres = ICreateTypeInfo_AddFuncDesc(createti, 0, &funcdesc);
2781 ok(hres == S_OK, "got %08x\n", hres);
2782
2783 hres = ICreateTypeInfo_AddRefTypeInfo(createti, dispatch, &hreftype);
2784 ok(hres == S_OK, "got %08x\n", hres);
2785
2786 hres = ICreateTypeInfo_AddImplType(createti, 0, hreftype);
2787 ok(hres == S_OK, "got %08x\n", hres);
2788
2789 hres = ICreateTypeInfo_QueryInterface(createti, &IID_ITypeInfo, (void**)&dual);
2790 ok(hres == S_OK, "got %08x\n", hres);
2791
2792 hres = ITypeInfo_GetTypeAttr(dual, &typeattr);
2793 ok(hres == S_OK, "got %08x\n", hres);
2794 ok(typeattr->cbSizeInstance == ptr_size, "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
2795 ok(typeattr->typekind == 3, "typekind = %d\n", typeattr->typekind);
2796 ok(typeattr->cFuncs == 1, "cFuncs = %d\n", typeattr->cFuncs);
2797 ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars);
2798 ok(typeattr->cImplTypes == 1, "cImplTypes = %d\n", typeattr->cImplTypes);
2799 ok(typeattr->cbSizeVft == 8 * ptr_size, "cbSizeVft = %d\n", typeattr->cbSizeVft);
2800 ok(typeattr->cbAlignment == 4, "cbAlignment = %d\n", typeattr->cbAlignment);
2801 ok(typeattr->wTypeFlags == (TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FDUAL), "wTypeFlags = %d\n", typeattr->wTypeFlags);
2802 ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
2803 ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
2804
2805 ITypeInfo_ReleaseTypeAttr(dual, typeattr);
2806
2807 hres = ITypeInfo_GetRefTypeOfImplType(dual, -1, &hreftype);
2808 ok(hres == S_OK, "got %08x\n", hres);
2809 ok(hreftype == -2, "got %08x\n", hreftype);
2810
2811 hres = ITypeInfo_GetRefTypeInfo(dual, -2, &ti);
2812 ok(hres == S_OK, "got %08x\n", hres);
2813
2814 hres = ITypeInfo_GetTypeAttr(ti, &typeattr);
2815 ok(hres == S_OK, "got %08x\n", hres);
2816 ok(typeattr->cbSizeInstance == ptr_size, "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
2817 ok(typeattr->typekind == 4, "typekind = %d\n", typeattr->typekind);
2818 ok(typeattr->cFuncs == 8, "cFuncs = %d\n", typeattr->cFuncs);
2819 ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars);
2820 ok(typeattr->cImplTypes == 1, "cImplTypes = %d\n", typeattr->cImplTypes);
2821 ok(typeattr->cbSizeVft == 7 * sizeof(void *), "cbSizeVft = %d\n", typeattr->cbSizeVft);
2822 ok(typeattr->cbAlignment == 4, "cbAlignment = %d\n", typeattr->cbAlignment);
2823 ok(typeattr->wTypeFlags == (TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FDUAL), "wTypeFlags = %d\n", typeattr->wTypeFlags);
2824 ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
2825 ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
2826
2827 ITypeInfo_ReleaseTypeAttr(ti, typeattr);
2828
2829 ITypeInfo_Release(ti);
2830
2831 hres = ICreateTypeInfo_SetTypeDescAlias(createti, &typedesc1);
2832 ok(hres == TYPE_E_BADMODULEKIND, "got %08x\n", hres);
2833
2834 ICreateTypeInfo_Release(createti);
2835
2836 hres = ITypeInfo_GetTypeAttr(interface1, &typeattr);
2837 ok(hres == S_OK, "got %08x\n", hres);
2838 ok(typeattr->cbSizeInstance == ptr_size, "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
2839 ok(typeattr->typekind == 3, "typekind = %d\n", typeattr->typekind);
2840 ok(typeattr->cFuncs == 13, "cFuncs = %d\n", typeattr->cFuncs);
2841 ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars);
2842 ok(typeattr->cImplTypes == 1, "cImplTypes = %d\n", typeattr->cImplTypes);
2843 ok(typeattr->cbSizeVft == 16 * ptr_size, "cbSizeVft = %d\n", typeattr->cbSizeVft);
2844 ok(typeattr->cbAlignment == 4, "cbAlignment = %d\n", typeattr->cbAlignment);
2845 ok(typeattr->wTypeFlags == 0, "wTypeFlags = %d\n", typeattr->wTypeFlags);
2846 ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
2847 ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
2848
2849 ITypeInfo_ReleaseTypeAttr(interface1, typeattr);
2850
2851 hres = ITypeInfo_GetTypeAttr(interface2, &typeattr);
2852 ok(hres == S_OK, "got %08x\n", hres);
2853 ok(typeattr->cbSizeInstance == ptr_size, "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
2854 ok(typeattr->typekind == 3, "typekind = %d\n", typeattr->typekind);
2855 ok(typeattr->cFuncs == 2, "cFuncs = %d\n", typeattr->cFuncs);
2856 ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars);
2857 ok(typeattr->cImplTypes == 1, "cImplTypes = %d\n", typeattr->cImplTypes);
2858 ok((sys == SYS_WIN32 && typeattr->cbSizeVft == 0xaab0) ||
2859 (sys == SYS_WIN64 && typeattr->cbSizeVft == 0xaab8),
2860 "cbSizeVft = 0x%x\n", typeattr->cbSizeVft);
2861 ok(typeattr->cbAlignment == 4, "cbAlignment = %d\n", typeattr->cbAlignment);
2862 ok(typeattr->wTypeFlags == 0, "wTypeFlags = %d\n", typeattr->wTypeFlags);
2863 ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
2864 ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
2865
2866 ITypeInfo_ReleaseTypeAttr(interface2, typeattr);
2867
2868 ok(ITypeInfo_Release(interface2)==0, "Object should be freed\n");
2869 ok(ITypeInfo_Release(interface1)==0, "Object should be freed\n");
2870 ok(ITypeInfo_Release(dual)==0, "Object should be freed\n");
2871
2872 hres = ICreateTypeLib2_CreateTypeInfo(createtl, aliasW, TKIND_ALIAS, &createti);
2873 ok(hres == S_OK, "got %08x\n", hres);
2874
2875 hres = ICreateTypeInfo_QueryInterface(createti, &IID_ITypeInfo, (void**)&interface1);
2876 ok(hres == S_OK, "got %08x\n", hres);
2877
2878 if(0){
2879 /* windows gives invalid values here, and even breaks the typeinfo permanently
2880 * on winxp. only call GetTypeAttr() on a TKIND_ALIAS after SetTypeDescAlias. */
2881 hres = ITypeInfo_GetTypeAttr(interface1, &typeattr);
2882 ok(hres == S_OK, "got %08x\n", hres);
2883 ok(typeattr->cbSizeInstance == 0xffffffb4, "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
2884 ok(typeattr->typekind == TKIND_ALIAS, "typekind = %d\n", typeattr->typekind);
2885 ok(typeattr->cFuncs == 0, "cFuncs = %d\n", typeattr->cFuncs);
2886 ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars);
2887 ok(typeattr->cImplTypes == 0, "cImplTypes = %d\n", typeattr->cImplTypes);
2888 ok(typeattr->cbSizeVft == 0, "cbSizeVft = %d\n", typeattr->cbSizeVft);
2889 ok(typeattr->cbAlignment == 0, "cbAlignment = %d\n", typeattr->cbAlignment);
2890 ok(typeattr->wTypeFlags == 0, "wTypeFlags = %d\n", typeattr->wTypeFlags);
2891 ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
2892 ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
2893 ok(typeattr->tdescAlias.vt == VT_EMPTY, "Got wrong tdescAlias.vt: %u\n", typeattr->tdescAlias.vt);
2894 ITypeInfo_ReleaseTypeAttr(interface1, typeattr);
2895 }
2896
2897 hres = ICreateTypeInfo_SetTypeDescAlias(createti, NULL);
2898 ok(hres == E_INVALIDARG, "got %08x\n", hres);
2899
2900 typedesc1.vt = VT_I1;
2901 hres = ICreateTypeInfo_SetTypeDescAlias(createti, &typedesc1);
2902 ok(hres == S_OK, "got %08x\n", hres);
2903
2904 hres = ITypeInfo_GetTypeAttr(interface1, &typeattr);
2905 ok(hres == S_OK, "got %08x\n", hres);
2906 ok(typeattr->cbSizeInstance == 1, "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
2907 ok(typeattr->typekind == TKIND_ALIAS, "typekind = %d\n", typeattr->typekind);
2908 ok(typeattr->cFuncs == 0, "cFuncs = %d\n", typeattr->cFuncs);
2909 ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars);
2910 ok(typeattr->cImplTypes == 0, "cImplTypes = %d\n", typeattr->cImplTypes);
2911 ok(typeattr->cbSizeVft == 0, "cbSizeVft = %d\n", typeattr->cbSizeVft);
2912 ok(typeattr->cbAlignment == 1, "cbAlignment = %d\n", typeattr->cbAlignment);
2913 ok(typeattr->wTypeFlags == 0, "wTypeFlags = %d\n", typeattr->wTypeFlags);
2914 ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
2915 ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
2916 ok(typeattr->tdescAlias.vt == VT_I1, "Got wrong tdescAlias.vt: %u\n", typeattr->tdescAlias.vt);
2917 ITypeInfo_ReleaseTypeAttr(interface1, typeattr);
2918
2919 typedesc1.vt = VT_R8;
2920 hres = ICreateTypeInfo_SetTypeDescAlias(createti, &typedesc1);
2921 ok(hres == S_OK, "got %08x\n", hres);
2922
2923 hres = ITypeInfo_GetTypeAttr(interface1, &typeattr);
2924 ok(hres == S_OK, "got %08x\n", hres);
2925 ok(typeattr->cbSizeInstance == 8, "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
2926 ok(typeattr->typekind == TKIND_ALIAS, "typekind = %d\n", typeattr->typekind);
2927 ok(typeattr->cFuncs == 0, "cFuncs = %d\n", typeattr->cFuncs);
2928 ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars);
2929 ok(typeattr->cImplTypes == 0, "cImplTypes = %d\n", typeattr->cImplTypes);
2930 ok(typeattr->cbSizeVft == 0, "cbSizeVft = %d\n", typeattr->cbSizeVft);
2931 ok(typeattr->cbAlignment == 4, "cbAlignment = %d\n", typeattr->cbAlignment);
2932 ok(typeattr->wTypeFlags == 0, "wTypeFlags = %d\n", typeattr->wTypeFlags);
2933 ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
2934 ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
2935 ok(typeattr->tdescAlias.vt == VT_R8, "Got wrong tdescAlias.vt: %u\n", typeattr->tdescAlias.vt);
2936 ITypeInfo_ReleaseTypeAttr(interface1, typeattr);
2937
2938 ITypeInfo_Release(interface1);
2939 ICreateTypeInfo_Release(createti);
2940
2941 hres = ICreateTypeLib2_SaveAllChanges(createtl);
2942 ok(hres == S_OK, "got %08x\n", hres);
2943
2944 ok(ICreateTypeLib2_Release(createtl)==0, "Object should be freed\n");
2945
2946 ok(ITypeInfo_Release(dispatch)==0, "Object should be freed\n");
2947 ok(ITypeInfo_Release(unknown)==0, "Object should be freed\n");
2948 ok(ITypeLib_Release(stdole)==0, "Object should be freed\n");
2949
2951 ok(hres == S_OK, "got %08x\n", hres);
2952
2953 hres = ITypeLib_GetLibAttr(tl, &libattr);
2954 ok(hres == S_OK, "got %08x\n", hres);
2955 ok(libattr->syskind == sys, "syskind = %d\n", libattr->syskind);
2956 ok(libattr->wMajorVerNum == 0, "wMajorVer = %d\n", libattr->wMajorVerNum);
2957 ok(libattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", libattr->wMinorVerNum);
2958 ok(libattr->wLibFlags == LIBFLAG_FHASDISKIMAGE, "wLibFlags = %d\n", libattr->wLibFlags);
2959 ITypeLib_ReleaseTLibAttr(tl, libattr);
2960
2961 found = 2;
2962 memset(tinfos, 0, sizeof(tinfos));
2963 memids[0] = 0xdeadbeef;
2964 memids[1] = 0xdeadbeef;
2965 hres = ITypeLib_FindName(tl, param1W, 0, tinfos, memids, &found);
2966 ok(hres == S_OK, "got: %08x\n", hres);
2967 ok(found == 0, "got wrong count: %u\n", found);
2968 ok(tinfos[0] == NULL, "got invalid typeinfo[0]\n");
2969 ok(tinfos[1] == NULL, "got invalid typeinfo[1]\n");
2970 ok(memids[0] == 0xdeadbeef, "got invalid memid[0]\n");
2971 ok(memids[1] == 0xdeadbeef, "got invalid memid[1]\n");
2972
2973 found = 2;
2974 memset(tinfos, 0, sizeof(tinfos));
2975 memids[0] = 0xdeadbeef;
2976 memids[1] = 0xdeadbeef;
2977 hres = ITypeLib_FindName(tl, func1W, 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] == 0, "got invalid memid[0]\n");
2983 ok(memids[1] == 0xdeadbeef, "got invalid memid[1]\n");
2984 if(tinfos[0])
2985 ITypeInfo_Release(tinfos[0]);
2986
2987 found = 2;
2988 memset(tinfos, 0, sizeof(tinfos));
2989 memids[0] = 0xdeadbeef;
2990 memids[1] = 0xdeadbeef;
2991 hres = ITypeLib_FindName(tl, interface1W, 0, tinfos, memids, &found);
2992 ok(hres == S_OK, "got: %08x\n", hres);
2993 ok(found == 1, "got wrong count: %u\n", found);
2994 ok(tinfos[0] != NULL, "got invalid typeinfo[0]\n");
2995 ok(tinfos[1] == NULL, "got invalid typeinfo[1]\n");
2996 ok(memids[0] == MEMBERID_NIL, "got invalid memid[0]: %x\n", memids[0]);
2997 ok(memids[1] == 0xdeadbeef, "got invalid memid[1]\n");
2998 if(tinfos[0])
2999 ITypeInfo_Release(tinfos[0]);
3000
3001 hres = ITypeLib_GetDocumentation(tl, -1, &name, &docstring, &helpcontext, &helpfile);
3002 ok(hres == S_OK, "got %08x\n", hres);
3003 ok(memcmp(typelibW, name, sizeof(typelibW)) == 0, "got wrong typelib name: %s\n",
3005 ok(docstring == NULL, "got wrong docstring: %s\n", wine_dbgstr_w(docstring));
3006 ok(helpcontext == 0, "got wrong helpcontext: 0x%x\n", helpcontext);
3007 ok(memcmp(helpfileW, helpfile, sizeof(helpfileW)) == 0,
3008 "got wrong helpfile: %s\n", wine_dbgstr_w(helpfile));
3011
3012 hres = ITypeLib_GetDocumentation(tl, 0, &name, &docstring, &helpcontext, &helpfile);
3013 ok(hres == S_OK, "got %08x\n", hres);
3014 ok(memcmp(interface1W, name, sizeof(interface1W)) == 0, "got wrong typeinfo name: %s\n",
3016 ok(docstring == NULL, "got wrong docstring: %s\n", wine_dbgstr_w(docstring));
3017 ok(helpcontext == 0, "got wrong helpcontext: 0x%x\n", helpcontext);
3018 ok(memcmp(helpfileW, helpfile, sizeof(helpfileW)) == 0,
3019 "got wrong helpfile: %s\n", wine_dbgstr_w(helpfile));
3022
3023 hres = ITypeLib_QueryInterface(tl, &IID_ITypeLib2, (void**)&tl2);
3024 ok(hres == S_OK, "no ITypeLib2 interface (%x)\n", hres);
3025 V_VT(&cust_data) = VT_EMPTY;
3026 V_I4(&cust_data) = 0;
3027 hres = ITypeLib2_GetCustData(tl2, &tlcustguid, &cust_data);
3028 ok(hres == S_OK, "got %08x\n", hres);
3029 ok(V_VT(&cust_data) == VT_I4, "V_VT(&cust_data) = %d\n", V_VT(&cust_data));
3030 ok(V_I4(&cust_data) == 1, "V_I4(&cust_data) = %d\n", V_I4(&cust_data));
3031 ITypeLib2_Release(tl2);
3032
3033 hres = ITypeLib_GetTypeInfo(tl, 0, &ti);
3034 ok(hres == S_OK, "got %08x\n", hres);
3035
3036 hres = ITypeInfo_GetTypeAttr(ti, &typeattr);
3037 ok(hres == S_OK, "got %08x\n", hres);
3038 ok(typeattr->cbSizeInstance == sizeof(void*), "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
3039 ok(typeattr->typekind == TKIND_INTERFACE, "typekind = %d\n", typeattr->typekind);
3040 ok(typeattr->cFuncs == 13, "cFuncs = %d\n", typeattr->cFuncs);
3041 ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars);
3042 ok(typeattr->cImplTypes == 1, "cImplTypes = %d\n", typeattr->cImplTypes);
3044 ok(typeattr->cbSizeVft == 16 * sizeof(void*), "cbSizeVft = %d\n", typeattr->cbSizeVft);
3045 ok(typeattr->cbAlignment == alignment, "cbAlignment = %d\n", typeattr->cbAlignment);
3046 ok(typeattr->wTypeFlags == 0, "wTypeFlags = %d\n", typeattr->wTypeFlags);
3047 ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
3048 ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
3049 ITypeInfo_ReleaseTypeAttr(ti, typeattr);
3050
3051 hres = ITypeInfo_GetRefTypeOfImplType(ti, 0, &hreftype);
3052 ok(hres == S_OK, "got %08x\n", hres);
3053 ok(hreftype == 3, "hreftype = %d\n", hreftype);
3054
3055 hres = ITypeInfo_GetRefTypeInfo(ti, hreftype, &unknown);
3056 ok(hres == S_OK, "got %08x\n", hres);
3057
3058 hres = ITypeInfo_GetTypeAttr(unknown, &typeattr);
3059 ok(hres == S_OK, "got %08x\n", hres);
3060 ok(IsEqualGUID(&typeattr->guid, &IID_IUnknown), "got wrong reftypeinfo\n");
3061 ITypeInfo_ReleaseTypeAttr(unknown, typeattr);
3062
3063 ITypeInfo_Release(unknown);
3064
3065 hres = ITypeInfo_GetFuncDesc(ti, 0, &pfuncdesc);
3066 ok(hres == S_OK, "got %08x\n", hres);
3067 ok(pfuncdesc->memid == 0, "got %x\n", pfuncdesc->memid);
3068 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3069 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3070 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3071 ok(pfuncdesc->invkind == INVOKE_PROPERTYPUTREF, "got 0x%x\n", pfuncdesc->invkind);
3072 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3073 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
3074 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3075 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3076 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3077 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3078 edesc = pfuncdesc->lprgelemdescParam;
3079 ok(edesc->tdesc.vt == VT_BSTR, "got: %d\n", edesc->tdesc.vt);
3080 ok(U(*edesc).idldesc.wIDLFlags == IDLFLAG_FIN, "got: %x\n", U(*edesc).idldesc.wIDLFlags);
3081
3082 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3083 ok(hres == S_OK, "got: %08x\n", hres);
3084 ok(!memcmp(name, func1W, sizeof(func1W)), "got name: %s\n", wine_dbgstr_w(name));
3085 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3086 ok(helpcontext == 0x201, "got helpcontext: 0x%x\n", helpcontext);
3087 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3090
3091 hres = ITypeInfo_GetNames(ti, pfuncdesc->memid, NULL, 0, &cnames);
3092 ok(hres == E_INVALIDARG, "got: %08x\n", hres);
3093
3094 cnames = 8;
3095 hres = ITypeInfo_GetNames(ti, pfuncdesc->memid, names, 0, &cnames);
3096 ok(hres == S_OK, "got: %08x\n", hres);
3097 ok(cnames == 0, "got: %u\n", cnames);
3098
3099 hres = ITypeInfo_GetNames(ti, pfuncdesc->memid, names, ARRAY_SIZE(names), &cnames);
3100 ok(hres == S_OK, "got: %08x\n", hres);
3101 ok(cnames == 1, "got: %u\n", cnames);
3102 ok(!memcmp(names[0], func1W, sizeof(func1W)), "got names[0]: %s\n", wine_dbgstr_w(names[0]));
3103 SysFreeString(names[0]);
3104
3105 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3106
3107 hres = ITypeInfo_GetFuncDesc(ti, 1, &pfuncdesc);
3108 ok(hres == S_OK, "got %08x\n", hres);
3109 ok(pfuncdesc->memid == 0x60010001, "got %x\n", pfuncdesc->memid);
3110 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3111 ok(pfuncdesc->lprgelemdescParam == NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3112 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3113 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3114 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3115 ok(pfuncdesc->cParams == 0, "got %d\n", pfuncdesc->cParams);
3116 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3117 ok(pfuncdesc->oVft == 4 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3118 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3119 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3120 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3121
3122 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3123 ok(hres == S_OK, "got: %08x\n", hres);
3124 ok(name == NULL, "got name: %s\n", wine_dbgstr_w(name));
3125 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3126 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3127 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3129 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3130
3131 hres = ITypeInfo_GetFuncDesc(ti, 2, &pfuncdesc);
3132 ok(hres == S_OK, "got %08x\n", hres);
3133 ok(pfuncdesc->memid == 0x1, "got %x\n", pfuncdesc->memid);
3134 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3135 ok(pfuncdesc->lprgelemdescParam == NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3136 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3137 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3138 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3139 ok(pfuncdesc->cParams == 0, "got %d\n", pfuncdesc->cParams);
3140 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3141 ok(pfuncdesc->oVft == 5 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3142 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3143 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3144 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3145
3146 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3147 ok(hres == S_OK, "got: %08x\n", hres);
3148 ok(name == NULL, "got name: %s\n", wine_dbgstr_w(name));
3149 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3150 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3151 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3153 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3154
3155 hres = ITypeInfo_GetFuncDesc(ti, 3, &pfuncdesc);
3156 ok(hres == S_OK, "got %08x\n", hres);
3157 ok(pfuncdesc->memid == 0x6001000b, "got %x\n", pfuncdesc->memid);
3158 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3159 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3160 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3161 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3162 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3163 ok(pfuncdesc->cParams == 2, "got %d\n", pfuncdesc->cParams);
3164 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3165 ok(pfuncdesc->oVft == 6 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3166 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3167 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3168 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3169
3170 edesc = pfuncdesc->lprgelemdescParam;
3171 ok(edesc->tdesc.vt == VT_BSTR, "got: %d\n", edesc->tdesc.vt);
3172 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3173 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3174 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3175 U(*edesc).paramdesc.pparamdescex->cBytes);
3176 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_BSTR, "got: %d\n",
3177 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3178 ok(!lstrcmpW(V_BSTR(&U(*edesc).paramdesc.pparamdescex->varDefaultValue), nameW),
3179 "got: %s\n",
3180 wine_dbgstr_w(V_BSTR(&U(*edesc).paramdesc.pparamdescex->varDefaultValue)));
3181
3182 edesc = pfuncdesc->lprgelemdescParam + 1;
3183 ok(edesc->tdesc.vt == VT_BSTR, "got: %d\n", edesc->tdesc.vt);
3184 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3185 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3186 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3187 U(*edesc).paramdesc.pparamdescex->cBytes);
3188 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_BSTR, "got: %d\n",
3189 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3190 ok(!lstrcmpW(V_BSTR(&U(*edesc).paramdesc.pparamdescex->varDefaultValue), nameW),
3191 "got: %s\n",
3192 wine_dbgstr_w(V_BSTR(&U(*edesc).paramdesc.pparamdescex->varDefaultValue)));
3193
3194 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3195 ok(hres == S_OK, "got: %08x\n", hres);
3196 ok(!memcmp(name, func2W, sizeof(func2W)), "got name: %s\n", wine_dbgstr_w(name));
3197 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3198 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3199 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3202
3203 hres = ITypeInfo_GetNames(ti, pfuncdesc->memid, names, ARRAY_SIZE(names), &cnames);
3204 ok(hres == S_OK, "got: %08x\n", hres);
3205 ok(cnames == 3, "got: %u\n", cnames);
3206 ok(!memcmp(names[0], func2W, sizeof(func2W)), "got names[0]: %s\n", wine_dbgstr_w(names[0]));
3207 ok(!memcmp(names[1], param1W, sizeof(func2W)), "got names[1]: %s\n", wine_dbgstr_w(names[1]));
3208 ok(!memcmp(names[2], param2W, sizeof(func2W)), "got names[2]: %s\n", wine_dbgstr_w(names[2]));
3209 SysFreeString(names[0]);
3210 SysFreeString(names[1]);
3211 SysFreeString(names[2]);
3212 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3213
3214 hres = ITypeInfo_GetFuncDesc(ti, 4, &pfuncdesc);
3215 ok(hres == S_OK, "got %08x\n", hres);
3216 ok(pfuncdesc->memid == 0x6001000c, "got %x\n", pfuncdesc->memid);
3217 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3218 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3219 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3220 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3221 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3222 ok(pfuncdesc->cParams == 2, "got %d\n", pfuncdesc->cParams);
3223 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3224 ok(pfuncdesc->oVft == 7 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3225 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3226 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3227 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3228
3229 edesc = pfuncdesc->lprgelemdescParam;
3230 ok(edesc->tdesc.vt == VT_INT, "got: %d\n", edesc->tdesc.vt);
3231 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3232 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3233 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3234 U(*edesc).paramdesc.pparamdescex->cBytes);
3235 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_I4, "got: %d\n",
3236 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3237 ok(V_I4(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0xFFFFFFFF,
3238 "got: 0x%x\n", V_I4(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3239
3240 edesc = pfuncdesc->lprgelemdescParam + 1;
3241 ok(edesc->tdesc.vt == VT_INT, "got: %d\n", edesc->tdesc.vt);
3242 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3243 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3244 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3245 U(*edesc).paramdesc.pparamdescex->cBytes);
3246 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_I4, "got: %d\n",
3247 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3248 ok(V_I4(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0xFFFFFFFF,
3249 "got: 0x%x\n", V_I4(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3250
3251 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3252 ok(hres == S_OK, "got: %08x\n", hres);
3253 ok(name == NULL, "got name: %s\n", wine_dbgstr_w(name));
3254 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3255 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3256 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3258 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3259
3260 hres = ITypeInfo_GetFuncDesc(ti, 5, &pfuncdesc);
3261 ok(hres == S_OK, "got %08x\n", hres);
3262 ok(pfuncdesc->memid == 0x60010005, "got %x\n", pfuncdesc->memid);
3263 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3264 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3265 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3266 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3267 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3268 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
3269 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3270 ok(pfuncdesc->oVft == 8 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3271 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3272 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3273 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3274
3275 edesc = pfuncdesc->lprgelemdescParam;
3276 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3277 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3278 U(*edesc).paramdesc.pparamdescex->cBytes);
3279 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_INT, "got: %d\n",
3280 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3281 ok(V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0x789, "got: 0x%x\n",
3282 V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3283 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT,
3284 "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3285 ok(edesc->tdesc.vt == VT_USERDEFINED, "got: %d\n", edesc->tdesc.vt);
3286 ok(U(edesc->tdesc).hreftype == hreftype, "got: 0x%x\n", U(edesc->tdesc).hreftype);
3287
3288 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3289 ok(hres == S_OK, "got: %08x\n", hres);
3290 ok(name == NULL, "got name: %s\n", wine_dbgstr_w(name));
3291 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3292 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3293 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3295 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3296
3297 hres = ITypeInfo_GetFuncDesc(ti, 6, &pfuncdesc);
3298 ok(hres == S_OK, "got %08x\n", hres);
3299 ok(pfuncdesc->memid == 0x60010006, "got %x\n", pfuncdesc->memid);
3300 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3301 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3302 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3303 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3304 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3305 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
3306 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3307 ok(pfuncdesc->oVft == 9 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3308 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3309 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VARIANT, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3310 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3311
3312 edesc = pfuncdesc->lprgelemdescParam;
3313 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3314 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3315 U(*edesc).paramdesc.pparamdescex->cBytes);
3316 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_INT, "got: %d\n",
3317 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3318 ok(V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0x3, "got: 0x%x\n",
3319 V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3320 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT,
3321 "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3322 ok(edesc->tdesc.vt == VT_VARIANT, "got: %d\n", edesc->tdesc.vt);
3323 ok(U(edesc->tdesc).hreftype == 0, "got: 0x%x\n", U(edesc->tdesc).hreftype);
3324
3325 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3326 ok(hres == S_OK, "got: %08x\n", hres);
3327 ok(name == NULL, "got name: %s\n", wine_dbgstr_w(name));
3328 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3329 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3330 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3332 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3333
3334 hres = ITypeInfo_GetFuncDesc(ti, 7, &pfuncdesc);
3335 ok(hres == S_OK, "got %08x\n", hres);
3336 ok(pfuncdesc->memid == 0x60010009, "got %x\n", pfuncdesc->memid);
3337 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3338 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3339 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3340 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3341 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3342 ok(pfuncdesc->cParams == 2, "got %d\n", pfuncdesc->cParams);
3343 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3344 ok(pfuncdesc->oVft == 10 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3345 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3346 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3347 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3348
3349 edesc = pfuncdesc->lprgelemdescParam;
3350 ok(edesc->tdesc.vt == VT_INT, "got: %d\n", edesc->tdesc.vt);
3351 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FIN, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3352 ok(U(*edesc).paramdesc.pparamdescex == NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3353
3354 edesc = pfuncdesc->lprgelemdescParam + 1;
3355 ok(edesc->tdesc.vt == VT_UI2, "got: %d\n", edesc->tdesc.vt);
3356 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3357 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3358 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3359 U(*edesc).paramdesc.pparamdescex->cBytes);
3360 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_UI2, "got: %d\n",
3361 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3362 ok(V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0xFFFF, "got: 0x%x\n",
3363 V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3364
3365 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3366 ok(hres == S_OK, "got: %08x\n", hres);
3367 ok(name == NULL, "got name: %s\n", wine_dbgstr_w(name));
3368 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3369 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3370 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3372 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3373
3374 hres = ITypeInfo_GetFuncDesc(ti, 8, &pfuncdesc);
3375 ok(hres == S_OK, "got %08x\n", hres);
3376 ok(pfuncdesc->memid == 0x60010003, "got %x\n", pfuncdesc->memid);
3377 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3378 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3379 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3380 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3381 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3382 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
3383 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3384 ok(pfuncdesc->oVft == 11 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3385 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3386 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3387 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3388
3389 edesc = pfuncdesc->lprgelemdescParam;
3390 ok(edesc->tdesc.vt == VT_INT, "got: %d\n", edesc->tdesc.vt);
3391 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3392 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3393 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3394 U(*edesc).paramdesc.pparamdescex->cBytes);
3395 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_I4, "got: %d\n",
3396 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3397 ok(V_I4(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0x123, "got: 0x%x\n",
3398 V_I4(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3399
3400 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3401 ok(hres == S_OK, "got: %08x\n", hres);
3402 ok(name == NULL, "got name: %s\n", wine_dbgstr_w(name));
3403 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3404 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3405 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3407 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3408
3409 hres = ITypeInfo_GetFuncDesc(ti, 9, &pfuncdesc);
3410 ok(hres == S_OK, "got %08x\n", hres);
3411 ok(pfuncdesc->memid == 0, "got %x\n", pfuncdesc->memid);
3412 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3413 ok(pfuncdesc->lprgelemdescParam == NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3414 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3415 ok(pfuncdesc->invkind == INVOKE_PROPERTYGET, "got 0x%x\n", pfuncdesc->invkind);
3416 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3417 ok(pfuncdesc->cParams == 0, "got %d\n", pfuncdesc->cParams);
3418 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3419 ok(pfuncdesc->oVft == 12 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3420 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3421 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_BSTR, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3422 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3423
3424 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3425 ok(hres == S_OK, "got: %08x\n", hres);
3426 ok(!memcmp(name, func1W, sizeof(func1W)), "got name: %s\n", wine_dbgstr_w(name));
3427 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3428 ok(helpcontext == 0x201, "got helpcontext: 0x%x\n", helpcontext);
3429 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3432
3433 hres = ITypeInfo_GetNames(ti, pfuncdesc->memid, names, ARRAY_SIZE(names), &cnames);
3434 ok(hres == S_OK, "got: %08x\n", hres);
3435 ok(cnames == 1, "got: %u\n", cnames);
3436 ok(!memcmp(names[0], func1W, sizeof(func1W)), "got names[0]: %s\n", wine_dbgstr_w(names[0]));
3437 SysFreeString(names[0]);
3438 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3439
3440 hres = ITypeInfo_GetFuncDesc(ti, 10, &pfuncdesc);
3441 ok(hres == S_OK, "got %08x\n", hres);
3442 ok(pfuncdesc->memid == 0x60010007, "got %x\n", pfuncdesc->memid);
3443 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3444 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3445 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3446 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3447 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3448 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
3449 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3450 ok(pfuncdesc->oVft == 13 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3451 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3452 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3453 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3454
3455 edesc = pfuncdesc->lprgelemdescParam;
3456 ok(edesc->tdesc.vt == VT_PTR, "got: %d\n", edesc->tdesc.vt);
3457 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FIN, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3458 ok(U(*edesc).paramdesc.pparamdescex == NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3459 ok(U(edesc->tdesc).lptdesc != NULL, "got: %p\n", U(edesc->tdesc).lptdesc);
3460 ok(U(edesc->tdesc).lptdesc->vt == VT_PTR, "got: %d\n", U(edesc->tdesc).lptdesc->vt);
3461 ok(U(*U(edesc->tdesc).lptdesc).lptdesc != NULL, "got: %p\n", U(*U(edesc->tdesc).lptdesc).lptdesc);
3462 ok(U(*U(edesc->tdesc).lptdesc).lptdesc->vt == VT_BSTR, "got: %d\n", U(*U(edesc->tdesc).lptdesc).lptdesc->vt);
3463
3464 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3465 ok(hres == S_OK, "got: %08x\n", hres);
3466 ok(name == NULL, "got name: %s\n", wine_dbgstr_w(name));
3467 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3468 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3469 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3471 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3472
3473 hres = ITypeInfo_GetFuncDesc(ti, 11, &pfuncdesc);
3474 ok(hres == S_OK, "got %08x\n", hres);
3475 ok(pfuncdesc->memid == 0x60010004, "got %x\n", pfuncdesc->memid);
3476 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3477 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3478 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3479 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3480 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3481 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
3482 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3483 ok(pfuncdesc->oVft == 14 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3484 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3485 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3486 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3487
3488 edesc = pfuncdesc->lprgelemdescParam;
3489 ok(edesc->tdesc.vt == VT_PTR, "got: %d\n", edesc->tdesc.vt);
3490 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FIN, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3491 ok(U(*edesc).paramdesc.pparamdescex == NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3492 ok(U(edesc->tdesc).lptdesc != NULL, "got: %p\n", U(edesc->tdesc).lptdesc);
3493 ok(U(edesc->tdesc).lptdesc->vt == VT_BSTR, "got: %d\n", U(edesc->tdesc).lptdesc->vt);
3494
3495 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3496 ok(hres == S_OK, "got: %08x\n", hres);
3497 ok(name == NULL, "got name: %s\n", wine_dbgstr_w(name));
3498 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3499 ok(helpcontext == 0, "got helpcontext: 0x%x\n", helpcontext);
3500 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3502 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3503
3504 hres = ITypeInfo_GetFuncDesc(ti, 12, &pfuncdesc);
3505 ok(hres == S_OK, "got %08x\n", hres);
3506 ok(pfuncdesc->memid == 0, "got %x\n", pfuncdesc->memid);
3507 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3508 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3509 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3510 ok(pfuncdesc->invkind == INVOKE_PROPERTYPUT, "got 0x%x\n", pfuncdesc->invkind);
3511 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3512 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
3513 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3514 ok(pfuncdesc->oVft == 15 * sizeof(void*), "got %d\n", pfuncdesc->oVft);
3515 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3516 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3517 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3518
3519 edesc = pfuncdesc->lprgelemdescParam;
3520 ok(edesc->tdesc.vt == VT_BSTR, "got: %d\n", edesc->tdesc.vt);
3521 ok(U(*edesc).idldesc.wIDLFlags == IDLFLAG_FIN, "got: %x\n", U(*edesc).idldesc.wIDLFlags);
3522
3523 hres = ITypeInfo_GetDocumentation(ti, pfuncdesc->memid, &name, &docstring, &helpcontext, &helpfile);
3524 ok(hres == S_OK, "got: %08x\n", hres);
3525 ok(!memcmp(name, func1W, sizeof(func1W)), "got name: %s\n", wine_dbgstr_w(name));
3526 ok(docstring == NULL, "got docstring: %s\n", wine_dbgstr_w(docstring));
3527 ok(helpcontext == 0x201, "got helpcontext: 0x%x\n", helpcontext);
3528 ok(!memcmp(helpfile, helpfileW, sizeof(helpfileW)), "got helpfile: %s\n", wine_dbgstr_w(helpfile));
3531
3532 hres = ITypeInfo_GetNames(ti, pfuncdesc->memid, names, ARRAY_SIZE(names), &cnames);
3533 ok(hres == S_OK, "got: %08x\n", hres);
3534 ok(cnames == 1, "got: %u\n", cnames);
3535 ok(!memcmp(names[0], func1W, sizeof(func1W)), "got names[0]: %s\n", wine_dbgstr_w(names[0]));
3536 SysFreeString(names[0]);
3537 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3538
3539 hres = ITypeInfo_GetFuncDesc(ti, 13, &pfuncdesc);
3540 ok(hres == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hres);
3541
3542 ok(ITypeInfo_Release(ti) == 0, "Object should be freed\n");
3543
3544 hres = ITypeLib_GetTypeInfo(tl, 1, &ti);
3545 ok(hres == S_OK, "got %08x\n", hres);
3546
3547 hres = ITypeInfo_GetTypeAttr(ti, &typeattr);
3548 ok(hres == S_OK, "got %08x\n", hres);
3549 ok(typeattr->cbSizeInstance == sizeof(void*), "cbSizeInstance = %d\n", typeattr->cbSizeInstance);
3550 ok(typeattr->typekind == TKIND_INTERFACE, "typekind = %d\n", typeattr->typekind);
3551 ok(typeattr->cFuncs == 2, "cFuncs = %d\n", typeattr->cFuncs);
3552 ok(typeattr->cVars == 0, "cVars = %d\n", typeattr->cVars);
3553 ok(typeattr->cImplTypes == 1, "cImplTypes = %d\n", typeattr->cImplTypes);
3554 ok(typeattr->cbSizeVft == 0xaab8 || typeattr->cbSizeVft == 0xaab0 ||
3555 typeattr->cbSizeVft == 0x5560, "cbSizeVft = 0x%x\n", typeattr->cbSizeVft);
3556 ok(typeattr->cbAlignment == alignment, "cbAlignment = %d\n", typeattr->cbAlignment);
3557 ok(typeattr->wTypeFlags == 0, "wTypeFlags = %d\n", typeattr->wTypeFlags);
3558 ok(typeattr->wMajorVerNum == 0, "wMajorVerNum = %d\n", typeattr->wMajorVerNum);
3559 ok(typeattr->wMinorVerNum == 0, "wMinorVerNum = %d\n", typeattr->wMinorVerNum);
3560 ITypeInfo_ReleaseTypeAttr(ti, typeattr);
3561
3562 hres = ITypeInfo_GetRefTypeOfImplType(ti, 0, &hreftype);
3563 ok(hres == S_OK, "got %08x\n", hres);
3564
3565 hres = ITypeInfo_GetFuncDesc(ti, 0, &pfuncdesc);
3566 ok(hres == S_OK, "got %08x\n", hres);
3567 ok(pfuncdesc->memid == 0x60020000, "got %x\n", pfuncdesc->memid);
3568 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3569 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3570 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3571 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3572 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3573 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
3574 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3575 ok(pfuncdesc->oVft == (short)(0xaaa8 * sizeof(void *) / ptr_size), "got %x\n", pfuncdesc->oVft);
3576 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3577 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3578 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3579
3580 edesc = pfuncdesc->lprgelemdescParam;
3581 ok(edesc->tdesc.vt == VT_VARIANT, "got: %d\n", edesc->tdesc.vt);
3582 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT,
3583 "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3584 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3585 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3586 U(*edesc).paramdesc.pparamdescex->cBytes);
3587 ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_INT, "got: %d\n",
3588 V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3589 ok(V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0x3, "got: 0x%x\n",
3590 V_UI2(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
3591 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT,
3592 "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3593 ok(U(edesc->tdesc).lptdesc == NULL, "got: %p\n", U(edesc->tdesc).lptdesc);
3594 ok(U(edesc->tdesc).hreftype == 0, "got: %d\n", U(edesc->tdesc).hreftype);
3595 ITypeInfo_ReleaseFuncDesc(ti, pfuncdesc);
3596
3597 hres = ITypeInfo_GetFuncDesc(ti, 1, &pfuncdesc);
3598 ok(hres == S_OK, "got %08x\n", hres);
3599 ok(pfuncdesc->memid == 0x60020001, "got %x\n", pfuncdesc->memid);
3600 ok(pfuncdesc->lprgscode == NULL, "got %p\n", pfuncdesc->lprgscode);
3601 ok(pfuncdesc->lprgelemdescParam != NULL, "got %p\n", pfuncdesc->lprgelemdescParam);
3602 ok(pfuncdesc->funckind == FUNC_PUREVIRTUAL, "got 0x%x\n", pfuncdesc->funckind);
3603 ok(pfuncdesc->invkind == INVOKE_FUNC, "got 0x%x\n", pfuncdesc->invkind);
3604 ok(pfuncdesc->callconv == CC_STDCALL, "got 0x%x\n", pfuncdesc->callconv);
3605 ok(pfuncdesc->cParams == 1, "got %d\n", pfuncdesc->cParams);
3606 ok(pfuncdesc->cParamsOpt == 0, "got %d\n", pfuncdesc->cParamsOpt);
3607 ok(pfuncdesc->oVft == (short)((sys == SYS_WIN64 ? 0xaab0 : 0xaaac) * sizeof(void *) / ptr_size), "got %x\n", pfuncdesc->oVft);
3608 ok(pfuncdesc->cScodes == 0, "got %d\n", pfuncdesc->cScodes);
3609 ok(pfuncdesc->elemdescFunc.tdesc.vt == VT_VOID, "got %d\n", pfuncdesc->elemdescFunc.tdesc.vt);
3610 ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
3611
3612 edesc = pfuncdesc->lprgelemdescParam;
3613 ok(edesc->tdesc.vt == VT_VARIANT, "got: %d\n", edesc->tdesc.vt);
3614 ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT,
3615 "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
3616 ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
3617 ok(U(*edesc).paramdesc.pparamdescex->cBytes == sizeof(PARAMDESCEX), "got: %d\n",
3618 U(*edesc).paramdesc.pparamdescex-