oleaut32: Use IDispatch vtable size instead of hardcoded value.

This commit is contained in:
Nikolay Sivov 2011-01-04 14:00:13 +03:00 committed by Alexandre Julliard
parent b09fd556b0
commit ed749f51ce
2 changed files with 5 additions and 4 deletions

View File

@ -1082,7 +1082,7 @@ typedef struct tagTLBVarDesc
VARDESC vardesc; /* lots of info on the variable and its attributes. */ VARDESC vardesc; /* lots of info on the variable and its attributes. */
BSTR Name; /* the name of this variable */ BSTR Name; /* the name of this variable */
int HelpContext; int HelpContext;
int HelpStringContext; /* FIXME: where? */ int HelpStringContext;
BSTR HelpString; BSTR HelpString;
int ctCustData; int ctCustData;
TLBCustData * pCustData;/* linked list to cust data; */ TLBCustData * pCustData;/* linked list to cust data; */
@ -5110,7 +5110,8 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface,
if((*ppTypeAttr)->typekind == TKIND_DISPATCH) { if((*ppTypeAttr)->typekind == TKIND_DISPATCH) {
/* This should include all the inherited funcs */ /* This should include all the inherited funcs */
(*ppTypeAttr)->cFuncs = (*ppTypeAttr)->cbSizeVft / sizeof(void *); (*ppTypeAttr)->cFuncs = (*ppTypeAttr)->cbSizeVft / sizeof(void *);
(*ppTypeAttr)->cbSizeVft = 7 * sizeof(void *); /* This is always the size of IDispatch's vtbl */ /* This is always the size of IDispatch's vtbl */
(*ppTypeAttr)->cbSizeVft = sizeof(IDispatchVtbl);
(*ppTypeAttr)->wTypeFlags &= ~TYPEFLAG_FOLEAUTOMATION; (*ppTypeAttr)->wTypeFlags &= ~TYPEFLAG_FOLEAUTOMATION;
} }
return S_OK; return S_OK;

View File

@ -3207,10 +3207,10 @@ static HRESULT WINAPI ITypeInfo2_fnGetTypeAttr(
(*ppTypeAttr)->typekind = This->typekind; (*ppTypeAttr)->typekind = This->typekind;
(*ppTypeAttr)->cFuncs = cti2_get_func_count(This->typeinfo); (*ppTypeAttr)->cFuncs = cti2_get_func_count(This->typeinfo);
if(This->typeinfo->flags&TYPEFLAG_FDUAL && This->typekind==TKIND_DISPATCH) if(This->typeinfo->flags&TYPEFLAG_FDUAL && This->typekind==TKIND_DISPATCH)
(*ppTypeAttr)->cFuncs += 7; (*ppTypeAttr)->cFuncs += sizeof(IDispatchVtbl)/sizeof(void*);
(*ppTypeAttr)->cVars = cti2_get_var_count(This->typeinfo); (*ppTypeAttr)->cVars = cti2_get_var_count(This->typeinfo);
(*ppTypeAttr)->cImplTypes = This->typeinfo->cImplTypes; (*ppTypeAttr)->cImplTypes = This->typeinfo->cImplTypes;
(*ppTypeAttr)->cbSizeVft = This->typekind==TKIND_DISPATCH ? 7 * sizeof(void*) : This->typeinfo->cbSizeVft; (*ppTypeAttr)->cbSizeVft = This->typekind == TKIND_DISPATCH ? sizeof(IDispatchVtbl) : This->typeinfo->cbSizeVft;
(*ppTypeAttr)->cbAlignment = (This->typeinfo->typekind>>11) & 0x1f; (*ppTypeAttr)->cbAlignment = (This->typeinfo->typekind>>11) & 0x1f;
(*ppTypeAttr)->wTypeFlags = This->typeinfo->flags; (*ppTypeAttr)->wTypeFlags = This->typeinfo->flags;
(*ppTypeAttr)->wMajorVerNum = LOWORD(This->typeinfo->version); (*ppTypeAttr)->wMajorVerNum = LOWORD(This->typeinfo->version);