Sync with trunk (r48545)
[reactos.git] / dll / win32 / fusion / fusionpriv.h
1 /*
2 * fusion private definitions
3 *
4 * Copyright 2008 James Hawkins
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #ifndef __WINE_FUSION_PRIVATE__
22 #define __WINE_FUSION_PRIVATE__
23
24 #include <stdarg.h>
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winver.h"
30
31 #include <pshpack1.h>
32
33 typedef struct
34 {
35 ULONG Signature;
36 USHORT MajorVersion;
37 USHORT MinorVersion;
38 ULONG Reserved;
39 ULONG VersionLength;
40 LPSTR Version;
41 BYTE Flags;
42 WORD Streams;
43 } METADATAHDR;
44
45 typedef struct
46 {
47 DWORD Offset;
48 DWORD Size;
49 } METADATASTREAMHDR;
50
51 typedef struct
52 {
53 DWORD Reserved1;
54 BYTE MajorVersion;
55 BYTE MinorVersion;
56 BYTE HeapOffsetSizes;
57 BYTE Reserved2;
58 LARGE_INTEGER MaskValid;
59 LARGE_INTEGER MaskSorted;
60 } METADATATABLESHDR;
61
62 typedef struct
63 {
64 WORD Generation;
65 WORD Name;
66 WORD Mvid;
67 WORD EncId;
68 WORD EncBaseId;
69 } MODULETABLE;
70
71 typedef struct
72 {
73 DWORD Flags;
74 WORD Name;
75 WORD Namespace;
76 WORD Extends;
77 WORD FieldList;
78 WORD MethodList;
79 } TYPEDEFTABLE;
80
81 typedef struct
82 {
83 WORD ResolutionScope;
84 WORD Name;
85 WORD Namespace;
86 } TYPEREFTABLE;
87
88 typedef struct
89 {
90 WORD Flags;
91 WORD Name;
92 WORD Signature;
93 } FIELDTABLE;
94
95 typedef struct
96 {
97 DWORD HashAlgId;
98 WORD MajorVersion;
99 WORD MinorVersion;
100 WORD BuildNumber;
101 WORD RevisionNumber;
102 DWORD Flags;
103 WORD PublicKey;
104 WORD Name;
105 WORD Culture;
106 } ASSEMBLYTABLE;
107
108 typedef struct
109 {
110 DWORD Offset;
111 DWORD Flags;
112 WORD Name;
113 WORD Implementation;
114 } MANIFESTRESTABLE;
115
116 typedef struct
117 {
118 DWORD RVA;
119 WORD ImplFlags;
120 WORD Flags;
121 WORD Name;
122 WORD Signature;
123 WORD ParamList;
124 } METHODDEFTABLE;
125
126 typedef struct
127 {
128 WORD Flags;
129 WORD Sequence;
130 WORD Name;
131 } PARAMTABLE;
132
133 typedef struct
134 {
135 WORD Class;
136 WORD Interface;
137 } INTERFACEIMPLTABLE;
138
139 typedef struct
140 {
141 WORD Class;
142 WORD Name;
143 WORD Signature;
144 } MEMBERREFTABLE;
145
146 typedef struct
147 {
148 BYTE Type;
149 BYTE Reserved;
150 WORD Parent;
151 WORD Value;
152 } CONSTANTTABLE;
153
154 typedef struct
155 {
156 WORD Parent;
157 WORD Type;
158 WORD Value;
159 } CUSTOMATTRIBUTETABLE;
160
161 typedef struct
162 {
163 WORD Parent;
164 WORD NativeType;
165 } FIELDMARSHALTABLE;
166
167 typedef struct
168 {
169 WORD Action;
170 WORD Parent;
171 WORD PermissionSet;
172 } DECLSECURITYTABLE;
173
174 typedef struct
175 {
176 WORD PackingSize;
177 DWORD ClassSize;
178 WORD Parent;
179 } CLASSLAYOUTTABLE;
180
181 typedef struct
182 {
183 DWORD Offset;
184 WORD Field;
185 } FIELDLAYOUTTABLE;
186
187 typedef struct
188 {
189 WORD Signature;
190 } STANDALONESIGTABLE;
191
192 typedef struct
193 {
194 WORD Parent;
195 WORD EventList;
196 } EVENTMAPTABLE;
197
198 typedef struct
199 {
200 WORD EventFlags;
201 WORD Name;
202 WORD EventType;
203 } EVENTTABLE;
204
205 typedef struct
206 {
207 WORD Parent;
208 WORD PropertyList;
209 } PROPERTYMAPTABLE;
210
211 typedef struct
212 {
213 WORD Flags;
214 WORD Name;
215 WORD Type;
216 } PROPERTYTABLE;
217
218 typedef struct
219 {
220 WORD Semantics;
221 WORD Method;
222 WORD Association;
223 } METHODSEMANTICSTABLE;
224
225 typedef struct
226 {
227 WORD Class;
228 WORD MethodBody;
229 WORD MethodDeclaration;
230 } METHODIMPLTABLE;
231
232 typedef struct
233 {
234 WORD Name;
235 } MODULEREFTABLE;
236
237 typedef struct
238 {
239 WORD Signature;
240 } TYPESPECTABLE;
241
242 typedef struct
243 {
244 WORD MappingFlags;
245 WORD MemberForwarded;
246 WORD ImportName;
247 WORD ImportScope;
248 } IMPLMAPTABLE;
249
250 typedef struct
251 {
252 DWORD RVA;
253 WORD Field;
254 } FIELDRVATABLE;
255
256 typedef struct
257 {
258 DWORD Processor;
259 } ASSEMBLYPROCESSORTABLE;
260
261 typedef struct
262 {
263 DWORD OSPlatformID;
264 DWORD OSMajorVersion;
265 DWORD OSMinorVersion;
266 } ASSEMBLYOSTABLE;
267
268 typedef struct
269 {
270 WORD MajorVersion;
271 WORD MinorVersion;
272 WORD BuildNumber;
273 WORD RevisionNumber;
274 DWORD Flags;
275 WORD PublickKeyOrToken;
276 WORD Name;
277 WORD Culture;
278 WORD HashValue;
279 } ASSEMBLYREFTABLE;
280
281 typedef struct
282 {
283 DWORD Processor;
284 WORD AssemblyRef;
285 } ASSEMBLYREFPROCESSORTABLE;
286
287 typedef struct
288 {
289 DWORD OSPlatformId;
290 DWORD OSMajorVersion;
291 DWORD OSMinorVersion;
292 WORD AssemblyRef;
293 } ASSEMBLYREFOSTABLE;
294
295 typedef struct
296 {
297 DWORD Flags;
298 WORD Name;
299 WORD HashValue;
300 } FILETABLE;
301
302 typedef struct
303 {
304 DWORD Flags;
305 DWORD TypeDefId;
306 WORD TypeName;
307 WORD TypeNameSpace;
308 WORD Implementation;
309 } EXPORTEDTYPETABLE;
310
311 typedef struct
312 {
313 WORD NestedClass;
314 WORD EnclosingClass;
315 } NESTEDCLASSTABLE;
316
317 typedef struct
318 {
319 WORD Number;
320 WORD Flags;
321 } GENERICPARAMTABLE;
322
323 typedef struct
324 {
325 WORD MethodDef;
326 WORD Instantiation;
327 } METHODSPECTABLE;
328
329 typedef struct
330 {
331 WORD Owner;
332 WORD Constraint;
333 } GENERICPARAMCONSTRAINTTABLE;
334
335 typedef struct
336 {
337 DWORD ImportLookupTable;
338 DWORD DateTimeStamp;
339 DWORD ForwarderChain;
340 DWORD Name;
341 DWORD ImportAddressTable;
342 BYTE pad[20];
343 } IMPORTTABLE;
344
345 typedef struct
346 {
347 DWORD HintNameTableRVA;
348 BYTE pad[8];
349 } IMPORTLOOKUPTABLE;
350
351 typedef struct
352 {
353 WORD Hint;
354 BYTE Name[12];
355 BYTE Module[12];
356 DWORD Reserved;
357 WORD EntryPoint;
358 DWORD RVA;
359 } HINTNAMETABLE;
360
361 typedef struct
362 {
363 DWORD PageRVA;
364 DWORD Size;
365 DWORD Relocation;
366 } RELOCATION;
367
368 typedef struct
369 {
370 WORD wLength;
371 WORD wValueLength;
372 WORD wType;
373 WCHAR szKey[17];
374 VS_FIXEDFILEINFO Value;
375 } VS_VERSIONINFO;
376
377 typedef struct
378 {
379 WORD wLength;
380 WORD wValueLength;
381 WORD wType;
382 WCHAR szKey[13];
383 } VARFILEINFO;
384
385 typedef struct
386 {
387 WORD wLength;
388 WORD wValueLength;
389 WORD wType;
390 WCHAR szKey[13];
391 DWORD Value;
392 } VAR;
393
394 typedef struct
395 {
396 WORD wLength;
397 WORD wValueLength;
398 WORD wType;
399 WCHAR szKey[15];
400 } STRINGFILEINFO;
401
402 typedef struct
403 {
404 WORD wLength;
405 WORD wValueLength;
406 WORD wType;
407 WCHAR szKey[9];
408 } STRINGTABLE;
409
410 typedef struct
411 {
412 WORD wLength;
413 WORD wValueLength;
414 WORD wType;
415 } STRINGHDR;
416
417 typedef struct
418 {
419 DWORD Size;
420 DWORD Signature;
421 DWORD HeaderVersion;
422 DWORD SkipData;
423 BYTE Data[168];
424 } RESOURCE;
425
426 #include <poppack.h>
427
428 struct tagASSEMBLY;
429 typedef struct tagASSEMBLY ASSEMBLY;
430
431 HRESULT assembly_create(ASSEMBLY **out, LPCWSTR file);
432 HRESULT assembly_release(ASSEMBLY *assembly);
433 HRESULT assembly_get_name(ASSEMBLY *assembly, LPWSTR *name);
434 HRESULT assembly_get_path(ASSEMBLY *assembly, LPWSTR *path);
435 HRESULT assembly_get_version(ASSEMBLY *assembly, LPWSTR *version);
436 BYTE assembly_get_architecture(ASSEMBLY *assembly);
437 HRESULT assembly_get_pubkey_token(ASSEMBLY *assembly, LPWSTR *token);
438
439 static inline LPWSTR strdupW(LPCWSTR src)
440 {
441 LPWSTR dest;
442
443 if (!src)
444 return NULL;
445
446 dest = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(src) + 1) * sizeof(WCHAR));
447 if (dest)
448 lstrcpyW(dest, src);
449
450 return dest;
451 }
452
453 #define BYTES_PER_TOKEN 8
454 #define CHARS_PER_BYTE 2
455 #define TOKEN_LENGTH (BYTES_PER_TOKEN * CHARS_PER_BYTE + 1)
456
457 static inline void token_to_str(BYTE *bytes, LPWSTR str)
458 {
459 DWORD i;
460
461 static const WCHAR hexval[16] = {
462 '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'
463 };
464
465 for(i = 0; i < BYTES_PER_TOKEN; i++)
466 {
467 str[i * 2] = hexval[((bytes[i] >> 4) & 0xF)];
468 str[i * 2 + 1] = hexval[(bytes[i]) & 0x0F];
469 }
470 str[i * 2] = 0;
471 }
472
473 #endif /* __WINE_FUSION_PRIVATE__ */