Typelib changes 1

Nyef nyef at softhome.net
Sat Mar 13 12:36:00 CST 2004


Hello all.

Attached is a patch to rename some of the fields in
typelib.h to makes more evocative than 'unk00'.

--Alastair Bridgewater
-------------- next part --------------
Index: typelib.h
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.h,v
retrieving revision 1.17
diff -u -r1.17 typelib.h
--- typelib.h	21 Jan 2004 22:24:08 -0000	1.17
+++ typelib.h	13 Mar 2004 17:43:01 -0000
@@ -76,9 +76,9 @@
         INT   helpfile;         /* position of helpfile in stringtable */
 /*0x40*/INT   CustomDataOffset; /* if -1 no custom data, else it is offset */
                                 /* in customer data/guid offset table */
-        INT   res44;            /* unknown always: 0x20 */
-        INT   res48;            /* unknown always: 0x80 */
-        INT   dispatchpos;      /* gets a value (1+n*0x0c) with Idispatch interfaces */
+        INT   res44;            /* unknown always: 0x20 (guid hash size?) */
+        INT   res48;            /* unknown always: 0x80 (name hash size?) */
+        INT   dispatchpos;      /* HREFTYPE to IDispatch, or -1 if no IDispatch */
 /*0x50*/INT   res50;            /* is zero becomes one when an interface is derived */
 } MSFT_Header;
 
@@ -172,11 +172,11 @@
     INT   DataType;     /* data type of the memeber, eg return of function */
     INT   Flags;        /* something to do with attribute flags (LOWORD) */
 #ifdef WORDS_BIGENDIAN
-    INT16 res3;         /* some offset into dunno what */
+    INT16 funcdescsize; /* size of reconstituted FUNCDESC and related structs */
     INT16 VtableOffset; /* offset in vtable */
 #else
     INT16 VtableOffset; /* offset in vtable */
-    INT16 res3;         /* some offset into dunno what */
+    INT16 funcdescsize; /* size of reconstituted FUNCDESC and related structs */
 #endif
     INT   FKCCIC;       /* bit string with the following  */
                         /* meaning (bit 0 is the msb): */
@@ -226,11 +226,11 @@
     INT   DataType;     /* data type of the variable */
     INT   Flags;        /* VarFlags (LOWORD) */
 #ifdef WORDS_BIGENDIAN
-    INT16 res3;         /* some offset into dunno what */
+    INT16 vardescsize;  /* size of reconstituted VARDESC and related structs */
     INT16 VarKind;      /* VarKind */
 #else
     INT16 VarKind;      /* VarKind */
-    INT16 res3;         /* some offset into dunno what */
+    INT16 vardescsize;  /* size of reconstituted VARDESC and related structs */
 #endif
     INT   OffsValue;    /* value of the variable or the offset  */
                         /* in the data structure */
@@ -258,17 +258,23 @@
 /* this is how a guid is stored */
 typedef struct {
     GUID guid;
-    INT   unk10;        /* differntiate with libid, classid etc? */
-                        /* it's -2 for a libary */
-                        /* it's 0 for an interface */
-    INT   unk14;        /* always? -1 */
+    INT   hreftype;     /* -2 for the typelib guid, typeinfo offset
+			   for typeinfo guid, low two bits are 01 if
+			   this is an imported typeinfo, low two bits
+			   are 10 if this is an imported typelib (used
+			   by imported typeinfos) */
+    INT   next_hash;    /* offset to next guid in the hash bucket */
 } MSFT_GuidEntry;
 /* some data preceding entries in the name table */
 typedef struct {
-    INT   unk00;        /* sometimes -1 (lib, parameter) ,
-                           sometimes 0 (interface, func) */
-    INT   unk10;        /* sometimes -1 (lib) , sometimes 0 (interface, func),
-                           sometimes 0x10 (par) */
+    INT   hreftype;     /* is -1 if name is for neither a typeinfo,
+			   a variable, or a function (that is, name
+			   is for a typelib or a function parameter).
+			   otherwise is the offset of the first
+			   typeinfo that this name refers to (either
+			   to the typeinfo itself or to a member of
+			   the typeinfo */
+    INT   next_hash;    /* offset to next name in the hash bucket */
     INT   namelen;      /* only lower 8 bits are valid,
 			   lower-middle 8 bits are unknown (flags?),
 			   upper 16 bits are hash code */
Index: typelib2.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib2.c,v
retrieving revision 1.13
diff -u -r1.13 typelib2.c
--- typelib2.c	10 Feb 2004 02:26:06 -0000	1.13
+++ typelib2.c	13 Mar 2004 17:43:05 -0000
@@ -521,7 +521,7 @@
     }
 
     hash_key = (hash & 0xf) | ((hash & 0x10) & (0 - !!(hash & 0xe0)));
-    guid_space->unk14 = This->typelib_guidhash_segment[hash_key];
+    guid_space->next_hash = This->typelib_guidhash_segment[hash_key];
     This->typelib_guidhash_segment[hash_key] = offset;
 
     TRACE("Updating GUID hash table (%s,0x%x).\n", debugstr_guid(&guid->guid), hash);
@@ -558,12 +558,12 @@
     if (offset == -1) return -1;
 
     name_space = (void *)(This->typelib_segment_data[MSFT_SEG_NAME] + offset);
-    name_space->unk00 = -1;
-    name_space->unk10 = -1;
+    name_space->hreftype = -1;
+    name_space->next_hash = -1;
     memcpy(&name_space->namelen, encoded_name, length);
 
     if (This->typelib_namehash_segment[encoded_name[2] & 0x7f] != -1)
-	name_space->unk10 = This->typelib_namehash_segment[encoded_name[2] & 0x7f];
+	name_space->next_hash = This->typelib_namehash_segment[encoded_name[2] & 0x7f];
 
     This->typelib_namehash_segment[encoded_name[2] & 0x7f] = offset;
 
@@ -751,8 +751,8 @@
 
     guidentry.guid = *guid;
 
-    guidentry.unk10 = -1;
-    guidentry.unk14 = -1;
+    guidentry.hreftype = -1;
+    guidentry.next_hash = -1;
 
     guidoffset = ctl2_alloc_guid(This, &guidentry);
     if (guidoffset == -1) return E_OUTOFMEMORY;
@@ -1114,8 +1114,8 @@
     TRACE("(%p,%s)\n", iface, debugstr_guid(guid));
 
     guidentry.guid = *guid;
-    guidentry.unk10 = 0;
-    guidentry.unk14 = 0x18;
+    guidentry.hreftype = 0;
+    guidentry.next_hash = 0x18;
 
     offset = ctl2_alloc_guid(This->typelib, &guidentry);
     
@@ -1147,8 +1147,8 @@
 	WCHAR stdole2tlb[] = { 's','t','d','o','l','e','2','.','t','l','b',0 };
 
 	foo.guid = IID_StdOle;
-	foo.unk10 = 2;
-	foo.unk14 = -1;
+	foo.hreftype = 2;
+	foo.next_hash = -1;
 	guidoffset = ctl2_alloc_guid(This->typelib, &foo);
 	if (guidoffset == -1) return E_OUTOFMEMORY;
 
@@ -1156,8 +1156,8 @@
 	if (fileoffset == -1) return E_OUTOFMEMORY;
 
 	foo.guid = IID_IDispatch;
-	foo.unk10 = 1;
-	foo.unk14 = -1;
+	foo.hreftype = 1;
+	foo.next_hash = -1;
 	guidoffset = ctl2_alloc_guid(This->typelib, &foo);
 	if (guidoffset == -1) return E_OUTOFMEMORY;
 
@@ -3028,8 +3028,8 @@
     TRACE("(%p,%s)\n", iface, debugstr_guid(guid));
 
     guidentry.guid = *guid;
-    guidentry.unk10 = -2;
-    guidentry.unk14 = -1;
+    guidentry.hreftype = -2;
+    guidentry.next_hash = -1;
 
     offset = ctl2_alloc_guid(This, &guidentry);
     


More information about the wine-patches mailing list