[Wine-patches] [eter-2.1 1/4] oleaut32: Fix logic for deciding whether type description follows the name (v2). (eterbug #4684).
Dmitry Timoshkov
dtimoshkov на etersoft.ru
Ср Янв 27 08:34:06 MSK 2016
This makes it possible to load an SLTG typelib generated by widl.
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.
---
dlls/oleaut32/typelib.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 8fd8740..6449565 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -3704,7 +3704,7 @@ 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;
+ char *paramName = pNameTable + (*pArg & ~1);
BOOL HaveOffs;
/* If arg type follows then paramName points to the 2nd
letter of the name, else the next WORD is an offset to
@@ -3715,26 +3715,21 @@ static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI,
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)
+ if(*pArg == 0xffff || *pArg == 0xfffe)
paramName = NULL;
- else if(*pArg == 0xfffe) {
- paramName = NULL;
- HaveOffs = TRUE;
- }
- else if(paramName[-1] && !isalnum(paramName[-1]))
- HaveOffs = TRUE;
+ 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);
}
--
2.6.5
Подробная информация о списке рассылки Wine-patches