From: Dmitry Timoshkov dmitry@baikal.ru
It looks like the lowest bit actually indicates whether type description follows the name, and since the name offsets are always aligned that makes sense.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/oleaut32/typelib.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index f421a76fe95..3f6e81015c1 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -4167,37 +4167,20 @@ static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, pArg = (WORD*)(pBlk + pFunc->arg_off);
for(param = 0; param < pFuncDesc->funcdesc.cParams; param++) { - char *paramName = pNameTable + *pArg; - BOOL HaveOffs; - /* If arg type follows then paramName points to the 2nd - letter of the name, else the next WORD is an offset to - the arg type and paramName points to the first letter. - So let's take one char off paramName and see if we're - pointing at an alphanumeric char. However if *pArg is - 0xffff or 0xfffe then the param has no name, the former - meaning that the next WORD is the type, the latter - meaning that the next WORD is an offset to the type. */ - - HaveOffs = FALSE; - if(*pArg == 0xffff) - paramName = NULL; - else if(*pArg == 0xfffe) { - paramName = NULL; - HaveOffs = TRUE; - } - else if(paramName[-1] && !isalnum(paramName[-1])) - HaveOffs = TRUE; + char *paramName = (*pArg & ~1) == 0xfffe ? NULL : pNameTable + (*pArg & ~1); + BOOL HaveOffs = !(*pArg & 1);
pArg++;
+ TRACE_(typelib)("param %d: paramName %s, *pArg %#x\n", + param, debugstr_a(paramName), *pArg); + if(HaveOffs) { /* the next word is an offset to type */ pType = (WORD*)(pBlk + *pArg); SLTG_DoElem(pType, pBlk, &pFuncDesc->funcdesc.lprgelemdescParam[param], ref_lookup); pArg++; } else { - if(paramName) - paramName--; pArg = SLTG_DoElem(pArg, pBlk, &pFuncDesc->funcdesc.lprgelemdescParam[param], ref_lookup); }