Release 941122
[wine/multimedia.git] / include / peexe.h
blobd5ce3428585880d7b9d9a3adb6eb42252bd27ce4
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 reserved[2];
142 u_int ModuleName;
143 u_int reserved1;
146 struct pe_import_name
148 u_short Hint;
149 u_char Name[1];
153 * Export module directory stuff
156 struct PE_Export_Directory
158 u_long Characteristics;
159 u_long TimeDateStamp;
160 u_short Major_version;
161 u_short Minor_version;
162 u_long Name;
163 u_long Base;
164 u_long Number_Of_Functions;
165 u_long Number_Of_Names;
166 u_long * AddressOfFunctions;
167 u_long * AddressOfNames;
168 u_short * Address_Of_Name_Ordinals;
172 * Resource directory stuff
175 struct PE_Resource_Directory
177 u_long Characteristics;
178 u_long TimeDateStamp;
179 u_short MajorVersion;
180 u_short MinorVersion;
181 u_short NumberOfNamedEntries;
182 u_short NumberOfIdEntries;
185 struct PE_Directory_Entry
187 u_long Name;
188 u_long OffsetToData;
191 struct PE_Directory_Name_String
193 u_short Length;
194 char NameString[1];
197 struct PE_Directory_Name_String_U
199 u_short Length;
200 u_short NameString[1];
203 struct PE_Resource_Leaf_Entry
205 u_long OffsetToData;
206 u_long Size;
207 u_long CodePage;
208 u_long Reserved;
211 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
212 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
214 #endif /* __WINE_PEEXE_H */