1 /* p_tmt.h --
2 
3    This file is part of the UPX executable compressor.
4 
5    Copyright (C) 1996-2020 Markus Franz Xaver Johannes Oberhumer
6    Copyright (C) 1996-2020 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_TMT_H
30 #define __UPX_P_TMT_H 1
31 
32 
33 /*************************************************************************
34 // tmt/adam
35 **************************************************************************/
36 
37 class PackTmt : public Packer
38 {
39     typedef Packer super;
40 public:
41     PackTmt(InputFile *f);
getVersion()42     virtual int getVersion() const { return 13; }
getFormat()43     virtual int getFormat() const { return UPX_F_TMT_ADAM; }
getName()44     virtual const char *getName() const { return "tmt/adam"; }
getFullName(const options_t *)45     virtual const char *getFullName(const options_t *) const { return "i386-dos32.tmt.adam"; }
46     virtual const int *getCompressionMethods(int method, int level) const;
47     virtual const int *getFilters() const;
48 
49     virtual void pack(OutputFile *fo);
50     virtual void unpack(OutputFile *fo);
51 
52     virtual bool canPack();
53     virtual int canUnpack();
54 
55 protected:
56     virtual int readFileHeader();
57 
58     virtual unsigned findOverlapOverhead(const upx_bytep buf,
59                                          const upx_bytep tbuf,
60                                          unsigned range = 0,
61                                          unsigned upper_limit = ~0u) const;
62     virtual void buildLoader(const Filter *ft);
63     virtual Linker* newLinker() const;
64 
65     unsigned adam_offset;
66     int big_relocs;
67 
68     struct tmt_header_t
69     {
70         char _[16];     // signature,linkerversion,minversion,exesize,imagestart
71         LE32 imagesize;
72         char __[4];     // initial memory
73         LE32 entry;
74         char ___[12];   // esp,numfixups,flags
75         LE32 relocsize;
76     } ih, oh;
77 };
78 
79 
80 #endif /* already included */
81 
82 /* vim:set ts=4 sw=4 et: */
83