oleaut: Improve SLTG var support.

Pass both the start of the block and the offset to the first item into
SLTG_DoVars as they may be different.
Process 0xfffe offsets for variable names - this means to use the
previous name.
Add support for parsing the optional varflags field.
This commit is contained in:
Robert Shearman 2006-07-03 13:54:38 +01:00 committed by Alexandre Julliard
parent 4b6b51ae99
commit 3f97460c2b
2 changed files with 19 additions and 7 deletions

View File

@ -2820,27 +2820,33 @@ static char *SLTG_DoImpls(char *pBlk, ITypeInfoImpl *pTI,
return (char*)info;
}
static void SLTG_DoVars(char *pBlk, ITypeInfoImpl *pTI, unsigned short cVars, char *pNameTable)
static void SLTG_DoVars(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsigned short cVars, char *pNameTable)
{
TLBVarDesc **ppVarDesc = &pTI->varlist;
BSTR bstrPrevName = NULL;
SLTG_Variable *pItem;
unsigned short i;
WORD *pType;
char buf[300];
for(pItem = (SLTG_Variable *)pBlk, i = 0; i < cVars;
for(pItem = (SLTG_Variable *)pFirstItem, i = 0; i < cVars;
pItem = (SLTG_Variable *)(pBlk + pItem->next), i++) {
*ppVarDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(**ppVarDesc));
(*ppVarDesc)->Name = TLB_MultiByteToBSTR(pItem->name + pNameTable);
(*ppVarDesc)->vardesc.memid = pItem->memid;
if(pItem->magic != SLTG_VAR_MAGIC) {
if (pItem->magic != SLTG_VAR_MAGIC &&
pItem->magic != SLTG_VAR_WITH_FLAGS_MAGIC) {
FIXME_(typelib)("var magic = %02x\n", pItem->magic);
return;
}
if (pItem->name == 0xfffe)
(*ppVarDesc)->Name = SysAllocString(bstrPrevName);
else
(*ppVarDesc)->Name = TLB_MultiByteToBSTR(pItem->name + pNameTable);
TRACE_(typelib)("byte_offs = 0x%x\n", pItem->byte_offs);
TRACE_(typelib)("memid = 0x%lx\n", pItem->memid);
@ -2863,6 +2869,9 @@ static void SLTG_DoVars(char *pBlk, ITypeInfoImpl *pTI, unsigned short cVars, ch
(*ppVarDesc)->vardesc.varkind = VAR_PERINSTANCE;
}
if (pItem->magic == SLTG_VAR_WITH_FLAGS_MAGIC)
(*ppVarDesc)->vardesc.wVarFlags = pItem->varflags;
if (pItem->flags & 0x80)
(*ppVarDesc)->vardesc.wVarFlags |= VARFLAG_FREADONLY;
@ -2879,6 +2888,7 @@ static void SLTG_DoVars(char *pBlk, ITypeInfoImpl *pTI, unsigned short cVars, ch
dump_TypeDesc(&(*ppVarDesc)->vardesc.elemdescVar.tdesc, buf);
bstrPrevName = (*ppVarDesc)->Name;
ppVarDesc = &((*ppVarDesc)->next);
}
pTI->TypeAttr.cVars = cVars;
@ -3032,7 +3042,7 @@ static void SLTG_ProcessRecord(char *pBlk, ITypeInfoImpl *pTI,
char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
SLTG_TypeInfoTail *pTITail)
{
SLTG_DoVars(pBlk, pTI, pTITail->cVars, pNameTable);
SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable);
}
static void SLTG_ProcessAlias(char *pBlk, ITypeInfoImpl *pTI,
@ -3067,7 +3077,7 @@ static void SLTG_ProcessDispatch(char *pBlk, ITypeInfoImpl *pTI,
pNameTable);
if (pTITail->vars_off != 0xffff)
SLTG_DoVars(pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable);
SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable);
if (pTITail->funcs_off != 0xffff)
SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable);
@ -3085,7 +3095,7 @@ static void SLTG_ProcessEnum(char *pBlk, ITypeInfoImpl *pTI,
char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
SLTG_TypeInfoTail *pTITail)
{
SLTG_DoVars(pBlk, pTI, pTITail->cVars, pNameTable);
SLTG_DoVars(pBlk, pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable);
}
/* Because SLTG_OtherTypeInfo is such a painful struct, we make a more

View File

@ -580,9 +580,11 @@ typedef struct {
DWORD memid;
WORD helpcontext; /* ?? */
WORD helpstring; /* ?? */
WORD varflags; /* only present if magic & 0x02 */
} SLTG_Variable;
#define SLTG_VAR_MAGIC 0x0a
#define SLTG_VAR_WITH_FLAGS_MAGIC 0x2a
/* CARRAYs look like this