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