From fe311461a785730cf046ef4267a86f5fa66cddde Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Wed, 29 Jun 2005 19:18:25 +0000 Subject: [PATCH] Cope with the index in a import table entry being a typeinfo index rather than a guid offset. --- dlls/oleaut32/typelib.c | 7 +++++-- dlls/oleaut32/typelib.h | 8 +++++--- dlls/oleaut32/typelib2.c | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 869f90bd5c0..defeede82e8 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -1997,8 +1997,11 @@ static void MSFT_DoRefType(TLBContext *pcx, ITypeInfoImpl *pTI, if(pImpLib){ (*ppRefType)->reference=offset; (*ppRefType)->pImpTLInfo = pImpLib; - MSFT_ReadGuid(&(*ppRefType)->guid, impinfo.oGuid, pcx); - (*ppRefType)->index = TLB_REF_USE_GUID; + if(impinfo.flags & MSFT_IMPINFO_OFFSET_IS_GUID) { + MSFT_ReadGuid(&(*ppRefType)->guid, impinfo.oGuid, pcx); + (*ppRefType)->index = TLB_REF_USE_GUID; + } else + (*ppRefType)->index = impinfo.oGuid; }else{ ERR("Cannot find a reference\n"); (*ppRefType)->reference=-1; diff --git a/dlls/oleaut32/typelib.h b/dlls/oleaut32/typelib.h index 6f7b8cd4330..5e9c90f33b2 100644 --- a/dlls/oleaut32/typelib.h +++ b/dlls/oleaut32/typelib.h @@ -157,17 +157,19 @@ typedef struct tagMSFT_TypeInfoBase { /* else it is zero? */ INT res18; /* always? 0 */ /*060*/ INT res19; /* always? -1 */ - } MSFT_TypeInfoBase; +} MSFT_TypeInfoBase; /* layout of an entry with information on imported types */ typedef struct tagMSFT_ImpInfo { - INT res0; /* bits 0 - 15: count */ + INT flags; /* bits 0 - 15: count */ /* bit 16: if set oGuid is an offset to Guid */ /* if clear oGuid is a typeinfo index in the specified typelib */ /* bits 24 - 31: TKIND of reference */ INT oImpFile; /* offset in the Import File table */ INT oGuid; /* offset in Guid table or typeinfo index (see bit 16 of res0) */ - } MSFT_ImpInfo; +} MSFT_ImpInfo; + +#define MSFT_IMPINFO_OFFSET_IS_GUID 0x00010000 /* function description data */ typedef struct { diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index 14d91126d39..b1e793345a6 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -1242,7 +1242,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeFlags(ICreateTypeInfo2 *iface, U guidoffset = ctl2_alloc_guid(This->typelib, &foo); if (guidoffset == -1) return E_OUTOFMEMORY; - impinfo.res0 = 0x03010000; + impinfo.flags = TKIND_INTERFACE << 24 | MSFT_IMPINFO_OFFSET_IS_GUID; impinfo.oImpFile = fileoffset; impinfo.oGuid = guidoffset; ctl2_alloc_importinfo(This->typelib, &impinfo);