Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * typelib_struct.h internal wine data structures |
| 3 | * used to decode typelib's |
| 4 | * |
| 5 | * Copyright 1999 Rein KLazes |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2.1 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
Jonathan Ernst | 360a3f9 | 2006-05-18 14:49:52 +0200 | [diff] [blame] | 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 20 | */ |
| 21 | #ifndef _WIDL_TYPELIB_STRUCT_H |
| 22 | #define _WIDL_TYPELIB_STRUCT_H |
| 23 | |
| 24 | #define HELPDLLFLAG (0x0100) |
| 25 | #define DO_NOT_SEEK (-1) |
| 26 | |
| 27 | #define MSFT_HREFTYPE_INTHISFILE(href) (!((href) & 3)) |
| 28 | #define MSFT_HREFTYPE_INDEX(href) ((href) /sizeof(MSFT_TypeInfoBase)) |
| 29 | |
| 30 | /*-------------------------FILE STRUCTURES-----------------------------------*/ |
| 31 | |
| 32 | /* There are two known file formats, those created with ICreateTypeLib |
| 33 | * have the signature "SLTG" as their first four bytes, while those created |
| 34 | * with ICreateTypeLib2 have "MSFT". |
| 35 | */ |
| 36 | |
Jacek Caban | 6137e1b | 2006-05-15 21:55:04 +0200 | [diff] [blame] | 37 | #define MSFT_MAGIC 0x5446534d |
| 38 | |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 39 | /***************************************************** |
| 40 | * MSFT typelibs |
| 41 | * |
| 42 | * These are TypeLibs created with ICreateTypeLib2 |
| 43 | * |
| 44 | */ |
| 45 | |
| 46 | /* |
| 47 | * structure of the typelib type2 header |
| 48 | * it is at the beginning of a type lib file |
| 49 | * |
| 50 | */ |
| 51 | typedef struct tagMSFT_Header { |
Huw Davies | 989960f | 2005-01-11 10:38:51 +0000 | [diff] [blame] | 52 | /*0x00*/INT magic1; /* 0x5446534D "MSFT" */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 53 | INT magic2; /* 0x00010002 version nr? */ |
| 54 | INT posguid; /* position of libid in guid table */ |
| 55 | /* (should be, else -1) */ |
| 56 | INT lcid; /* locale id */ |
| 57 | /*0x10*/INT lcid2; |
Huw Davies | 989960f | 2005-01-11 10:38:51 +0000 | [diff] [blame] | 58 | INT varflags; /* (largely) unknown flags */ |
| 59 | /* the lower nibble is syskind */ |
| 60 | /* 0x40 always seems to be set */ |
| 61 | /* 0x10 set with a helpfile defined */ |
| 62 | /* 0x100 set with a helpstringdll defined - in this |
| 63 | case the offset to the name in the stringtable |
| 64 | appears right after this struct, before the |
| 65 | typeinfo offsets */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 66 | INT version; /* set with SetVersion() */ |
| 67 | INT flags; /* set with SetFlags() */ |
| 68 | /*0x20*/INT nrtypeinfos; /* number of typeinfo's (till so far) */ |
| 69 | INT helpstring; /* position of help string in stringtable */ |
| 70 | INT helpstringcontext; |
| 71 | INT helpcontext; |
| 72 | /*0x30*/INT nametablecount; /* number of names in name table */ |
| 73 | INT nametablechars; /* nr of characters in name table */ |
| 74 | INT NameOffset; /* offset of name in name table */ |
| 75 | INT helpfile; /* position of helpfile in stringtable */ |
| 76 | /*0x40*/INT CustomDataOffset; /* if -1 no custom data, else it is offset */ |
| 77 | /* in customer data/guid offset table */ |
| 78 | INT res44; /* unknown always: 0x20 (guid hash size?) */ |
| 79 | INT res48; /* unknown always: 0x80 (name hash size?) */ |
| 80 | INT dispatchpos; /* HREFTYPE to IDispatch, or -1 if no IDispatch */ |
Jacek Caban | 4812abc | 2006-05-13 18:07:38 +0200 | [diff] [blame] | 81 | /*0x50*/INT nimpinfos; /* number of impinfos */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 82 | } MSFT_Header; |
| 83 | |
| 84 | /* segments in the type lib file have a structure like this: */ |
| 85 | typedef struct tagMSFT_pSeg { |
| 86 | INT offset; /* absolute offset in file */ |
| 87 | INT length; /* length of segment */ |
| 88 | INT res08; /* unknown always -1 */ |
| 89 | INT res0c; /* unknown always 0x0f in the header */ |
| 90 | /* 0x03 in the typeinfo_data */ |
| 91 | } MSFT_pSeg; |
| 92 | |
| 93 | /* layout of the main segment directory */ |
| 94 | typedef struct tagMSFT_SegDir { |
Austin English | 90f89fa | 2008-01-15 19:28:45 -0600 | [diff] [blame] | 95 | /*1*/MSFT_pSeg pTypeInfoTab; /* each typeinfo gets an entry of 0x64 bytes */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 96 | /* (25 ints) */ |
| 97 | /*2*/MSFT_pSeg pImpInfo; /* table with info for imported types */ |
Austin English | 90f89fa | 2008-01-15 19:28:45 -0600 | [diff] [blame] | 98 | /*3*/MSFT_pSeg pImpFiles; /* import libraries */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 99 | /*4*/MSFT_pSeg pRefTab; /* References table */ |
Francois Gouget | d0794c4 | 2008-01-23 15:16:30 +0100 | [diff] [blame] | 100 | /*5*/MSFT_pSeg pLibtab; /* always exists, always same size (0x80) */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 101 | /* hash table w offsets to guid????? */ |
| 102 | /*6*/MSFT_pSeg pGuidTab; /* all guids are stored here together with */ |
| 103 | /* offset in some table???? */ |
Austin English | 90f89fa | 2008-01-15 19:28:45 -0600 | [diff] [blame] | 104 | /*7*/MSFT_pSeg res07; /* always created, always same size (0x200) */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 105 | /* purpose largely unknown */ |
| 106 | /*8*/MSFT_pSeg pNametab; /* name tables */ |
| 107 | /*9*/MSFT_pSeg pStringtab; /* string table */ |
| 108 | /*A*/MSFT_pSeg pTypdescTab; /* table with type descriptors */ |
| 109 | /*B*/MSFT_pSeg pArrayDescriptions; |
| 110 | /*C*/MSFT_pSeg pCustData; /* data table, used for custom data and default */ |
| 111 | /* parameter values */ |
| 112 | /*D*/MSFT_pSeg pCDGuids; /* table with offsets for the guids and into */ |
| 113 | /* the customer data table */ |
| 114 | /*E*/MSFT_pSeg res0e; /* unknown */ |
| 115 | /*F*/MSFT_pSeg res0f; /* unknown */ |
| 116 | } MSFT_SegDir; |
| 117 | |
| 118 | |
| 119 | /* base type info data */ |
| 120 | typedef struct tagMSFT_TypeInfoBase { |
| 121 | /*000*/ INT typekind; /* it is the TKIND_xxx */ |
Austin English | 90f89fa | 2008-01-15 19:28:45 -0600 | [diff] [blame] | 122 | /* some byte alignment stuff */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 123 | INT memoffset; /* points past the file, if no elements */ |
| 124 | INT res2; /* zero if no element, N*0x40 */ |
Austin English | 90f89fa | 2008-01-15 19:28:45 -0600 | [diff] [blame] | 125 | INT res3; /* -1 if no element, (N-1)*0x38 */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 126 | /*010*/ INT res4; /* always? 3 */ |
| 127 | INT res5; /* always? zero */ |
| 128 | INT cElement; /* counts elements, HI=cVars, LO=cFuncs */ |
| 129 | INT res7; /* always? zero */ |
| 130 | /*020*/ INT res8; /* always? zero */ |
| 131 | INT res9; /* always? zero */ |
| 132 | INT resA; /* always? zero */ |
| 133 | INT posguid; /* position in guid table */ |
| 134 | /*030*/ INT flags; /* Typeflags */ |
| 135 | INT NameOffset; /* offset in name table */ |
| 136 | INT version; /* element version */ |
| 137 | INT docstringoffs; /* offset of docstring in string tab */ |
| 138 | /*040*/ INT helpstringcontext; /* */ |
| 139 | INT helpcontext; /* */ |
| 140 | INT oCustData; /* offset in customer data table */ |
| 141 | #ifdef WORDS_BIGENDIAN |
Huw Davies | 652ec64 | 2005-01-26 20:40:34 +0000 | [diff] [blame] | 142 | INT16 cbSizeVft; /* virtual table size, including inherits */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 143 | INT16 cImplTypes; /* nr of implemented interfaces */ |
| 144 | #else |
| 145 | INT16 cImplTypes; /* nr of implemented interfaces */ |
Huw Davies | 652ec64 | 2005-01-26 20:40:34 +0000 | [diff] [blame] | 146 | INT16 cbSizeVft; /* virtual table size, including inherits */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 147 | #endif |
| 148 | /*050*/ INT size; /* size in bytes, at least for structures */ |
| 149 | /* FIXME: name of this field */ |
| 150 | INT datatype1; /* position in type description table */ |
Francois Gouget | bb8e625 | 2006-12-04 19:55:35 +0100 | [diff] [blame] | 151 | /* or in base interfaces */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 152 | /* if coclass: offset in reftable */ |
| 153 | /* if interface: reference to inherited if */ |
Huw Davies | 652ec64 | 2005-01-26 20:40:34 +0000 | [diff] [blame] | 154 | INT datatype2; /* for interfaces: hiword is num of inherited funcs */ |
| 155 | /* loword is num of inherited interfaces */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 156 | INT res18; /* always? 0 */ |
| 157 | /*060*/ INT res19; /* always? -1 */ |
Huw Davies | a205107 | 2005-06-29 19:18:41 +0000 | [diff] [blame] | 158 | } MSFT_TypeInfoBase; |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 159 | |
| 160 | /* layout of an entry with information on imported types */ |
| 161 | typedef struct tagMSFT_ImpInfo { |
Huw Davies | a205107 | 2005-06-29 19:18:41 +0000 | [diff] [blame] | 162 | INT flags; /* bits 0 - 15: count */ |
Huw Davies | a2c58e2 | 2005-06-28 13:52:23 +0000 | [diff] [blame] | 163 | /* bit 16: if set oGuid is an offset to Guid */ |
| 164 | /* if clear oGuid is a typeinfo index in the specified typelib */ |
| 165 | /* bits 24 - 31: TKIND of reference */ |
| 166 | INT oImpFile; /* offset in the Import File table */ |
Jacek Caban | 6137e1b | 2006-05-15 21:55:04 +0200 | [diff] [blame] | 167 | INT oGuid; /* offset in Guid table or typeinfo index (see bit 16 of flags) */ |
Huw Davies | a205107 | 2005-06-29 19:18:41 +0000 | [diff] [blame] | 168 | } MSFT_ImpInfo; |
| 169 | |
| 170 | #define MSFT_IMPINFO_OFFSET_IS_GUID 0x00010000 |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 171 | |
| 172 | /* function description data */ |
| 173 | typedef struct { |
Austin English | 90f89fa | 2008-01-15 19:28:45 -0600 | [diff] [blame] | 174 | /* INT recsize; record size including some extra stuff */ |
Francois Gouget | 6b10c32 | 2005-03-30 17:08:31 +0000 | [diff] [blame] | 175 | INT DataType; /* data type of the member, eg return of function */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 176 | INT Flags; /* something to do with attribute flags (LOWORD) */ |
| 177 | #ifdef WORDS_BIGENDIAN |
| 178 | INT16 funcdescsize; /* size of reconstituted FUNCDESC and related structs */ |
| 179 | INT16 VtableOffset; /* offset in vtable */ |
| 180 | #else |
| 181 | INT16 VtableOffset; /* offset in vtable */ |
| 182 | INT16 funcdescsize; /* size of reconstituted FUNCDESC and related structs */ |
| 183 | #endif |
| 184 | INT FKCCIC; /* bit string with the following */ |
Huw Davies | b1a0c6c | 2005-01-19 19:08:01 +0000 | [diff] [blame] | 185 | /* meaning (bit 0 is the lsb): */ |
| 186 | /* bits 0 - 2: FUNCKIND */ |
| 187 | /* bits 3 - 6: INVOKEKIND */ |
| 188 | /* bit 7: custom data present */ |
| 189 | /* bits 8 - 11: CALLCONV */ |
| 190 | /* bit 12: parameters have default values */ |
| 191 | /* bit 13: oEntry is numeric */ |
Huw Davies | 13e3605 | 2005-02-08 12:09:42 +0000 | [diff] [blame] | 192 | /* bit 14: has retval param */ |
Huw Davies | 49eb0b7 | 2005-02-01 18:48:25 +0000 | [diff] [blame] | 193 | /* bits 16 - 31: index of next function with same id */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 194 | #ifdef WORDS_BIGENDIAN |
| 195 | INT16 nroargs; /* nr of optional arguments */ |
| 196 | INT16 nrargs; /* number of arguments (including optional ????) */ |
| 197 | #else |
| 198 | INT16 nrargs; /* number of arguments (including optional ????) */ |
| 199 | INT16 nroargs; /* nr of optional arguments */ |
| 200 | #endif |
| 201 | /* optional attribute fields, the number of them is variable */ |
| 202 | INT OptAttr[1]; |
| 203 | /* |
| 204 | 0* INT helpcontext; |
| 205 | 1* INT oHelpString; |
Huw Davies | b1a0c6c | 2005-01-19 19:08:01 +0000 | [diff] [blame] | 206 | 2* INT oEntry; // either offset in string table or numeric as it is (see bit 13 of FKCCIC) // |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 207 | 3* INT res9; // unknown (-1) // |
| 208 | 4* INT resA; // unknown (-1) // |
| 209 | 5* INT HelpStringContext; |
| 210 | // these are controlled by a bit set in the FKCCIC field // |
| 211 | 6* INT oCustData; // custom data for function // |
| 212 | 7* INT oArgCustData[1]; // custom data per argument // |
| 213 | */ |
| 214 | } MSFT_FuncRecord; |
| 215 | |
| 216 | /* after this may follow an array with default value pointers if the |
| 217 | * appropriate bit in the FKCCIC field has been set: |
| 218 | * INT oDefautlValue[nrargs]; |
| 219 | */ |
| 220 | |
| 221 | /* Parameter info one per argument*/ |
| 222 | typedef struct { |
| 223 | INT DataType; |
| 224 | INT oName; |
| 225 | INT Flags; |
| 226 | } MSFT_ParameterInfo; |
| 227 | |
| 228 | /* Variable description data */ |
| 229 | typedef struct { |
Austin English | 90f89fa | 2008-01-15 19:28:45 -0600 | [diff] [blame] | 230 | /* INT recsize; // record size including some extra stuff */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 231 | INT DataType; /* data type of the variable */ |
| 232 | INT Flags; /* VarFlags (LOWORD) */ |
| 233 | #ifdef WORDS_BIGENDIAN |
| 234 | INT16 vardescsize; /* size of reconstituted VARDESC and related structs */ |
| 235 | INT16 VarKind; /* VarKind */ |
| 236 | #else |
| 237 | INT16 VarKind; /* VarKind */ |
| 238 | INT16 vardescsize; /* size of reconstituted VARDESC and related structs */ |
| 239 | #endif |
| 240 | INT OffsValue; /* value of the variable or the offset */ |
| 241 | /* in the data structure */ |
| 242 | /* optional attribute fields, the number of them is variable */ |
| 243 | /* controlled by record length */ |
| 244 | INT HelpContext; |
| 245 | INT oHelpString; |
| 246 | INT res9; /* unknown (-1) */ |
| 247 | INT oCustData; /* custom data for variable */ |
| 248 | INT HelpStringContext; |
| 249 | |
| 250 | } MSFT_VarRecord; |
| 251 | |
| 252 | /* Structure of the reference data */ |
| 253 | typedef struct { |
| 254 | INT reftype; /* either offset in type info table, then it's */ |
| 255 | /* a multiple of 64 */ |
| 256 | /* or offset in the external reference table */ |
| 257 | /* with an offset of 1 */ |
| 258 | INT flags; |
| 259 | INT oCustData; /* custom data */ |
| 260 | INT onext; /* next offset, -1 if last */ |
| 261 | } MSFT_RefRecord; |
| 262 | |
| 263 | /* this is how a guid is stored */ |
| 264 | typedef struct { |
| 265 | GUID guid; |
| 266 | INT hreftype; /* -2 for the typelib guid, typeinfo offset |
| 267 | for typeinfo guid, low two bits are 01 if |
| 268 | this is an imported typeinfo, low two bits |
| 269 | are 10 if this is an imported typelib (used |
| 270 | by imported typeinfos) */ |
| 271 | INT next_hash; /* offset to next guid in the hash bucket */ |
| 272 | } MSFT_GuidEntry; |
| 273 | /* some data preceding entries in the name table */ |
| 274 | typedef struct { |
| 275 | INT hreftype; /* is -1 if name is for neither a typeinfo, |
| 276 | a variable, or a function (that is, name |
| 277 | is for a typelib or a function parameter). |
| 278 | otherwise is the offset of the first |
| 279 | typeinfo that this name refers to (either |
| 280 | to the typeinfo itself or to a member of |
| 281 | the typeinfo */ |
| 282 | INT next_hash; /* offset to next name in the hash bucket */ |
Huw Davies | 652ec64 | 2005-01-26 20:40:34 +0000 | [diff] [blame] | 283 | INT namelen; /* only lower 8 bits are valid */ |
| 284 | /* 0x1000 if name is only used once as a variable name */ |
| 285 | /* 0x2000 if name is a variable in an enumeration */ |
| 286 | /* 0x3800 if name is typeinfo name */ |
| 287 | /* upper 16 bits are hash code */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 288 | } MSFT_NameIntro; |
Francois Gouget | bb8e625 | 2006-12-04 19:55:35 +0100 | [diff] [blame] | 289 | /* the custom data table directory has entries like this */ |
Huw Davies | 346188b | 2005-01-06 20:45:21 +0000 | [diff] [blame] | 290 | typedef struct { |
| 291 | INT GuidOffset; |
| 292 | INT DataOffset; |
| 293 | INT next; /* next offset in the table, -1 if it's the last */ |
| 294 | } MSFT_CDGuid; |
| 295 | |
| 296 | |
| 297 | /*********************************************************** |
| 298 | * |
| 299 | * SLTG typelibs. |
| 300 | * |
| 301 | * These are created with ICreateTypeLib |
| 302 | * |
| 303 | */ |
| 304 | |
| 305 | #include "pshpack1.h" |
| 306 | |
| 307 | typedef struct { |
| 308 | /*00*/ DWORD SLTG_magic; /* 0x47544c53 == "SLTG" */ |
| 309 | /*04*/ WORD nrOfFileBlks; /* no of SLTG_BlkEntry's + 1 */ |
| 310 | /*06*/ WORD res06; /* ?? always 9 */ |
| 311 | /*08*/ WORD res08; /* some kind of len/offset ?? */ |
| 312 | /*0a*/ WORD first_blk; /* 1 based index into blk entries that |
| 313 | corresponds to first block in file */ |
| 314 | /*0c*/ DWORD res0c; /* always 0x000204ff */ |
| 315 | /*10*/ DWORD res10; /* always 0x00000000 */ |
| 316 | /*14*/ DWORD res14; /* always 0x000000c0 */ |
| 317 | /*18*/ DWORD res18; /* always 0x46000000 */ |
| 318 | /*1c*/ DWORD res1c; /* always 0x00000044 */ |
| 319 | /*20*/ DWORD res20; /* always 0xffff0000 */ |
| 320 | } SLTG_Header; |
| 321 | |
| 322 | /* This gets followed by a list of block entries */ |
| 323 | typedef struct { |
| 324 | /*00*/ DWORD len; |
| 325 | /*04*/ WORD index_string; /* offs from start of SLTG_Magic to index string */ |
| 326 | /*06*/ WORD next; |
| 327 | } SLTG_BlkEntry; |
| 328 | |
| 329 | /* The order of the blocks in the file is given by starting at Block |
| 330 | entry firt_blk and stepping through using the next pointer */ |
| 331 | |
| 332 | /* These then get followed by this magic */ |
| 333 | typedef struct { |
| 334 | /*00*/ BYTE res00; /* always 0x01 */ |
| 335 | /*01*/ CHAR CompObj_magic[8]; /* always "CompObj" */ |
| 336 | /*09*/ CHAR dir_magic[4]; /* always "dir" */ |
| 337 | } SLTG_Magic; |
| 338 | |
| 339 | #define SLTG_COMPOBJ_MAGIC "CompObj" |
| 340 | #define SLTG_DIR_MAGIC "dir" |
| 341 | |
| 342 | /* Next we have SLTG_Header.nrOfFileBlks - 2 of Index strings. These |
| 343 | are presumably unique to within the file and look something like |
| 344 | "AAAAAAAAAA" with the first character incremented from 'A' to ensure |
| 345 | uniqueness. I guess successive chars increment when we need to wrap |
| 346 | the first one. */ |
| 347 | |
| 348 | typedef struct { |
| 349 | /*00*/ CHAR string[11]; |
| 350 | } SLTG_Index; |
| 351 | |
| 352 | |
| 353 | /* This is followed by SLTG_pad9 */ |
| 354 | typedef struct { |
| 355 | /*00*/ CHAR pad[9]; /* 9 '\0's */ |
| 356 | } SLTG_Pad9; |
| 357 | |
| 358 | |
| 359 | /* Now we have the noOfFileBlks - 1 worth of blocks. The length of |
| 360 | each block is given by its entry in SLTG_BlkEntry. */ |
| 361 | |
| 362 | /* type SLTG_NAME in rather like a BSTR except that the length in |
| 363 | bytes is given by the first WORD and the string contains 8bit chars */ |
| 364 | |
| 365 | typedef WORD SLTG_Name; |
| 366 | |
| 367 | /* The main library block looks like this. This one seems to come last */ |
| 368 | |
| 369 | typedef struct { |
| 370 | /*00*/ WORD magic; /* 0x51cc */ |
| 371 | /*02*/ WORD res02; /* 0x0003, 0x0004 */ |
| 372 | /*04*/ WORD name; /* offset to name in name table */ |
| 373 | /*06*/ SLTG_Name res06; /* maybe this is just WORD == 0xffff */ |
| 374 | SLTG_Name helpstring; |
| 375 | SLTG_Name helpfile; |
| 376 | DWORD helpcontext; |
| 377 | WORD syskind; /* == 1 for win32, 0 for win16 */ |
| 378 | WORD lcid; /* == 0x409, 0x809 etc */ |
| 379 | DWORD res12; /* == 0 */ |
| 380 | WORD libflags; /* LIBFLAG_* */ |
| 381 | WORD maj_vers; |
| 382 | WORD min_vers; |
| 383 | GUID uuid; |
| 384 | } SLTG_LibBlk; |
| 385 | |
| 386 | #define SLTG_LIBBLK_MAGIC 0x51cc |
| 387 | |
| 388 | /* we then get 0x40 bytes worth of 0xffff or small numbers followed by |
| 389 | nrOfFileBlks - 2 of these */ |
| 390 | typedef struct { |
| 391 | WORD small_no; |
| 392 | SLTG_Name index_name; /* This refers to a name in the directory */ |
| 393 | SLTG_Name other_name; /* Another one of these weird names */ |
| 394 | WORD res1a; /* 0xffff */ |
| 395 | WORD name_offs; /* offset to name in name table */ |
| 396 | WORD more_bytes; /* if this is non-zero we get this many |
| 397 | bytes before the next element, which seem |
| 398 | to reference the docstring of the type ? */ |
| 399 | WORD res20; /* 0xffff */ |
| 400 | DWORD helpcontext; |
| 401 | WORD res26; /* 0xffff */ |
| 402 | GUID uuid; |
| 403 | } SLTG_OtherTypeInfo; |
| 404 | |
| 405 | /* Next we get WORD 0x0003 followed by a DWORD which if we add to |
| 406 | 0x216 gives the offset to the name table from the start of the LibBlk |
| 407 | struct */ |
| 408 | |
| 409 | typedef struct { |
| 410 | /*00*/ WORD magic; /* 0x0501 */ |
| 411 | /*02*/ DWORD href_table; /* if not 0xffffffff, then byte offset from |
| 412 | beginning of struct to href table */ |
| 413 | /*06*/ DWORD res06; /* 0xffffffff */ |
| 414 | /*0a*/ DWORD elem_table; /* offset to members */ |
| 415 | /*0e*/ DWORD res0e; /* 0xffffffff */ |
| 416 | /*12*/ WORD major_version; /* major version number */ |
| 417 | /*14*/ WORD minor_version; /* minor version number */ |
| 418 | /*16*/ DWORD res16; /* 0xfffe0000 */ |
| 419 | /*1a*/ BYTE typeflags1;/* 0x02 | top 5 bits hold l5sbs of TYPEFLAGS */ |
| 420 | /*1b*/ BYTE typeflags2;/* TYPEFLAGS >> 5 */ |
| 421 | /*1c*/ BYTE typeflags3;/* 0x02*/ |
| 422 | /*1d*/ BYTE typekind; /* 0x03 == TKIND_INTERFACE etc. */ |
| 423 | /*1e*/ DWORD res1e; /* 0x00000000 or 0xffffffff */ |
| 424 | } SLTG_TypeInfoHeader; |
| 425 | |
| 426 | #define SLTG_TIHEADER_MAGIC 0x0501 |
| 427 | |
| 428 | typedef struct { |
| 429 | /*00*/ WORD cFuncs; |
| 430 | /*02*/ WORD cVars; |
| 431 | /*04*/ WORD cImplTypes; |
| 432 | /*06*/ WORD res06; |
| 433 | /*08*/ WORD res08; |
| 434 | /*0a*/ WORD res0a; |
| 435 | /*0c*/ WORD res0c; |
| 436 | /*0e*/ WORD res0e; |
| 437 | /*10*/ WORD res10; |
| 438 | /*12*/ WORD res12; |
| 439 | /*14*/ WORD tdescalias_vt; /* for TKIND_ALIAS */ |
| 440 | /*16*/ WORD res16; |
| 441 | /*18*/ WORD res18; |
| 442 | /*1a*/ WORD res1a; |
| 443 | /*1c*/ WORD res1c; |
| 444 | /*1e*/ WORD res1e; |
| 445 | /*20*/ WORD cbSizeInstance; |
| 446 | /*22*/ WORD cbAlignment; |
| 447 | /*24*/ WORD res24; |
| 448 | /*26*/ WORD res26; |
| 449 | /*28*/ WORD cbSizeVft; |
| 450 | /*2a*/ WORD res2a; |
| 451 | /*2c*/ WORD res2c; |
| 452 | /*2e*/ WORD res2e; |
| 453 | /*30*/ WORD res30; |
| 454 | /*32*/ WORD res32; |
| 455 | /*34*/ WORD res34; |
| 456 | } SLTG_TypeInfoTail; |
| 457 | |
| 458 | typedef struct { |
| 459 | /*00*/ WORD res00; /* 0x0001 sometimes 0x0003 ?? */ |
| 460 | /*02*/ WORD res02; /* 0xffff */ |
| 461 | /*04*/ BYTE res04; /* 0x01 */ |
| 462 | /*05*/ DWORD cbExtra; /* No of bytes that follow */ |
| 463 | } SLTG_MemberHeader; |
| 464 | |
| 465 | typedef struct { |
| 466 | /*00*/ WORD magic; /* 0x120a */ |
| 467 | /*02*/ WORD next; /* offset in bytes to next block from start of block |
| 468 | group, 0xffff if last item */ |
| 469 | /*04*/ WORD name; /* offset to name within name table */ |
| 470 | /*06*/ WORD value; /* offset to value from start of block group */ |
| 471 | /*08*/ WORD res08; /* 0x56 */ |
| 472 | /*0a*/ DWORD memid; /* memid */ |
| 473 | /*0e*/ WORD helpcontext;/* 0xfffe == no context, 0x0001 == stored in EnumInfo struct, else offset |
| 474 | to value from start of block group */ |
| 475 | /*10*/ WORD helpstring;/* offset from start of block group to string offset */ |
| 476 | } SLTG_EnumItem; |
| 477 | |
| 478 | #define SLTG_ENUMITEM_MAGIC 0x120a |
| 479 | |
| 480 | typedef struct { |
| 481 | /*00*/ WORD vt; /* vartype, 0xffff marks end. */ |
| 482 | /*02*/ WORD res02; /* ?, 0xffff marks end */ |
| 483 | } SLTG_AliasItem; |
| 484 | |
| 485 | #define SLTG_ALIASITEM_MAGIC 0x001d |
| 486 | |
| 487 | |
| 488 | typedef struct { |
| 489 | BYTE magic; /* 0x4c or 0x6c */ |
| 490 | BYTE inv; /* high nibble is INVOKE_KIND, low nibble = 2 */ |
| 491 | WORD next; /* byte offset from beginning of group to next fn */ |
| 492 | WORD name; /* Offset within name table to name */ |
| 493 | DWORD dispid; /* dispid */ |
| 494 | WORD helpcontext; /* helpcontext (again 1 is special) */ |
| 495 | WORD helpstring;/* helpstring offset to offset */ |
| 496 | WORD arg_off; /* offset to args from start of block */ |
| 497 | BYTE nacc; /* lowest 3bits are CALLCONV, rest are no of args */ |
| 498 | BYTE retnextopt;/* if 0x80 bit set ret type follows else next WORD |
| 499 | is offset to ret type. No of optional args is |
| 500 | middle 6 bits */ |
| 501 | WORD rettype; /* return type VT_?? or offset to ret type */ |
| 502 | WORD vtblpos; /* position in vtbl? */ |
| 503 | WORD funcflags; /* present if magic == 0x6c */ |
| 504 | /* Param list starts, repeat next two as required */ |
| 505 | #if 0 |
| 506 | WORD name; /* offset to 2nd letter of name */ |
| 507 | WORD+ type; /* VT_ of param */ |
| 508 | #endif |
| 509 | } SLTG_Function; |
| 510 | |
| 511 | #define SLTG_FUNCTION_MAGIC 0x4c |
| 512 | #define SLTG_FUNCTION_WITH_FLAGS_MAGIC 0x6c |
| 513 | |
| 514 | typedef struct { |
| 515 | /*00*/ BYTE magic; /* 0xdf */ |
| 516 | /*01*/ BYTE res01; /* 0x00 */ |
| 517 | /*02*/ DWORD res02; /* 0xffffffff */ |
| 518 | /*06*/ DWORD res06; /* 0xffffffff */ |
| 519 | /*0a*/ DWORD res0a; /* 0xffffffff */ |
| 520 | /*0e*/ DWORD res0e; /* 0xffffffff */ |
| 521 | /*12*/ DWORD res12; /* 0xffffffff */ |
| 522 | /*16*/ DWORD res16; /* 0xffffffff */ |
| 523 | /*1a*/ DWORD res1a; /* 0xffffffff */ |
| 524 | /*1e*/ DWORD res1e; /* 0xffffffff */ |
| 525 | /*22*/ DWORD res22; /* 0xffffffff */ |
| 526 | /*26*/ DWORD res26; /* 0xffffffff */ |
| 527 | /*2a*/ DWORD res2a; /* 0xffffffff */ |
| 528 | /*2e*/ DWORD res2e; /* 0xffffffff */ |
| 529 | /*32*/ DWORD res32; /* 0xffffffff */ |
| 530 | /*36*/ DWORD res36; /* 0xffffffff */ |
| 531 | /*3a*/ DWORD res3a; /* 0xffffffff */ |
| 532 | /*3e*/ DWORD res3e; /* 0xffffffff */ |
| 533 | /*42*/ WORD res42; /* 0xffff */ |
| 534 | /*44*/ DWORD number; /* this is 8 times the number of refs */ |
| 535 | /*48*/ /* Now we have number bytes (8 for each ref) of SLTG_UnknownRefInfo */ |
| 536 | |
| 537 | /*50*/ WORD res50; /* 0xffff */ |
| 538 | /*52*/ BYTE res52; /* 0x01 */ |
| 539 | /*53*/ DWORD res53; /* 0x00000000 */ |
| 540 | /*57*/ SLTG_Name names[1]; |
| 541 | /* Now we have number/8 SLTG_Names (first WORD is no of bytes in the ascii |
| 542 | * string). Strings look like "*\Rxxxx*#n". If xxxx == ffff then the |
| 543 | * ref refers to the nth type listed in this library (0 based). Else |
| 544 | * the xxxx (which maybe fewer than 4 digits) is the offset into the name |
| 545 | * table to a string "*\G{<guid>}#1.0#0#C:\WINNT\System32\stdole32.tlb#" |
| 546 | * The guid is the typelib guid; the ref again refers to the nth type of |
| 547 | * the imported typelib. |
| 548 | */ |
| 549 | |
| 550 | /*xx*/ BYTE resxx; /* 0xdf */ |
| 551 | |
| 552 | } SLTG_RefInfo; |
| 553 | |
| 554 | #define SLTG_REF_MAGIC 0xdf |
| 555 | |
| 556 | typedef struct { |
| 557 | WORD res00; /* 0x0001 */ |
| 558 | BYTE res02; /* 0x02 */ |
| 559 | BYTE res03; /* 0x40 if internal ref, 0x00 if external ? */ |
| 560 | WORD res04; /* 0xffff */ |
| 561 | WORD res06; /* 0x0000, 0x0013 or 0xffff ?? */ |
| 562 | } SLTG_UnknownRefInfo; |
| 563 | |
| 564 | typedef struct { |
| 565 | WORD res00; /* 0x004a */ |
| 566 | WORD next; /* byte offs to next interface */ |
| 567 | WORD res04; /* 0xffff */ |
| 568 | BYTE impltypeflags; /* IMPLTYPEFLAG_* */ |
| 569 | BYTE res07; /* 0x80 */ |
| 570 | WORD res08; /* 0x0012, 0x0028 ?? */ |
| 571 | WORD ref; /* number in ref table ? */ |
| 572 | WORD res0c; /* 0x4000 */ |
| 573 | WORD res0e; /* 0xfffe */ |
| 574 | WORD res10; /* 0xffff */ |
| 575 | WORD res12; /* 0x001d */ |
| 576 | WORD pos_in_table; /* 0x0, 0x4, ? */ |
| 577 | } SLTG_ImplInfo; |
| 578 | |
| 579 | #define SLTG_IMPL_MAGIC 0x004a |
| 580 | |
| 581 | typedef struct { |
| 582 | BYTE magic; /* 0x0a */ |
| 583 | BYTE typepos; |
| 584 | WORD next; |
| 585 | WORD name; |
| 586 | WORD byte_offs; /* pos in struct */ |
| 587 | WORD type; /* if typepos == 0x02 this is the type, else offset to type */ |
| 588 | DWORD memid; |
| 589 | WORD helpcontext; /* ?? */ |
| 590 | WORD helpstring; /* ?? */ |
| 591 | } SLTG_RecordItem; |
| 592 | |
| 593 | #define SLTG_RECORD_MAGIC 0x0a |
| 594 | |
| 595 | |
| 596 | /* CARRAYs look like this |
| 597 | WORD type == VT_CARRAY |
| 598 | WORD offset from start of block to SAFEARRAY |
| 599 | WORD typeofarray |
| 600 | */ |
| 601 | |
| 602 | #include "poppack.h" |
| 603 | |
| 604 | /*---------------------------END--------------------------------------------*/ |
| 605 | #endif |