typelib: import table fix

Huw D M Davies h.davies1 at physics.ox.ac.uk
Wed Jun 29 06:32:34 CDT 2005


        Huw Davies <huw at codeweavers.com> for Mandriva
        Cope with the index in a import table entry being a typeinfo
        index rather than a guid offset.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.154
diff -u -p -r1.154 typelib.c
--- dlls/oleaut32/typelib.c	21 Jun 2005 20:53:14 -0000	1.154
+++ dlls/oleaut32/typelib.c	29 Jun 2005 11:26:37 -0000
@@ -1997,8 +1997,11 @@ static void MSFT_DoRefType(TLBContext *p
         if(pImpLib){
             (*ppRefType)->reference=offset;
             (*ppRefType)->pImpTLInfo = pImpLib;
-            MSFT_ReadGuid(&(*ppRefType)->guid, impinfo.oGuid, pcx);
-	    (*ppRefType)->index = TLB_REF_USE_GUID;
+            if(impinfo.flags & MSFT_IMPINFO_OFFSET_IS_GUID) {
+                MSFT_ReadGuid(&(*ppRefType)->guid, impinfo.oGuid, pcx);
+                (*ppRefType)->index = TLB_REF_USE_GUID;
+            } else
+                (*ppRefType)->index = impinfo.oGuid;               
         }else{
             ERR("Cannot find a reference\n");
             (*ppRefType)->reference=-1;
Index: dlls/oleaut32/typelib.h
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.h,v
retrieving revision 1.20
diff -u -p -r1.20 typelib.h
--- dlls/oleaut32/typelib.h	28 Jun 2005 13:52:23 -0000	1.20
+++ dlls/oleaut32/typelib.h	29 Jun 2005 11:26:37 -0000
@@ -157,17 +157,19 @@ typedef struct tagMSFT_TypeInfoBase {
                                 /* else it is zero? */
         INT     res18;          /* always? 0 */
 /*060*/ INT     res19;          /* always? -1 */
-    } MSFT_TypeInfoBase;
+} MSFT_TypeInfoBase;
 
 /* layout of an entry with information on imported types */
 typedef struct tagMSFT_ImpInfo {
-    INT     res0;           /* bits 0 - 15:  count */
+    INT     flags;          /* bits 0 - 15:  count */
                             /* bit  16:      if set oGuid is an offset to Guid */
                             /*               if clear oGuid is a typeinfo index in the specified typelib */
                             /* bits 24 - 31: TKIND of reference */
     INT     oImpFile;       /* offset in the Import File table */
     INT     oGuid;          /* offset in Guid table or typeinfo index (see bit 16 of res0) */
-    } MSFT_ImpInfo;
+} MSFT_ImpInfo;
+
+#define MSFT_IMPINFO_OFFSET_IS_GUID 0x00010000
 
 /* function description data */
 typedef struct {
Index: dlls/oleaut32/typelib2.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib2.c,v
retrieving revision 1.36
diff -u -p -r1.36 typelib2.c
--- dlls/oleaut32/typelib2.c	6 Jun 2005 19:50:37 -0000	1.36
+++ dlls/oleaut32/typelib2.c	29 Jun 2005 11:26:37 -0000
@@ -1242,7 +1242,7 @@ static HRESULT WINAPI ICreateTypeInfo2_f
 	guidoffset = ctl2_alloc_guid(This->typelib, &foo);
 	if (guidoffset == -1) return E_OUTOFMEMORY;
 
-	impinfo.res0 = 0x03010000;
+	impinfo.flags = TKIND_INTERFACE << 24 | MSFT_IMPINFO_OFFSET_IS_GUID;
 	impinfo.oImpFile = fileoffset;
 	impinfo.oGuid = guidoffset;
 	ctl2_alloc_importinfo(This->typelib, &impinfo);



More information about the wine-patches mailing list