widl: Fix pointer size for SYS_WIN64 typelibs.
The fact that test data was wrong was hidden by broken widl typelib, and same test typelib was used on windows so we never get proper test results. Standard IUnknown/IDispatch that live in system stdole2.tlb are also tested now.
This commit is contained in:
parent
84d91bb93d
commit
c46debeeeb
|
@ -651,7 +651,7 @@ static const char *create_test_typelib(int res_no)
|
|||
static void test_TypeInfo(void)
|
||||
{
|
||||
ITypeLib *pTypeLib;
|
||||
ITypeInfo *pTypeInfo;
|
||||
ITypeInfo *pTypeInfo, *ti;
|
||||
ITypeInfo2 *pTypeInfo2;
|
||||
HRESULT hr;
|
||||
static WCHAR wszBogus[] = { 'b','o','g','u','s',0 };
|
||||
|
@ -668,6 +668,7 @@ static void test_TypeInfo(void)
|
|||
TYPEKIND kind;
|
||||
const char *filenameA;
|
||||
WCHAR filename[MAX_PATH];
|
||||
TYPEATTR *attr;
|
||||
|
||||
hr = LoadTypeLib(wszStdOle2, &pTypeLib);
|
||||
ok_ole_success(hr, LoadTypeLib);
|
||||
|
@ -765,8 +766,6 @@ static void test_TypeInfo(void)
|
|||
|
||||
ITypeInfo_Release(pTypeInfo);
|
||||
|
||||
|
||||
|
||||
hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, &IID_IDispatch, &pTypeInfo);
|
||||
ok_ole_success(hr, ITypeLib_GetTypeInfoOfGuid);
|
||||
|
||||
|
@ -792,6 +791,23 @@ static void test_TypeInfo(void)
|
|||
VariantClear(&var);
|
||||
}
|
||||
|
||||
/* Check instance size for IDispatch, typelib is loaded using system SYS_WIN* kind so it always matches
|
||||
system bitness. */
|
||||
hr = ITypeInfo_GetTypeAttr(pTypeInfo, &attr);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(attr->cbSizeInstance == sizeof(void*), "got size %d\n", attr->cbSizeInstance);
|
||||
ok(attr->typekind == TKIND_INTERFACE, "got typekind %d\n", attr->typekind);
|
||||
ITypeInfo_ReleaseTypeAttr(pTypeInfo, attr);
|
||||
|
||||
/* same size check with some general interface */
|
||||
hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, &IID_IEnumVARIANT, &ti);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
hr = ITypeInfo_GetTypeAttr(ti, &attr);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(attr->cbSizeInstance == sizeof(void*), "got size %d\n", attr->cbSizeInstance);
|
||||
ITypeInfo_ReleaseTypeAttr(ti, attr);
|
||||
ITypeInfo_Release(ti);
|
||||
|
||||
/* test invoking a method with a [restricted] keyword */
|
||||
|
||||
/* correct member id -- wrong flags -- cNamedArgs not bigger than cArgs */
|
||||
|
@ -3757,7 +3773,7 @@ static const interface_info info[] = {
|
|||
/* interfaces count: 2 */
|
||||
{
|
||||
"IDualIface",
|
||||
/*kind*/ TKIND_DISPATCH, /*flags*/ 0x1040, /*align*/ 4, /*size*/ 4,
|
||||
/*kind*/ TKIND_DISPATCH, /*flags*/ 0x1040, /*align*/ 4, /*size*/ sizeof(void*),
|
||||
/*#vtbl*/ 7, /*#func*/ 8,
|
||||
{
|
||||
{
|
||||
|
@ -3898,7 +3914,7 @@ static const interface_info info[] = {
|
|||
},
|
||||
{
|
||||
"ISimpleIface",
|
||||
/*kind*/ TKIND_INTERFACE, /*flags*/ 0x1000, /*align*/ 4, /*size*/ 4,
|
||||
/*kind*/ TKIND_INTERFACE, /*flags*/ 0x1000, /*align*/ 4, /*size*/ sizeof(void*),
|
||||
/*#vtbl*/ 8, /*#func*/ 1,
|
||||
{
|
||||
{
|
||||
|
|
|
@ -3545,7 +3545,7 @@ static ITypeLib2* ITypeLib2_Constructor_MSFT(LPVOID pLib, DWORD dwTLBLength)
|
|||
cx.length = dwTLBLength;
|
||||
|
||||
/* read header */
|
||||
MSFT_ReadLEDWords((void*)&tlbHeader, sizeof(tlbHeader), &cx, 0);
|
||||
MSFT_ReadLEDWords(&tlbHeader, sizeof(tlbHeader), &cx, 0);
|
||||
TRACE_(typelib)("header:\n");
|
||||
TRACE_(typelib)("\tmagic1=0x%08x ,magic2=0x%08x\n",tlbHeader.magic1,tlbHeader.magic2 );
|
||||
if (tlbHeader.magic1 != MSFT_SIGNATURE) {
|
||||
|
@ -9645,7 +9645,7 @@ static DWORD WMSFT_compile_typeinfo(ITypeInfoImpl *info, INT16 index, WMSFT_TLBF
|
|||
size = sizeof(MSFT_TypeInfoBase);
|
||||
|
||||
if(data){
|
||||
MSFT_TypeInfoBase *base = (void*)data;
|
||||
MSFT_TypeInfoBase *base = (MSFT_TypeInfoBase*)data;
|
||||
if(info->wTypeFlags & TYPEFLAG_FDUAL)
|
||||
base->typekind = TKIND_DISPATCH;
|
||||
else
|
||||
|
|
|
@ -174,7 +174,7 @@ static void ctl2_init_segdir(
|
|||
|
||||
segdir = &typelib->typelib_segdir[MSFT_SEG_TYPEINFO];
|
||||
|
||||
for (i = 0; i < 15; i++) {
|
||||
for (i = 0; i < MSFT_SEG_MAX; i++) {
|
||||
segdir[i].offset = -1;
|
||||
segdir[i].length = 0;
|
||||
segdir[i].res08 = -1;
|
||||
|
@ -827,7 +827,6 @@ static int encode_type(
|
|||
case VT_UI4:
|
||||
case VT_R4:
|
||||
case VT_ERROR:
|
||||
case VT_BSTR:
|
||||
case VT_HRESULT:
|
||||
*encoded_type = default_type;
|
||||
*width = 4;
|
||||
|
@ -863,8 +862,9 @@ static int encode_type(
|
|||
|
||||
case VT_UNKNOWN:
|
||||
case VT_DISPATCH:
|
||||
case VT_BSTR:
|
||||
*encoded_type = default_type;
|
||||
*width = 4;
|
||||
*width = pointer_size;
|
||||
*alignment = 4;
|
||||
break;
|
||||
|
||||
|
@ -875,7 +875,7 @@ static int encode_type(
|
|||
case VT_LPSTR:
|
||||
case VT_LPWSTR:
|
||||
*encoded_type = 0xfffe0000 | vt;
|
||||
*width = 4;
|
||||
*width = pointer_size;
|
||||
*alignment = 4;
|
||||
break;
|
||||
|
||||
|
@ -898,7 +898,7 @@ static int encode_type(
|
|||
if(next_vt == VT_DISPATCH || next_vt == VT_UNKNOWN) {
|
||||
chat("encode_type: skipping ptr\n");
|
||||
*encoded_type = target_type;
|
||||
*width = 4;
|
||||
*width = pointer_size;
|
||||
*alignment = 4;
|
||||
*decoded_size = child_size;
|
||||
break;
|
||||
|
@ -928,13 +928,12 @@ static int encode_type(
|
|||
|
||||
*encoded_type = typeoffset;
|
||||
|
||||
*width = 4;
|
||||
*width = pointer_size;
|
||||
*alignment = 4;
|
||||
*decoded_size = 8 /*sizeof(TYPEDESC)*/ + child_size;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case VT_SAFEARRAY:
|
||||
{
|
||||
type_t *element_type = type_alias_get_aliasee(type_array_get_element(type));
|
||||
|
@ -966,13 +965,12 @@ static int encode_type(
|
|||
|
||||
*encoded_type = typeoffset;
|
||||
|
||||
*width = 4;
|
||||
*width = pointer_size;
|
||||
*alignment = 4;
|
||||
*decoded_size = 8 /*sizeof(TYPEDESC)*/ + child_size;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case VT_USERDEFINED:
|
||||
{
|
||||
int typeinfo_offset;
|
||||
|
@ -1119,7 +1117,7 @@ static int encode_var(
|
|||
chat("encode_var: skipping ptr\n");
|
||||
*encoded_type = target_type;
|
||||
*decoded_size = child_size;
|
||||
*width = 4;
|
||||
*width = pointer_size;
|
||||
*alignment = 4;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1148,7 +1146,7 @@ static int encode_var(
|
|||
|
||||
*encoded_type = typeoffset;
|
||||
|
||||
*width = 4;
|
||||
*width = pointer_size;
|
||||
*alignment = 4;
|
||||
*decoded_size = 8 /*sizeof(TYPEDESC)*/ + child_size;
|
||||
return 0;
|
||||
|
@ -1728,7 +1726,7 @@ static HRESULT add_var_desc(msft_typeinfo_t *typeinfo, UINT index, var_t* var)
|
|||
break;
|
||||
case TKIND_DISPATCH:
|
||||
var_kind = 3; /* VAR_DISPATCH */
|
||||
typeinfo->datawidth = 4;
|
||||
typeinfo->datawidth = pointer_size;
|
||||
var_alignment = 4;
|
||||
break;
|
||||
default:
|
||||
|
@ -1981,7 +1979,7 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
|
|||
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_DISPATCH, dispinterface->name,
|
||||
dispinterface->attrs);
|
||||
|
||||
msft_typeinfo->typeinfo->size = 4;
|
||||
msft_typeinfo->typeinfo->size = pointer_size;
|
||||
msft_typeinfo->typeinfo->typekind |= 0x2100;
|
||||
|
||||
msft_typeinfo->typeinfo->flags |= 0x1000; /* TYPEFLAG_FDISPATCHABLE */
|
||||
|
@ -2046,7 +2044,7 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
|
|||
|
||||
interface->typelib_idx = typelib->typelib_header.nrtypeinfos;
|
||||
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_INTERFACE, interface->name, interface->attrs);
|
||||
msft_typeinfo->typeinfo->size = 4;
|
||||
msft_typeinfo->typeinfo->size = pointer_size;
|
||||
msft_typeinfo->typeinfo->typekind |= 0x2200;
|
||||
|
||||
for (derived = inherit; derived; derived = type_iface_get_inherit(derived))
|
||||
|
@ -2210,7 +2208,7 @@ static void add_coclass_typeinfo(msft_typelib_t *typelib, type_t *cls)
|
|||
first_source->flags |= 0x1;
|
||||
|
||||
msft_typeinfo->typeinfo->cImplTypes = num_ifaces;
|
||||
msft_typeinfo->typeinfo->size = 4;
|
||||
msft_typeinfo->typeinfo->size = pointer_size;
|
||||
msft_typeinfo->typeinfo->typekind |= 0x2200;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue