Solve remaining problems with scroll bars in the edit control.
[wine.git] / dlls / oleaut32 / typelib.h
blobbd1f0ebfc118eab654122b4a4fd1dc741e117c27
1 /*
2 * typelib.h internal wine data structures
3 * used to decode typelib's
5 * Copyright 1999 Rein KLazes
6 *
7 */
8 #ifndef _WINE_TYPELIB_H
9 #define _WINE_TYPELIB_H
11 #include "oleauto.h"
12 #include "wine/windef16.h"
14 #define TLBMAGIC2 "MSFT"
15 #define TLBMAGIC1 "SLTG"
16 #define HELPDLLFLAG (0x0100)
17 #define DO_NOT_SEEK (-1)
19 #define HREFTYPE_INTHISFILE(href) (!((href) & 3))
20 #define HREFTYPE_INDEX(href) ((href) /sizeof(TLBTypeInfoBase))
22 /*-------------------------FILE STRUCTURES-----------------------------------*/
26 * structure of the typelib type2 header
27 * it is at the beginning of a type lib file
30 typedef struct tagTLB2Header {
31 /*0x00*/INT magic1; /* 0x5446534D "MSFT" */
32 INT magic2; /* 0x00010002 version nr? */
33 INT posguid; /* position of libid in guid table */
34 /* (should be, else -1) */
35 INT lcid; /* locale id */
36 /*0x10*/INT lcid2;
37 INT varflags; /* (largely) unknown flags ,seems to be always 41 */
38 /* becomes 0x51 with a helpfile defined */
39 /* if help dll defined its 0x151 */
40 /* update : the lower nibble is syskind */
41 INT version; /* set with SetVersion() */
42 INT flags; /* set with SetFlags() */
43 /*0x20*/INT nrtypeinfos; /* number of typeinfo's (till so far) */
44 INT helpstring; /* position of help string in stringtable */
45 INT helpstringcontext;
46 INT helpcontext;
47 /*0x30*/INT nametablecount; /* number of names in name table */
48 INT nametablechars; /* nr of characters in name table */
49 INT NameOffset; /* offset of name in name table */
50 INT helpfile; /* position of helpfile in stringtable */
51 /*0x40*/INT CustomDataOffset; /* if -1 no custom data, else it is offset */
52 /* in customer data/guid offset table */
53 INT res44; /* unknown always: 0x20 */
54 INT res48; /* unknown always: 0x80 */
55 INT dispatchpos; /* gets a value (1+n*0x0c) with Idispatch interfaces */
56 /*0x50*/INT res50; /* is zero becomes one when an interface is derived */
57 } TLB2Header;
59 /* segments in the type lib file have a structure like this: */
60 typedef struct _tptag {
61 INT offset; /* absolute offset in file */
62 INT length; /* length of segment */
63 INT res08; /* unknown always -1 */
64 INT res0c; /* unknown always 0x0f in the header */
65 /* 0x03 in the typeinfo_data */
66 } pSeg;
68 /* layout of the main segment directory */
69 typedef struct tagTLBSegDir {
70 /*1*/pSeg pTypeInfoTab; /* each type info get an entry of 0x64 bytes */
71 /* (25 ints) */
72 /*2*/pSeg pImpInfo; /* table with info for imported types */
73 /*3*/pSeg pImpFiles; /* import libaries */
74 /*4*/pSeg pRefTab; /* References table */
75 /*5*/pSeg pLibtab; /* always exists, alway same size (0x80) */
76 /* hash table w offsets to guid????? */
77 /*6*/pSeg pGuidTab; /* all guids are stored here together with */
78 /* offset in some table???? */
79 /*7*/pSeg res07; /* always created, alway same size (0x200) */
80 /* purpose largely unknown */
81 /*8*/pSeg pNametab; /* name tables */
82 /*9*/pSeg pStringtab; /*string table */
83 /*A*/pSeg pTypdescTab; /* table with type descriptors */
84 /*B*/pSeg pArrayDescriptions;
85 /*C*/pSeg pCustData; /* data table, used for custom data and default */
86 /* parameter values */
87 /*D*/pSeg pCDGuids; /* table with offsets for the guids and into the customer data table */
88 /*E*/pSeg res0e; /* unknown */
89 /*F*/pSeg res0f; /* unknown */
90 } TLBSegDir;
93 /* base type info data */
94 typedef struct tagTLBTypeInfoBase {
95 /*000*/ INT typekind; /* it is the TKIND_xxx */
96 /* some byte alignment stuf */
97 INT memoffset; /* points past the file, if no elements */
98 INT res2; /* zero if no element, N*0x40 */
99 INT res3; /* -1 if no lement, (N-1)*0x38 */
100 /*010*/ INT res4; /* always? 3 */
101 INT res5; /* always? zero */
102 INT cElement; /* counts elements, HI=cVars, LO=cFuncs */
103 INT res7; /* always? zero */
104 /*020*/ INT res8; /* always? zero */
105 INT res9; /* always? zero */
106 INT resA; /* always? zero */
107 INT posguid; /* position in guid table */
108 /*030*/ INT flags; /* Typeflags */
109 INT NameOffset; /* offset in name table */
110 INT version; /* element version */
111 INT docstringoffs; /* offset of docstring in string tab */
112 /*040*/ INT helpstringcontext; /* */
113 INT helpcontext; /* */
114 INT oCustData; /* offset in customer data table */
115 INT16 cImplTypes; /* nr of implemented interfaces */
116 INT16 cbSizeVft; /* virtual table size, not including inherits */
117 /*050*/ INT size; /* size in bytes, at least for structures */
118 /* fixme: name of this field */
119 INT datatype1; /* position in type description table */
120 /* or in base intefaces */
121 /* if coclass: offset in reftable */
122 /* if interface: reference to inherited if */
123 INT datatype2; /* if 0x8000, entry above is valid */
124 /* actually dunno */
125 /* else it is zero? */
126 INT res18; /* always? 0 */
127 /*060*/ INT res19; /* always? -1 */
128 } TLBTypeInfoBase;
130 /* layout of an entry with information on imported types */
131 typedef struct tagTLBImpInfo {
132 INT res0; /* unknown */
133 INT oImpFile; /* offset inthe Import File table */
134 INT oGuid; /* offset in Guid table */
135 } TLBImpInfo;
137 /* function description data */
138 typedef struct {
139 /* INT recsize; record size including some xtra stuff */
140 INT DataType; /* data type of the memeber, eg return of function */
141 INT Flags; /* something to do with attribute flags (LOWORD) */
142 INT16 VtableOffset; /* offset in vtable */
143 INT16 res3; /* some offset into dunno what */
144 INT FKCCIC; /* bit string with the following */
145 /* meaning (bit 0 is the msb): */
146 /* bit 2 indicates that oEntry is numeric */
147 /* bit 3 that parameter has default values */
148 /* calling convention (bits 4-7 ) */
149 /* bit 8 indicates that custom data is present */
150 /* Invokation kind (bits 9-12 ) */
151 /* function kind (eg virtual), bits 13-15 */
152 INT16 nrargs; /* number of arguments (including optional ????) */
153 INT16 nroargs; /* nr of optional arguments */
154 /* optional attribute fields, the number of them is variable */
155 INT OptAttr[1];
157 0* INT helpcontext;
158 1* INT oHelpString;
159 2* INT oEntry; // either offset in string table or numeric as it is //
160 3* INT res9; // unknown (-1) //
161 4* INT resA; // unknown (-1) //
162 5* INT HelpStringContext;
163 // these are controlled by a bit set in the FKCCIC field //
164 6* INT oCustData; // custom data for function //
165 7* INT oArgCustData[1]; // custom data per argument //
167 } TLBFuncRecord;
169 /* after this may follow an array with default value pointers if the
170 * appropriate bit in the FKCCIC field has been set:
171 * INT oDefautlValue[nrargs];
174 /* Parameter info one per argument*/
175 typedef struct {
176 INT DataType;
177 INT oName;
178 INT Flags;
179 } TLBParameterInfo;
181 /* Variable description data */
182 typedef struct {
183 /* INT recsize; // record size including some xtra stuff */
184 INT DataType; /* data type of the variable */
185 INT Flags; /* VarFlags (LOWORD) */
186 INT16 VarKind; /* VarKind */
187 INT16 res3; /* some offset into dunno what */
188 INT OffsValue; /* value of the variable or the offset */
189 /* in the data structure */
190 /* optional attribute fields, the number of them is variable */
191 /* controlled by record length */
192 INT HelpContext;
193 INT oHelpString;
194 INT res9; /* unknown (-1) */
195 INT oCustData; /* custom data for variable */
196 INT HelpStringContext;
198 } TLBVarRecord;
200 /* Structure of the reference data */
201 typedef struct {
202 INT reftype; /* either offset in type info table, then its */
203 /* a multiple of 64 */
204 /* or offset in the external reference table */
205 /* with an offset of 1 */
206 INT flags;
207 INT oCustData; /* custom data */
208 INT onext; /* next offset, -1 if last */
209 } TLBRefRecord;
211 /* this is how a guid is stored */
212 typedef struct {
213 GUID guid;
214 INT unk10; /* differntiate with libid, classid etc? */
215 /* its -2 for a libary */
216 /* it's 0 for an interface */
217 INT unk14; /* always? -1 */
218 } TLBGuidEntry;
219 /* some data preceding entries in the name table */
220 typedef struct {
221 INT unk00; /* sometimes -1 (lib, parameter) ,
222 sometimes 0 (interface, func) */
223 INT unk10; /* sometimes -1 (lib) , sometimes 0 (interface, func),
224 sometime 0x10 (par) */
225 INT namelen; /* only lower 8 bits are valid */
226 } TLBNameIntro;
227 /* the custom data table directory has enties like this */
228 typedef struct {
229 INT GuidOffset;
230 INT DataOffset;
231 INT next; /* next offset in the table, -1 if its the last */
232 } TLBCDGuid;
236 /*---------------------------END--------------------------------------------*/
237 #endif