Release 960606
[wine.git] / include / peexe.h
blobff85a08460956d409baaedf5e10ef1fa1981415f
1 /*
2 * Copyright Eric Youngdale (1994)
3 */
4 #ifndef __WINE_PEEXE_H
5 #define __WINE_PEEXE_H
9 struct coff_header
11 u_short Machine;
12 u_short NumberOfSections;
13 u_long TimeDateStamp;
14 u_long PointerToSymbolTable;
15 u_long NumberOfSymbols;
16 u_short SizeOfOptionalHeader;
17 u_short Characteristics;
21 /* These defines describe the meanings of the bits in the Characteristics
22 field */
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
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_ALPHA 0x184
44 struct Directory
46 u_long Virtual_address;
47 u_long Size;
51 /* Optional coff header - used by NT to provide additional information. */
53 struct ocoffhdr
55 u_short Magic; /* Good old COFF magic 0413 */
56 u_char MajorLinkerVersion;
57 u_char MinorLinkerVersion;
58 u_long SizeOfCode;
59 u_long SizeOfInitializedData;
60 u_long SizeOfUninitializedData;
61 u_long AddressOfEntryPoint;
62 u_long BaseOfCode;
63 u_long BaseOfData;
64 u_long BaseOfImage;
65 u_long SectionAlignment;
66 u_long FileAlignment;
67 u_short MajorOperatingSystemVersion;
68 u_short MinorOperatingSystemVersion;
69 u_short MajorImageVersion;
70 u_short MinorImageVersion;
71 u_short MajorSubsystemVersion;
72 u_short MinorSubsystemVersion;
73 u_long Unknown1;
74 u_long SizeOfImage;
75 u_long SizeOfHeaders;
76 u_long CheckSum;
77 u_short Subsystem;
78 u_short DllCharacteristics;
79 u_long SizeOfStackReserve;
80 u_long SizeOfStackCommit;
81 u_long SizeOfHeapReserve;
82 u_long SizeOfHeapCommit;
83 u_long LoaderFlags;
84 u_long NumberOfRvaAndSizes;
85 struct Directory DataDirectory[16];
88 /* These are indexes into the DataDirectory array */
89 #define IMAGE_FILE_EXPORT_DIRECTORY 0
90 #define IMAGE_FILE_IMPORT_DIRECTORY 1
91 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
92 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
93 #define IMAGE_FILE_SECURITY_DIRECTORY 4
94 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
95 #define IMAGE_FILE_DEBUG_DIRECTORY 6
96 #define IMAGE_FILE_DESCRIPTION_STRING 7
97 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
98 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
99 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
101 struct pe_header_s
103 char magic[4]; /* Must be 'P', 'E', 0, 0 */
104 struct coff_header coff;
105 struct ocoffhdr opt_coff;
109 struct pe_segment_table
111 u_char Name[8];
112 u_long Virtual_Size;
113 u_long Virtual_Address;
114 u_long Size_Of_Raw_Data;
115 u_long PointerToRawData;
116 u_long PointerToRelocations;
117 u_long PointerToLinenumbers;
118 u_short NumberOfRelocations;
119 u_short NumberOfLinenumbers;
120 u_long Characteristics;
123 /* These defines are for the Characteristics bitfield. */
125 #define IMAGE_SCN_TYPE_CNT_CODE 0x20
126 #define IMAGE_SCN_TYPE_CNT_INITIALIZED_DATA 0x40
127 #define IMAGE_SCN_TYPE_CNT_UNINITIALIZED_DATA 0x80
128 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
129 #define IMAGE_SCN_MEM_SHARED 0x10000000
130 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
131 #define IMAGE_SCN_MEM_READ 0x40000000
132 #define IMAGE_SCN_MEM_WRITE 0x80000000
135 * Import module directory stuff
138 struct PE_Import_Directory
140 u_int Import_List;
141 u_int TimeDate;
142 u_int Forwarder;
143 u_int ModuleName;
144 u_int Thunk_List;
147 struct pe_import_name
149 u_short Hint;
150 u_char Name[1];
154 * Export module directory stuff
157 struct PE_Export_Directory
159 u_long Characteristics;
160 u_long TimeDateStamp;
161 u_short Major_version;
162 u_short Minor_version;
163 u_long Name;
164 u_long Base;
165 u_long Number_Of_Functions;
166 u_long Number_Of_Names;
167 u_long * AddressOfFunctions;
168 u_long * AddressOfNames;
169 u_short * Address_Of_Name_Ordinals;
170 /* u_char ModuleName[1]; */
174 * Resource directory stuff
177 struct PE_Resource_Directory
179 u_long Characteristics;
180 u_long TimeDateStamp;
181 u_short MajorVersion;
182 u_short MinorVersion;
183 u_short NumberOfNamedEntries;
184 u_short NumberOfIdEntries;
187 struct PE_Directory_Entry
189 u_long Name;
190 u_long OffsetToData;
193 struct PE_Directory_Name_String
195 u_short Length;
196 char NameString[1];
199 struct PE_Directory_Name_String_U
201 u_short Length;
202 u_short NameString[1];
205 struct PE_Resource_Leaf_Entry
207 u_long OffsetToData;
208 u_long Size;
209 u_long CodePage;
210 u_long Reserved;
213 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
214 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
216 struct PE_Reloc_Block
218 u_long PageRVA;
219 u_long BlockSize;
220 short Relocations[1];
223 #define IMAGE_REL_BASED_ABSOLUTE 0
224 #define IMAGE_REL_BASED_HIGH 1
225 #define IMAGE_REL_BASED_LOW 2
226 #define IMAGE_REL_BASED_HIGHLOW 3
227 #define IMAGE_REL_BASED_HIGHADJ 4
228 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
230 #endif /* __WINE_PEEXE_H */