Load some useful TYPEATTR elements from v1 typelibs.

This commit is contained in:
Huw D M Davies 2001-09-10 23:13:28 +00:00 committed by Alexandre Julliard
parent 98343e325c
commit 3db218a2a1
2 changed files with 62 additions and 18 deletions

View File

@ -2334,7 +2334,7 @@ static char *SLTG_DoImpls(SLTG_ImplInfo *info, ITypeInfoImpl *pTI,
return (char*)info; return (char*)info;
} }
static void SLTG_ProcessCoClass(char *pBlk, ITypeInfoImpl *pTI, static SLTG_TypeInfoTail *SLTG_ProcessCoClass(char *pBlk, ITypeInfoImpl *pTI,
char *pNameTable) char *pNameTable)
{ {
SLTG_TypeInfoHeader *pTIHeader = (SLTG_TypeInfoHeader*)pBlk; SLTG_TypeInfoHeader *pTIHeader = (SLTG_TypeInfoHeader*)pBlk;
@ -2355,11 +2355,11 @@ static void SLTG_ProcessCoClass(char *pBlk, ITypeInfoImpl *pTI,
pNextItem = SLTG_DoImpls((SLTG_ImplInfo*)pFirstItem, pTI, FALSE); pNextItem = SLTG_DoImpls((SLTG_ImplInfo*)pFirstItem, pTI, FALSE);
} }
return; return (SLTG_TypeInfoTail*)(pFirstItem + pMemHeader->cbExtra);
} }
static void SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI, static SLTG_TypeInfoTail *SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI,
char *pNameTable) char *pNameTable)
{ {
SLTG_TypeInfoHeader *pTIHeader = (SLTG_TypeInfoHeader*)pBlk; SLTG_TypeInfoHeader *pTIHeader = (SLTG_TypeInfoHeader*)pBlk;
@ -2391,7 +2391,7 @@ static void SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI,
if(pFunc->magic != SLTG_FUNCTION_MAGIC && if(pFunc->magic != SLTG_FUNCTION_MAGIC &&
pFunc->magic != SLTG_FUNCTION_WITH_FLAGS_MAGIC) { pFunc->magic != SLTG_FUNCTION_WITH_FLAGS_MAGIC) {
FIXME("func magic = %02x\n", pFunc->magic); FIXME("func magic = %02x\n", pFunc->magic);
return; return NULL;
} }
*ppFuncDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *ppFuncDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(**ppFuncDesc)); sizeof(**ppFuncDesc));
@ -2470,9 +2470,11 @@ static void SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI,
} }
pTI->TypeAttr.cFuncs = num; pTI->TypeAttr.cFuncs = num;
dump_TLBFuncDesc(pTI->funclist); dump_TLBFuncDesc(pTI->funclist);
return (SLTG_TypeInfoTail*)(pFirstItem + pMemHeader->cbExtra);
} }
static void SLTG_ProcessRecord(char *pBlk, ITypeInfoImpl *pTI, char *pNameTable) static SLTG_TypeInfoTail *SLTG_ProcessRecord(char *pBlk, ITypeInfoImpl *pTI,
char *pNameTable)
{ {
SLTG_TypeInfoHeader *pTIHeader = (SLTG_TypeInfoHeader*)pBlk; SLTG_TypeInfoHeader *pTIHeader = (SLTG_TypeInfoHeader*)pBlk;
SLTG_MemberHeader *pMemHeader; SLTG_MemberHeader *pMemHeader;
@ -2490,7 +2492,7 @@ static void SLTG_ProcessRecord(char *pBlk, ITypeInfoImpl *pTI, char *pNameTable)
pItem = (SLTG_RecordItem *)(pFirstItem + pItem->next), num++) { pItem = (SLTG_RecordItem *)(pFirstItem + pItem->next), num++) {
if(pItem->magic != SLTG_RECORD_MAGIC) { if(pItem->magic != SLTG_RECORD_MAGIC) {
FIXME("record magic = %02x\n", pItem->magic); FIXME("record magic = %02x\n", pItem->magic);
return; return NULL;
} }
*ppVarDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *ppVarDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(**ppVarDesc)); sizeof(**ppVarDesc));
@ -2519,9 +2521,11 @@ static void SLTG_ProcessRecord(char *pBlk, ITypeInfoImpl *pTI, char *pNameTable)
if(pItem->next == 0xffff) break; if(pItem->next == 0xffff) break;
} }
pTI->TypeAttr.cVars = num; pTI->TypeAttr.cVars = num;
return (SLTG_TypeInfoTail*)(pFirstItem + pMemHeader->cbExtra);
} }
static void SLTG_ProcessEnum(char *pBlk, ITypeInfoImpl *pTI, char *pNameTable) static SLTG_TypeInfoTail *SLTG_ProcessEnum(char *pBlk, ITypeInfoImpl *pTI,
char *pNameTable)
{ {
SLTG_TypeInfoHeader *pTIHeader = (SLTG_TypeInfoHeader*)pBlk; SLTG_TypeInfoHeader *pTIHeader = (SLTG_TypeInfoHeader*)pBlk;
SLTG_MemberHeader *pMemHeader; SLTG_MemberHeader *pMemHeader;
@ -2537,7 +2541,7 @@ static void SLTG_ProcessEnum(char *pBlk, ITypeInfoImpl *pTI, char *pNameTable)
pItem = (SLTG_EnumItem *)(pFirstItem + pItem->next), num++) { pItem = (SLTG_EnumItem *)(pFirstItem + pItem->next), num++) {
if(pItem->magic != SLTG_ENUMITEM_MAGIC) { if(pItem->magic != SLTG_ENUMITEM_MAGIC) {
FIXME("enumitem magic = %04x\n", pItem->magic); FIXME("enumitem magic = %04x\n", pItem->magic);
return; return NULL;
} }
*ppVarDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *ppVarDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(**ppVarDesc)); sizeof(**ppVarDesc));
@ -2556,6 +2560,7 @@ static void SLTG_ProcessEnum(char *pBlk, ITypeInfoImpl *pTI, char *pNameTable)
if(pItem->next == 0xffff) break; if(pItem->next == 0xffff) break;
} }
pTI->TypeAttr.cVars = num; pTI->TypeAttr.cVars = num;
return (SLTG_TypeInfoTail*)(pFirstItem + pMemHeader->cbExtra);
} }
/* Because SLTG_OtherTypeInfo is such a painfull struct, we make a more /* Because SLTG_OtherTypeInfo is such a painfull struct, we make a more
@ -2737,6 +2742,7 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
order = pBlkEntry[order].next - 1, i++) { order = pBlkEntry[order].next - 1, i++) {
SLTG_TypeInfoHeader *pTIHeader; SLTG_TypeInfoHeader *pTIHeader;
SLTG_TypeInfoTail *pTITail;
if(strcmp(pBlkEntry[order].index_string + (char*)pMagic, if(strcmp(pBlkEntry[order].index_string + (char*)pMagic,
pOtherTypeInfoBlks[i].index_name)) { pOtherTypeInfoBlks[i].index_name)) {
@ -2777,27 +2783,34 @@ static ITypeLib2* ITypeLib2_Constructor_SLTG(LPVOID pLib, DWORD dwTLBLength)
switch(pTIHeader->typekind) { switch(pTIHeader->typekind) {
case TKIND_ENUM: case TKIND_ENUM:
SLTG_ProcessEnum(pBlk, *ppTypeInfoImpl, pNameTable); pTITail = SLTG_ProcessEnum(pBlk, *ppTypeInfoImpl, pNameTable);
break; break;
case TKIND_RECORD: case TKIND_RECORD:
SLTG_ProcessRecord(pBlk, *ppTypeInfoImpl, pNameTable); pTITail = SLTG_ProcessRecord(pBlk, *ppTypeInfoImpl, pNameTable);
break; break;
case TKIND_INTERFACE: case TKIND_INTERFACE:
SLTG_ProcessInterface(pBlk, *ppTypeInfoImpl, pNameTable); pTITail = SLTG_ProcessInterface(pBlk, *ppTypeInfoImpl, pNameTable);
break; break;
case TKIND_COCLASS: case TKIND_COCLASS:
SLTG_ProcessCoClass(pBlk, *ppTypeInfoImpl, pNameTable); pTITail = SLTG_ProcessCoClass(pBlk, *ppTypeInfoImpl, pNameTable);
break; break;
default: default:
FIXME("Not processing typekind %d\n", pTIHeader->typekind); FIXME("Not processing typekind %d\n", pTIHeader->typekind);
pTITail = NULL;
break; break;
} }
if(pTITail) { /* could get cFuncs, cVars and cImplTypes from here
but we've already set those */
(*ppTypeInfoImpl)->TypeAttr.cbAlignment = pTITail->cbAlignment;
(*ppTypeInfoImpl)->TypeAttr.cbSizeInstance = pTITail->cbSizeInstance;
(*ppTypeInfoImpl)->TypeAttr.cbSizeVft = pTITail->cbSizeVft;
}
ppTypeInfoImpl = &((*ppTypeInfoImpl)->next); ppTypeInfoImpl = &((*ppTypeInfoImpl)->next);
pBlk += pBlkEntry[order].len; pBlk += pBlkEntry[order].len;
} }
@ -3030,8 +3043,8 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
{ {
ICOM_THIS( ITypeLibImpl, iface); ICOM_THIS( ITypeLibImpl, iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
/* FIXME: must do a copy here */ *ppTLibAttr = HeapAlloc(GetProcessHeap(), 0, sizeof(**ppTLibAttr));
*ppTLibAttr=&This->LibAttr; memcpy(*ppTLibAttr, &This->LibAttr, sizeof(**ppTLibAttr));
return S_OK; return S_OK;
} }
@ -3226,7 +3239,8 @@ static VOID WINAPI ITypeLib2_fnReleaseTLibAttr(
{ {
ICOM_THIS( ITypeLibImpl, iface); ICOM_THIS( ITypeLibImpl, iface);
TRACE("freeing (%p)\n",This); TRACE("freeing (%p)\n",This);
/* nothing to do */ HeapFree(GetProcessHeap(),0,pTLibAttr);
} }
/* ITypeLib2::GetCustData /* ITypeLib2::GetCustData

View File

@ -22,7 +22,7 @@
/*-------------------------FILE STRUCTURES-----------------------------------*/ /*-------------------------FILE STRUCTURES-----------------------------------*/
/* There are two known file formats, those created with ICreateTypeLib /* There are two known file formats, those created with ICreateTypeLib
* have the signature "SLGT" as their first four bytes, while those created * have the signature "SLTG" as their first four bytes, while those created
* with ICreateTypeLib2 have "MSFT". * with ICreateTypeLib2 have "MSFT".
*/ */
@ -375,6 +375,36 @@ typedef struct {
#define SLTG_TIHEADER_MAGIC 0x0501 #define SLTG_TIHEADER_MAGIC 0x0501
typedef struct {
/*00*/ WORD cFuncs;
/*02*/ WORD cVars;
/*04*/ WORD cImplTypes;
/*06*/ WORD res06;
/*08*/ WORD res08;
/*0a*/ WORD res0a;
/*0c*/ WORD res0c;
/*0e*/ WORD res0e;
/*10*/ WORD res10;
/*12*/ WORD res12;
/*14*/ WORD res14;
/*16*/ WORD res16;
/*18*/ WORD res18;
/*1a*/ WORD res1a;
/*1c*/ WORD res1c;
/*1e*/ WORD res1e;
/*20*/ WORD cbSizeInstance;
/*22*/ WORD cbAlignment;
/*24*/ WORD res24;
/*26*/ WORD res26;
/*28*/ WORD cbSizeVft;
/*2a*/ WORD res2a;
/*2c*/ WORD res2c;
/*2e*/ WORD res2e;
/*30*/ WORD res30;
/*32*/ WORD res32;
/*34*/ WORD res34;
} SLTG_TypeInfoTail;
typedef struct { typedef struct {
/*00*/ WORD res00; /* 0x0001 sometimes 0x0003 ?? */ /*00*/ WORD res00; /* 0x0001 sometimes 0x0003 ?? */
/*02*/ WORD res02; /* 0xffff */ /*02*/ WORD res02; /* 0xffff */