Upx_Doxygen
https://github.com/upx/upx
p_djgpp2.h
1 /* p_djgpp2.h --
2 
3  This file is part of the UPX executable compressor.
4 
5  Copyright (C) 1996-2016 Markus Franz Xaver Johannes Oberhumer
6  Copyright (C) 1996-2016 Laszlo Molnar
7  All Rights Reserved.
8 
9  UPX and the UCL library are free software; you can redistribute them
10  and/or modify them under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 2 of
12  the License, or (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING.
21  If not, write to the Free Software Foundation, Inc.,
22  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 
24  Markus F.X.J. Oberhumer Laszlo Molnar
25  <markus@oberhumer.com> <ezerotven+github@gmail.com>
26  */
27 
28 
29 #ifndef __UPX_P_DJGPP2_H
30 #define __UPX_P_DJGPP2_H 1
31 
32 
33 /*************************************************************************
34 // djgpp2/coff
35 **************************************************************************/
36 
37 class PackDjgpp2 : public Packer
38 {
39  typedef Packer super;
40 
41 public:
43  virtual int getVersion() const { return 14; }
44  virtual int getFormat() const { return UPX_F_DJGPP2_COFF; }
45  virtual const char *getName() const { return "djgpp2/coff"; }
46  virtual const char *getFullName(const options_t *) const { return "i386-dos32.djgpp2.coff"; }
47  virtual const int *getCompressionMethods(int method, int level) const;
48  virtual const int *getFilters() const;
49 
50  virtual void pack(OutputFile *fo);
51  virtual void unpack(OutputFile *fo);
52 
53  virtual bool canPack();
54  virtual int canUnpack();
55 
56 protected:
57  virtual void handleStub(OutputFile *fo);
58  virtual int readFileHeader();
59 
60  virtual unsigned findOverlapOverhead(const upx_bytep buf,
61  const upx_bytep tbuf,
62  unsigned range = 0,
63  unsigned upper_limit = ~0u) const;
64  virtual void buildLoader(const Filter *ft);
65  virtual Linker* newLinker() const;
66 
67  unsigned coff_offset;
68 
69  __packed_struct(external_scnhdr_t)
70  char _[12]; // name, paddr
71  LE32 vaddr;
72  LE32 size;
73  LE32 scnptr;
74  char misc[12]; // relptr, lnnoptr, nreloc, nlnno
75  char __[4]; // flags
76  __packed_struct_end()
77 
78  __packed_struct(coff_header_t)
79  // ext_file_hdr
80  LE16 f_magic;
81  LE16 f_nscns;
82  char _[4]; // f_timdat
83  LE32 f_symptr;
84  LE32 f_nsyms;
85  char __[2]; // f_opthdr
86  LE16 f_flags;
87 
88  // aout_hdr
89  LE16 a_magic;
90  char ___[2]; // a_vstamp
91  LE32 a_tsize;
92  LE32 a_dsize;
93  char ____[4]; // a_bsize
94  LE32 a_entry;
95  char _____[8]; // a_text_start a_data_start
96 
97  // section headers
98  external_scnhdr_t sh[3];
99  __packed_struct_end()
100 
101  coff_header_t coff_hdr;
102  external_scnhdr_t *text,*data,*bss;
103 
104  void stripDebug();
105 };
106 
107 
108 #endif /* already included */
109 
110 /* vim:set ts=4 sw=4 et: */
Definition: linker.h:35
Definition: options.h:45
Definition: file.h:89
Definition: packer.h:115
Definition: file.h:121
Definition: p_djgpp2.h:37
Definition: filter.h:53