[PATCH 3/4] Update variable description and typeinfo size in ICreateTypeInfo2::SetVarHelpContext()

Nikolay Sivov nsivov at codeweavers.com
Thu Dec 30 14:06:44 CST 2010


---
 dlls/oleaut32/typelib.c  |    4 ++--
 dlls/oleaut32/typelib.h  |    2 +-
 dlls/oleaut32/typelib2.c |   18 ++++++++++++++++++
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 8482afe..88f3345 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -2108,8 +2108,8 @@ static void MSFT_DoVars(TLBContext *pcx, ITypeInfoImpl *pTI, int cFuncs,
         if(reclength > FIELD_OFFSET(MSFT_VarRecord, HelpContext))
             (*pptvd)->HelpContext = pVarRec->HelpContext;
 
-        if(reclength > FIELD_OFFSET(MSFT_VarRecord, oHelpString))
-            (*pptvd)->HelpString = MSFT_ReadString(pcx, pVarRec->oHelpString);
+        if(reclength > FIELD_OFFSET(MSFT_VarRecord, HelpString))
+            (*pptvd)->HelpString = MSFT_ReadString(pcx, pVarRec->HelpString);
 
         if(reclength > FIELD_OFFSET(MSFT_VarRecord, HelpStringContext))
             (*pptvd)->HelpStringContext = pVarRec->HelpStringContext;
diff --git a/dlls/oleaut32/typelib.h b/dlls/oleaut32/typelib.h
index 6649407..dfa3809 100644
--- a/dlls/oleaut32/typelib.h
+++ b/dlls/oleaut32/typelib.h
@@ -244,7 +244,7 @@ typedef struct {
     /* optional attribute fields, the number of them is variable */
     /* controlled by record length */
     INT   HelpContext;
-    INT   oHelpString;
+    INT   HelpString;
     INT   res9;         /* unknown (-1) */
     INT   oCustData;        /* custom data for variable */
     INT   HelpStringContext;
diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 504d442..6e36d69 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -245,6 +245,23 @@ static inline INT ctl2_get_record_size(const CyclicList *iter)
     return iter->u.data[0] & 0xFFFF;
 }
 
+static void ctl2_update_var_size(const ICreateTypeInfo2Impl *This, CyclicList *var, int size)
+{
+    int old = ctl2_get_record_size(var), i;
+
+    if (old >= size) return;
+
+    /* initialize fields included in size but currently unused */
+    for (i = old/sizeof(int); i < (size/sizeof(int) - 1); i++)
+    {
+        /* HelpContext/HelpStringContext being 0 means it's not set */
+        var->u.data[i] = (i == 5 || i == 9) ? 0 : -1;
+    }
+
+    var->u.data[0] += size - old;
+    This->typedata->next->u.val += size - old;
+}
+
 /* NOTE: entry always assumed to be a function */
 static inline INVOKEKIND ctl2_get_invokekind(const CyclicList *func)
 {
@@ -2543,6 +2560,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetVarHelpContext(
        {
            if (index-- == 0)
            {
+               ctl2_update_var_size(This, iter, FIELD_OFFSET(MSFT_VarRecord, HelpString));
                iter->u.data[5] = context;
                return S_OK;
            }
-- 
1.5.6.5



--------------030106040703080401040000--



More information about the wine-patches mailing list