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