Stub for SetVolumeLabel().
[wine] / include / peexe.h
1 /*
2  * Copyright  Eric Youngdale (1994)
3  */
4 #ifndef __WINE_PEEXE_H
5 #define __WINE_PEEXE_H
6
7 #include "windef.h"
8
9 typedef struct _IMAGE_FILE_HEADER {
10         WORD    Machine;                        /* 00 */
11         WORD    NumberOfSections;               /* 02 */
12         DWORD   TimeDateStamp;                  /* 04 */
13         DWORD   PointerToSymbolTable;           /* 08 */
14         DWORD   NumberOfSymbols;                /* 0c */
15         WORD    SizeOfOptionalHeader;           /* 10 */
16         WORD    Characteristics;                /* 12 */
17 } IMAGE_FILE_HEADER,*PIMAGE_FILE_HEADER;
18
19 #define IMAGE_SIZEOF_FILE_HEADER        20
20
21 /* These defines describe the meanings of the bits in the Characteristics
22    field */
23
24 #define IMAGE_FILE_RELOCS_STRIPPED      1 /* No relocation info */
25 #define IMAGE_FILE_EXECUTABLE_IMAGE     2
26 #define IMAGE_FILE_LINE_NUMS_STRIPPED   4
27 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED  8
28 #define IMAGE_FILE_16BIT_MACHINE        0x40
29 #define IMAGE_FILE_BYTES_REVERSED_LO    0x80
30 #define IMAGE_FILE_32BIT_MACHINE        0x100
31 #define IMAGE_FILE_DEBUG_STRIPPED       0x200
32 #define IMAGE_FILE_SYSTEM               0x1000
33 #define IMAGE_FILE_DLL                  0x2000
34 #define IMAGE_FILE_BYTES_REVERSED_HI    0x8000
35
36 /* These are the settings of the Machine field. */
37 #define IMAGE_FILE_MACHINE_UNKNOWN      0
38 #define IMAGE_FILE_MACHINE_I860         0x14d
39 #define IMAGE_FILE_MACHINE_I386         0x14c
40 #define IMAGE_FILE_MACHINE_R3000        0x162
41 #define IMAGE_FILE_MACHINE_R4000        0x166
42 #define IMAGE_FILE_MACHINE_R10000       0x168
43 #define IMAGE_FILE_MACHINE_ALPHA        0x184
44 #define IMAGE_FILE_MACHINE_POWERPC      0x1F0  
45
46 typedef struct _IMAGE_DATA_DIRECTORY
47 {
48         DWORD   VirtualAddress;
49         DWORD   Size;
50 } IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;
51
52 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
53
54 /* Optional coff header - used by NT to provide additional information. */
55 typedef struct _IMAGE_OPTIONAL_HEADER
56 {
57         /*
58          * Standard fields.
59          */
60
61         WORD    Magic;                          /* 00 */
62         BYTE    MajorLinkerVersion;             /* 02 */
63         BYTE    MinorLinkerVersion;             /* 03 */
64         DWORD   SizeOfCode;                     /* 04 */
65         DWORD   SizeOfInitializedData;          /* 08 */
66         DWORD   SizeOfUninitializedData;        /* 0C */
67         DWORD   AddressOfEntryPoint;            /* 10 */
68         DWORD   BaseOfCode;                     /* 14 */
69         DWORD   BaseOfData;                     /* 18 */
70
71         /*
72          * NT additional fields.
73          */
74
75         DWORD   ImageBase;                      /* 1C */
76         DWORD   SectionAlignment;               /* 20 */
77         DWORD   FileAlignment;                  /* 24 */
78         WORD    MajorOperatingSystemVersion;    /* 28 */
79         WORD    MinorOperatingSystemVersion;    /* 2A */
80         WORD    MajorImageVersion;              /* 2C */
81         WORD    MinorImageVersion;              /* 2E */
82         WORD    MajorSubsystemVersion;          /* 30 */
83         WORD    MinorSubsystemVersion;          /* 32 */
84         DWORD   Reserved1;                      /* 34 */
85         DWORD   SizeOfImage;                    /* 38 */
86         DWORD   SizeOfHeaders;                  /* 3C */
87         DWORD   CheckSum;                       /* 40 */
88         WORD    Subsystem;                      /* 44 */
89         WORD    DllCharacteristics;             /* 46 */
90         DWORD   SizeOfStackReserve;             /* 48 */
91         DWORD   SizeOfStackCommit;              /* 4C */
92         DWORD   SizeOfHeapReserve;              /* 50 */
93         DWORD   SizeOfHeapCommit;               /* 54 */
94         DWORD   LoaderFlags;                    /* 58 */
95         DWORD   NumberOfRvaAndSizes;            /* 5C */
96                                                 /* 60: */
97         IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
98 } IMAGE_OPTIONAL_HEADER,*PIMAGE_OPTIONAL_HEADER;
99
100 /* Possible Magic values */
101 #define IMAGE_NT_OPTIONAL_HDR_MAGIC        0x10b
102 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC       0x107
103
104 /* These are indexes into the DataDirectory array */
105 #define IMAGE_FILE_EXPORT_DIRECTORY             0
106 #define IMAGE_FILE_IMPORT_DIRECTORY             1
107 #define IMAGE_FILE_RESOURCE_DIRECTORY           2
108 #define IMAGE_FILE_EXCEPTION_DIRECTORY          3
109 #define IMAGE_FILE_SECURITY_DIRECTORY           4
110 #define IMAGE_FILE_BASE_RELOCATION_TABLE        5
111 #define IMAGE_FILE_DEBUG_DIRECTORY              6
112 #define IMAGE_FILE_DESCRIPTION_STRING           7
113 #define IMAGE_FILE_MACHINE_VALUE                8  /* Mips */
114 #define IMAGE_FILE_THREAD_LOCAL_STORAGE         9
115 #define IMAGE_FILE_CALLBACK_DIRECTORY           10
116
117 /* Directory Entries, indices into the DataDirectory array */
118
119 #define IMAGE_DIRECTORY_ENTRY_EXPORT            0
120 #define IMAGE_DIRECTORY_ENTRY_IMPORT            1
121 #define IMAGE_DIRECTORY_ENTRY_RESOURCE          2
122 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION         3
123 #define IMAGE_DIRECTORY_ENTRY_SECURITY          4
124 #define IMAGE_DIRECTORY_ENTRY_BASERELOC         5
125 #define IMAGE_DIRECTORY_ENTRY_DEBUG             6
126 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT         7
127 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR         8   /* (MIPS GP) */
128 #define IMAGE_DIRECTORY_ENTRY_TLS               9
129 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG       10
130 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT      11
131 #define IMAGE_DIRECTORY_ENTRY_IAT               12  /* Import Address Table */
132 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT      13
133 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR    14
134
135 /* Subsystem Values */
136
137 #define IMAGE_SUBSYSTEM_UNKNOWN         0
138 #define IMAGE_SUBSYSTEM_NATIVE          1
139 #define IMAGE_SUBSYSTEM_WINDOWS_GUI     2       /* Windows GUI subsystem */
140 #define IMAGE_SUBSYSTEM_WINDOWS_CUI     3       /* Windows character subsystem*/
141 #define IMAGE_SUBSYSTEM_OS2_CUI         5
142 #define IMAGE_SUBSYSTEM_POSIX_CUI       7
143
144 typedef struct _IMAGE_NT_HEADERS {
145         DWORD                   Signature;      /* 00: PE\0\0 */
146         IMAGE_FILE_HEADER       FileHeader;     /* 04: Fileheader */
147         IMAGE_OPTIONAL_HEADER   OptionalHeader; /* 18: Optional Header */
148 } IMAGE_NT_HEADERS,*PIMAGE_NT_HEADERS;
149
150
151 #define PE_HEADER(module) \
152     ((IMAGE_NT_HEADERS*)((LPBYTE)(module) + \
153                          (((IMAGE_DOS_HEADER*)(module))->e_lfanew)))
154
155 #define PE_SECTIONS(module) \
156     ((IMAGE_SECTION_HEADER*)((LPBYTE)&PE_HEADER(module)->OptionalHeader + \
157                            PE_HEADER(module)->FileHeader.SizeOfOptionalHeader))
158
159 #define RVA_PTR(module,field) ((LPBYTE)(module) + PE_HEADER(module)->field)
160
161 /* Section header format */
162
163 #define IMAGE_SIZEOF_SHORT_NAME 8
164
165 typedef struct _IMAGE_SECTION_HEADER {
166         BYTE    Name[IMAGE_SIZEOF_SHORT_NAME];  /* 00: */
167         union {
168                 DWORD   PhysicalAddress;        /* 04: */
169                 DWORD   VirtualSize;            /* 04: */
170         } Misc;
171         DWORD   VirtualAddress;                 /* 08: */
172         DWORD   SizeOfRawData;                  /* 0C: */
173         DWORD   PointerToRawData;               /* 10: */
174         DWORD   PointerToRelocations;           /* 14: */
175         DWORD   PointerToLinenumbers;           /* 18: */
176         WORD    NumberOfRelocations;            /* 1C: */
177         WORD    NumberOfLinenumbers;            /* 1E: */
178         DWORD   Characteristics;                /* 20: */
179                                                 /* 24: */
180 } IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER;
181
182 #define IMAGE_SIZEOF_SECTION_HEADER 40
183
184 /* These defines are for the Characteristics bitfield. */
185 /* #define IMAGE_SCN_TYPE_REG                   0x00000000 - Reserved */
186 /* #define IMAGE_SCN_TYPE_DSECT                 0x00000001 - Reserved */
187 /* #define IMAGE_SCN_TYPE_NOLOAD                0x00000002 - Reserved */
188 /* #define IMAGE_SCN_TYPE_GROUP                 0x00000004 - Reserved */
189 /* #define IMAGE_SCN_TYPE_NO_PAD                0x00000008 - Reserved */
190 /* #define IMAGE_SCN_TYPE_COPY                  0x00000010 - Reserved */
191
192 #define IMAGE_SCN_CNT_CODE                      0x00000020
193 #define IMAGE_SCN_CNT_INITIALIZED_DATA          0x00000040
194 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA        0x00000080
195
196 #define IMAGE_SCN_LNK_OTHER                     0x00000100 
197 #define IMAGE_SCN_LNK_INFO                      0x00000200  
198 /* #define      IMAGE_SCN_TYPE_OVER             0x00000400 - Reserved */
199 #define IMAGE_SCN_LNK_REMOVE                    0x00000800
200 #define IMAGE_SCN_LNK_COMDAT                    0x00001000
201
202 /*                                              0x00002000 - Reserved */
203 /* #define IMAGE_SCN_MEM_PROTECTED              0x00004000 - Obsolete */
204 #define IMAGE_SCN_MEM_FARDATA                   0x00008000
205
206 /* #define IMAGE_SCN_MEM_SYSHEAP                0x00010000 - Obsolete */
207 #define IMAGE_SCN_MEM_PURGEABLE                 0x00020000
208 #define IMAGE_SCN_MEM_16BIT                     0x00020000
209 #define IMAGE_SCN_MEM_LOCKED                    0x00040000
210 #define IMAGE_SCN_MEM_PRELOAD                   0x00080000
211
212 #define IMAGE_SCN_ALIGN_1BYTES                  0x00100000
213 #define IMAGE_SCN_ALIGN_2BYTES                  0x00200000
214 #define IMAGE_SCN_ALIGN_4BYTES                  0x00300000
215 #define IMAGE_SCN_ALIGN_8BYTES                  0x00400000
216 #define IMAGE_SCN_ALIGN_16BYTES                 0x00500000  /* Default */
217 #define IMAGE_SCN_ALIGN_32BYTES                 0x00600000
218 #define IMAGE_SCN_ALIGN_64BYTES                 0x00700000
219 /*                                              0x00800000 - Unused */
220
221 #define IMAGE_SCN_LNK_NRELOC_OVFL               0x01000000
222
223
224 #define IMAGE_SCN_MEM_DISCARDABLE               0x02000000
225 #define IMAGE_SCN_MEM_NOT_CACHED                0x04000000
226 #define IMAGE_SCN_MEM_NOT_PAGED                 0x08000000
227 #define IMAGE_SCN_MEM_SHARED                    0x10000000
228 #define IMAGE_SCN_MEM_EXECUTE                   0x20000000
229 #define IMAGE_SCN_MEM_READ                      0x40000000
230 #define IMAGE_SCN_MEM_WRITE                     0x80000000
231
232
233 /* Import name entry */
234 typedef struct _IMAGE_IMPORT_BY_NAME {
235         WORD    Hint;
236         BYTE    Name[1];
237 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
238
239 /* Import thunk */
240 typedef struct _IMAGE_THUNK_DATA {
241         union {
242                 LPBYTE    ForwarderString;
243                 FARPROC Function;
244                 DWORD     Ordinal;
245                 PIMAGE_IMPORT_BY_NAME   AddressOfData;
246         } u1;
247 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
248
249 /* Import module directory */
250
251 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
252         union {
253                 DWORD   Characteristics; /* 0 for terminating null import descriptor  */
254                 PIMAGE_THUNK_DATA OriginalFirstThunk;   /* RVA to original unbound IAT */
255         } u;
256         DWORD   TimeDateStamp;  /* 0 if not bound,
257                                  * -1 if bound, and real date\time stamp
258                                  *    in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
259                                  * (new BIND)
260                                  * otherwise date/time stamp of DLL bound to
261                                  * (Old BIND)
262                                  */
263         DWORD   ForwarderChain; /* -1 if no forwarders */
264         DWORD   Name;
265         /* RVA to IAT (if bound this IAT has actual addresses) */
266         PIMAGE_THUNK_DATA FirstThunk;   
267 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
268
269 #define IMAGE_ORDINAL_FLAG              0x80000000
270 #define IMAGE_SNAP_BY_ORDINAL(Ordinal)  ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
271 #define IMAGE_ORDINAL(Ordinal)          (Ordinal & 0xffff)
272
273 /* Export module directory */
274
275 typedef struct _IMAGE_EXPORT_DIRECTORY {
276         DWORD   Characteristics;
277         DWORD   TimeDateStamp;
278         WORD    MajorVersion;
279         WORD    MinorVersion;
280         DWORD   Name;
281         DWORD   Base;
282         DWORD   NumberOfFunctions;
283         DWORD   NumberOfNames;
284         LPDWORD *AddressOfFunctions;
285         LPDWORD *AddressOfNames;
286         LPWORD  *AddressOfNameOrdinals;
287 /*  u_char ModuleName[1]; */
288 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
289
290
291 /*
292  * Resource directory stuff
293  */
294 typedef struct _IMAGE_RESOURCE_DIRECTORY {
295         DWORD   Characteristics;
296         DWORD   TimeDateStamp;
297         WORD    MajorVersion;
298         WORD    MinorVersion;
299         WORD    NumberOfNamedEntries;
300         WORD    NumberOfIdEntries;
301         /*  IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
302 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
303
304 #define IMAGE_RESOURCE_NAME_IS_STRING           0x80000000
305 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY        0x80000000
306
307 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
308         union {
309                 struct {
310                         unsigned NameOffset:31;
311                         unsigned NameIsString:1;
312                 } s;
313                 DWORD   Name;
314                 WORD    Id;
315         } u1;
316         union {
317                 DWORD   OffsetToData;
318                 struct {
319                         unsigned OffsetToDirectory:31;
320                         unsigned DataIsDirectory:1;
321                 } s;
322         } u2;
323 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
324
325
326 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
327         WORD    Length;
328         CHAR    NameString[ 1 ];
329 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
330
331 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
332         WORD    Length;
333         WCHAR   NameString[ 1 ];
334 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
335
336 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
337         DWORD   OffsetToData;
338         DWORD   Size;
339         DWORD   CodePage;
340         DWORD   ResourceHandle;
341 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
342
343 typedef struct _IMAGE_BASE_RELOCATION
344 {
345         DWORD   VirtualAddress;
346         DWORD   SizeOfBlock;
347         WORD    TypeOffset[1];
348 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
349
350 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
351         DWORD   Characteristics;
352         DWORD   TimeDateStamp;
353         WORD    MajorVersion;
354         WORD    MinorVersion;
355         DWORD   GlobalFlagsClear;
356         DWORD   GlobalFlagsSet;
357         DWORD   CriticalSectionDefaultTimeout;
358         DWORD   DeCommitFreeBlockThreshold;
359         DWORD   DeCommitTotalFreeThreshold;
360         LPVOID  LockPrefixTable;
361         DWORD   MaximumAllocationSize;
362         DWORD   VirtualMemoryThreshold;
363         DWORD   ProcessHeapFlags;
364         DWORD   Reserved[ 4 ];
365 } IMAGE_LOAD_CONFIG_DIRECTORY,*PIMAGE_LOAD_CONFIG_DIRECTORY;
366
367 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
368         LPVOID DllHandle,DWORD Reason,LPVOID Reserved
369 );
370
371 typedef struct _IMAGE_TLS_DIRECTORY {
372         DWORD   StartAddressOfRawData;
373         DWORD   EndAddressOfRawData;
374         LPDWORD AddressOfIndex;
375         PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
376         DWORD   SizeOfZeroFill;
377         DWORD   Characteristics;
378 } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
379
380 /*
381  * The IMAGE_DEBUG_DIRECTORY data directory points to an array of
382  * these structures.
383  */
384 typedef struct _IMAGE_DEBUG_DIRECTORY {
385         DWORD   Characteristics;
386         DWORD   TimeDateStamp;
387         WORD    MajorVersion;
388         WORD    MinorVersion;
389         DWORD   Type;
390         DWORD   SizeOfData;
391         DWORD   AddressOfRawData;
392         DWORD   PointerToRawData;
393 } IMAGE_DEBUG_DIRECTORY,*PIMAGE_DEBUG_DIRECTORY;
394
395 /*
396  * The type field above can take these (plus a few other
397  * irrelevant) values.
398  */
399 #define IMAGE_DEBUG_TYPE_UNKNOWN        0
400 #define IMAGE_DEBUG_TYPE_COFF           1
401 #define IMAGE_DEBUG_TYPE_CODEVIEW       2
402 #define IMAGE_DEBUG_TYPE_FPO            3
403 #define IMAGE_DEBUG_TYPE_MISC           4
404 #define IMAGE_DEBUG_TYPE_EXCEPTION      5
405 #define IMAGE_DEBUG_TYPE_FIXUP          6
406 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC    7
407 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC  8
408
409 /* generic relocation types */
410 #define IMAGE_REL_BASED_ABSOLUTE                0
411 #define IMAGE_REL_BASED_HIGH                    1
412 #define IMAGE_REL_BASED_LOW                     2
413 #define IMAGE_REL_BASED_HIGHLOW                 3
414 #define IMAGE_REL_BASED_HIGHADJ                 4
415 #define IMAGE_REL_BASED_MIPS_JMPADDR            5
416 #define IMAGE_REL_BASED_SECTION                 6
417 #define IMAGE_REL_BASED_REL                     7
418 #define IMAGE_REL_BASED_MIPS_JMPADDR16          9
419 #define IMAGE_REL_BASED_IA64_IMM64              9 /* yes, 9 too */
420 #define IMAGE_REL_BASED_DIR64                   10
421 #define IMAGE_REL_BASED_HIGH3ADJ                11
422
423 /* I386 relocation types */
424 #define IMAGE_REL_I386_ABSOLUTE                 0
425 #define IMAGE_REL_I386_DIR16                    1
426 #define IMAGE_REL_I386_REL16                    2
427 #define IMAGE_REL_I386_DIR                      6
428 #define IMAGE_REL_I386_DIR32NB                  7
429 #define IMAGE_REL_I386_SEG12                    9
430 #define IMAGE_REL_I386_SECTION                  10
431 #define IMAGE_REL_I386_SECREL                   11
432 #define IMAGE_REL_I386_REL                      20
433
434 /* MIPS relocation types */
435 #define IMAGE_REL_MIPS_ABSOLUTE         0x0000
436 #define IMAGE_REL_MIPS_REFHALF          0x0001
437 #define IMAGE_REL_MIPS_REFWORD          0x0002
438 #define IMAGE_REL_MIPS_JMPADDR          0x0003
439 #define IMAGE_REL_MIPS_REFHI            0x0004
440 #define IMAGE_REL_MIPS_REFLO            0x0005
441 #define IMAGE_REL_MIPS_GPREL            0x0006
442 #define IMAGE_REL_MIPS_LITERAL          0x0007
443 #define IMAGE_REL_MIPS_SECTION          0x000A
444 #define IMAGE_REL_MIPS_SECREL           0x000B
445 #define IMAGE_REL_MIPS_SECRELLO         0x000C
446 #define IMAGE_REL_MIPS_SECRELHI         0x000D
447 #define IMAGE_REL_MIPS_JMPADDR16        0x0010
448 #define IMAGE_REL_MIPS_REFWORDNB        0x0022
449 #define IMAGE_REL_MIPS_PAIR             0x0025
450
451 /* ALPHA relocation types */
452 #define IMAGE_REL_ALPHA_ABSOLUTE        0x0000
453 #define IMAGE_REL_ALPHA_REFLONG         0x0001
454 #define IMAGE_REL_ALPHA_REFQUAD         0x0002
455 #define IMAGE_REL_ALPHA_GPREL           0x0003
456 #define IMAGE_REL_ALPHA_LITERAL         0x0004
457 #define IMAGE_REL_ALPHA_LITUSE          0x0005
458 #define IMAGE_REL_ALPHA_GPDISP          0x0006
459 #define IMAGE_REL_ALPHA_BRADDR          0x0007
460 #define IMAGE_REL_ALPHA_HINT            0x0008
461 #define IMAGE_REL_ALPHA_INLINE_REFLONG  0x0009
462 #define IMAGE_REL_ALPHA_REFHI           0x000A
463 #define IMAGE_REL_ALPHA_REFLO           0x000B
464 #define IMAGE_REL_ALPHA_PAIR            0x000C
465 #define IMAGE_REL_ALPHA_MATCH           0x000D
466 #define IMAGE_REL_ALPHA_SECTION         0x000E
467 #define IMAGE_REL_ALPHA_SECREL          0x000F
468 #define IMAGE_REL_ALPHA_REFLONGNB       0x0010
469 #define IMAGE_REL_ALPHA_SECRELLO        0x0011
470 #define IMAGE_REL_ALPHA_SECRELHI        0x0012
471 #define IMAGE_REL_ALPHA_REFQ3           0x0013
472 #define IMAGE_REL_ALPHA_REFQ2           0x0014
473 #define IMAGE_REL_ALPHA_REFQ1           0x0015
474 #define IMAGE_REL_ALPHA_GPRELLO         0x0016
475 #define IMAGE_REL_ALPHA_GPRELHI         0x0017
476
477 /* PowerPC relocation types */
478 #define IMAGE_REL_PPC_ABSOLUTE          0x0000
479 #define IMAGE_REL_PPC_ADDR64            0x0001
480 #define IMAGE_REL_PPC_ADDR            0x0002
481 #define IMAGE_REL_PPC_ADDR24            0x0003
482 #define IMAGE_REL_PPC_ADDR16            0x0004
483 #define IMAGE_REL_PPC_ADDR14            0x0005
484 #define IMAGE_REL_PPC_REL24             0x0006
485 #define IMAGE_REL_PPC_REL14             0x0007
486 #define IMAGE_REL_PPC_TOCREL16          0x0008
487 #define IMAGE_REL_PPC_TOCREL14          0x0009
488 #define IMAGE_REL_PPC_ADDR32NB          0x000A
489 #define IMAGE_REL_PPC_SECREL            0x000B
490 #define IMAGE_REL_PPC_SECTION           0x000C
491 #define IMAGE_REL_PPC_IFGLUE            0x000D
492 #define IMAGE_REL_PPC_IMGLUE            0x000E
493 #define IMAGE_REL_PPC_SECREL16          0x000F
494 #define IMAGE_REL_PPC_REFHI             0x0010
495 #define IMAGE_REL_PPC_REFLO             0x0011
496 #define IMAGE_REL_PPC_PAIR              0x0012
497 #define IMAGE_REL_PPC_SECRELLO          0x0013
498 #define IMAGE_REL_PPC_SECRELHI          0x0014
499 #define IMAGE_REL_PPC_GPREL             0x0015
500 #define IMAGE_REL_PPC_TYPEMASK          0x00FF
501 /* modifier bits */
502 #define IMAGE_REL_PPC_NEG               0x0100
503 #define IMAGE_REL_PPC_BRTAKEN           0x0200
504 #define IMAGE_REL_PPC_BRNTAKEN          0x0400
505 #define IMAGE_REL_PPC_TOCDEFN           0x0800
506
507 /* SH3 ? relocation type */
508 #define IMAGE_REL_SH3_ABSOLUTE          0x0000
509 #define IMAGE_REL_SH3_DIRECT16          0x0001
510 #define IMAGE_REL_SH3_DIRECT          0x0002
511 #define IMAGE_REL_SH3_DIRECT8           0x0003
512 #define IMAGE_REL_SH3_DIRECT8_WORD      0x0004
513 #define IMAGE_REL_SH3_DIRECT8_LONG      0x0005
514 #define IMAGE_REL_SH3_DIRECT4           0x0006
515 #define IMAGE_REL_SH3_DIRECT4_WORD      0x0007
516 #define IMAGE_REL_SH3_DIRECT4_LONG      0x0008
517 #define IMAGE_REL_SH3_PCREL8_WORD       0x0009
518 #define IMAGE_REL_SH3_PCREL8_LONG       0x000A
519 #define IMAGE_REL_SH3_PCREL12_WORD      0x000B
520 #define IMAGE_REL_SH3_STARTOF_SECTION   0x000C
521 #define IMAGE_REL_SH3_SIZEOF_SECTION    0x000D
522 #define IMAGE_REL_SH3_SECTION           0x000E
523 #define IMAGE_REL_SH3_SECREL            0x000F
524 #define IMAGE_REL_SH3_DIRECT32_NB       0x0010
525
526 /* ARM (Archimedes?) relocation types */
527 #define IMAGE_REL_ARM_ABSOLUTE          0x0000
528 #define IMAGE_REL_ARM_ADDR              0x0001
529 #define IMAGE_REL_ARM_ADDR32NB          0x0002
530 #define IMAGE_REL_ARM_BRANCH24          0x0003
531 #define IMAGE_REL_ARM_BRANCH11          0x0004
532 #define IMAGE_REL_ARM_SECTION           0x000E
533 #define IMAGE_REL_ARM_SECREL            0x000F
534
535 /* IA64 relocation types */
536 #define IMAGE_REL_IA64_ABSOLUTE         0x0000
537 #define IMAGE_REL_IA64_IMM14            0x0001
538 #define IMAGE_REL_IA64_IMM22            0x0002
539 #define IMAGE_REL_IA64_IMM64            0x0003
540 #define IMAGE_REL_IA64_DIR              0x0004
541 #define IMAGE_REL_IA64_DIR64            0x0005
542 #define IMAGE_REL_IA64_PCREL21B         0x0006
543 #define IMAGE_REL_IA64_PCREL21M         0x0007
544 #define IMAGE_REL_IA64_PCREL21F         0x0008
545 #define IMAGE_REL_IA64_GPREL22          0x0009
546 #define IMAGE_REL_IA64_LTOFF22          0x000A
547 #define IMAGE_REL_IA64_SECTION          0x000B
548 #define IMAGE_REL_IA64_SECREL22         0x000C
549 #define IMAGE_REL_IA64_SECREL64I        0x000D
550 #define IMAGE_REL_IA64_SECREL           0x000E
551 #define IMAGE_REL_IA64_LTOFF64          0x000F
552 #define IMAGE_REL_IA64_DIR32NB          0x0010
553 #define IMAGE_REL_IA64_RESERVED_11      0x0011
554 #define IMAGE_REL_IA64_RESERVED_12      0x0012
555 #define IMAGE_REL_IA64_RESERVED_13      0x0013
556 #define IMAGE_REL_IA64_RESERVED_14      0x0014
557 #define IMAGE_REL_IA64_RESERVED_15      0x0015
558 #define IMAGE_REL_IA64_RESERVED_16      0x0016
559 #define IMAGE_REL_IA64_ADDEND           0x001F
560
561 /*
562  * This is the structure that appears at the very start of a .DBG file.
563  */
564 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
565         WORD    Signature;
566         WORD    Flags;
567         WORD    Machine;
568         WORD    Characteristics;
569         DWORD   TimeDateStamp;
570         DWORD   CheckSum;
571         DWORD   ImageBase;
572         DWORD   SizeOfImage;
573         DWORD   NumberOfSections;
574         DWORD   ExportedNamesSize;
575         DWORD   DebugDirectorySize;
576         DWORD   Reserved[ 3 ];
577 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
578
579 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
580
581 typedef struct tagMESSAGE_RESOURCE_ENTRY {
582         WORD    Length;
583         WORD    Flags;
584         BYTE    Text[1];
585 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
586 #define MESSAGE_RESOURCE_UNICODE        0x0001
587
588 typedef struct tagMESSAGE_RESOURCE_BLOCK {
589         DWORD   LowId;
590         DWORD   HighId;
591         DWORD   OffsetToEntries;
592 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
593
594 typedef struct tagMESSAGE_RESOURCE_DATA {
595         DWORD                   NumberOfBlocks;
596         MESSAGE_RESOURCE_BLOCK  Blocks[ 1 ];
597 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
598
599 #endif /* __WINE_PEEXE_H */