This commit is contained in:
László Molnár 2014-03-06 22:38:15 +01:00
commit 804a0ce601
14 changed files with 1938 additions and 6252 deletions

File diff suppressed because it is too large Load Diff

View File

@ -34,9 +34,9 @@
// arm/pe
**************************************************************************/
class PackArmPe : public PeFile
class PackArmPe : public PeFile32
{
typedef PeFile super;
typedef PeFile32 super;
public:
PackArmPe(InputFile *f);
@ -47,18 +47,26 @@ public:
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
virtual bool handleForceOption();
virtual void callCompressWithFilters(Filter &, int filter_strategy,
unsigned ih_codebase);
virtual void defineSymbols(unsigned ncsection, unsigned upxsection,
unsigned sizeof_oh, unsigned isize_isplit,
Reloc &rel, unsigned s1addr);
virtual void addNewRelocations(Reloc &, unsigned upxsection);
virtual unsigned getProcessImportParam(unsigned upxsection);
virtual void setOhDataBase(const pe_section_t *osection);
virtual void setOhHeaderSize(const pe_section_t *osection);
virtual void pack(OutputFile *fo);
virtual bool canPack();
virtual int canUnpack();
protected:
virtual void buildLoader(const Filter *ft);
virtual Linker* newLinker() const;
virtual unsigned processImports();
virtual void processImports(unsigned, unsigned);
virtual void rebuildImports(upx_byte *&);
virtual void addKernelImports();
virtual void processTls(Interval *);

File diff suppressed because it is too large Load Diff

View File

@ -34,9 +34,9 @@
// w32/pe
**************************************************************************/
class PackW32Pe : public PeFile
class PackW32Pe : public PeFile32
{
typedef PeFile super;
typedef PeFile32 super;
public:
PackW32Pe(InputFile *f);
@ -47,36 +47,22 @@ public:
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
virtual bool handleForceOption();
virtual void defineSymbols(unsigned ncsection, unsigned upxsection,
unsigned sizeof_oh, unsigned isize_isplit,
Reloc &rel, unsigned s1addr);
virtual void addNewRelocations(Reloc &, unsigned upxsection);
virtual void setOhDataBase(const pe_section_t *osection);
virtual void setOhHeaderSize(const pe_section_t *osection);
virtual void pack(OutputFile *fo);
virtual bool canPack();
virtual int canUnpack();
protected:
virtual int readFileHeader();
virtual void buildLoader(const Filter *ft);
virtual Linker* newLinker() const;
virtual unsigned processImports();
virtual void processImports(unsigned, unsigned);
virtual void rebuildImports(upx_byte *&);
virtual void processTls(Interval *); //NEW: TLS callback handling - Stefan Widmann
void processTls(Reloc *, const Interval *, unsigned); //NEW: TLS callback handling - Stefan Widmann
void processLoadConf(Reloc *, const Interval *, unsigned);
void processLoadConf(Interval *);
upx_byte *oloadconf;
unsigned soloadconf;
unsigned tlscb_ptr; //NEW: TLS callback handling - Stefan Widmann
unsigned tls_handler_offset;
bool isrtm;
bool use_dep_hack;
bool use_clear_dirty_stack;
bool use_tls_callbacks; //NEW: TLS callback handling - Stefan Widmann
};

File diff suppressed because it is too large Load Diff

View File

@ -33,9 +33,9 @@
// w64/pep
**************************************************************************/
class PackW64Pep : public PepFile
class PackW64Pep : public PeFile64
{
typedef PepFile super;
typedef PeFile64 super;
public:
PackW64Pep(InputFile *f);
@ -46,36 +46,19 @@ public:
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
virtual bool handleForceOption();
virtual void defineSymbols(unsigned ncsection, unsigned upxsection,
unsigned sizeof_oh, unsigned isize_isplit,
Reloc &rel, unsigned s1addr);
virtual void setOhDataBase(const pe_section_t *) {}
virtual void setOhHeaderSize(const pe_section_t *osection);
virtual void pack(OutputFile *fo);
virtual bool canPack();
virtual int canUnpack();
protected:
virtual int readFileHeader();
virtual void buildLoader(const Filter *ft);
virtual Linker* newLinker() const;
virtual unsigned processImports();
virtual void processImports(unsigned, unsigned);
virtual void rebuildImports(upx_byte *&);
virtual void processTls(Interval *); //NEW: TLS callback handling - Stefan Widmann
void processTls(Reloc *, const Interval *, unsigned); //NEW: TLS callback handling - Stefan Widmann
void processLoadConf(Reloc *, const Interval *, unsigned);
void processLoadConf(Interval *);
upx_byte *oloadconf;
unsigned soloadconf;
unsigned tlscb_ptr; //NEW: TLS callback handling - Stefan Widmann
unsigned tls_handler_offset;
bool isrtm;
bool use_dep_hack;
bool use_clear_dirty_stack;
bool use_tls_callbacks; //NEW: TLS callback handling - Stefan Widmann
};

View File

@ -32,7 +32,6 @@
#include "packer.h"
#include "lefile.h"
#include "pefile.h"
#include "pepfile.h"
#include "p_elf.h"
#include "p_com.h"

File diff suppressed because it is too large Load Diff

View File

@ -42,34 +42,79 @@ protected:
class Reloc;
class Resource;
class Export;
class ImportLinker;
struct pe_section_t;
PeFile(InputFile *f);
virtual ~PeFile();
virtual int getVersion() const { return 13; }
virtual void unpack(OutputFile *fo);
void readSectionHeaders(unsigned objs, unsigned sizeof_ih);
unsigned readSections(unsigned objs, unsigned usize,
unsigned ih_filealign, unsigned ih_datasize);
void checkHeaderValues(unsigned subsystem, unsigned mask,
unsigned ih_entry, unsigned ih_filealign);
unsigned handleStripRelocs(upx_uint64_t ih_imagebase,
upx_uint64_t default_imagebase,
unsigned dllflags);
virtual bool handleForceOption() = 0;
virtual void callCompressWithFilters(Filter &, int filter_strategy,
unsigned ih_codebase);
virtual void defineSymbols(unsigned ncsection, unsigned upxsection,
unsigned sizeof_oh, unsigned isize_isplit,
Reloc &rel, unsigned s1addr) = 0;
virtual void addNewRelocations(Reloc &, unsigned) {}
void callProcessRelocs(Reloc &rel, unsigned &ic);
void callProcessResources(Resource &res, unsigned &ic);
virtual unsigned getProcessImportParam(unsigned) { return 0; }
virtual void setOhDataBase(const pe_section_t *osection) = 0;
virtual void setOhHeaderSize(const pe_section_t *osection) = 0;
template <typename LEXX, typename ht>
void pack0(OutputFile *fo, ht &ih, ht &oh,
unsigned subsystem_mask, upx_uint64_t default_imagebase,
bool last_section_rsrc_only);
template <typename ht, typename LEXX, typename ord_mask_t>
void unpack0(OutputFile *fo, const ht &ih, ht &oh,
ord_mask_t ord_mask, bool set_oft);
// unpacker capabilities
virtual bool canUnpackVersion(int version) const
{ return (version >= 12 && version <= 13); }
int canUnpack0(unsigned max_sections, LE16 &ih_objects,
LE32 &ih_entry, unsigned ihsize);
protected:
virtual int readFileHeader();
virtual bool testUnpackVersion(int version) const;
virtual void readPeHeader() = 0;
unsigned pe_offset;
template <typename LEXX, typename ord_mask_t>
unsigned processImports0(ord_mask_t ord_mask);
template <typename LEXX, typename ord_mask_t>
void rebuildImports(upx_byte *& extrainfo,
ord_mask_t ord_mask, bool set_oft);
virtual unsigned processImports() = 0;
virtual void processImports(unsigned, unsigned) = 0;
virtual void rebuildImports(upx_byte *&) = 0;
virtual void processImports(unsigned, unsigned);
upx_byte *oimport;
unsigned soimport;
upx_byte *oimpdlls;
unsigned soimpdlls;
ImportLinker *ilinker;
void addKernelImport(const char *, const char *);
virtual void addKernelImports();
upx_uint64_t ilinkerGetAddress(const char *, const char *) const;
void processRelocs();
virtual void processRelocs() = 0;
void processRelocs(Reloc *);
void rebuildRelocs(upx_byte *&);
void rebuildRelocs(upx_byte *&, unsigned bits,
unsigned flags, upx_uint64_t imagebase);
upx_byte *orelocs;
unsigned sorelocs;
upx_byte *oxrelocs;
@ -83,16 +128,34 @@ protected:
void processResources(Resource *);
void processResources(Resource *, unsigned);
void rebuildResources(upx_byte *&);
void rebuildResources(upx_byte *&, unsigned);
upx_byte *oresources;
unsigned soresources;
virtual void processTls(Interval *);
void processTls(Reloc *, const Interval *, unsigned);
template <typename>
struct tls_traits;
template <typename LEXX>
void processTls1(Interval *iv,
typename tls_traits<LEXX>::cb_value_t imagebase,
unsigned imagesize); // pass 1
template <typename LEXX>
void processTls2(Reloc *rel,const Interval *iv,unsigned newaddr,
typename tls_traits<LEXX>::cb_value_t imagebase); // pass 2
virtual void processTls(Interval *iv) = 0;
virtual void processTls(Reloc *r, const Interval *iv, unsigned a) = 0;
void rebuildTls();
upx_byte *otls;
unsigned sotls;
unsigned tlsindex;
unsigned tlscb_ptr;
unsigned tls_handler_offset;
bool use_tls_callbacks;
void processLoadConf(Reloc *, const Interval *, unsigned);
void processLoadConf(Interval *);
upx_byte *oloadconf;
unsigned soloadconf;
unsigned stripDebug(unsigned);
@ -106,49 +169,17 @@ protected:
unsigned crelocs; // rva of preprocessed fixups
int big_relocs;
__packed_struct(pe_header_t)
// 0x0
char _[4]; // pemagic
LE16 cpu;
LE16 objects;
char __[12]; // timestamp + reserved
LE16 opthdrsize;
LE16 flags;
// optional header
LE16 coffmagic; // NEW: Stefan Widmann
char ___[2]; // linkerversion
LE32 codesize;
// 0x20
LE32 datasize;
LE32 bsssize;
LE32 entry;
LE32 codebase;
// 0x30
LE32 database;
// nt specific fields
LE32 imagebase;
LE32 objectalign;
LE32 filealign; // should set to 0x200 ?
// 0x40
char ____[16]; // versions
// 0x50
LE32 imagesize;
LE32 headersize;
LE32 chksum; // should set to 0
LE16 subsystem;
LE16 dllflags;
// 0x60
char _____[20]; // stack + heap sizes
// 0x74
LE32 ddirsentries; // usually 16
__packed_struct(ddirs_t)
LE32 vaddr;
LE32 size;
__packed_struct_end()
ddirs_t ddirs[16];
__packed_struct(ddirs_t)
LE32 vaddr;
LE32 size;
__packed_struct_end()
ddirs_t *iddirs;
ddirs_t *oddirs;
LE32 &IDSIZE(unsigned x) { return iddirs[x].size; }
LE32 &IDADDR(unsigned x) { return iddirs[x].vaddr; }
LE32 &ODSIZE(unsigned x) { return oddirs[x].size; }
LE32 &ODADDR(unsigned x) { return oddirs[x].vaddr; }
__packed_struct(pe_section_t)
char name[8];
@ -160,8 +191,12 @@ protected:
LE32 flags;
__packed_struct_end()
pe_header_t ih, oh;
pe_section_t *isection;
bool isdll;
bool isrtm;
bool use_dep_hack;
bool use_clear_dirty_stack;
static unsigned virta2objnum (unsigned, pe_section_t *, unsigned);
unsigned tryremove (unsigned, unsigned);
@ -372,6 +407,128 @@ protected:
};
class PeFile32 : public PeFile
{
typedef PeFile super;
protected:
PeFile32(InputFile *f);
virtual ~PeFile32();
void pack0(OutputFile *fo, unsigned subsystem_mask,
upx_uint64_t default_imagebase, bool last_section_rsrc_only);
virtual void unpack(OutputFile *fo);
virtual int canUnpack();
virtual void readPeHeader();
virtual unsigned processImports();
virtual void processRelocs();
virtual void processTls(Interval *);
void processTls(Reloc *, const Interval *, unsigned);
__packed_struct(pe_header_t)
// 0x0
char _[4]; // pemagic
LE16 cpu;
LE16 objects;
char __[12]; // timestamp + reserved
LE16 opthdrsize;
LE16 flags;
// optional header
LE16 coffmagic; // NEW: Stefan Widmann
char ___[2]; // linkerversion
LE32 codesize;
// 0x20
LE32 datasize;
LE32 bsssize;
LE32 entry;
LE32 codebase;
// 0x30
LE32 database;
// nt specific fields
LE32 imagebase;
LE32 objectalign;
LE32 filealign; // should set to 0x200 ?
// 0x40
char ____[16]; // versions
// 0x50
LE32 imagesize;
LE32 headersize;
LE32 chksum; // should set to 0
LE16 subsystem;
LE16 dllflags;
// 0x60
char _____[20]; // stack + heap sizes
// 0x74
LE32 ddirsentries; // usually 16
ddirs_t ddirs[16];
__packed_struct_end()
pe_header_t ih, oh;
};
class PeFile64 : public PeFile
{
typedef PeFile super;
protected:
PeFile64(InputFile *f);
virtual ~PeFile64();
void pack0(OutputFile *fo, unsigned subsystem_mask,
upx_uint64_t default_imagebase);
virtual void unpack(OutputFile *fo);
virtual int canUnpack();
virtual void readPeHeader();
virtual unsigned processImports();
virtual void processRelocs();
virtual void processTls(Interval *);
void processTls(Reloc *, const Interval *, unsigned);
__packed_struct(pe_header_t)
// 0x0
char _[4]; // pemagic
LE16 cpu;
LE16 objects; // number of sections
char __[12]; // timestamp + reserved
LE16 opthdrsize;
LE16 flags; // characteristics
// optional header
LE16 coffmagic; // NEW: Stefan Widmann
char ___[2]; // linkerversion
LE32 codesize;
// 0x20
LE32 datasize;
LE32 bsssize;
LE32 entry; // still a 32 bit RVA
LE32 codebase;
// 0x30
//LE32 database; // field does not exist in PE+!
// nt specific fields
LE64 imagebase; // LE32 -> LE64 - Stefan Widmann standard is 0x0000000140000000
LE32 objectalign;
LE32 filealign; // should set to 0x200 ?
// 0x40
char ____[16]; // versions
// 0x50
LE32 imagesize;
LE32 headersize;
LE32 chksum; // should set to 0
LE16 subsystem;
LE16 dllflags;
// 0x60
char _____[36]; // stack + heap sizes + loader flag
// 0x84
LE32 ddirsentries; // usually 16
ddirs_t ddirs[16];
__packed_struct_end()
pe_header_t ih, oh;
};
#endif /* already included */

File diff suppressed because it is too large Load Diff

View File

@ -1,386 +0,0 @@
/* pepfile.h --
This file is part of the UPX executable compressor.
Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2014 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
-------------------------------------------------------------------
PE+ format extension changes (C) 2010 Stefan Widmann
changes in:
- pe_header_t
*/
#ifndef __UPX_PEPFILE_H
#define __UPX_PEPFILE_H 1
/*************************************************************************
// general/pe handling
**************************************************************************/
class PepFile : public Packer
{
typedef Packer super;
protected:
class Interval;
class Reloc;
class Resource;
class Export;
PepFile(InputFile *f);
virtual ~PepFile();
virtual int getVersion() const { return 13; }
virtual void unpack(OutputFile *fo);
// unpacker capabilities
virtual bool canUnpackVersion(int version) const
{ return (version >= 12 && version <= 13); }
protected:
virtual int readFileHeader();
virtual bool testUnpackVersion(int version) const;
unsigned pe_offset;
virtual unsigned processImports() = 0;
virtual void processImports(unsigned, unsigned) = 0;
virtual void rebuildImports(upx_byte *&) = 0;
upx_byte *oimport;
unsigned soimport;
upx_byte *oimpdlls;
unsigned soimpdlls;
void processRelocs();
void processRelocs(Reloc *);
void rebuildRelocs(upx_byte *&);
upx_byte *orelocs;
unsigned sorelocs;
upx_byte *oxrelocs;
unsigned soxrelocs;
void processExports(Export *);
void processExports(Export *,unsigned);
void rebuildExports();
upx_byte *oexport;
unsigned soexport;
void processResources(Resource *);
void processResources(Resource *, unsigned);
void rebuildResources(upx_byte *&);
upx_byte *oresources;
unsigned soresources;
// virtual void processTls(Interval *);
// void processTls(Reloc *, const Interval *, unsigned);
void rebuildTls();
upx_byte *otls;
unsigned sotls;
unsigned tlsindex;
unsigned stripDebug(unsigned);
unsigned icondir_offset;
int icondir_count;
bool importbyordinal;
bool kernel32ordinal;
unsigned rvamin;
unsigned cimports; // rva of preprocessed imports
unsigned crelocs; // rva of preprocessed fixups
int big_relocs;
__packed_struct(pe_header_t)
// 0x0
char _[4]; // pemagic
LE16 cpu;
LE16 objects; // number of sections
char __[12]; // timestamp + reserved
LE16 opthdrsize;
LE16 flags; // characteristics
// optional header
LE16 coffmagic; // NEW: Stefan Widmann
char ___[2]; // linkerversion
LE32 codesize;
// 0x20
LE32 datasize;
LE32 bsssize;
LE32 entry; // still a 32 bit RVA
LE32 codebase;
// 0x30
//LE32 database; // field does not exist in PE+!
// nt specific fields
LE64 imagebase; // LE32 -> LE64 - Stefan Widmann standard is 0x0000000140000000
LE32 objectalign;
LE32 filealign; // should set to 0x200 ?
// 0x40
char ____[16]; // versions
// 0x50
LE32 imagesize;
LE32 headersize;
LE32 chksum; // should set to 0
LE16 subsystem;
LE16 dllflags;
// 0x60
char _____[36]; // stack + heap sizes + loader flag
// 0x84
LE32 ddirsentries; // usually 16
__packed_struct(ddirs_t)
LE32 vaddr; // dir RVAs and sizes are still 32 bit
LE32 size;
__packed_struct_end()
ddirs_t ddirs[16];
__packed_struct_end()
__packed_struct(pe_section_t) // no change in section description structures
char name[8];
LE32 vsize;
LE32 vaddr;
LE32 size;
LE32 rawdataptr;
char _[12];
LE32 flags;
__packed_struct_end()
pe_header_t ih, oh;
pe_section_t *isection;
static unsigned virta2objnum (unsigned, pe_section_t *, unsigned);
unsigned tryremove (unsigned, unsigned);
enum {
PEDIR_EXPORT = 0,
PEDIR_IMPORT = 1,
PEDIR_RESOURCE = 2,
PEDIR_EXCEPTION = 3, // Exception table
PEDIR_SEC = 4, // Certificate table (file pointer)
PEDIR_RELOC = 5,
PEDIR_DEBUG = 6,
PEDIR_COPYRIGHT = 7, // Architecture-specific data
PEDIR_GLOBALPTR = 8, // Global pointer
PEDIR_TLS = 9,
PEDIR_LOADCONF = 10, // Load Config Table
PEDIR_BOUNDIM = 11,
PEDIR_IAT = 12,
PEDIR_DELAYIMP = 13, // Delay Import Descriptor
PEDIR_COMRT = 14 // Com+ Runtime Header
};
enum {
PEFL_CODE = 0x20,
PEFL_DATA = 0x40,
PEFL_BSS = 0x80,
PEFL_INFO = 0x200,
PEFL_EXTRELS = 0x01000000, // extended relocations
PEFL_DISCARD = 0x02000000,
PEFL_NOCACHE = 0x04000000,
PEFL_NOPAGE = 0x08000000,
PEFL_SHARED = 0x10000000,
PEFL_EXEC = 0x20000000,
PEFL_READ = 0x40000000,
PEFL_WRITE = 0x80000000
};
enum {
RELOCS_STRIPPED = 0x0001,
EXECUTABLE = 0x0002,
LNUM_STRIPPED = 0x0004,
LSYMS_STRIPPED = 0x0008,
AGGRESSIVE_TRIM = 0x0010,
TWO_GIGS_AWARE = 0x0020,
FLITTLE_ENDIAN = 0x0080,
BITS_32_MACHINE = 0x0100,
DEBUG_STRIPPED = 0x0200,
REMOVABLE_SWAP = 0x0400,
SYSTEM_PROGRAM = 0x1000,
DLL_FLAG = 0x2000,
FBIG_ENDIAN = 0x8000
};
//NEW: DLL characteristics definition for ASLR, ... - Stefan Widmann
enum {
IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE = 0x0040,
IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY = 0x0080,
IMAGE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100,
IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0x0200,
IMAGE_DLLCHARACTERISTICS_NO_SEH = 0x0400,
IMAGE_DLLCHARACTERISTICS_NO_BIND = 0x0800,
IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 0x2000,
IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
};
// predefined resource types
enum {
RT_CURSOR = 1, RT_BITMAP, RT_ICON, RT_MENU, RT_DIALOG, RT_STRING,
RT_FONTDIR, RT_FONT, RT_ACCELERATOR, RT_RCDATA, RT_MESSAGETABLE,
RT_GROUP_CURSOR, RT_GROUP_ICON = 14, RT_VERSION = 16, RT_DLGINCLUDE,
RT_PLUGPLAY = 19, RT_VXD, RT_ANICURSOR, RT_ANIICON, RT_HTML,
RT_MANIFEST, RT_LAST
};
class Interval : private noncopyable
{
unsigned capacity;
void *base;
public:
struct interval
{
unsigned start, len;
} *ivarr;
unsigned ivnum;
Interval(void *b);
~Interval();
void add(unsigned start,unsigned len);
void add(const void *start,unsigned len);
void add(const void *start,const void *end);
void add(const Interval *iv);
void flatten();
void clear();
void dump() const;
private:
static int __acc_cdecl_qsort compare(const void *p1,const void *p2);
};
class Reloc : private noncopyable
{
upx_byte *start;
unsigned size;
void newRelocPos(void *p);
struct reloc;
reloc *rel;
LE16 *rel1;
unsigned counts[16];
public:
Reloc(upx_byte *,unsigned);
Reloc(unsigned rnum);
//
bool next(unsigned &pos,unsigned &type);
const unsigned *getcounts() const { return counts; }
//
void add(unsigned pos,unsigned type);
void finish(upx_byte *&p,unsigned &size);
};
class Resource : private noncopyable
{
struct res_dir_entry;
struct res_dir;
struct res_data;
struct upx_rnode;
struct upx_rbranch;
struct upx_rleaf;
const upx_byte *start;
upx_byte *newstart;
upx_rnode *root;
upx_rleaf *head;
upx_rleaf *current;
unsigned dsize;
unsigned ssize;
void check(const res_dir*,unsigned);
upx_rnode *convert(const void *,upx_rnode *,unsigned);
void build(const upx_rnode *,unsigned &,unsigned &,unsigned);
void clear(upx_byte *,unsigned,Interval *);
void dump(const upx_rnode *,unsigned) const;
void destroy(upx_rnode *urd,unsigned level);
public:
Resource();
Resource(const upx_byte *p);
~Resource();
void init(const upx_byte *);
unsigned dirsize() const;
bool next();
unsigned itype() const;
const upx_byte *ntype() const;
unsigned size() const;
unsigned offs() const;
unsigned &newoffs();
upx_byte *build();
bool clear();
void dump() const;
unsigned iname() const;
const upx_byte *nname() const;
/*
unsigned ilang() const {return current->id;}
const upx_byte *nlang() const {return current->name;}
*/
};
class Export : private noncopyable
{
__packed_struct(export_dir_t)
char _[12]; // flags, timedate, version
LE32 name;
char __[4]; // ordinal base
LE32 functions;
LE32 names;
LE32 addrtable;
LE32 nameptrtable;
LE32 ordinaltable;
__packed_struct_end()
export_dir_t edir;
char *ename;
char *functionptrs;
char *ordinals;
char **names;
char *base;
unsigned size;
Interval iv;
public:
Export(char *_base);
~Export();
void convert(unsigned eoffs,unsigned esize);
void build(char *base,unsigned newoffs);
unsigned getsize() const { return size; }
};
};
#endif /* already included */
/*
vi:ts=4:et
*/

View File

@ -1,5 +1,5 @@
/* amd64-win64.pep.h
created from amd64-win64.pep.bin, 21168 (0x52b0) bytes
created from amd64-win64.pep.bin, 21244 (0x52fc) bytes
This file is part of the UPX executable compressor.
@ -31,11 +31,11 @@
*/
#define STUB_AMD64_WIN64_PEP_SIZE 21168
#define STUB_AMD64_WIN64_PEP_ADLER32 0x11b3b4f8
#define STUB_AMD64_WIN64_PEP_CRC32 0xa0ed3bbf
#define STUB_AMD64_WIN64_PEP_SIZE 21244
#define STUB_AMD64_WIN64_PEP_ADLER32 0x8f35c2d8
#define STUB_AMD64_WIN64_PEP_CRC32 0x26033695
unsigned char stub_amd64_win64_pep[21168] = {
unsigned char stub_amd64_win64_pep[21244] = {
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0010 */ 1, 0, 62, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0,176, 27, 0, 0, 0, 0, 0, 0,
@ -414,20 +414,20 @@ unsigned char stub_amd64_win64_pep[21168] = {
/* 0x1770 */ 233, 4,138, 7, 72,131,199, 1, 72,255,201,117,217,235, 5, 72,
/* 0x1780 */ 255,201,117,190, 72,131,236, 40, 72,141,190, 0, 0, 0, 0,139,
/* 0x1790 */ 7, 9,192,116,255,139, 95, 4, 72,141,140, 48, 0, 0, 0, 0,
/* 0x17a0 */ 72, 1,243, 72,131,199, 8,255,150, 0, 0, 0, 0, 72,149,138,
/* 0x17a0 */ 72, 1,243, 72,131,199, 8,255, 21, 0, 0, 0, 0, 72,149,138,
/* 0x17b0 */ 7, 72,255,199, 8,192,116,215,121,255,122, 16,139, 7, 72,131,
/* 0x17c0 */ 199, 4, 72,139,132, 48, 0, 0, 0, 0,235,255, 72, 15,183, 23,
/* 0x17d0 */ 72,131,199, 2,235,255, 72,137,249, 72,137,250,255,200,242,174,
/* 0x17e0 */ 72,137,233,255,150, 0, 0, 0, 0, 72, 9,192,116, 9, 72,137,
/* 0x17e0 */ 72,137,233,255, 21, 0, 0, 0, 0, 72, 9,192,116, 9, 72,137,
/* 0x17f0 */ 3, 72,131,195, 8,235,255, 72,131,196, 40, 93, 95, 94, 91, 49,
/* 0x1800 */ 192,195,255,166, 0, 0, 0, 0, 72,131,196, 40, 72,141,190, 0,
/* 0x1800 */ 192,195,255, 37, 0, 0, 0, 0, 72,131,196, 40, 72,141,190, 0,
/* 0x1810 */ 0, 0, 0, 72,131,199, 4, 72,141, 94,252, 49,192,138, 7, 72,
/* 0x1820 */ 255,199, 9,192,116,255, 60,239,119, 17, 72, 1,195, 72,139, 3,
/* 0x1830 */ 72, 15,200, 72, 1,240, 72,137, 3,235,224, 36, 15,193,224, 16,
/* 0x1840 */ 102,139, 7, 72,131,199, 2, 9,192,117,255,139, 7, 72,131,199,
/* 0x1850 */ 4,235,255, 72,135,247, 72,141,143, 0, 0, 0, 0,235, 4,102,
/* 0x1860 */ 1, 12, 7,173, 9,192,117,247,193,233, 16,235, 4,102, 1, 12,
/* 0x1870 */ 7,173, 9,192,117,247, 72,139,174, 0, 0, 0, 0, 72,141,190,
/* 0x1870 */ 7,173, 9,192,117,247, 72,139, 45, 0, 0, 0, 0, 72,141,190,
/* 0x1880 */ 0, 0, 0, 0,187, 0, 0, 0,128, 80, 73,137,225, 65,184, 4,
/* 0x1890 */ 0, 0, 0, 72,137,218, 72,137,249, 72,131,236, 32,255,213, 72,
/* 0x18a0 */ 141,135, 0, 0, 0, 0,128, 32,127,128, 96, 40,127, 76,141, 76,
@ -1223,140 +1223,145 @@ unsigned char stub_amd64_win64_pep[21168] = {
/* 0x4a00 */ 54, 95, 54, 52, 95, 51, 50, 83, 32, 32, 32, 32, 32, 32,115,116,
/* 0x4a10 */ 97,114,116, 95,111,102, 95,105,109,112,111,114,116,115, 10, 48,
/* 0x4a20 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 53, 32,
/* 0x4a30 */ 82, 95, 88, 56, 54, 95, 54, 52, 95, 51, 50, 83, 32, 32, 32, 32,
/* 0x4a40 */ 32, 32, 76,111, 97,100, 76,105, 98,114, 97,114,121, 65, 10, 10,
/* 0x4a50 */ 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82,
/* 0x4a60 */ 68, 83, 32, 70, 79, 82, 32, 91, 80, 69, 73, 66, 89, 79, 82, 68,
/* 0x4a70 */ 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32,
/* 0x4a80 */ 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4a90 */ 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48,
/* 0x4aa0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 32, 82, 95, 88,
/* 0x4ab0 */ 56, 54, 95, 54, 52, 95, 80, 67, 56, 32, 32, 32, 32, 32, 32, 98,
/* 0x4ac0 */ 121,110, 97,109,101, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79,
/* 0x4ad0 */ 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 80,
/* 0x4ae0 */ 69, 75, 51, 50, 79, 82, 68, 93, 58, 10, 79, 70, 70, 83, 69, 84,
/* 0x4af0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32,
/* 0x4b00 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76,
/* 0x4b10 */ 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4b20 */ 48, 48, 99, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 51, 50, 83,
/* 0x4b30 */ 32, 32, 32, 32, 32, 32,107,101,114,110,101,108, 51, 50, 95,111,
/* 0x4b40 */ 114,100,105,110, 97,108,115, 10, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4b50 */ 48, 48, 48, 48, 48, 48, 49, 49, 32, 82, 95, 88, 56, 54, 95, 54,
/* 0x4b60 */ 52, 95, 80, 67, 56, 32, 32, 32, 32, 32, 32,110,101,120,116, 95,
/* 0x4b70 */ 105,109,112, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32,
/* 0x4b80 */ 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 80, 69, 73,
/* 0x4b90 */ 77, 79, 82, 68, 49, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32,
/* 0x4ba0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32,
/* 0x4bb0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69,
/* 0x4bc0 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4bd0 */ 57, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 56, 32, 32,
/* 0x4be0 */ 32, 32, 32, 32,102,105,114,115,116, 95,105,109,112, 10, 10, 82,
/* 0x4bf0 */ 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68,
/* 0x4c00 */ 83, 32, 70, 79, 82, 32, 91, 80, 69, 73, 77, 80, 79, 82, 50, 93,
/* 0x4c10 */ 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4c20 */ 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4c30 */ 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48,
/* 0x4c40 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,102, 32, 82, 95, 88, 56,
/* 0x4c50 */ 54, 95, 54, 52, 95, 51, 50, 83, 32, 32, 32, 32, 32, 32, 71,101,
/* 0x4c60 */ 116, 80,114,111, 99, 65,100,100,114,101,115,115, 10, 48, 48, 48,
/* 0x4c70 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 48, 32, 82, 95,
/* 0x4c80 */ 88, 56, 54, 95, 54, 52, 95, 80, 67, 56, 32, 32, 32, 32, 32, 32,
/* 0x4c90 */ 110,101,120,116, 95,102,117,110, 99, 10, 10, 82, 69, 76, 79, 67,
/* 0x4ca0 */ 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79,
/* 0x4cb0 */ 82, 32, 91, 80, 69, 73, 69, 82, 69, 88, 69, 93, 58, 10, 79, 70,
/* 0x4cc0 */ 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84,
/* 0x4cd0 */ 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4ce0 */ 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4cf0 */ 48, 48, 48, 48, 48, 48, 50, 32, 82, 95, 88, 56, 54, 95, 54, 52,
/* 0x4d00 */ 95, 51, 50, 83, 32, 32, 32, 32, 32, 32, 69,120,105,116, 80,114,
/* 0x4d10 */ 111, 99,101,115,115, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79,
/* 0x4d20 */ 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 80,
/* 0x4d30 */ 69, 82, 69, 76, 79, 67, 49, 93, 58, 10, 79, 70, 70, 83, 69, 84,
/* 0x4d40 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32,
/* 0x4d50 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76,
/* 0x4d60 */ 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4d70 */ 48, 48, 51, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 51, 50, 83,
/* 0x4d80 */ 32, 32, 32, 32, 32, 32,115,116, 97,114,116, 95,111,102, 95,114,
/* 0x4d90 */ 101,108,111, 99,115, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79,
/* 0x4da0 */ 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 80,
/* 0x4db0 */ 69, 82, 69, 76, 79, 67, 51, 93, 58, 10, 79, 70, 70, 83, 69, 84,
/* 0x4dc0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32,
/* 0x4dd0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76,
/* 0x4de0 */ 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4df0 */ 48, 48,101, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 56,
/* 0x4e00 */ 32, 32, 32, 32, 32, 32,114,101,108,111, 99, 95,101,110,100,120,
/* 0x4e10 */ 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67,
/* 0x4e20 */ 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 82, 69, 76, 54, 52, 66,
/* 0x4e30 */ 73, 71, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32,
/* 0x4e40 */ 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32,
/* 0x4e50 */ 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48,
/* 0x4e60 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 51, 32, 82,
/* 0x4e70 */ 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 56, 32, 32, 32, 32, 32,
/* 0x4e80 */ 32,114,101,108,111, 99, 95, 97,100,100, 10, 10, 82, 69, 76, 79,
/* 0x4e90 */ 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70,
/* 0x4ea0 */ 79, 82, 32, 91, 82, 69, 76, 79, 67, 54, 52, 74, 93, 58, 10, 79,
/* 0x4eb0 */ 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4ec0 */ 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4ed0 */ 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4ee0 */ 48, 48, 48, 48, 48, 48, 48, 49, 32, 82, 95, 88, 56, 54, 95, 54,
/* 0x4ef0 */ 52, 95, 80, 67, 56, 32, 32, 32, 32, 32, 32,114,101,108,111, 99,
/* 0x4f00 */ 95, 97,100,100, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78,
/* 0x4f10 */ 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 80, 69,
/* 0x4f20 */ 82, 76, 79, 72, 73, 48, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32,
/* 0x4f30 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32,
/* 0x4f40 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85,
/* 0x4f50 */ 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4f60 */ 48, 54, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 51, 50, 83, 32,
/* 0x4f70 */ 32, 32, 32, 32, 32,114,101,108,111, 99, 95,100,101,108,116, 10,
/* 0x4f80 */ 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79,
/* 0x4f90 */ 82, 68, 83, 32, 70, 79, 82, 32, 91, 80, 69, 68, 69, 80, 72, 65,
/* 0x4fa0 */ 75, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32,
/* 0x4fb0 */ 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32,
/* 0x4fc0 */ 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48,
/* 0x4fd0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 51, 32, 82, 95,
/* 0x4fe0 */ 88, 56, 54, 95, 54, 52, 95, 51, 50, 83, 32, 32, 32, 32, 32, 32,
/* 0x4ff0 */ 86,105,114,116,117, 97,108, 80,114,111,116,101, 99,116, 10, 48,
/* 0x5000 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 97, 32,
/* 0x5010 */ 82, 95, 88, 56, 54, 95, 54, 52, 95, 51, 50, 83, 32, 32, 32, 32,
/* 0x5020 */ 32, 32,118,112, 95, 98, 97,115,101, 10, 48, 48, 48, 48, 48, 48,
/* 0x5030 */ 48, 48, 48, 48, 48, 48, 48, 48, 48,102, 32, 82, 95, 88, 56, 54,
/* 0x5040 */ 95, 54, 52, 95, 51, 50, 32, 32, 32, 32, 32, 32, 32,118,112, 95,
/* 0x5050 */ 115,105,122,101, 43, 48,120, 48, 48, 48, 48, 48, 48, 48, 48, 56,
/* 0x5060 */ 48, 48, 48, 48, 48, 48, 48, 10, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5070 */ 48, 48, 48, 48, 48, 48, 50, 99, 32, 82, 95, 88, 56, 54, 95, 54,
/* 0x5080 */ 52, 95, 51, 50, 83, 32, 32, 32, 32, 32, 32,115,119,114,105, 10,
/* 0x5090 */ 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79,
/* 0x50a0 */ 82, 68, 83, 32, 70, 79, 82, 32, 91, 80, 69, 84, 76, 83, 67, 93,
/* 0x50b0 */ 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x50c0 */ 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x50d0 */ 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48,
/* 0x50e0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 32, 82, 95, 88, 56,
/* 0x50f0 */ 54, 95, 54, 52, 95, 80, 67, 51, 50, 32, 32, 32, 32, 32, 80, 69,
/* 0x5100 */ 84, 76, 83, 67, 50, 45, 48,120, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5110 */ 48, 48, 48, 48, 48, 48, 48, 53, 10, 48, 48, 48, 48, 48, 48, 48,
/* 0x5120 */ 48, 48, 48, 48, 48, 48, 48, 48, 97, 32, 82, 95, 88, 56, 54, 95,
/* 0x5130 */ 54, 52, 95, 51, 50, 83, 32, 32, 32, 32, 32, 32,116,108,115, 95,
/* 0x5140 */ 109,111,100,117,108,101, 95, 98, 97,115,101, 10, 48, 48, 48, 48,
/* 0x5150 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 54, 32, 82, 95, 88,
/* 0x5160 */ 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32, 32, 32, 32, 32, 80,
/* 0x5170 */ 69, 84, 76, 83, 67, 50, 45, 48,120, 48, 48, 48, 48, 48, 48, 48,
/* 0x5180 */ 48, 48, 48, 48, 48, 48, 48, 48, 52, 10, 10, 82, 69, 76, 79, 67,
/* 0x5190 */ 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79,
/* 0x51a0 */ 82, 32, 91, 80, 69, 68, 79, 74, 85, 77, 80, 93, 58, 10, 79, 70,
/* 0x51b0 */ 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84,
/* 0x51c0 */ 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x51d0 */ 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x51e0 */ 48, 48, 48, 48, 48, 48, 49, 32, 82, 95, 88, 56, 54, 95, 54, 52,
/* 0x51f0 */ 95, 80, 67, 51, 50, 32, 32, 32, 32, 32,111,114,105,103,105,110,
/* 0x5200 */ 97,108, 95,101,110,116,114,121, 45, 48,120, 48, 48, 48, 48, 48,
/* 0x5210 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 10, 10, 82, 69, 76,
/* 0x5220 */ 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32,
/* 0x5230 */ 70, 79, 82, 32, 91, 80, 69, 84, 76, 83, 67, 50, 93, 58, 10, 79,
/* 0x5240 */ 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x5250 */ 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x5260 */ 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5270 */ 48, 48, 48, 48, 48, 48, 48, 53, 32, 82, 95, 88, 56, 54, 95, 54,
/* 0x5280 */ 52, 95, 80, 67, 51, 50, 32, 32, 32, 32, 32,116,108,115, 95, 99,
/* 0x5290 */ 97,108,108, 98, 97, 99,107,115, 95,112,116,114, 45, 48,120, 48,
/* 0x52a0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 10
/* 0x4a30 */ 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32, 32, 32,
/* 0x4a40 */ 32, 32, 76,111, 97,100, 76,105, 98,114, 97,114,121, 65, 45, 48,
/* 0x4a50 */ 120, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4a60 */ 52, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69,
/* 0x4a70 */ 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 80, 69, 73, 66, 89,
/* 0x4a80 */ 79, 82, 68, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32,
/* 0x4a90 */ 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32,
/* 0x4aa0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48,
/* 0x4ab0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 32,
/* 0x4ac0 */ 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 56, 32, 32, 32, 32,
/* 0x4ad0 */ 32, 32, 98,121,110, 97,109,101, 10, 10, 82, 69, 76, 79, 67, 65,
/* 0x4ae0 */ 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82,
/* 0x4af0 */ 32, 91, 80, 69, 75, 51, 50, 79, 82, 68, 93, 58, 10, 79, 70, 70,
/* 0x4b00 */ 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89,
/* 0x4b10 */ 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4b20 */ 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4b30 */ 48, 48, 48, 48, 48, 99, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95,
/* 0x4b40 */ 51, 50, 83, 32, 32, 32, 32, 32, 32,107,101,114,110,101,108, 51,
/* 0x4b50 */ 50, 95,111,114,100,105,110, 97,108,115, 10, 48, 48, 48, 48, 48,
/* 0x4b60 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 32, 82, 95, 88, 56,
/* 0x4b70 */ 54, 95, 54, 52, 95, 80, 67, 56, 32, 32, 32, 32, 32, 32,110,101,
/* 0x4b80 */ 120,116, 95,105,109,112, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73,
/* 0x4b90 */ 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91,
/* 0x4ba0 */ 80, 69, 73, 77, 79, 82, 68, 49, 93, 58, 10, 79, 70, 70, 83, 69,
/* 0x4bb0 */ 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69,
/* 0x4bc0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65,
/* 0x4bd0 */ 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4be0 */ 48, 48, 48, 57, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67,
/* 0x4bf0 */ 56, 32, 32, 32, 32, 32, 32,102,105,114,115,116, 95,105,109,112,
/* 0x4c00 */ 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67,
/* 0x4c10 */ 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 80, 69, 73, 77, 80, 79,
/* 0x4c20 */ 82, 50, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32,
/* 0x4c30 */ 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32,
/* 0x4c40 */ 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48,
/* 0x4c50 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,102, 32, 82,
/* 0x4c60 */ 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32, 32, 32, 32,
/* 0x4c70 */ 32, 71,101,116, 80,114,111, 99, 65,100,100,114,101,115,115, 45,
/* 0x4c80 */ 48,120, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4c90 */ 48, 52, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4ca0 */ 48, 50, 48, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 56,
/* 0x4cb0 */ 32, 32, 32, 32, 32, 32,110,101,120,116, 95,102,117,110, 99, 10,
/* 0x4cc0 */ 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79,
/* 0x4cd0 */ 82, 68, 83, 32, 70, 79, 82, 32, 91, 80, 69, 73, 69, 82, 69, 88,
/* 0x4ce0 */ 69, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32,
/* 0x4cf0 */ 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32,
/* 0x4d00 */ 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48,
/* 0x4d10 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 32, 82, 95,
/* 0x4d20 */ 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32, 32, 32, 32, 32,
/* 0x4d30 */ 69,120,105,116, 80,114,111, 99,101,115,115, 45, 48,120, 48, 48,
/* 0x4d40 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 10, 10,
/* 0x4d50 */ 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82,
/* 0x4d60 */ 68, 83, 32, 70, 79, 82, 32, 91, 80, 69, 82, 69, 76, 79, 67, 49,
/* 0x4d70 */ 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32,
/* 0x4d80 */ 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4d90 */ 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48,
/* 0x4da0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 51, 32, 82, 95, 88,
/* 0x4db0 */ 56, 54, 95, 54, 52, 95, 51, 50, 83, 32, 32, 32, 32, 32, 32,115,
/* 0x4dc0 */ 116, 97,114,116, 95,111,102, 95,114,101,108,111, 99,115, 10, 10,
/* 0x4dd0 */ 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82,
/* 0x4de0 */ 68, 83, 32, 70, 79, 82, 32, 91, 80, 69, 82, 69, 76, 79, 67, 51,
/* 0x4df0 */ 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32,
/* 0x4e00 */ 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4e10 */ 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48,
/* 0x4e20 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,101, 32, 82, 95, 88,
/* 0x4e30 */ 56, 54, 95, 54, 52, 95, 80, 67, 56, 32, 32, 32, 32, 32, 32,114,
/* 0x4e40 */ 101,108,111, 99, 95,101,110,100,120, 10, 10, 82, 69, 76, 79, 67,
/* 0x4e50 */ 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79,
/* 0x4e60 */ 82, 32, 91, 82, 69, 76, 54, 52, 66, 73, 71, 93, 58, 10, 79, 70,
/* 0x4e70 */ 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84,
/* 0x4e80 */ 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4e90 */ 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4ea0 */ 48, 48, 48, 48, 48, 48, 51, 32, 82, 95, 88, 56, 54, 95, 54, 52,
/* 0x4eb0 */ 95, 80, 67, 56, 32, 32, 32, 32, 32, 32,114,101,108,111, 99, 95,
/* 0x4ec0 */ 97,100,100, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32,
/* 0x4ed0 */ 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 82, 69, 76,
/* 0x4ee0 */ 79, 67, 54, 52, 74, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32,
/* 0x4ef0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32,
/* 0x4f00 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69,
/* 0x4f10 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x4f20 */ 49, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 56, 32, 32,
/* 0x4f30 */ 32, 32, 32, 32,114,101,108,111, 99, 95, 97,100,100, 10, 10, 82,
/* 0x4f40 */ 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68,
/* 0x4f50 */ 83, 32, 70, 79, 82, 32, 91, 80, 69, 82, 76, 79, 72, 73, 48, 93,
/* 0x4f60 */ 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4f70 */ 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x4f80 */ 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48,
/* 0x4f90 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 54, 32, 82, 95, 88, 56,
/* 0x4fa0 */ 54, 95, 54, 52, 95, 51, 50, 83, 32, 32, 32, 32, 32, 32,114,101,
/* 0x4fb0 */ 108,111, 99, 95,100,101,108,116, 10, 10, 82, 69, 76, 79, 67, 65,
/* 0x4fc0 */ 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82,
/* 0x4fd0 */ 32, 91, 80, 69, 68, 69, 80, 72, 65, 75, 93, 58, 10, 79, 70, 70,
/* 0x4fe0 */ 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89,
/* 0x4ff0 */ 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x5000 */ 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5010 */ 48, 48, 48, 48, 48, 51, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95,
/* 0x5020 */ 80, 67, 51, 50, 32, 32, 32, 32, 32, 86,105,114,116,117, 97,108,
/* 0x5030 */ 80,114,111,116,101, 99,116, 45, 48,120, 48, 48, 48, 48, 48, 48,
/* 0x5040 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 10, 48, 48, 48, 48, 48,
/* 0x5050 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 97, 32, 82, 95, 88, 56,
/* 0x5060 */ 54, 95, 54, 52, 95, 51, 50, 83, 32, 32, 32, 32, 32, 32,118,112,
/* 0x5070 */ 95, 98, 97,115,101, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5080 */ 48, 48, 48, 48, 48,102, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95,
/* 0x5090 */ 51, 50, 32, 32, 32, 32, 32, 32, 32,118,112, 95,115,105,122,101,
/* 0x50a0 */ 43, 48,120, 48, 48, 48, 48, 48, 48, 48, 48, 56, 48, 48, 48, 48,
/* 0x50b0 */ 48, 48, 48, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x50c0 */ 48, 48, 50, 99, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 51, 50,
/* 0x50d0 */ 83, 32, 32, 32, 32, 32, 32,115,119,114,105, 10, 10, 82, 69, 76,
/* 0x50e0 */ 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32,
/* 0x50f0 */ 70, 79, 82, 32, 91, 80, 69, 84, 76, 83, 67, 93, 58, 10, 79, 70,
/* 0x5100 */ 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84,
/* 0x5110 */ 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x5120 */ 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5130 */ 48, 48, 48, 48, 48, 48, 50, 32, 82, 95, 88, 56, 54, 95, 54, 52,
/* 0x5140 */ 95, 80, 67, 51, 50, 32, 32, 32, 32, 32, 80, 69, 84, 76, 83, 67,
/* 0x5150 */ 50, 45, 48,120, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5160 */ 48, 48, 48, 53, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5170 */ 48, 48, 48, 48, 97, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 51,
/* 0x5180 */ 50, 83, 32, 32, 32, 32, 32, 32,116,108,115, 95,109,111,100,117,
/* 0x5190 */ 108,101, 95, 98, 97,115,101, 10, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x51a0 */ 48, 48, 48, 48, 48, 48, 49, 54, 32, 82, 95, 88, 56, 54, 95, 54,
/* 0x51b0 */ 52, 95, 80, 67, 51, 50, 32, 32, 32, 32, 32, 80, 69, 84, 76, 83,
/* 0x51c0 */ 67, 50, 45, 48,120, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x51d0 */ 48, 48, 48, 48, 52, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79,
/* 0x51e0 */ 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 80,
/* 0x51f0 */ 69, 68, 79, 74, 85, 77, 80, 93, 58, 10, 79, 70, 70, 83, 69, 84,
/* 0x5200 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32,
/* 0x5210 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76,
/* 0x5220 */ 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5230 */ 48, 48, 49, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51,
/* 0x5240 */ 50, 32, 32, 32, 32, 32,111,114,105,103,105,110, 97,108, 95,101,
/* 0x5250 */ 110,116,114,121, 45, 48,120, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x5260 */ 48, 48, 48, 48, 48, 48, 52, 10, 10, 82, 69, 76, 79, 67, 65, 84,
/* 0x5270 */ 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32,
/* 0x5280 */ 91, 80, 69, 84, 76, 83, 67, 50, 93, 58, 10, 79, 70, 70, 83, 69,
/* 0x5290 */ 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69,
/* 0x52a0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65,
/* 0x52b0 */ 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x52c0 */ 48, 48, 48, 53, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67,
/* 0x52d0 */ 51, 50, 32, 32, 32, 32, 32,116,108,115, 95, 99, 97,108,108, 98,
/* 0x52e0 */ 97, 99,107,115, 95,112,116,114, 45, 48,120, 48, 48, 48, 48, 48,
/* 0x52f0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 10
};

View File

@ -247,7 +247,7 @@ next_dll:
add rbx, rsi
add rdi, 8
call [rsi + LoadLibraryA]
call [rip + LoadLibraryA]
xchg rax, rbp
next_func:
@ -279,7 +279,7 @@ section PEIMPOR2
first_imp:
mov rcx, rbp
call [rsi + GetProcAddress]
call [rip + GetProcAddress]
#if 1
;// FIXME: is this error handling really needed?
@ -302,7 +302,7 @@ section PEIERDLL
section PEIEREXE
// rcx contains garbage -> garbage return code
jmp [rsi + ExitProcess]
jmp [rip + ExitProcess]
section PEIMDONE
imports_done:
add rsp, 0x28
@ -377,7 +377,7 @@ relhi0:
// =============
section PEDEPHAK
mov rbp, [rsi + VirtualProtect]
mov rbp, [rip + VirtualProtect]
lea rdi, [rsi + vp_base]
mov ebx, IMM32(vp_size) // 0x1000 or 0x2000

View File

@ -194,7 +194,7 @@ OFFSET TYPE VALUE
0000000000000007 R_X86_64_32S compressed_imports
0000000000000010 R_X86_64_PC8 imports_done
0000000000000018 R_X86_64_32S start_of_imports
0000000000000025 R_X86_64_32S LoadLibraryA
0000000000000025 R_X86_64_PC32 LoadLibraryA-0x0000000000000004
RELOCATION RECORDS FOR [PEIBYORD]:
OFFSET TYPE VALUE
@ -211,12 +211,12 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [PEIMPOR2]:
OFFSET TYPE VALUE
000000000000000f R_X86_64_32S GetProcAddress
000000000000000f R_X86_64_PC32 GetProcAddress-0x0000000000000004
0000000000000020 R_X86_64_PC8 next_func
RELOCATION RECORDS FOR [PEIEREXE]:
OFFSET TYPE VALUE
0000000000000002 R_X86_64_32S ExitProcess
0000000000000002 R_X86_64_PC32 ExitProcess-0x0000000000000004
RELOCATION RECORDS FOR [PERELOC1]:
OFFSET TYPE VALUE
@ -240,7 +240,7 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [PEDEPHAK]:
OFFSET TYPE VALUE
0000000000000003 R_X86_64_32S VirtualProtect
0000000000000003 R_X86_64_PC32 VirtualProtect-0x0000000000000004
000000000000000a R_X86_64_32S vp_base
000000000000000f R_X86_64_32 vp_size+0x0000000080000000
000000000000002c R_X86_64_32S swri