Big merge of my working tree: Added options `--all-methods', new
Packer::getCompressionMethods(), improved Packer::compressWithFilters(). committer: mfx <mfx> 978449945 +0000
This commit is contained in:
parent
1084d86063
commit
aa540f85fa
2
BUGS
2
BUGS
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
|
Copyright (c) 1996-2001 Markus Oberhumer & Laszlo Molnar
|
||||||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
||||||
http://upx.tsx.org
|
http://upx.tsx.org
|
||||||
|
|
||||||
|
|||||||
4
Makefile
4
Makefile
@ -13,6 +13,10 @@ mostlyclean clean distclean maintainer-clean:
|
|||||||
dist: distclean
|
dist: distclean
|
||||||
false
|
false
|
||||||
|
|
||||||
|
zip:
|
||||||
|
cd .. && rm -f upx-currenz.zip && zip -r upx-current.zip upx
|
||||||
|
|
||||||
|
|
||||||
cvs-admin-ko:
|
cvs-admin-ko:
|
||||||
cvs admin -ko .
|
cvs admin -ko .
|
||||||
cvs update
|
cvs update
|
||||||
|
|||||||
10
NEWS
10
NEWS
@ -2,8 +2,14 @@
|
|||||||
User visible changes for UPX
|
User visible changes for UPX
|
||||||
==================================================================
|
==================================================================
|
||||||
|
|
||||||
|
Changes in 1.12 beta (XX Jan 2001):
|
||||||
|
* UNSTABLE BETA VERSION - DO NOT USE EXCEPT FOR TESTING
|
||||||
|
* implemented several new options for finer compression control:
|
||||||
|
`--all-methods', `--all-filters' and `--brute'
|
||||||
|
* linux/386: added the option `--force-execve'
|
||||||
|
|
||||||
Changes in 1.11 beta (20 Dec 2000):
|
Changes in 1.11 beta (20 Dec 2000):
|
||||||
* UNSTABLE BETA VERSION - DO NOT USE EXCEPT FOR TESTING!!! REALLY.
|
* UNSTABLE BETA VERSION - DO NOT USE EXCEPT FOR TESTING
|
||||||
* vmlinuz/386: new format - UPX now supports bootable linux kernels
|
* vmlinuz/386: new format - UPX now supports bootable linux kernels
|
||||||
* linux/386: added the new direct-to-memory executable formats - no
|
* linux/386: added the new direct-to-memory executable formats - no
|
||||||
more temp files are needed for decompression!
|
more temp files are needed for decompression!
|
||||||
@ -188,7 +194,7 @@ Changes in 0.60 (06 Mar 1999)
|
|||||||
* fixed a bug which could make UPX hang when an exe header contained
|
* fixed a bug which could make UPX hang when an exe header contained
|
||||||
an illegal value
|
an illegal value
|
||||||
* added some compression flags for the win32/pe format
|
* added some compression flags for the win32/pe format
|
||||||
* added support for Atari ST executables (atari/tos)
|
* added support for Atari ST/TT executables (atari/tos)
|
||||||
* improved compression ratio
|
* improved compression ratio
|
||||||
* improved compression speed
|
* improved compression speed
|
||||||
|
|
||||||
|
|||||||
2
PROJECTS
2
PROJECTS
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
|
Copyright (c) 1996-2001 Markus Oberhumer & Laszlo Molnar
|
||||||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
||||||
http://upx.tsx.org
|
http://upx.tsx.org
|
||||||
|
|
||||||
|
|||||||
6
README
6
README
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
|
Copyright (c) 1996-2001 Markus Oberhumer & Laszlo Molnar
|
||||||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
||||||
http://upx.tsx.org
|
http://upx.tsx.org
|
||||||
|
|
||||||
@ -126,8 +126,8 @@ THE FUTURE
|
|||||||
COPYRIGHT
|
COPYRIGHT
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
|
|
||||||
This program may be used freely, and you are welcome to
|
This program may be used freely, and you are welcome to
|
||||||
redistribute it under certain conditions.
|
redistribute it under certain conditions.
|
||||||
|
|||||||
2
THANKS
2
THANKS
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
|
Copyright (c) 1996-2001 Markus Oberhumer & Laszlo Molnar
|
||||||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
||||||
http://upx.tsx.org
|
http://upx.tsx.org
|
||||||
|
|
||||||
|
|||||||
2
TODO
2
TODO
@ -64,8 +64,6 @@ FORMAT TMT/ADAM
|
|||||||
- the decompressors are already aligned, no need for an
|
- the decompressors are already aligned, no need for an
|
||||||
extra alignment
|
extra alignment
|
||||||
|
|
||||||
- verify that compressWithFilters() works
|
|
||||||
|
|
||||||
|
|
||||||
FORMAT WATCOM/LE
|
FORMAT WATCOM/LE
|
||||||
================
|
================
|
||||||
|
|||||||
@ -3,14 +3,14 @@ SHELL = /bin/sh
|
|||||||
top_srcdir = ..
|
top_srcdir = ..
|
||||||
|
|
||||||
PACKAGE = upx
|
PACKAGE = upx
|
||||||
VERSION_DATE = 30 Dec 2000
|
VERSION_DATE = 02 Jan 2001
|
||||||
VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING.*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING.*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
||||||
|
|
||||||
TRIMSPACE = cat
|
TRIMSPACE = cat
|
||||||
TRIMSPACE = sed -e 's/ *$$//'
|
TRIMSPACE = sed -e 's/ *$$//'
|
||||||
|
|
||||||
BUILT_SOURCES = upx.1 upx.doc upx.html upx.man upx.ps upx.tex
|
BUILT_SOURCES = upx.1 upx.doc upx.html upx.man upx.ps upx.tex
|
||||||
BUILT_SOURCES = upx.1 upx.doc upx.html upx.man
|
BUILT_SOURCES = upx.1 upx.doc upx.html
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|||||||
104
doc/upx.pod
104
doc/upx.pod
@ -12,11 +12,11 @@ B<upx> S<[ I<command> ]> S<[ I<options> ]> I<filename>...
|
|||||||
|
|
||||||
=head1 ABSTRACT
|
=head1 ABSTRACT
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996, 1997, 1998, 1999, 2000
|
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
|
||||||
Markus F.X.J. Oberhumer, Laszlo Molnar & John F. Reiser
|
Markus F.X.J. Oberhumer, Laszlo Molnar & John F. Reiser
|
||||||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
||||||
http://upx.tsx.org
|
http://upx.tsx.org
|
||||||
|
|
||||||
|
|
||||||
B<UPX> is a portable, extendable, high-performance executable packer for
|
B<UPX> is a portable, extendable, high-performance executable packer for
|
||||||
@ -178,17 +178,24 @@ squeezes out even some more compression ratio. While it is usually fine
|
|||||||
to use this option with your favorite .com file it may take a long time
|
to use this option with your favorite .com file it may take a long time
|
||||||
to compress a multi-megabyte program. You have been warned.
|
to compress a multi-megabyte program. You have been warned.
|
||||||
|
|
||||||
Tips for even better compression:
|
Tips for achieving the best compression ratio:
|
||||||
|
|
||||||
=over 4
|
=over 4
|
||||||
|
|
||||||
=item *
|
=item *
|
||||||
|
|
||||||
Try if B<--overlay=strip> works.
|
Use the compression level B<--best>.
|
||||||
|
|
||||||
=item *
|
=item *
|
||||||
|
|
||||||
Try B<--all-filters>.
|
Try one or both of the options B<--all-methods> and B<--all-filters>.
|
||||||
|
|
||||||
|
Info: the option B<--brute> is an abbrevation for all the options
|
||||||
|
B<S<--best> S<--all-methods> S<--all-filters>>.
|
||||||
|
|
||||||
|
=item *
|
||||||
|
|
||||||
|
Try if B<--overlay=strip> works.
|
||||||
|
|
||||||
=item *
|
=item *
|
||||||
|
|
||||||
@ -277,6 +284,16 @@ Extra options available for this executable format:
|
|||||||
|
|
||||||
--8086 Create an executable that works on any 8086 CPU.
|
--8086 Create an executable that works on any 8086 CPU.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=head2 NOTES FOR DOS/EXE
|
=head2 NOTES FOR DOS/EXE
|
||||||
@ -294,6 +311,11 @@ Extra options available for this executable format:
|
|||||||
|
|
||||||
--no-reloc Use no relocation records in the exe header.
|
--no-reloc Use no relocation records in the exe header.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=head2 NOTES FOR DOS/SYS
|
=head2 NOTES FOR DOS/SYS
|
||||||
@ -311,6 +333,16 @@ Extra options available for this executable format:
|
|||||||
|
|
||||||
--8086 Create an executable that works on any 8086 CPU.
|
--8086 Create an executable that works on any 8086 CPU.
|
||||||
|
|
||||||
|
--all-methods Compress the program several times, using all
|
||||||
|
available compression methods. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=head2 NOTES FOR DJGPP2/COFF
|
=head2 NOTES FOR DJGPP2/COFF
|
||||||
@ -338,10 +370,15 @@ Extra options available for this executable format:
|
|||||||
--coff Produce COFF output instead of EXE. By default
|
--coff Produce COFF output instead of EXE. By default
|
||||||
UPX keeps your current stub.
|
UPX keeps your current stub.
|
||||||
|
|
||||||
--all-filters Compress the program several times, using different
|
--all-methods Compress the program several times, using all
|
||||||
preprocessing filters. This may improve the compression
|
available compression methods. This may improve
|
||||||
ratio in some cases, but usually the default filter
|
the compression ratio in some cases, but usually
|
||||||
gives the best results anyway.
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -649,10 +686,15 @@ This format is used by the TMT Pascal compiler - see http://www.tmt.com/ .
|
|||||||
|
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
|
|
||||||
--all-filters Compress the program several times, using different
|
--all-methods Compress the program several times, using all
|
||||||
preprocessing filters. This may improve the compression
|
available compression methods. This may improve
|
||||||
ratio in some cases, but usually the default filter
|
the compression ratio in some cases, but usually
|
||||||
gives the best results anyway.
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -691,10 +733,15 @@ Drawbacks:
|
|||||||
|
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
|
|
||||||
--all-filters Compress the program several times, using different
|
--all-methods Compress the program several times, using all
|
||||||
preprocessing filters. This may improve the compression
|
available compression methods. This may improve
|
||||||
ratio in some cases, but usually the default filter
|
the compression ratio in some cases, but usually
|
||||||
gives the best results anyway.
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -770,10 +817,15 @@ Extra options available for this executable format:
|
|||||||
UPX never strips relocations from a DLL
|
UPX never strips relocations from a DLL
|
||||||
regardless of this option.
|
regardless of this option.
|
||||||
|
|
||||||
--all-filters Compress the program several times, using different
|
--all-methods Compress the program several times, using all
|
||||||
preprocessing filters. This may improve the compression
|
available compression methods. This may improve
|
||||||
ratio in some cases, but usually the default filter
|
the compression ratio in some cases, but usually
|
||||||
gives the best results anyway.
|
the default method gives the best results anyway.
|
||||||
|
|
||||||
|
--all-filters Compress the program several times, using all
|
||||||
|
available preprocessing filters. This may improve
|
||||||
|
the compression ratio in some cases, but usually
|
||||||
|
the default filter gives the best results anyway.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -805,11 +857,11 @@ Please report all bugs immediately to the authors.
|
|||||||
|
|
||||||
=head1 COPYRIGHT
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
|
|
||||||
Copyright (C) 2000 John Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
|
|
||||||
This program may be used freely, and you are welcome to
|
This program may be used freely, and you are welcome to
|
||||||
redistribute it under certain conditions.
|
redistribute it under certain conditions.
|
||||||
|
|||||||
@ -178,7 +178,8 @@ ifeq (1,2) # checkergcc
|
|||||||
else
|
else
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
##CFLAGS += -O0 -gstabs+3
|
##CFLAGS += -O0 -gstabs+3
|
||||||
CFLAGS += -O0 -gdwarf-2
|
##CFLAGS += -O0 -gdwarf-2
|
||||||
|
CFLAGS += -O0 -g
|
||||||
else
|
else
|
||||||
##LDFLAGS += -static
|
##LDFLAGS += -static
|
||||||
STUBEDIT_EXE = objcopy -S -R .comment -R .note $@ && perl $(srcdir)/stub/scripts/brandelf.pl $@ && chmod 755 $@
|
STUBEDIT_EXE = objcopy -S -R .comment -R .note $@ && perl $(srcdir)/stub/scripts/brandelf.pl $@ && chmod 755 $@
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -459,9 +459,9 @@ struct options_t {
|
|||||||
// compression options
|
// compression options
|
||||||
int method;
|
int method;
|
||||||
int level; // compression level 1..10
|
int level; // compression level 1..10
|
||||||
int mem_level; // memory level 1..9
|
|
||||||
int filter; // preferred filter from Packer::getFilters()
|
int filter; // preferred filter from Packer::getFilters()
|
||||||
bool all_filters; // try all filters ?
|
bool all_methods; // try all available compression methods ?
|
||||||
|
bool all_filters; // try all available filters ?
|
||||||
|
|
||||||
// other options
|
// other options
|
||||||
int backup;
|
int backup;
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -135,10 +135,14 @@ void throwEOFException(const char *msg, int e)
|
|||||||
|
|
||||||
const char *prettyName(const char *n)
|
const char *prettyName(const char *n)
|
||||||
{
|
{
|
||||||
while (*n >= '0' && *n <= '9') // gcc / egcs
|
#if defined(__GNUC__)
|
||||||
|
while (*n >= '0' && *n <= '9') // gcc
|
||||||
n++;
|
n++;
|
||||||
|
#endif
|
||||||
|
#if defined(_MSC_VER)
|
||||||
if (strncmp(n, "class ", 6) == 0) // Visual C++
|
if (strncmp(n, "class ", 6) == 0) // Visual C++
|
||||||
n += 6;
|
n += 6;
|
||||||
|
#endif
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
10
src/file.cpp
10
src/file.cpp
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -171,7 +171,11 @@ void FileBase::write(const void *buf, int len)
|
|||||||
void FileBase::seek(off_t off, int whence)
|
void FileBase::seek(off_t off, int whence)
|
||||||
{
|
{
|
||||||
if (!isOpen())
|
if (!isOpen())
|
||||||
throwIOException("bad seek");
|
throwIOException("bad seek 1");
|
||||||
|
if (whence == SEEK_SET && off < 0)
|
||||||
|
throwIOException("bad seek 2");
|
||||||
|
if (whence == SEEK_END && off > 0)
|
||||||
|
throwIOException("bad seek 3");
|
||||||
if (::lseek(_fd,off,whence) < 0)
|
if (::lseek(_fd,off,whence) < 0)
|
||||||
throwIOException("seek error",errno);
|
throwIOException("seek error",errno);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -129,7 +129,7 @@ bool Filter::filter(upx_byte *buf_, unsigned buf_len_)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Filter::unfilter(upx_byte *buf_, unsigned buf_len_, bool verify_checksum)
|
void Filter::unfilter(upx_byte *buf_, unsigned buf_len_, bool verify_checksum)
|
||||||
{
|
{
|
||||||
initFilter(this, buf_, buf_len_);
|
initFilter(this, buf_, buf_len_);
|
||||||
|
|
||||||
@ -137,11 +137,11 @@ bool Filter::unfilter(upx_byte *buf_, unsigned buf_len_, bool verify_checksum)
|
|||||||
if (fe == NULL)
|
if (fe == NULL)
|
||||||
throwInternalError("unfilter-1");
|
throwInternalError("unfilter-1");
|
||||||
if (fe->id == 0)
|
if (fe->id == 0)
|
||||||
return true;
|
return;
|
||||||
if (buf_len < fe->min_buf_len)
|
if (buf_len < fe->min_buf_len)
|
||||||
return false;
|
return;
|
||||||
if (fe->max_buf_len && buf_len > fe->max_buf_len)
|
if (fe->max_buf_len && buf_len > fe->max_buf_len)
|
||||||
return false;
|
return;
|
||||||
if (!fe->do_unfilter)
|
if (!fe->do_unfilter)
|
||||||
throwInternalError("unfilter-2");
|
throwInternalError("unfilter-2");
|
||||||
|
|
||||||
@ -158,12 +158,10 @@ bool Filter::unfilter(upx_byte *buf_, unsigned buf_len_, bool verify_checksum)
|
|||||||
if (this->adler != upx_adler32(a, this->buf, this->buf_len))
|
if (this->adler != upx_adler32(a, this->buf, this->buf_len))
|
||||||
throwInternalError("unfilter-4");
|
throwInternalError("unfilter-4");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Filter::verifyUnfilter()
|
void Filter::verifyUnfilter()
|
||||||
{
|
{
|
||||||
// Note:
|
// Note:
|
||||||
// This verify is just because of complete paranoia that there
|
// This verify is just because of complete paranoia that there
|
||||||
@ -175,9 +173,8 @@ bool Filter::verifyUnfilter()
|
|||||||
// Packer::verifyOverlappingDecompression()
|
// Packer::verifyOverlappingDecompression()
|
||||||
|
|
||||||
//printf("verifyUnfilter: %02x %p %d\n", this->id, this->buf, this->buf_len);
|
//printf("verifyUnfilter: %02x %p %d\n", this->id, this->buf, this->buf_len);
|
||||||
if (clevel == 1)
|
if (clevel != 1)
|
||||||
return true;
|
unfilter(this->buf, this->buf_len, true);
|
||||||
return unfilter(this->buf, this->buf_len, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
11
src/filter.h
11
src/filter.h
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -44,8 +44,7 @@ class FilterImp;
|
|||||||
// call throwFilterException() - this will cause the compression
|
// call throwFilterException() - this will cause the compression
|
||||||
// to fail.
|
// to fail.
|
||||||
//
|
//
|
||||||
// The return value of unfilters can/should be ignored. They throw
|
// Unfilters throw exceptions in case of errors.
|
||||||
// exceptions in case of errors.
|
|
||||||
//
|
//
|
||||||
// The main idea behind filters is to convert relative jumps and calls
|
// The main idea behind filters is to convert relative jumps and calls
|
||||||
// to absolute addresses so that the buffer compresses better.
|
// to absolute addresses so that the buffer compresses better.
|
||||||
@ -58,8 +57,8 @@ public:
|
|||||||
void init(int id=0, unsigned addvalue=0);
|
void init(int id=0, unsigned addvalue=0);
|
||||||
|
|
||||||
bool filter(upx_byte *buf, unsigned buf_len);
|
bool filter(upx_byte *buf, unsigned buf_len);
|
||||||
bool unfilter(upx_byte *buf, unsigned buf_len, bool verify_checksum=false);
|
void unfilter(upx_byte *buf, unsigned buf_len, bool verify_checksum=false);
|
||||||
bool verifyUnfilter();
|
void verifyUnfilter();
|
||||||
bool scan(const upx_byte *buf, unsigned buf_len);
|
bool scan(const upx_byte *buf, unsigned buf_len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
68
src/help.cpp
68
src/help.cpp
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -48,7 +48,7 @@ void show_head(void)
|
|||||||
fg = con_fg(f,FG_GREEN);
|
fg = con_fg(f,FG_GREEN);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" Ultimate Packer for eXecutables\n"
|
" Ultimate Packer for eXecutables\n"
|
||||||
" Copyright (C) 1996, 1997, 1998, 1999, 2000\n"
|
" Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001\n"
|
||||||
"UPX v%-12sMarkus F.X.J. Oberhumer & Laszlo Molnar%21s\n\n",
|
"UPX v%-12sMarkus F.X.J. Oberhumer & Laszlo Molnar%21s\n\n",
|
||||||
UPX_VERSION_STRING, UPX_VERSION_DATE);
|
UPX_VERSION_STRING, UPX_VERSION_DATE);
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
@ -137,12 +137,16 @@ void show_help(int x)
|
|||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --coff produce COFF output [default: EXE]\n"
|
" --coff produce COFF output [default: EXE]\n"
|
||||||
|
" --all-methods try all available compression methods\n"
|
||||||
|
" --all-filters try all available preprocessing filters\n"
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for dos/com:\n");
|
con_fprintf(f,"Options for dos/com:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --8086 make compressed com work on any 8086\n"
|
" --8086 make compressed com work on any 8086\n"
|
||||||
|
" --all-methods try all available compression methods\n"
|
||||||
|
" --all-filters try all available preprocessing filters\n"
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for dos/exe:\n");
|
con_fprintf(f,"Options for dos/exe:\n");
|
||||||
@ -150,13 +154,43 @@ void show_help(int x)
|
|||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --8086 make compressed exe work on any 8086\n"
|
" --8086 make compressed exe work on any 8086\n"
|
||||||
" --no-reloc put no relocations in to the exe header\n"
|
" --no-reloc put no relocations in to the exe header\n"
|
||||||
|
" --all-methods try all available compression methods\n"
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for dos/sys:\n");
|
con_fprintf(f,"Options for dos/sys:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --8086 make compressed sys work on any 8086\n"
|
" --8086 make compressed sys work on any 8086\n"
|
||||||
|
" --all-methods try all available compression methods\n"
|
||||||
|
" --all-filters try all available preprocessing filters\n"
|
||||||
"\n");
|
"\n");
|
||||||
|
#if 0
|
||||||
|
fg = con_fg(f,FG_YELLOW);
|
||||||
|
con_fprintf(f,"Options for linux/386\n");
|
||||||
|
fg = con_fg(f,fg);
|
||||||
|
con_fprintf(f,
|
||||||
|
" --script use /usr/local/lib/upx/upx[bd] as decompressor\n"
|
||||||
|
" --script=/path/upxX use path/upxX as decompressor\n"
|
||||||
|
"\n");
|
||||||
|
#endif
|
||||||
|
#if 1
|
||||||
|
fg = con_fg(f,FG_YELLOW);
|
||||||
|
con_fprintf(f,"Options for tmt/adam:\n");
|
||||||
|
fg = con_fg(f,fg);
|
||||||
|
con_fprintf(f,
|
||||||
|
" --all-methods try all available compression methods\n"
|
||||||
|
" --all-filters try all available preprocessing filters\n"
|
||||||
|
"\n");
|
||||||
|
#endif
|
||||||
|
#if 1
|
||||||
|
fg = con_fg(f,FG_YELLOW);
|
||||||
|
con_fprintf(f,"Options for [b]vmlinuz/386\n");
|
||||||
|
fg = con_fg(f,fg);
|
||||||
|
con_fprintf(f,
|
||||||
|
" --all-methods try all available compression methods\n"
|
||||||
|
" --all-filters try all available preprocessing filters\n"
|
||||||
|
"\n");
|
||||||
|
#endif
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for watcom/le:\n");
|
con_fprintf(f,"Options for watcom/le:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
@ -175,28 +209,25 @@ void show_help(int x)
|
|||||||
" --compress-resources=0 do not compress any resources at all\n"
|
" --compress-resources=0 do not compress any resources at all\n"
|
||||||
" --strip-relocs=0 do not strip relocations\n"
|
" --strip-relocs=0 do not strip relocations\n"
|
||||||
" --strip-relocs=1 strip relocations [default]\n"
|
" --strip-relocs=1 strip relocations [default]\n"
|
||||||
|
" --all-methods try all available compression methods\n"
|
||||||
|
" --all-filters try all available preprocessing filters\n"
|
||||||
"\n");
|
"\n");
|
||||||
#if 0
|
|
||||||
fg = con_fg(f,FG_YELLOW);
|
|
||||||
con_fprintf(f,"Options for linux/386\n");
|
|
||||||
fg = con_fg(f,fg);
|
|
||||||
con_fprintf(f,
|
|
||||||
" --script use /usr/local/lib/upx/upx[bd] as decompressor\n"
|
|
||||||
" --script=/path/upxX use path/upxX as decompressor\n"
|
|
||||||
"\n");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" file.. executables to (de)compress\n"
|
"file.. executables to (de)compress\n"
|
||||||
"\n"
|
"\n");
|
||||||
"This version supports:\n "
|
fg = con_fg(f,FG_YELLOW);
|
||||||
|
con_fprintf(f,"This version supports:\n");
|
||||||
|
fg = con_fg(f,fg);
|
||||||
|
con_fprintf(f," "
|
||||||
"atari/tos, "
|
"atari/tos, "
|
||||||
"bvmlinuz/386, "
|
"bvmlinuz/386, "
|
||||||
"djgpp2/coff, "
|
"djgpp2/coff, "
|
||||||
"dos/com, "
|
"dos/com, "
|
||||||
"dos/exe, "
|
"dos/exe, "
|
||||||
"dos/sys,\n "
|
"dos/sys,\n "
|
||||||
|
//"elks/8086, "
|
||||||
"linux/386, "
|
"linux/386, "
|
||||||
"linux/elf386, "
|
"linux/elf386, "
|
||||||
"linux/sh386, "
|
"linux/sh386, "
|
||||||
@ -204,6 +235,7 @@ void show_help(int x)
|
|||||||
"tmt/adam, "
|
"tmt/adam, "
|
||||||
"vmlinuz/386,\n "
|
"vmlinuz/386,\n "
|
||||||
"watcom/le, "
|
"watcom/le, "
|
||||||
|
//"win16/ne, "
|
||||||
"win32/pe"
|
"win32/pe"
|
||||||
"\n\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit http://upx.tsx.org\n"
|
"\n\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit http://upx.tsx.org\n"
|
||||||
//"\n\nUPX comes with ABSOLUTELY NO WARRANTY; for details type `upx -L'.\n"
|
//"\n\nUPX comes with ABSOLUTELY NO WARRANTY; for details type `upx -L'.\n"
|
||||||
@ -280,9 +312,9 @@ void show_version(int x)
|
|||||||
#if defined(WITH_UCL)
|
#if defined(WITH_UCL)
|
||||||
fprintf(f,"UCL data compression library %s\n", ucl_version_string());
|
fprintf(f,"UCL data compression library %s\n", ucl_version_string());
|
||||||
#endif
|
#endif
|
||||||
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Markus Franz Xaver Johannes Oberhumer\n");
|
fprintf(f,"Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer\n");
|
||||||
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Laszlo Molnar\n");
|
fprintf(f,"Copyright (C) 1996-2001 Laszlo Molnar\n");
|
||||||
fprintf(f,"Copyright (C) 2000 John F. Reiser\n");
|
fprintf(f,"Copyright (C) 2000-2001 John F. Reiser\n");
|
||||||
fprintf(f,"UPX comes with ABSOLUTELY NO WARRANTY; for details type `%s -L'.\n", progname);
|
fprintf(f,"UPX comes with ABSOLUTELY NO WARRANTY; for details type `%s -L'.\n", progname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
47
src/main.cpp
47
src/main.cpp
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -30,6 +30,7 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "mygetopt.h"
|
#include "mygetopt.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
#include "packer.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@ -44,7 +45,6 @@ void init_options(struct options_t *o)
|
|||||||
o->cmd = CMD_NONE;
|
o->cmd = CMD_NONE;
|
||||||
o->method = -1;
|
o->method = -1;
|
||||||
o->level = -1;
|
o->level = -1;
|
||||||
o->mem_level = -1;
|
|
||||||
o->filter = -1;
|
o->filter = -1;
|
||||||
|
|
||||||
o->backup = -1;
|
o->backup = -1;
|
||||||
@ -271,7 +271,12 @@ static void set_cmd(int cmd)
|
|||||||
static bool set_method(int m, int l)
|
static bool set_method(int m, int l)
|
||||||
{
|
{
|
||||||
if (m > 0)
|
if (m > 0)
|
||||||
|
{
|
||||||
|
if (!Packer::isValidCompressionMethod(m))
|
||||||
|
return false;
|
||||||
opt->method = m;
|
opt->method = m;
|
||||||
|
opt->all_methods = false;
|
||||||
|
}
|
||||||
if (l > 0)
|
if (l > 0)
|
||||||
opt->level = l;
|
opt->level = l;
|
||||||
set_cmd(CMD_COMPRESS);
|
set_cmd(CMD_COMPRESS);
|
||||||
@ -417,7 +422,7 @@ static int do_option(int optc, const char *arg)
|
|||||||
case 'f':
|
case 'f':
|
||||||
opt->force++;
|
opt->force++;
|
||||||
break;
|
break;
|
||||||
case 901:
|
case 902:
|
||||||
set_cmd(CMD_FILEINFO);
|
set_cmd(CMD_FILEINFO);
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
@ -426,9 +431,11 @@ static int do_option(int optc, const char *arg)
|
|||||||
set_cmd(CMD_HELP);
|
set_cmd(CMD_HELP);
|
||||||
break;
|
break;
|
||||||
case 'h'+256:
|
case 'h'+256:
|
||||||
|
#if 0
|
||||||
/* according to GNU standards */
|
/* according to GNU standards */
|
||||||
set_term(stdout);
|
set_term(stdout);
|
||||||
opt->console = CON_FILE;
|
opt->console = CON_FILE;
|
||||||
|
#endif
|
||||||
show_help(1);
|
show_help(1);
|
||||||
e_exit(EXIT_OK);
|
e_exit(EXIT_OK);
|
||||||
break;
|
break;
|
||||||
@ -487,16 +494,18 @@ static int do_option(int optc, const char *arg)
|
|||||||
if (!set_method(-1, optc - '0'))
|
if (!set_method(-1, optc - '0'))
|
||||||
e_method(opt->method, optc);
|
e_method(opt->method, optc);
|
||||||
break;
|
break;
|
||||||
case 900:
|
|
||||||
|
case 901: // --brute
|
||||||
|
opt->all_methods = true;
|
||||||
|
opt->method = -1;
|
||||||
|
opt->all_filters = true;
|
||||||
|
opt->filter = -1;
|
||||||
|
/* fallthrough */
|
||||||
|
case 900: // --best
|
||||||
if (!set_method(-1, 10))
|
if (!set_method(-1, 10))
|
||||||
e_method(opt->method, 10);
|
e_method(opt->method, 10);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// compression memory level
|
|
||||||
case 902:
|
|
||||||
getoptvar(&opt->mem_level, 1, 9);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
case 512:
|
case 512:
|
||||||
opt->console = CON_FILE;
|
opt->console = CON_FILE;
|
||||||
@ -525,6 +534,9 @@ static int do_option(int optc, const char *arg)
|
|||||||
opt->all_filters = true;
|
opt->all_filters = true;
|
||||||
opt->filter = -1;
|
opt->filter = -1;
|
||||||
break;
|
break;
|
||||||
|
case 528:
|
||||||
|
opt->all_methods = true;
|
||||||
|
opt->method = -1;
|
||||||
// compression parms
|
// compression parms
|
||||||
case 531:
|
case 531:
|
||||||
getoptvar(&opt->crp.c_flags, 0, 3);
|
getoptvar(&opt->crp.c_flags, 0, 3);
|
||||||
@ -665,10 +677,11 @@ static int get_options(int argc, char **argv)
|
|||||||
static const struct mfx_option longopts[] =
|
static const struct mfx_option longopts[] =
|
||||||
{
|
{
|
||||||
// commands
|
// commands
|
||||||
{"best", 0, 0, 900}, // compress best
|
{"best", 0x10, 0, 900}, // compress best
|
||||||
|
{"brute", 0x10, 0, 901}, // compress best, brute force
|
||||||
{"decompress", 0, 0, 'd'}, // decompress
|
{"decompress", 0, 0, 'd'}, // decompress
|
||||||
{"fast", 0, 0, '1'}, // compress faster
|
{"fast", 0x10, 0, '1'}, // compress faster
|
||||||
{"fileinfo", 0x10, 0, 901}, // display info about file
|
{"fileinfo", 0x10, 0, 902}, // display info about file
|
||||||
{"help", 0, 0, 'h'+256}, // give help
|
{"help", 0, 0, 'h'+256}, // give help
|
||||||
{"license", 0, 0, 'L'}, // display software license
|
{"license", 0, 0, 'L'}, // display software license
|
||||||
{"list", 0, 0, 'l'}, // list compressed exe
|
{"list", 0, 0, 'l'}, // list compressed exe
|
||||||
@ -722,8 +735,8 @@ static const struct mfx_option longopts[] =
|
|||||||
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
||||||
// compression settings
|
// compression settings
|
||||||
{"all-filters", 0x10, 0, 527},
|
{"all-filters", 0x10, 0, 527},
|
||||||
|
{"all-methods", 0x10, 0, 528},
|
||||||
{"filter", 0x31, 0, 526}, // --filter=
|
{"filter", 0x31, 0, 526}, // --filter=
|
||||||
{"mem", 0x31, 0, 902}, // --mem=
|
|
||||||
{"small", 0x10, 0, 525},
|
{"small", 0x10, 0, 525},
|
||||||
// compression runtime parameters
|
// compression runtime parameters
|
||||||
{"crp-cf", 0x31, 0, 531},
|
{"crp-cf", 0x31, 0, 531},
|
||||||
@ -785,8 +798,9 @@ static void get_envoptions(int argc, char **argv)
|
|||||||
static const struct mfx_option longopts[] =
|
static const struct mfx_option longopts[] =
|
||||||
{
|
{
|
||||||
// commands
|
// commands
|
||||||
{"best", 0, 0, 900}, // compress best
|
{"best", 0x10, 0, 900}, // compress best
|
||||||
{"fast", 0, 0, '1'}, // compress faster
|
{"brute", 0x10, 0, 901}, // compress best, brute force
|
||||||
|
{"fast", 0x10, 0, '1'}, // compress faster
|
||||||
|
|
||||||
// options
|
// options
|
||||||
{"info", 0, 0, 'i'}, // info mode
|
{"info", 0, 0, 'i'}, // info mode
|
||||||
@ -1111,7 +1125,6 @@ int main(int argc, char *argv[])
|
|||||||
// invalidate compression options
|
// invalidate compression options
|
||||||
opt->method = 0;
|
opt->method = 0;
|
||||||
opt->level = 0;
|
opt->level = 0;
|
||||||
opt->mem_level = 0;
|
|
||||||
memset(&opt->crp, 0xff, sizeof(opt->crp));
|
memset(&opt->crp, 0xff, sizeof(opt->crp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -44,16 +44,19 @@ static const
|
|||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int PackCom::getCompressionMethod() const
|
const int *PackCom::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_LE16, -1 };
|
||||||
return M_NRV2B_LE16;
|
if (M_IS_NRV2B(method))
|
||||||
|
return m_nrv2b;
|
||||||
#if 0
|
#if 0
|
||||||
// NOT IMPLEMENTED
|
// NOT IMPLEMENTED
|
||||||
if (M_IS_NRV2D(opt->method))
|
static const int m_nrv2d[] = { M_NRV2D_LE16, -1 };
|
||||||
return M_NRV2D_LE16;
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
#endif
|
#endif
|
||||||
return M_NRV2B_LE16;
|
UNUSED(level);
|
||||||
|
return m_nrv2b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -191,23 +194,12 @@ void PackCom::pack(OutputFile *fo)
|
|||||||
|
|
||||||
// prepare packheader
|
// prepare packheader
|
||||||
ph.u_len = file_size;
|
ph.u_len = file_size;
|
||||||
ph.filter = 0;
|
|
||||||
// prepare filter
|
// prepare filter
|
||||||
Filter ft(opt->level);
|
Filter ft(ph.level);
|
||||||
ft.addvalue = getCallTrickOffset();
|
ft.addvalue = getCallTrickOffset();
|
||||||
|
// compress
|
||||||
int strategy = -1; // try the first working filter
|
|
||||||
if (opt->filter >= 0 && isValidFilter(opt->filter))
|
|
||||||
// try opt->filter or 0 if that fails
|
|
||||||
strategy = -2;
|
|
||||||
else if (opt->all_filters || opt->level > 9)
|
|
||||||
// choose best from all available filters
|
|
||||||
strategy = 0;
|
|
||||||
else if (opt->level == 9)
|
|
||||||
// choose best from the first 4 filters
|
|
||||||
strategy = 4;
|
|
||||||
const unsigned overlap_range = ph.u_len < 0xFE00 - ft.addvalue ? 32 : 0;
|
const unsigned overlap_range = ph.u_len < 0xFE00 - ft.addvalue ? 32 : 0;
|
||||||
compressWithFilters(&ft, overlap_range, strategy);
|
compressWithFilters(&ft, overlap_range);
|
||||||
|
|
||||||
const int lsize = getLoaderSize();
|
const int lsize = getLoaderSize();
|
||||||
MemBuffer loader(lsize);
|
MemBuffer loader(lsize);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
virtual int getVersion() const { return 11; }
|
virtual int getVersion() const { return 11; }
|
||||||
virtual int getFormat() const { return UPX_F_DOS_COM; }
|
virtual int getFormat() const { return UPX_F_DOS_COM; }
|
||||||
virtual const char *getName() const { return "dos/com"; }
|
virtual const char *getName() const { return "dos/com"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -50,15 +50,21 @@ PackDjgpp2::PackDjgpp2(InputFile *f) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PackDjgpp2::getCompressionMethod() const
|
const int *PackDjgpp2::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||||
return M_NRV2B_LE32;
|
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||||
if (M_IS_NRV2D(opt->method))
|
|
||||||
return M_NRV2D_LE32;
|
if (M_IS_NRV2B(method))
|
||||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
return m_nrv2b;
|
||||||
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
|
if (level == 1 || file_size <= 512*1024)
|
||||||
|
return m_nrv2b;
|
||||||
|
return m_nrv2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const int *PackDjgpp2::getFilters() const
|
const int *PackDjgpp2::getFilters() const
|
||||||
{
|
{
|
||||||
static const int filters[] = { 0x26, 0x24, 0x11, 0x14, 0x13, 0x16,
|
static const int filters[] = { 0x26, 0x24, 0x11, 0x14, 0x13, 0x16,
|
||||||
@ -277,43 +283,14 @@ void PackDjgpp2::pack(OutputFile *fo)
|
|||||||
fi->seek(coff_offset+tpos,SEEK_SET);
|
fi->seek(coff_offset+tpos,SEEK_SET);
|
||||||
fi->readx(ibuf + (tpos & 0x1ff),size);
|
fi->readx(ibuf + (tpos & 0x1ff),size);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// filter
|
|
||||||
Filter ft(opt->level);
|
|
||||||
tryFilters(&ft, ibuf, usize - data->size, text->vaddr & ~0x1ff);
|
|
||||||
|
|
||||||
// compress
|
|
||||||
ph.filter = ft.id;
|
|
||||||
ph.filter_cto = ft.cto;
|
|
||||||
ph.u_len = usize;
|
|
||||||
if (!compress(ibuf,obuf))
|
|
||||||
throwNotCompressible();
|
|
||||||
|
|
||||||
ph.overlap_overhead = findOverlapOverhead(obuf,ibuf,512);
|
|
||||||
buildLoader(&ft);
|
|
||||||
|
|
||||||
// verify filter
|
|
||||||
ft.verifyUnfilter();
|
|
||||||
#else
|
|
||||||
// new version using compressWithFilters()
|
|
||||||
|
|
||||||
// prepare packheader
|
// prepare packheader
|
||||||
ph.u_len = usize;
|
ph.u_len = usize;
|
||||||
ph.filter = 0;
|
|
||||||
// prepare filter
|
// prepare filter
|
||||||
Filter ft(opt->level);
|
Filter ft(ph.level);
|
||||||
ft.buf_len = usize - data->size;
|
ft.buf_len = usize - data->size;
|
||||||
ft.addvalue = text->vaddr & ~0x1ff;
|
ft.addvalue = text->vaddr & ~0x1ff;
|
||||||
|
// compress
|
||||||
int strategy = -1; // try the first working filter
|
compressWithFilters(&ft, 512);
|
||||||
if (opt->filter >= 0 && isValidFilter(opt->filter))
|
|
||||||
// try opt->filter or 0 if that fails
|
|
||||||
strategy = -2;
|
|
||||||
else if (opt->all_filters)
|
|
||||||
// choose best from all available filters
|
|
||||||
strategy = 0;
|
|
||||||
compressWithFilters(&ft, 512, strategy);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// patch coff header #2
|
// patch coff header #2
|
||||||
const unsigned lsize = getLoaderSize();
|
const unsigned lsize = getLoaderSize();
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -43,7 +43,7 @@ public:
|
|||||||
virtual int getVersion() const { return 11; }
|
virtual int getVersion() const { return 11; }
|
||||||
virtual int getFormat() const { return UPX_F_DJGPP2_COFF; }
|
virtual int getFormat() const { return UPX_F_DJGPP2_COFF; }
|
||||||
virtual const char *getName() const { return "djgpp2/coff"; }
|
virtual const char *getName() const { return "djgpp2/coff"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -49,13 +49,13 @@ static const unsigned zimage_offset = 0x1000;
|
|||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int PackElks8086::getCompressionMethod() const
|
const int *PackElks8086::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(method))
|
||||||
return M_NRV2B_8;
|
return M_NRV2B_8;
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(method))
|
||||||
return M_NRV2D_8;
|
return M_NRV2D_8;
|
||||||
return opt->level > 1 ? M_NRV2D_8 : M_NRV2B_8;
|
return level > 1 ? M_NRV2D_8 : M_NRV2B_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -113,18 +113,11 @@ void PackElks8086::pack(OutputFile *fo)
|
|||||||
readKernel();
|
readKernel();
|
||||||
|
|
||||||
// prepare filter
|
// prepare filter
|
||||||
Filter ft(opt->level);
|
Filter ft(ph.level);
|
||||||
ft.buf_len = ph.u_len;
|
ft.buf_len = ph.u_len;
|
||||||
ft.addvalue = kernel_entry;
|
ft.addvalue = kernel_entry;
|
||||||
|
// compress
|
||||||
int strategy = -1; // try the first working filter
|
compressWithFilters(&ft, overlap_range);
|
||||||
if (opt->filter >= 0 && isValidFilter(opt->filter))
|
|
||||||
// try opt->filter or 0 if that fails
|
|
||||||
strategy = -2;
|
|
||||||
else if (opt->all_filters)
|
|
||||||
// choose best from all available filters
|
|
||||||
strategy = 0;
|
|
||||||
compressWithFilters(&ft, overlap_range, strategy);
|
|
||||||
|
|
||||||
const unsigned lsize = getLoaderSize();
|
const unsigned lsize = getLoaderSize();
|
||||||
MemBuffer loader(lsize);
|
MemBuffer loader(lsize);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -54,13 +54,18 @@ PackExe::PackExe(InputFile *f) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PackExe::getCompressionMethod() const
|
const int *PackExe::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_8, M_NRV2D_8, -1 };
|
||||||
return M_NRV2B_8;
|
static const int m_nrv2d[] = { M_NRV2D_8, M_NRV2B_8, -1 };
|
||||||
if (M_IS_NRV2D(opt->method))
|
|
||||||
return M_NRV2D_8;
|
if (M_IS_NRV2B(method))
|
||||||
return opt->level > 1 && ih_imagesize >= 300000 ? M_NRV2D_8 : M_NRV2B_8;
|
return m_nrv2b;
|
||||||
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
|
if (level == 1 || ih_imagesize <= 256*1024)
|
||||||
|
return m_nrv2b;
|
||||||
|
return m_nrv2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -390,11 +395,12 @@ void PackExe::pack(OutputFile *fo)
|
|||||||
relocsize = 0;
|
relocsize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Filter ft(opt->level);
|
// prepare packheader
|
||||||
|
|
||||||
ph.u_len = ih_imagesize + relocsize;
|
ph.u_len = ih_imagesize + relocsize;
|
||||||
if (!compress(ibuf,obuf,0,MAXMATCH))
|
// prepare filter
|
||||||
throwNotCompressible();
|
Filter ft(ph.level);
|
||||||
|
// compress
|
||||||
|
compressWithFilters(&ft, 32, 0, NULL, 0, MAXMATCH);
|
||||||
if (ph.max_run_found + ph.max_match_found > 0x8000)
|
if (ph.max_run_found + ph.max_match_found > 0x8000)
|
||||||
throwCantPack("decompressor limit exceeded, send a bugreport");
|
throwCantPack("decompressor limit exceeded, send a bugreport");
|
||||||
|
|
||||||
@ -409,10 +415,9 @@ void PackExe::pack(OutputFile *fo)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ph.overlap_overhead = findOverlapOverhead(obuf,32);
|
|
||||||
const unsigned lsize = buildLoader(&ft);
|
|
||||||
int flag = fillExeHeader(&oh);
|
int flag = fillExeHeader(&oh);
|
||||||
|
|
||||||
|
const unsigned lsize = getLoaderSize();
|
||||||
MemBuffer loader(lsize);
|
MemBuffer loader(lsize);
|
||||||
memcpy(loader,getLoader(),lsize);
|
memcpy(loader,getLoader(),lsize);
|
||||||
//OutputFile::dump("xxloader.dat", loader, lsize);
|
//OutputFile::dump("xxloader.dat", loader, lsize);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
virtual int getVersion() const { return 11; }
|
virtual int getVersion() const { return 11; }
|
||||||
virtual int getFormat() const { return UPX_F_DOS_EXE; }
|
virtual int getFormat() const { return UPX_F_DOS_EXE; }
|
||||||
virtual const char *getName() const { return "dos/exe"; }
|
virtual const char *getName() const { return "dos/exe"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -64,9 +64,9 @@ PackLinuxI386elf::~PackLinuxI386elf()
|
|||||||
|
|
||||||
const upx_byte *PackLinuxI386elf::getLoader() const
|
const upx_byte *PackLinuxI386elf::getLoader() const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(ph.method))
|
||||||
return linux_i386elf_nrv2b_loader;
|
return linux_i386elf_nrv2b_loader;
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(ph.method))
|
||||||
return linux_i386elf_nrv2d_loader;
|
return linux_i386elf_nrv2d_loader;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -76,9 +76,9 @@ int PackLinuxI386elf::getLoaderSize() const
|
|||||||
if (0 != lsize) {
|
if (0 != lsize) {
|
||||||
return lsize;
|
return lsize;
|
||||||
}
|
}
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(ph.method))
|
||||||
return sizeof(linux_i386elf_nrv2b_loader);
|
return sizeof(linux_i386elf_nrv2b_loader);
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(ph.method))
|
||||||
return sizeof(linux_i386elf_nrv2d_loader);
|
return sizeof(linux_i386elf_nrv2d_loader);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ void PackLinuxI386elf::patchLoader()
|
|||||||
upx_uint const uncLsize = lsize - fold_begin;
|
upx_uint const uncLsize = lsize - fold_begin;
|
||||||
upx_uint cprLsize;
|
upx_uint cprLsize;
|
||||||
int r = upx_compress(loader + fold_begin, uncLsize, cprLoader, &cprLsize,
|
int r = upx_compress(loader + fold_begin, uncLsize, cprLoader, &cprLsize,
|
||||||
NULL, opt->method, 10, NULL, NULL);
|
NULL, ph.method, 10, NULL, NULL);
|
||||||
if (r != UPX_E_OK || cprLsize >= uncLsize)
|
if (r != UPX_E_OK || cprLsize >= uncLsize)
|
||||||
throwInternalError("loaded compression failed");
|
throwInternalError("loaded compression failed");
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -47,21 +47,26 @@ static const
|
|||||||
#include "stub/l_lx_n2d.h"
|
#include "stub/l_lx_n2d.h"
|
||||||
|
|
||||||
|
|
||||||
int PackLinuxI386::getCompressionMethod() const
|
const int *PackLinuxI386::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||||
return M_NRV2B_LE32;
|
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||||
if (M_IS_NRV2D(opt->method))
|
|
||||||
return M_NRV2D_LE32;
|
if (M_IS_NRV2B(method))
|
||||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
return m_nrv2b;
|
||||||
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
|
if (level == 1 || file_size <= 512*1024)
|
||||||
|
return m_nrv2b;
|
||||||
|
return m_nrv2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const upx_byte *PackLinuxI386::getLoader() const
|
const upx_byte *PackLinuxI386::getLoader() const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(ph.method))
|
||||||
return linux_i386exec_nrv2b_loader;
|
return linux_i386exec_nrv2b_loader;
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(ph.method))
|
||||||
return linux_i386exec_nrv2d_loader;
|
return linux_i386exec_nrv2d_loader;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -72,9 +77,9 @@ int PackLinuxI386::getLoaderSize() const
|
|||||||
if (0!=lsize) {
|
if (0!=lsize) {
|
||||||
return lsize;
|
return lsize;
|
||||||
}
|
}
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(ph.method))
|
||||||
return sizeof(linux_i386exec_nrv2b_loader);
|
return sizeof(linux_i386exec_nrv2b_loader);
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(ph.method))
|
||||||
return sizeof(linux_i386exec_nrv2d_loader);
|
return sizeof(linux_i386exec_nrv2d_loader);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -206,7 +211,7 @@ void PackLinuxI386::patchLoader()
|
|||||||
upx_uint const uncLsize = lsize - fold_begin;
|
upx_uint const uncLsize = lsize - fold_begin;
|
||||||
upx_uint cprLsize;
|
upx_uint cprLsize;
|
||||||
int r = upx_compress(loader + fold_begin, uncLsize, cprLoader, &cprLsize,
|
int r = upx_compress(loader + fold_begin, uncLsize, cprLoader, &cprLsize,
|
||||||
NULL, opt->method, 10, NULL, NULL);
|
NULL, ph.method, 10, NULL, NULL);
|
||||||
if (r != UPX_E_OK || cprLsize >= uncLsize)
|
if (r != UPX_E_OK || cprLsize >= uncLsize)
|
||||||
throwInternalError("loaded compression failed");
|
throwInternalError("loaded compression failed");
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -41,7 +41,7 @@ public:
|
|||||||
PackLinuxI386(InputFile *f) : super(f) { }
|
PackLinuxI386(InputFile *f) : super(f) { }
|
||||||
virtual int getFormat() const { return UPX_F_LINUX_i386; }
|
virtual int getFormat() const { return UPX_F_LINUX_i386; }
|
||||||
virtual const char *getName() const { return "linux/386"; }
|
virtual const char *getName() const { return "linux/386"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
|
|
||||||
virtual bool canPack();
|
virtual bool canPack();
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -57,11 +57,11 @@ const upx_byte *PackLinuxI386sep::getLoader() const
|
|||||||
name = "/usr/local/lib/upxX";
|
name = "/usr/local/lib/upxX";
|
||||||
}
|
}
|
||||||
sprintf(script, "#!%s\n", name);
|
sprintf(script, "#!%s\n", name);
|
||||||
if (M_IS_NRV2B(opt->method)) {
|
if (M_IS_NRV2B(ph.method)) {
|
||||||
script[strlen(script)-2] = 'b';
|
script[strlen(script)-2] = 'b';
|
||||||
return (upx_byte const *)script;
|
return (upx_byte const *)script;
|
||||||
}
|
}
|
||||||
if (M_IS_NRV2D(opt->method)) {
|
if (M_IS_NRV2D(ph.method)) {
|
||||||
script[strlen(script)-2] = 'd';
|
script[strlen(script)-2] = 'd';
|
||||||
return (upx_byte const *)script;
|
return (upx_byte const *)script;
|
||||||
}
|
}
|
||||||
@ -70,9 +70,9 @@ const upx_byte *PackLinuxI386sep::getLoader() const
|
|||||||
|
|
||||||
int PackLinuxI386sep::getLoaderSize() const
|
int PackLinuxI386sep::getLoaderSize() const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(ph.method))
|
||||||
return SCRIPT_SIZE;
|
return SCRIPT_SIZE;
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(ph.method))
|
||||||
return SCRIPT_SIZE;
|
return SCRIPT_SIZE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -63,9 +63,9 @@ PackLinuxI386sh::~PackLinuxI386sh()
|
|||||||
|
|
||||||
const upx_byte *PackLinuxI386sh::getLoader() const
|
const upx_byte *PackLinuxI386sh::getLoader() const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(ph.method))
|
||||||
return linux_i386sh_nrv2b_loader;
|
return linux_i386sh_nrv2b_loader;
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(ph.method))
|
||||||
return linux_i386sh_nrv2d_loader;
|
return linux_i386sh_nrv2d_loader;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -75,9 +75,9 @@ int PackLinuxI386sh::getLoaderSize() const
|
|||||||
if (0 != lsize) {
|
if (0 != lsize) {
|
||||||
return lsize;
|
return lsize;
|
||||||
}
|
}
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(ph.method))
|
||||||
return sizeof(linux_i386sh_nrv2b_loader);
|
return sizeof(linux_i386sh_nrv2b_loader);
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(ph.method))
|
||||||
return sizeof(linux_i386sh_nrv2d_loader);
|
return sizeof(linux_i386sh_nrv2d_loader);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ void PackLinuxI386sh::patchLoader()
|
|||||||
upx_uint const uncLsize = lsize - fold_begin;
|
upx_uint const uncLsize = lsize - fold_begin;
|
||||||
upx_uint cprLsize;
|
upx_uint cprLsize;
|
||||||
int r = upx_compress(loader + fold_begin, uncLsize, cprLoader, &cprLsize,
|
int r = upx_compress(loader + fold_begin, uncLsize, cprLoader, &cprLsize,
|
||||||
NULL, opt->method, 10, NULL, NULL);
|
NULL, ph.method, 10, NULL, NULL);
|
||||||
if (r != UPX_E_OK || cprLsize >= uncLsize)
|
if (r != UPX_E_OK || cprLsize >= uncLsize)
|
||||||
throwInternalError("loaded compression failed");
|
throwInternalError("loaded compression failed");
|
||||||
|
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -47,13 +47,18 @@ PackTmt::PackTmt(InputFile *f) : super(f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PackTmt::getCompressionMethod() const
|
const int *PackTmt::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||||
return M_NRV2B_LE32;
|
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||||
if (M_IS_NRV2D(opt->method))
|
|
||||||
return M_NRV2D_LE32;
|
if (M_IS_NRV2B(method))
|
||||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
return m_nrv2b;
|
||||||
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
|
if (level == 1 || file_size <= 512*1024)
|
||||||
|
return m_nrv2b;
|
||||||
|
return m_nrv2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -103,7 +108,7 @@ int PackTmt::buildLoader(const Filter *ft)
|
|||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// util
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int PackTmt::readFileHeader()
|
int PackTmt::readFileHeader()
|
||||||
@ -171,7 +176,9 @@ int PackTmt::readFileHeader()
|
|||||||
|
|
||||||
bool PackTmt::canPack()
|
bool PackTmt::canPack()
|
||||||
{
|
{
|
||||||
return readFileHeader();
|
if (!readFileHeader())
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -221,41 +228,13 @@ void PackTmt::pack(OutputFile *fo)
|
|||||||
relocsize += 4;
|
relocsize += 4;
|
||||||
memcpy(ibuf+usize,wrkmem,relocsize);
|
memcpy(ibuf+usize,wrkmem,relocsize);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// filter
|
|
||||||
Filter ft(opt->level);
|
|
||||||
tryFilters(&ft, ibuf, usize);
|
|
||||||
|
|
||||||
ph.filter = ft.id;
|
|
||||||
ph.filter_cto = ft.cto;
|
|
||||||
ph.u_len = usize + relocsize;
|
|
||||||
if (!compress(ibuf,obuf))
|
|
||||||
throwNotCompressible();
|
|
||||||
|
|
||||||
ph.overlap_overhead = findOverlapOverhead(obuf,512);
|
|
||||||
buildLoader(&ft);
|
|
||||||
|
|
||||||
// verify filter
|
|
||||||
ft.verifyUnfilter();
|
|
||||||
#else
|
|
||||||
// new version using compressWithFilters()
|
|
||||||
|
|
||||||
// prepare packheader
|
// prepare packheader
|
||||||
ph.u_len = usize + relocsize;
|
ph.u_len = usize + relocsize;
|
||||||
ph.filter = 0;
|
|
||||||
// prepare filter
|
// prepare filter
|
||||||
Filter ft(opt->level);
|
Filter ft(ph.level);
|
||||||
ft.buf_len = usize;
|
ft.buf_len = usize;
|
||||||
|
// compress
|
||||||
int strategy = -1; // try the first working filter
|
compressWithFilters(&ft, 512);
|
||||||
if (opt->filter >= 0 && isValidFilter(opt->filter))
|
|
||||||
// try opt->filter or 0 if that fails
|
|
||||||
strategy = -2;
|
|
||||||
else if (opt->all_filters)
|
|
||||||
// choose best from all available filters
|
|
||||||
strategy = 0;
|
|
||||||
compressWithFilters(&ft, 512, strategy);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const unsigned lsize = getLoaderSize();
|
const unsigned lsize = getLoaderSize();
|
||||||
MemBuffer loader(lsize);
|
MemBuffer loader(lsize);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
virtual int getVersion() const { return 11; }
|
virtual int getVersion() const { return 11; }
|
||||||
virtual int getFormat() const { return UPX_F_TMT_ADAM; }
|
virtual int getFormat() const { return UPX_F_TMT_ADAM; }
|
||||||
virtual const char *getName() const { return "tmt/adam"; }
|
virtual const char *getName() const { return "tmt/adam"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -29,6 +29,7 @@
|
|||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
#include "filter.h"
|
||||||
#include "packer.h"
|
#include "packer.h"
|
||||||
#include "p_tos.h"
|
#include "p_tos.h"
|
||||||
|
|
||||||
@ -57,13 +58,18 @@ PackTos::PackTos(InputFile *f) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PackTos::getCompressionMethod() const
|
const int *PackTos::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_8, M_NRV2D_8, -1 };
|
||||||
return M_NRV2B_8;
|
static const int m_nrv2d[] = { M_NRV2D_8, M_NRV2B_8, -1 };
|
||||||
if (M_IS_NRV2D(opt->method))
|
|
||||||
return M_NRV2D_8;
|
if (M_IS_NRV2B(method))
|
||||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_8 : M_NRV2B_8;
|
return m_nrv2b;
|
||||||
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
|
if (level == 1 || ih.fh_text + ih.fh_data <= 256*1024)
|
||||||
|
return m_nrv2b;
|
||||||
|
return m_nrv2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -75,9 +81,9 @@ const int *PackTos::getFilters() const
|
|||||||
|
|
||||||
const upx_byte *PackTos::getLoader() const
|
const upx_byte *PackTos::getLoader() const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(ph.method))
|
||||||
return opt->small ? nrv2b_loader_small : nrv2b_loader;
|
return opt->small ? nrv2b_loader_small : nrv2b_loader;
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(ph.method))
|
||||||
return opt->small ? nrv2d_loader_small : nrv2d_loader;
|
return opt->small ? nrv2d_loader_small : nrv2d_loader;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -85,9 +91,9 @@ const upx_byte *PackTos::getLoader() const
|
|||||||
|
|
||||||
int PackTos::getLoaderSize() const
|
int PackTos::getLoaderSize() const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
if (M_IS_NRV2B(ph.method))
|
||||||
return opt->small ? sizeof(nrv2b_loader_small) : sizeof(nrv2b_loader);
|
return opt->small ? sizeof(nrv2b_loader_small) : sizeof(nrv2b_loader);
|
||||||
if (M_IS_NRV2D(opt->method))
|
if (M_IS_NRV2D(ph.method))
|
||||||
return opt->small ? sizeof(nrv2d_loader_small) : sizeof(nrv2d_loader);
|
return opt->small ? sizeof(nrv2d_loader_small) : sizeof(nrv2d_loader);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -406,13 +412,14 @@ void PackTos::pack(OutputFile *fo)
|
|||||||
// alloc buffer
|
// alloc buffer
|
||||||
obuf.allocForCompression(t + d_len + 512);
|
obuf.allocForCompression(t + d_len + 512);
|
||||||
|
|
||||||
// compress (max_match = 65535)
|
// prepare packheader
|
||||||
ph.u_len = t;
|
ph.u_len = t;
|
||||||
if (!compress(ibuf,obuf,0,65535))
|
// prepare filter
|
||||||
throwNotCompressible();
|
Filter ft(ph.level);
|
||||||
|
// compress (max_match = 65535)
|
||||||
|
compressWithFilters(&ft, 512, 0, NULL, 0, 65535);
|
||||||
|
|
||||||
// The decompressed data will now get placed at this offset:
|
// The decompressed data will now get placed at this offset:
|
||||||
ph.overlap_overhead = findOverlapOverhead(obuf, 512);
|
|
||||||
unsigned offset = (ph.u_len + ph.overlap_overhead) - ph.c_len;
|
unsigned offset = (ph.u_len + ph.overlap_overhead) - ph.c_len;
|
||||||
|
|
||||||
// compute addresses
|
// compute addresses
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
virtual int getVersion() const { return 11; }
|
virtual int getVersion() const { return 11; }
|
||||||
virtual int getFormat() const { return UPX_F_ATARI_TOS; }
|
virtual int getFormat() const { return UPX_F_ATARI_TOS; }
|
||||||
virtual const char *getName() const { return "atari/tos"; }
|
virtual const char *getName() const { return "atari/tos"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -56,13 +56,18 @@ PackVmlinuzI386::PackVmlinuzI386(InputFile *f) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PackVmlinuzI386::getCompressionMethod() const
|
const int *PackVmlinuzI386::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||||
return M_NRV2B_LE32;
|
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||||
if (M_IS_NRV2D(opt->method))
|
|
||||||
return M_NRV2D_LE32;
|
if (M_IS_NRV2B(method))
|
||||||
return opt->level > 1 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
return m_nrv2b;
|
||||||
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
|
if (level == 1)
|
||||||
|
return m_nrv2b;
|
||||||
|
return m_nrv2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -217,18 +222,11 @@ void PackVmlinuzI386::pack(OutputFile *fo)
|
|||||||
readKernel();
|
readKernel();
|
||||||
|
|
||||||
// prepare filter
|
// prepare filter
|
||||||
Filter ft(opt->level);
|
Filter ft(ph.level);
|
||||||
ft.buf_len = ph.u_len;
|
ft.buf_len = ph.u_len;
|
||||||
ft.addvalue = kernel_entry;
|
ft.addvalue = kernel_entry;
|
||||||
|
// compress
|
||||||
int strategy = -1; // try the first working filter
|
compressWithFilters(&ft, 1 << 20);
|
||||||
if (opt->filter >= 0 && isValidFilter(opt->filter))
|
|
||||||
// try opt->filter or 0 if that fails
|
|
||||||
strategy = -2;
|
|
||||||
else if (opt->all_filters)
|
|
||||||
// choose best from all available filters
|
|
||||||
strategy = 0;
|
|
||||||
compressWithFilters(&ft, 1 << 20, strategy);
|
|
||||||
|
|
||||||
const unsigned lsize = getLoaderSize();
|
const unsigned lsize = getLoaderSize();
|
||||||
MemBuffer loader(lsize);
|
MemBuffer loader(lsize);
|
||||||
@ -291,18 +289,11 @@ void PackBvmlinuzI386::pack(OutputFile *fo)
|
|||||||
readKernel();
|
readKernel();
|
||||||
|
|
||||||
// prepare filter
|
// prepare filter
|
||||||
Filter ft(opt->level);
|
Filter ft(ph.level);
|
||||||
ft.buf_len = ph.u_len;
|
ft.buf_len = ph.u_len;
|
||||||
ft.addvalue = kernel_entry;
|
ft.addvalue = kernel_entry;
|
||||||
|
// compress
|
||||||
int strategy = -1; // try the first working filter
|
compressWithFilters(&ft, 512);
|
||||||
if (opt->filter >= 0 && isValidFilter(opt->filter))
|
|
||||||
// try opt->filter or 0 if that fails
|
|
||||||
strategy = -2;
|
|
||||||
else if (opt->all_filters)
|
|
||||||
// choose best from all available filters
|
|
||||||
strategy = 0;
|
|
||||||
compressWithFilters(&ft, 512, strategy);
|
|
||||||
|
|
||||||
// align everything to dword boundary - it is easier to handle
|
// align everything to dword boundary - it is easier to handle
|
||||||
unsigned clen = ph.c_len;
|
unsigned clen = ph.c_len;
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
virtual int getVersion() const { return 11; }
|
virtual int getVersion() const { return 11; }
|
||||||
virtual int getFormat() const { return UPX_F_VMLINUZ_i386; }
|
virtual int getFormat() const { return UPX_F_VMLINUZ_i386; }
|
||||||
virtual const char *getName() const { return "vmlinuz/386"; }
|
virtual const char *getName() const { return "vmlinuz/386"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
@ -116,7 +116,7 @@ public:
|
|||||||
PackElks8086(InputFile *f) : super(f) { }
|
PackElks8086(InputFile *f) : super(f) { }
|
||||||
virtual int getFormat() const { return UPX_F_ELKS_8086; }
|
virtual int getFormat() const { return UPX_F_ELKS_8086; }
|
||||||
virtual const char *getName() const { return "elks/8086"; }
|
virtual const char *getName() const { return "elks/8086"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -43,7 +43,7 @@ public:
|
|||||||
virtual int getVersion() const { return 11; }
|
virtual int getVersion() const { return 11; }
|
||||||
virtual int getFormat() const { return UPX_F_VXD_LE; }
|
virtual int getFormat() const { return UPX_F_VXD_LE; }
|
||||||
virtual const char *getName() const { return "vxd/le"; }
|
virtual const char *getName() const { return "vxd/le"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -43,13 +43,18 @@ PackW16Ne::PackW16Ne(InputFile *f) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PackW16Ne::getCompressionMethod() const
|
const int *PackW16Ne::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_8, M_NRV2D_8, -1 };
|
||||||
return M_NRV2B_8;
|
static const int m_nrv2d[] = { M_NRV2D_8, M_NRV2B_8, -1 };
|
||||||
if (M_IS_NRV2D(opt->method))
|
|
||||||
return M_NRV2D_8;
|
if (M_IS_NRV2B(method))
|
||||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_8 : M_NRV2B_8;
|
return m_nrv2b;
|
||||||
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
|
if (level == 1)
|
||||||
|
return m_nrv2b;
|
||||||
|
return m_nrv2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
virtual int getVersion() const { return 11; }
|
virtual int getVersion() const { return 11; }
|
||||||
virtual int getFormat() const { return UPX_F_WIN16_NE; }
|
virtual int getFormat() const { return UPX_F_WIN16_NE; }
|
||||||
virtual const char *getName() const { return "win16/ne"; }
|
virtual const char *getName() const { return "win16/ne"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -98,13 +98,18 @@ PackW32Pe::~PackW32Pe()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int PackW32Pe::getCompressionMethod() const
|
const int *PackW32Pe::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||||
return M_NRV2B_LE32;
|
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||||
if (M_IS_NRV2D(opt->method))
|
|
||||||
return M_NRV2D_LE32;
|
if (M_IS_NRV2B(method))
|
||||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
return m_nrv2b;
|
||||||
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
|
if (level == 1 || ih.codesize + ih.datasize <= 256*1024)
|
||||||
|
return m_nrv2b;
|
||||||
|
return m_nrv2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1377,7 +1382,9 @@ unsigned PackW32Pe::stripDebug(unsigned overlaystart)
|
|||||||
|
|
||||||
bool PackW32Pe::canPack()
|
bool PackW32Pe::canPack()
|
||||||
{
|
{
|
||||||
return readFileHeader();
|
if (!readFileHeader())
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1528,9 +1535,8 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for NeoLite
|
// check for NeoLite
|
||||||
for (ic = 0; ic < 64; ic++)
|
if (find(ibuf + ih.entry, 64+7, "NeoLite", 7) >= 0)
|
||||||
if (memcmp(ibuf + ih.entry + ic,"NeoLite",7) == 0)
|
throwCantPack("file is already compressed with another packer");
|
||||||
throwCantPack("file is already compressed with another packer");
|
|
||||||
|
|
||||||
unsigned overlay = file_size - stripDebug(overlaystart);
|
unsigned overlay = file_size - stripDebug(overlaystart);
|
||||||
if (overlay >= (unsigned) file_size)
|
if (overlay >= (unsigned) file_size)
|
||||||
@ -1612,48 +1618,16 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||||||
s += 4;
|
s += 4;
|
||||||
ph.u_len += s;
|
ph.u_len += s;
|
||||||
obuf.allocForCompression(ph.u_len);
|
obuf.allocForCompression(ph.u_len);
|
||||||
ph.u_len -= rvamin;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// filter
|
|
||||||
Filter ft(opt->level);
|
|
||||||
if (allow_filter)
|
|
||||||
tryFilters(&ft, ibuf + ih.codebase, ih.codesize);
|
|
||||||
|
|
||||||
// compress
|
|
||||||
ph.filter = ft.id;
|
|
||||||
ph.filter_cto = ft.cto;
|
|
||||||
if (!compress(ibuf + rvamin,obuf))
|
|
||||||
throwNotCompressible();
|
|
||||||
|
|
||||||
ph.overlap_overhead = findOverlapOverhead(obuf, 2048);
|
|
||||||
buildLoader(&ft);
|
|
||||||
|
|
||||||
// verify filter
|
|
||||||
ft.verifyUnfilter();
|
|
||||||
#else
|
|
||||||
// new version using compressWithFilters()
|
|
||||||
|
|
||||||
// prepare packheader
|
// prepare packheader
|
||||||
ph.filter = 0;
|
ph.u_len -= rvamin;
|
||||||
// prepare filter
|
// prepare filter
|
||||||
Filter ft(opt->level);
|
Filter ft(ph.level);
|
||||||
ft.buf_len = ih.codesize;
|
ft.buf_len = ih.codesize;
|
||||||
ft.addvalue = 0;
|
// compress
|
||||||
|
int strategy = allow_filter ? 0 : -3;
|
||||||
int strategy = -1; // try the first working filter
|
|
||||||
if (!allow_filter)
|
|
||||||
// no filter
|
|
||||||
strategy = -3;
|
|
||||||
else if (opt->filter >= 0 && isValidFilter(opt->filter))
|
|
||||||
// try opt->filter or 0 if that fails
|
|
||||||
strategy = -2;
|
|
||||||
else if (opt->all_filters)
|
|
||||||
// choose best from all available filters
|
|
||||||
strategy = 0;
|
|
||||||
compressWithFilters(&ft, 2048, strategy,
|
compressWithFilters(&ft, 2048, strategy,
|
||||||
NULL, 0, 0, ih.codebase, rvamin);
|
NULL, 0, 0, ih.codebase, rvamin);
|
||||||
#endif
|
|
||||||
|
|
||||||
newvsize = (ph.u_len + rvamin + ph.overlap_overhead + oam1) &~ oam1;
|
newvsize = (ph.u_len + rvamin + ph.overlap_overhead + oam1) &~ oam1;
|
||||||
if (tlsindex && ((newvsize - ph.c_len - 1024 + oam1) &~ oam1) > tlsindex + 4)
|
if (tlsindex && ((newvsize - ph.c_len - 1024 + oam1) &~ oam1) > tlsindex + 4)
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -50,7 +50,7 @@ public:
|
|||||||
virtual int getVersion() const { return 12; }
|
virtual int getVersion() const { return 12; }
|
||||||
virtual int getFormat() const { return UPX_F_WIN32_PE; }
|
virtual int getFormat() const { return UPX_F_WIN32_PE; }
|
||||||
virtual const char *getName() const { return isrtm ? "rtm32/pe" : "win32/pe"; }
|
virtual const char *getName() const { return isrtm ? "rtm32/pe" : "win32/pe"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -66,13 +66,18 @@ static const
|
|||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
int PackWcle::getCompressionMethod() const
|
const int *PackWcle::getCompressionMethods(int method, int level) const
|
||||||
{
|
{
|
||||||
if (M_IS_NRV2B(opt->method))
|
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||||
return M_NRV2B_LE32;
|
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||||
if (M_IS_NRV2D(opt->method))
|
|
||||||
return M_NRV2D_LE32;
|
if (M_IS_NRV2B(method))
|
||||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
return m_nrv2b;
|
||||||
|
if (M_IS_NRV2D(method))
|
||||||
|
return m_nrv2d;
|
||||||
|
if (level == 1 || file_size <= 512*1024)
|
||||||
|
return m_nrv2b;
|
||||||
|
return m_nrv2d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -130,7 +135,9 @@ void PackWcle::handleStub(OutputFile *fo)
|
|||||||
|
|
||||||
bool PackWcle::canPack()
|
bool PackWcle::canPack()
|
||||||
{
|
{
|
||||||
return LeFile::readFileHeader();
|
if (!LeFile::readFileHeader())
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -479,7 +486,7 @@ void PackWcle::pack(OutputFile *fo)
|
|||||||
sofixups += 13;
|
sofixups += 13;
|
||||||
|
|
||||||
// filter
|
// filter
|
||||||
Filter ft(opt->level);
|
Filter ft(ph.level);
|
||||||
tryFilters(&ft, iimage+text_vaddr, text_size, text_vaddr);
|
tryFilters(&ft, iimage+text_vaddr, text_size, text_vaddr);
|
||||||
|
|
||||||
encodeImage(&ft);
|
encodeImage(&ft);
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
virtual int getVersion() const { return 12; }
|
virtual int getVersion() const { return 12; }
|
||||||
virtual int getFormat() const { return UPX_F_WC_LE; }
|
virtual int getFormat() const { return UPX_F_WC_LE; }
|
||||||
virtual const char *getName() const { return "watcom/le"; }
|
virtual const char *getName() const { return "watcom/le"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|||||||
259
src/packer.cpp
259
src/packer.cpp
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -571,16 +571,20 @@ void Packer::initPackHeader()
|
|||||||
ph.u_file_size = file_size;
|
ph.u_file_size = file_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this is called directly after canPack() from class PackMaster
|
// this is called directly after canPack() from class PackMaster
|
||||||
void Packer::updatePackHeader()
|
void Packer::updatePackHeader()
|
||||||
{
|
{
|
||||||
// update our local options
|
assert(opt->cmd == CMD_COMPRESS);
|
||||||
if (opt->level < 0)
|
//
|
||||||
opt->level = file_size < 512*1024 ? 8 : 7;
|
const int *m = getCompressionMethods(opt->method, opt->level);
|
||||||
opt->method = getCompressionMethod();
|
ph.method = m[0];
|
||||||
// set ph
|
|
||||||
ph.level = opt->level;
|
ph.level = opt->level;
|
||||||
ph.method = opt->method;
|
if (ph.level < 0)
|
||||||
|
ph.level = file_size < 512*1024 ? 8 : 7;
|
||||||
|
//
|
||||||
|
assert(isValidCompressionMethod(ph.method));
|
||||||
|
assert(1 <= ph.level && ph.level <= 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -626,7 +630,7 @@ bool Packer::getPackHeader(void *b, int blen)
|
|||||||
throwCantUnpack("header size corrupted");
|
throwCantUnpack("header size corrupted");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (ph.method < M_NRV2B_LE32 || ph.method > M_NRV2D_LE16)
|
if (!isValidCompressionMethod(ph.method))
|
||||||
throwCantUnpack("unknown compression method");
|
throwCantUnpack("unknown compression method");
|
||||||
|
|
||||||
// Some formats might be able to unpack "subformats". Ask them.
|
// Some formats might be able to unpack "subformats". Ask them.
|
||||||
@ -668,6 +672,12 @@ void Packer::checkAlreadyPacked(void *b, int blen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Packer::isValidCompressionMethod(int method)
|
||||||
|
{
|
||||||
|
return (method >= M_NRV2B_LE32 && method <= M_NRV2D_LE16);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// patch util for loader
|
// patch util for loader
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@ -924,12 +934,12 @@ void Packer::initLoader(const void *pdata, int plen, int pinfo)
|
|||||||
"\n\0"
|
"\n\0"
|
||||||
"$Info: This file is packed with the UPX executable packer http://upx.tsx.org $"
|
"$Info: This file is packed with the UPX executable packer http://upx.tsx.org $"
|
||||||
"\n\0"
|
"\n\0"
|
||||||
"$Id: UPX " UPX_VERSION_STRING " Copyright (C) 1996-2000 the UPX Team. All Rights Reserved. $"
|
"$Id: UPX " UPX_VERSION_STRING " Copyright (C) 1996-2001 the UPX Team. All Rights Reserved. $"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
static const char identsmall[] =
|
static const char identsmall[] =
|
||||||
"\n"
|
"\n"
|
||||||
"$Id: UPX (C) 1996-2000 the UPX Team. All Rights Reserved. http://upx.tsx.org $"
|
"$Id: UPX (C) 1996-2001 the UPX Team. All Rights Reserved. http://upx.tsx.org $"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
if (opt->small)
|
if (opt->small)
|
||||||
@ -1059,8 +1069,8 @@ void Packer::addFilter32(int filter_id)
|
|||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// Try compression with several filters, choose the best or first one.
|
// Try compression with several methods and filters, choose the best
|
||||||
// Needs buildLoader().
|
/ or first working one. Needs buildLoader().
|
||||||
//
|
//
|
||||||
// Required inputs:
|
// Required inputs:
|
||||||
// this->ph
|
// this->ph
|
||||||
@ -1072,18 +1082,18 @@ void Packer::addFilter32(int filter_id)
|
|||||||
//
|
//
|
||||||
// - updates this->ph
|
// - updates this->ph
|
||||||
// - updates *ft
|
// - updates *ft
|
||||||
// - ibuf[] is restored to unfiltered version
|
// - ibuf[] is restored to the original unfiltered version
|
||||||
// - obuf[] contains the best compressed version
|
// - obuf[] contains the best compressed version
|
||||||
//
|
//
|
||||||
// strategy:
|
// strategy:
|
||||||
// 0: try all filters, use best one
|
// n: try the first N filters, use best one
|
||||||
// n: try the first N filters in parm_filters[], use best one
|
|
||||||
// -1: try all filters, use first working one
|
// -1: try all filters, use first working one
|
||||||
// -2: try only the opt->filter filter
|
// -2: try only the opt->filter filter
|
||||||
// -3: use no filter at all
|
// -3: use no filter at all
|
||||||
//
|
//
|
||||||
// This has been prepared for generalization into class Packer so that
|
// This has been prepared for generalization into class Packer so that
|
||||||
// opt->all_filters is available for all executable formats.
|
// opt->all_methods and/or opt->all_filters are available for all
|
||||||
|
// executable formats.
|
||||||
//
|
//
|
||||||
// It will replace the tryFilters() / compress() call sequence.
|
// It will replace the tryFilters() / compress() call sequence.
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@ -1114,23 +1124,39 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
|||||||
assert(orig_ft.id == 0);
|
assert(orig_ft.id == 0);
|
||||||
assert(filter_off + filter_len <= compress_buf_off + compress_buf_len);
|
assert(filter_off + filter_len <= compress_buf_off + compress_buf_len);
|
||||||
|
|
||||||
// setup raw_filters
|
// setup filter strategy
|
||||||
static const int no_filters[] = { 0, -1 };
|
if (strategy == 0)
|
||||||
int strategy_filters[] = { 0, -1 };
|
|
||||||
|
|
||||||
const int *raw_filters = parm_filters;
|
|
||||||
if (raw_filters == NULL)
|
|
||||||
raw_filters = getFilters();
|
|
||||||
if (raw_filters == NULL)
|
|
||||||
raw_filters = no_filters;
|
|
||||||
if (strategy == -2)
|
|
||||||
{
|
{
|
||||||
assert(opt->filter >= 0);
|
if (opt->all_filters)
|
||||||
strategy_filters[0] = opt->filter;
|
// choose best from all available filters
|
||||||
raw_filters = strategy_filters;
|
strategy = INT_MAX;
|
||||||
|
else if (opt->filter >= 0 && isValidFilter(opt->filter))
|
||||||
|
// try opt->filter
|
||||||
|
strategy = -2;
|
||||||
|
else
|
||||||
|
// try the first working filter
|
||||||
|
strategy = -1;
|
||||||
|
}
|
||||||
|
assert(strategy != 0);
|
||||||
|
|
||||||
|
// setup raw_filters
|
||||||
|
int tmp_filters[] = { 0, -1 };
|
||||||
|
const int *raw_filters = NULL;
|
||||||
|
if (strategy == -3)
|
||||||
|
raw_filters = tmp_filters;
|
||||||
|
else if (strategy == -2 && opt->filter >= 0)
|
||||||
|
{
|
||||||
|
tmp_filters[0] = opt->filter;
|
||||||
|
raw_filters = tmp_filters;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
raw_filters = parm_filters;
|
||||||
|
if (raw_filters == NULL)
|
||||||
|
raw_filters = getFilters();
|
||||||
|
if (raw_filters == NULL)
|
||||||
|
raw_filters = tmp_filters;
|
||||||
}
|
}
|
||||||
else if (strategy == -3)
|
|
||||||
raw_filters = no_filters;
|
|
||||||
|
|
||||||
// first pass - count number of filters
|
// first pass - count number of filters
|
||||||
int raw_nfilters = 0;
|
int raw_nfilters = 0;
|
||||||
@ -1140,7 +1166,7 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
|||||||
raw_nfilters++;
|
raw_nfilters++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy filters, eliminate duplicates, add a 0
|
// copy filters, add a 0
|
||||||
int nfilters = 0;
|
int nfilters = 0;
|
||||||
bool zero_seen = false;
|
bool zero_seen = false;
|
||||||
autoheap_array(int, filters, raw_nfilters + 2);
|
autoheap_array(int, filters, raw_nfilters + 2);
|
||||||
@ -1148,111 +1174,129 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
|||||||
{
|
{
|
||||||
if (*f == 0)
|
if (*f == 0)
|
||||||
zero_seen = true;
|
zero_seen = true;
|
||||||
bool duplicate = false;
|
filters[nfilters++] = *f;
|
||||||
for (int i = 0; i < nfilters; i++)
|
if (nfilters == strategy)
|
||||||
if (filters[i] == *f)
|
break;
|
||||||
duplicate = true;
|
|
||||||
if (!duplicate)
|
|
||||||
filters[nfilters++] = *f;
|
|
||||||
}
|
}
|
||||||
if (!zero_seen)
|
if (!zero_seen)
|
||||||
filters[nfilters++] = 0;
|
filters[nfilters++] = 0;
|
||||||
filters[nfilters] = -1;
|
filters[nfilters] = -1;
|
||||||
|
|
||||||
|
// methods
|
||||||
|
int tmp_methods[] = { ph.method, -1 };
|
||||||
|
const int *methods = NULL;
|
||||||
|
if (opt->all_methods)
|
||||||
|
methods = getCompressionMethods(-1, ph.level);
|
||||||
|
if (methods == NULL)
|
||||||
|
methods = tmp_methods;
|
||||||
|
int nmethods = 0;
|
||||||
|
while (methods[nmethods] >= 0)
|
||||||
|
{
|
||||||
|
assert(isValidCompressionMethod(methods[nmethods]));
|
||||||
|
nmethods++;
|
||||||
|
}
|
||||||
|
assert(nmethods > 0);
|
||||||
|
|
||||||
// update total_passes
|
// update total_passes
|
||||||
if (strategy < 0)
|
if (strategy < 0)
|
||||||
ui_total_passes += 1;
|
ui_total_passes += 1 * nmethods;
|
||||||
else
|
else
|
||||||
{
|
ui_total_passes += nfilters * nmethods;
|
||||||
if (strategy > nfilters)
|
|
||||||
nfilters = strategy;
|
|
||||||
ui_total_passes += nfilters;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Working buffer for compressed data. Don't waste memory.
|
// Working buffer for compressed data. Don't waste memory.
|
||||||
upx_byte *otemp = obuf;
|
upx_byte *otemp = obuf;
|
||||||
MemBuffer otemp_buf;
|
MemBuffer otemp_buf;
|
||||||
if (nfilters > 1 && strategy >= 0)
|
|
||||||
{
|
|
||||||
otemp_buf.allocForCompression(compress_buf_len);
|
|
||||||
otemp = otemp_buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
// compress
|
// compress
|
||||||
int nfilters_success = 0;
|
int nfilters_success = 0;
|
||||||
for (int i = 0; i < nfilters; i++)
|
for (int m = 0; m < nmethods; m++) // for all methods
|
||||||
{
|
{
|
||||||
// get fresh packheader
|
for (int i = 0; i < nfilters; i++) // for all filters
|
||||||
ph = orig_ph;
|
|
||||||
ph.filter = filters[i];
|
|
||||||
// get fresh filter
|
|
||||||
Filter ft = orig_ft;
|
|
||||||
ft.init(filters[i], orig_ft.addvalue);
|
|
||||||
// filter
|
|
||||||
optimizeFilter(&ft, ibuf + filter_off, filter_len);
|
|
||||||
bool success = ft.filter(ibuf + filter_off, filter_len);
|
|
||||||
if (ft.id != 0 && ft.calls == 0)
|
|
||||||
{
|
{
|
||||||
// filter did not do anything - no need to call ft.unfilter()
|
// get fresh packheader
|
||||||
success = false;
|
ph = orig_ph;
|
||||||
}
|
ph.method = methods[m];
|
||||||
if (!success)
|
ph.filter = filters[i];
|
||||||
{
|
// get fresh filter
|
||||||
// filter failed or was usesless
|
Filter ft = orig_ft;
|
||||||
if (strategy >= 0)
|
ft.init(ph.filter, orig_ft.addvalue);
|
||||||
ui_total_passes -= 1;
|
// filter
|
||||||
continue;
|
optimizeFilter(&ft, ibuf + filter_off, filter_len);
|
||||||
}
|
bool success = ft.filter(ibuf + filter_off, filter_len);
|
||||||
// filter success
|
if (ft.id != 0 && ft.calls == 0)
|
||||||
nfilters_success++;
|
|
||||||
ph.filter_cto = ft.cto;
|
|
||||||
// compress
|
|
||||||
if (compress(ibuf + compress_buf_off, otemp, max_offset, max_match))
|
|
||||||
{
|
|
||||||
unsigned lsize = 0;
|
|
||||||
if (ph.c_len + lsize < best_ph.c_len + best_ph_lsize)
|
|
||||||
{
|
{
|
||||||
// get results
|
// filter did not do anything - no need to call ft.unfilter()
|
||||||
ph.overlap_overhead = findOverlapOverhead(otemp, overlap_range);
|
success = false;
|
||||||
lsize = buildLoader(&ft);
|
|
||||||
}
|
}
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
// filter failed or was usesless
|
||||||
|
if (strategy > 0)
|
||||||
|
ui_total_passes -= 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// filter success
|
||||||
|
if (nfilters_success > 0 && otemp == obuf)
|
||||||
|
{
|
||||||
|
otemp_buf.allocForCompression(compress_buf_len);
|
||||||
|
otemp = otemp_buf;
|
||||||
|
}
|
||||||
|
nfilters_success++;
|
||||||
|
ph.filter_cto = ft.cto;
|
||||||
|
// compress
|
||||||
|
if (compress(ibuf + compress_buf_off, otemp, max_offset, max_match))
|
||||||
|
{
|
||||||
|
unsigned lsize = 0;
|
||||||
|
if (ph.c_len + lsize < best_ph.c_len + best_ph_lsize)
|
||||||
|
{
|
||||||
|
// get results
|
||||||
|
ph.overlap_overhead = findOverlapOverhead(otemp, overlap_range);
|
||||||
|
lsize = buildLoader(&ft);
|
||||||
|
}
|
||||||
#if 0
|
#if 0
|
||||||
printf("\n%02x: %d + %d = %d (best: %d + %d = %d)\n", ft.id,
|
printf("\n%2d %02x: %d + %d = %d (best: %d + %d = %d)\n", ph.method, ph.filter,
|
||||||
ph.c_len, getLoaderSize(), ph.c_len + getLoaderSize(),
|
ph.c_len, getLoaderSize(), ph.c_len + getLoaderSize(),
|
||||||
best_ph.c_len, best_ph_lsize, best_ph.c_len + best_ph_lsize);
|
best_ph.c_len, best_ph_lsize, best_ph.c_len + best_ph_lsize);
|
||||||
#endif
|
#endif
|
||||||
bool update = false;
|
bool update = false;
|
||||||
if (ph.c_len + lsize < best_ph.c_len + best_ph_lsize)
|
if (ph.c_len + lsize < best_ph.c_len + best_ph_lsize)
|
||||||
update = true;
|
|
||||||
else if (ph.c_len + lsize == best_ph.c_len + best_ph_lsize)
|
|
||||||
{
|
|
||||||
if (ph.overlap_overhead < best_ph.overlap_overhead)
|
|
||||||
update = true;
|
update = true;
|
||||||
|
else if (ph.c_len + lsize == best_ph.c_len + best_ph_lsize)
|
||||||
|
{
|
||||||
|
// prefer less overlap_overhead
|
||||||
|
if (ph.overlap_overhead < best_ph.overlap_overhead)
|
||||||
|
update = true;
|
||||||
|
else if (ph.overlap_overhead == best_ph.overlap_overhead)
|
||||||
|
{
|
||||||
|
// prefer bigger loaders
|
||||||
|
if (lsize > best_ph_lsize)
|
||||||
|
update = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (update)
|
||||||
|
{
|
||||||
|
// update obuf[] with best version
|
||||||
|
if (otemp != obuf)
|
||||||
|
memcpy(obuf, otemp, ph.c_len);
|
||||||
|
// save compression results
|
||||||
|
best_ph = ph;
|
||||||
|
best_ph_lsize = lsize;
|
||||||
|
best_ft = ft;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (update)
|
// restore ibuf[] - unfilter with verify
|
||||||
{
|
ft.unfilter(ibuf + filter_off, filter_len, true);
|
||||||
// update obuf[] with best version
|
//
|
||||||
if (otemp != obuf)
|
if (strategy < 0)
|
||||||
memcpy(obuf, otemp, ph.c_len);
|
break;
|
||||||
// save compression results
|
|
||||||
best_ph = ph;
|
|
||||||
best_ph_lsize = lsize;
|
|
||||||
best_ft = ft;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// restore ibuf[] - unfilter with verify
|
|
||||||
ft.unfilter(ibuf + filter_off, filter_len, true);
|
|
||||||
//
|
|
||||||
if (strategy < 0)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// postconditions
|
// postconditions 1)
|
||||||
assert(nfilters_success > 0);
|
assert(nfilters_success > 0);
|
||||||
assert(best_ph.u_len == orig_ph.u_len);
|
assert(best_ph.u_len == orig_ph.u_len);
|
||||||
assert(best_ph.filter == best_ft.id);
|
assert(best_ph.filter == best_ft.id);
|
||||||
assert(best_ph.filter_cto == best_ft.cto);
|
assert(best_ph.filter_cto == best_ft.cto);
|
||||||
assert(best_ph.overlap_overhead > 0);
|
|
||||||
|
|
||||||
// copy back results
|
// copy back results
|
||||||
this->ph = best_ph;
|
this->ph = best_ph;
|
||||||
@ -1264,6 +1308,9 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
|||||||
if (!checkCompressionRatio(best_ph.u_len, best_ph.c_len))
|
if (!checkCompressionRatio(best_ph.u_len, best_ph.c_len))
|
||||||
throwNotCompressible();
|
throwNotCompressible();
|
||||||
|
|
||||||
|
// postconditions 2)
|
||||||
|
assert(best_ph.overlap_overhead > 0);
|
||||||
|
|
||||||
// convenience
|
// convenience
|
||||||
buildLoader(&best_ft);
|
buildLoader(&best_ft);
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/packer.h
14
src/packer.h
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -107,10 +107,10 @@ public:
|
|||||||
virtual ~Packer();
|
virtual ~Packer();
|
||||||
|
|
||||||
virtual int getVersion() const = 0;
|
virtual int getVersion() const = 0;
|
||||||
// A unique integer ID for this executable format. See conf.h.
|
// A unique integer ID for this executable format. See unupx.h.
|
||||||
virtual int getFormat() const = 0;
|
virtual int getFormat() const = 0;
|
||||||
virtual const char *getName() const = 0;
|
virtual const char *getName() const = 0;
|
||||||
virtual int getCompressionMethod() const = 0;
|
virtual const int *getCompressionMethods(int method, int level) const = 0;
|
||||||
virtual const int *getFilters() const = 0;
|
virtual const int *getFilters() const = 0;
|
||||||
|
|
||||||
// PackMaster entries
|
// PackMaster entries
|
||||||
@ -163,7 +163,7 @@ protected:
|
|||||||
// high-level compression drivers
|
// high-level compression drivers
|
||||||
void compressWithFilters(Filter *ft,
|
void compressWithFilters(Filter *ft,
|
||||||
const unsigned overlap_range,
|
const unsigned overlap_range,
|
||||||
int strategy,
|
int strategy = 0,
|
||||||
const int *filters = NULL,
|
const int *filters = NULL,
|
||||||
unsigned max_offset = 0, unsigned max_match = 0,
|
unsigned max_offset = 0, unsigned max_match = 0,
|
||||||
unsigned filter_buf_off = 0,
|
unsigned filter_buf_off = 0,
|
||||||
@ -235,6 +235,10 @@ protected:
|
|||||||
virtual upx_byte *optimizeReloc32(upx_byte *in,unsigned relocnum,upx_byte *out,upx_byte *image,int bs,int *big);
|
virtual upx_byte *optimizeReloc32(upx_byte *in,unsigned relocnum,upx_byte *out,upx_byte *image,int bs,int *big);
|
||||||
virtual unsigned unoptimizeReloc32(upx_byte **in,upx_byte *image,MemBuffer *out,int bs);
|
virtual unsigned unoptimizeReloc32(upx_byte **in,upx_byte *image,MemBuffer *out,int bs);
|
||||||
|
|
||||||
|
// compression method util
|
||||||
|
public:
|
||||||
|
static bool isValidCompressionMethod(int method);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
InputFile *fi;
|
InputFile *fi;
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -95,7 +95,8 @@ static Packer* try_pack(Packer *p, InputFile *f)
|
|||||||
f->seek(0,SEEK_SET);
|
f->seek(0,SEEK_SET);
|
||||||
if (p->canPack())
|
if (p->canPack())
|
||||||
{
|
{
|
||||||
p->updatePackHeader();
|
if (opt->cmd == CMD_COMPRESS)
|
||||||
|
p->updatePackHeader();
|
||||||
f->seek(0,SEEK_SET);
|
f->seek(0,SEEK_SET);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -33,7 +33,7 @@
|
|||||||
db 10,0
|
db 10,0
|
||||||
db '$Id: UPX '
|
db '$Id: UPX '
|
||||||
db 'UPXV'
|
db 'UPXV'
|
||||||
db ' Copyright (C) 1996-2000 the UPX Team. All Rights Reserved. $'
|
db ' Copyright (C) 1996-2001 the UPX Team. All Rights Reserved. $'
|
||||||
db 10,0
|
db 10,0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; UPX and the UCL library are free software; you can redistribute them
|
||||||
@ -29,7 +29,7 @@
|
|||||||
; ------------- COPYRIGHT -------------
|
; ------------- COPYRIGHT -------------
|
||||||
|
|
||||||
db 10
|
db 10
|
||||||
db '$Id: UPX (C) 1996-2000 the UPX Team. All Rights Reserved. http://upx.tsx.org $'
|
db '$Id: UPX (C) 1996-2001 the UPX Team. All Rights Reserved. http://upx.tsx.org $'
|
||||||
db 10,0
|
db 10,0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
Integration of virtual exec() with decompression is
|
|
||||||
Copyright (C) 2000 John F. Reiser. All rights reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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
|
and/or modify them under the terms of the GNU General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
|||||||
@ -2,13 +2,11 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
|
; Copyright (C) 2000-2001 John F. Reiser
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; Integration of virtual exec() with decompression is
|
|
||||||
; Copyright (C) 2000 John F. Reiser. All rights reserved.
|
|
||||||
;
|
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; 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
|
; and/or modify them under the terms of the GNU General Public License as
|
||||||
; published by the Free Software Foundation; either version 2 of
|
; published by the Free Software Foundation; either version 2 of
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,13 +2,11 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
|
; Copyright (C) 2000-2001 John F. Reiser
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; Integration of virtual exec() with decompression is
|
|
||||||
; Copyright (C) 2000 John F. Reiser. All rights reserved.
|
|
||||||
;
|
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; 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
|
; and/or modify them under the terms of the GNU General Public License as
|
||||||
; published by the Free Software Foundation; either version 2 of
|
; published by the Free Software Foundation; either version 2 of
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
Integration of virtual exec() with decompression is
|
|
||||||
Copyright (C) 2000 John F. Reiser. All rights reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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
|
and/or modify them under the terms of the GNU General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
|||||||
@ -2,13 +2,11 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
|
; Copyright (C) 2000-2001 John F. Reiser
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; Integration of virtual exec() with decompression is
|
|
||||||
; Copyright (C) 2000 John F. Reiser. All rights reserved.
|
|
||||||
;
|
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; 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
|
; and/or modify them under the terms of the GNU General Public License as
|
||||||
; published by the Free Software Foundation; either version 2 of
|
; published by the Free Software Foundation; either version 2 of
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 2000 John F. Reiser
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
|
|||||||
@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2000 Laszlo Molnar
|
Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
|
Copyright (C) 2000-2001 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
Integration of virtual exec() with decompression is
|
|
||||||
Copyright (C) 2000 John F. Reiser. All rights reserved.
|
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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
|
and/or modify them under the terms of the GNU General Public License as
|
||||||
published by the Free Software Foundation; either version 2 of
|
published by the Free Software Foundation; either version 2 of
|
||||||
|
|||||||
@ -2,13 +2,11 @@
|
|||||||
;
|
;
|
||||||
; This file is part of the UPX executable compressor.
|
; This file is part of the UPX executable compressor.
|
||||||
;
|
;
|
||||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||||
|
; Copyright (C) 2000-2001 John F. Reiser
|
||||||
; All Rights Reserved.
|
; All Rights Reserved.
|
||||||
;
|
;
|
||||||
; Integration of virtual exec() with decompression is
|
|
||||||
; Copyright (C) 2000 John F. Reiser. All rights reserved.
|
|
||||||
;
|
|
||||||
; UPX and the UCL library are free software; you can redistribute them
|
; 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
|
; and/or modify them under the terms of the GNU General Public License as
|
||||||
; published by the Free Software Foundation; either version 2 of
|
; published by the Free Software Foundation; either version 2 of
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user