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