Piotr Caban : oleaut32: Compute TypeInfo offsets while writing data.

Alexandre Julliard julliard at winehq.org
Thu Feb 18 12:49:23 CST 2010


Module: wine
Branch: master
Commit: 21bfd64e6c3285972d43f28d912d270ee0be317e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=21bfd64e6c3285972d43f28d912d270ee0be317e

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Feb 18 03:20:33 2010 +0100

oleaut32: Compute TypeInfo offsets while writing data.

---

 dlls/oleaut32/typelib2.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 8c27916..eb30724 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -194,7 +194,6 @@ typedef struct tagICreateTypeInfo2Impl
 
     int indices[42];
     int names[42];
-    int offsets[42];
 
     int datawidth;
 
@@ -1384,7 +1383,6 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
     ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
 
     CyclicList *insert;
-    int offset;
     int *typedata;
     int i;
     int decoded_size;
@@ -1417,7 +1415,6 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
     This->typedata->next = insert;
     This->typedata = insert;
 
-    offset = This->typedata->next->u.val;
     This->typedata->next->u.val += 0x18 + (pFuncDesc->cParams * 12);
     typedata = This->typedata->u.data;
 
@@ -1450,7 +1447,6 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
     /* update the index data */
     This->indices[index] = ((0x6000 | This->typeinfo->cImplTypes) << 16) | index;
     This->names[index] = -1;
-    This->offsets[index] = offset;
 
     /* ??? */
     if (!This->typeinfo->res2) This->typeinfo->res2 = 0x20;
@@ -1641,7 +1637,6 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(
     ICreateTypeInfo2Impl *This = (ICreateTypeInfo2Impl *)iface;
 
     CyclicList *insert;
-    int offset;
     INT *typedata;
     int var_datawidth;
     int var_alignment;
@@ -1682,7 +1677,6 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(
     This->typedata->next = insert;
     This->typedata = insert;
 
-    offset = This->typedata->next->u.val;
     This->typedata->next->u.val += 0x14;
     typedata = This->typedata->u.data;
 
@@ -1694,7 +1688,6 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddVarDesc(
     /* update the index data */
     This->indices[index] = 0x40000000 + index;
     This->names[index] = -1;
-    This->offsets[index] = offset;
 
     /* figure out type widths and whatnot */
     ctl2_encode_typedesc(This->typelib, &pVarDesc->elemdescVar.tdesc,
@@ -3356,6 +3349,7 @@ static void ctl2_write_typeinfos(ICreateTypeLib2Impl *This, HANDLE hFile)
 
     for (typeinfo = This->typeinfos; typeinfo; typeinfo = typeinfo->next_typeinfo) {
         CyclicList *iter;
+        int offset = 0;
 
 	if (!typeinfo->typedata) continue;
 
@@ -3366,7 +3360,11 @@ static void ctl2_write_typeinfos(ICreateTypeLib2Impl *This, HANDLE hFile)
 
 	ctl2_write_chunk(hFile, typeinfo->indices, ((typeinfo->typeinfo->cElement & 0xffff) + (typeinfo->typeinfo->cElement >> 16)) * 4);
 	ctl2_write_chunk(hFile, typeinfo->names, ((typeinfo->typeinfo->cElement & 0xffff) + (typeinfo->typeinfo->cElement >> 16)) * 4);
-	ctl2_write_chunk(hFile, typeinfo->offsets, ((typeinfo->typeinfo->cElement & 0xffff) + (typeinfo->typeinfo->cElement >> 16)) * 4);
+
+        for(iter=typeinfo->typedata->next->next; iter!=typeinfo->typedata->next; iter=iter->next) {
+            ctl2_write_chunk(hFile, &offset, sizeof(int));
+            offset += iter->u.data[0] & 0xffff;
+        }
     }
 }
 




More information about the wine-cvs mailing list