Commit | Line | Data |
---|---|---|
830db048 ZF |
1 | /* msdos.h - MS-DOS and derived executable header information |
2 | ||
3 | Copyright (C) 1999-2018 Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software Foundation, | |
19 | Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ | |
20 | #ifndef _MSDOS_H | |
21 | #define _MSDOS_H | |
22 | ||
23 | #define IMAGE_DOS_SIGNATURE 0x5a4d /* MZ */ | |
24 | #define IMAGE_OS2_SIGNATURE 0x454e /* NE */ | |
25 | #define IMAGE_OS2_SIGNATURE_LE 0x454c /* LE */ | |
26 | #define IMAGE_OS2_SIGNATURE_LX 0x584c /* LX */ | |
27 | #define IMAGE_NT_SIGNATURE 0x00004550 /* PE\0\0 */ | |
28 | ||
29 | struct external_DOS_hdr | |
30 | { | |
31 | /* DOS header fields - always at offset zero in the EXE file. */ | |
32 | char e_magic[2]; /* Magic number. */ | |
33 | char e_cblp[2]; /* Bytes on last page of file. */ | |
34 | char e_cp[2]; /* Pages in file. */ | |
35 | char e_crlc[2]; /* Relocations. */ | |
36 | char e_cparhdr[2]; /* Size of header in paragraphs. */ | |
37 | char e_minalloc[2]; /* Minimum extra paragraphs needed. */ | |
38 | char e_maxalloc[2]; /* Maximum extra paragraphs needed. */ | |
39 | char e_ss[2]; /* Initial (relative) SS value. */ | |
40 | char e_sp[2]; /* Initial SP value. */ | |
41 | char e_csum[2]; /* Checksum. */ | |
42 | char e_ip[2]; /* Initial IP value. */ | |
43 | char e_cs[2]; /* Initial (relative) CS value. */ | |
44 | char e_lfarlc[2]; /* File address of relocation table. */ | |
45 | char e_ovno[2]; /* Overlay number. */ | |
46 | char e_res[4][2]; /* Reserved words, all 0x0. */ | |
47 | char e_oemid[2]; /* OEM identifier. */ | |
48 | char e_oeminfo[2]; /* OEM information. */ | |
49 | char e_res2[10][2]; /* Reserved words, all 0x0. */ | |
50 | char e_lfanew[4]; /* File address of new exe header, usually 0x80. */ | |
51 | char dos_message[16][4]; /* Other stuff, always follow DOS header. */ | |
52 | }; | |
53 | ||
54 | /* The actual DOS header only includes up to the e_ovno field. */ | |
55 | #define DOS_HDR_SIZE (offsetof (struct external_DOS_hdr, e_res)) | |
56 | ||
57 | #endif /* _MSDOS_H */ |