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
|
||||
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://upx.tsx.org
|
||||
|
||||
|
||||
4
Makefile
4
Makefile
@ -13,6 +13,10 @@ mostlyclean clean distclean maintainer-clean:
|
||||
dist: distclean
|
||||
false
|
||||
|
||||
zip:
|
||||
cd .. && rm -f upx-currenz.zip && zip -r upx-current.zip upx
|
||||
|
||||
|
||||
cvs-admin-ko:
|
||||
cvs admin -ko .
|
||||
cvs update
|
||||
|
||||
10
NEWS
10
NEWS
@ -2,8 +2,14 @@
|
||||
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):
|
||||
* 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
|
||||
* linux/386: added the new direct-to-memory executable formats - no
|
||||
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
|
||||
an illegal value
|
||||
* 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 speed
|
||||
|
||||
|
||||
2
PROJECTS
2
PROJECTS
@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
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://upx.tsx.org
|
||||
|
||||
|
||||
6
README
6
README
@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
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://upx.tsx.org
|
||||
|
||||
@ -126,8 +126,8 @@ THE FUTURE
|
||||
COPYRIGHT
|
||||
=========
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
|
||||
This program may be used freely, and you are welcome to
|
||||
redistribute it under certain conditions.
|
||||
|
||||
2
THANKS
2
THANKS
@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
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://upx.tsx.org
|
||||
|
||||
|
||||
2
TODO
2
TODO
@ -64,8 +64,6 @@ FORMAT TMT/ADAM
|
||||
- the decompressors are already aligned, no need for an
|
||||
extra alignment
|
||||
|
||||
- verify that compressWithFilters() works
|
||||
|
||||
|
||||
FORMAT WATCOM/LE
|
||||
================
|
||||
|
||||
@ -3,14 +3,14 @@ SHELL = /bin/sh
|
||||
top_srcdir = ..
|
||||
|
||||
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)
|
||||
|
||||
TRIMSPACE = cat
|
||||
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
|
||||
BUILT_SOURCES = upx.1 upx.doc upx.html
|
||||
|
||||
|
||||
###
|
||||
|
||||
98
doc/upx.pod
98
doc/upx.pod
@ -13,7 +13,7 @@ B<upx> S<[ I<command> ]> S<[ I<options> ]> I<filename>...
|
||||
=head1 ABSTRACT
|
||||
|
||||
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
|
||||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
||||
http://upx.tsx.org
|
||||
@ -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 compress a multi-megabyte program. You have been warned.
|
||||
|
||||
Tips for even better compression:
|
||||
Tips for achieving the best compression ratio:
|
||||
|
||||
=over 4
|
||||
|
||||
=item *
|
||||
|
||||
Try if B<--overlay=strip> works.
|
||||
Use the compression level B<--best>.
|
||||
|
||||
=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 *
|
||||
|
||||
@ -277,6 +284,16 @@ Extra options available for this executable format:
|
||||
|
||||
--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
|
||||
@ -294,6 +311,11 @@ Extra options available for this executable format:
|
||||
|
||||
--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
|
||||
@ -311,6 +333,16 @@ Extra options available for this executable format:
|
||||
|
||||
--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
|
||||
@ -338,10 +370,15 @@ Extra options available for this executable format:
|
||||
--coff Produce COFF output instead of EXE. By default
|
||||
UPX keeps your current stub.
|
||||
|
||||
--all-filters Compress the program several times, using different
|
||||
preprocessing filters. This may improve the compression
|
||||
ratio in some cases, but usually the default filter
|
||||
gives the best results anyway.
|
||||
--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.
|
||||
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
--all-filters Compress the program several times, using different
|
||||
preprocessing filters. This may improve the compression
|
||||
ratio in some cases, but usually the default filter
|
||||
gives the best results anyway.
|
||||
--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.
|
||||
|
||||
|
||||
|
||||
@ -691,10 +733,15 @@ Drawbacks:
|
||||
|
||||
Extra options available for this executable format:
|
||||
|
||||
--all-filters Compress the program several times, using different
|
||||
preprocessing filters. This may improve the compression
|
||||
ratio in some cases, but usually the default filter
|
||||
gives the best results anyway.
|
||||
--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.
|
||||
|
||||
|
||||
|
||||
@ -770,10 +817,15 @@ Extra options available for this executable format:
|
||||
UPX never strips relocations from a DLL
|
||||
regardless of this option.
|
||||
|
||||
--all-filters Compress the program several times, using different
|
||||
preprocessing filters. This may improve the compression
|
||||
ratio in some cases, but usually the default filter
|
||||
gives the best results anyway.
|
||||
--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.
|
||||
|
||||
|
||||
|
||||
@ -805,11 +857,11 @@ Please report all bugs immediately to the authors.
|
||||
|
||||
=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
|
||||
redistribute it under certain conditions.
|
||||
|
||||
@ -178,7 +178,8 @@ ifeq (1,2) # checkergcc
|
||||
else
|
||||
ifeq ($(DEBUG),1)
|
||||
##CFLAGS += -O0 -gstabs+3
|
||||
CFLAGS += -O0 -gdwarf-2
|
||||
##CFLAGS += -O0 -gdwarf-2
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
##LDFLAGS += -static
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
@ -459,9 +459,9 @@ struct options_t {
|
||||
// compression options
|
||||
int method;
|
||||
int level; // compression level 1..10
|
||||
int mem_level; // memory level 1..9
|
||||
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
|
||||
int backup;
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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)
|
||||
{
|
||||
while (*n >= '0' && *n <= '9') // gcc / egcs
|
||||
#if defined(__GNUC__)
|
||||
while (*n >= '0' && *n <= '9') // gcc
|
||||
n++;
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
if (strncmp(n, "class ", 6) == 0) // Visual C++
|
||||
n += 6;
|
||||
#endif
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 2000 John F. Reiser
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
throwIOException("seek error",errno);
|
||||
}
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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_);
|
||||
|
||||
@ -137,11 +137,11 @@ bool Filter::unfilter(upx_byte *buf_, unsigned buf_len_, bool verify_checksum)
|
||||
if (fe == NULL)
|
||||
throwInternalError("unfilter-1");
|
||||
if (fe->id == 0)
|
||||
return true;
|
||||
return;
|
||||
if (buf_len < fe->min_buf_len)
|
||||
return false;
|
||||
return;
|
||||
if (fe->max_buf_len && buf_len > fe->max_buf_len)
|
||||
return false;
|
||||
return;
|
||||
if (!fe->do_unfilter)
|
||||
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))
|
||||
throwInternalError("unfilter-4");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Filter::verifyUnfilter()
|
||||
void Filter::verifyUnfilter()
|
||||
{
|
||||
// Note:
|
||||
// This verify is just because of complete paranoia that there
|
||||
@ -175,9 +173,8 @@ bool Filter::verifyUnfilter()
|
||||
// Packer::verifyOverlappingDecompression()
|
||||
|
||||
//printf("verifyUnfilter: %02x %p %d\n", this->id, this->buf, this->buf_len);
|
||||
if (clevel == 1)
|
||||
return true;
|
||||
return unfilter(this->buf, this->buf_len, true);
|
||||
if (clevel != 1)
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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
|
||||
// to fail.
|
||||
//
|
||||
// The return value of unfilters can/should be ignored. They throw
|
||||
// exceptions in case of errors.
|
||||
// Unfilters throw exceptions in case of errors.
|
||||
//
|
||||
// The main idea behind filters is to convert relative jumps and calls
|
||||
// to absolute addresses so that the buffer compresses better.
|
||||
@ -58,8 +57,8 @@ public:
|
||||
void init(int id=0, unsigned addvalue=0);
|
||||
|
||||
bool filter(upx_byte *buf, unsigned buf_len);
|
||||
bool unfilter(upx_byte *buf, unsigned buf_len, bool verify_checksum=false);
|
||||
bool verifyUnfilter();
|
||||
void unfilter(upx_byte *buf, unsigned buf_len, bool verify_checksum=false);
|
||||
void verifyUnfilter();
|
||||
bool scan(const upx_byte *buf, unsigned buf_len);
|
||||
|
||||
public:
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
|
||||
66
src/help.cpp
66
src/help.cpp
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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);
|
||||
con_fprintf(f,
|
||||
" 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_VERSION_STRING, UPX_VERSION_DATE);
|
||||
fg = con_fg(f,fg);
|
||||
@ -137,12 +137,16 @@ void show_help(int x)
|
||||
fg = con_fg(f,fg);
|
||||
con_fprintf(f,
|
||||
" --coff produce COFF output [default: EXE]\n"
|
||||
" --all-methods try all available compression methods\n"
|
||||
" --all-filters try all available preprocessing filters\n"
|
||||
"\n");
|
||||
fg = con_fg(f,FG_YELLOW);
|
||||
con_fprintf(f,"Options for dos/com:\n");
|
||||
fg = con_fg(f,fg);
|
||||
con_fprintf(f,
|
||||
" --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");
|
||||
fg = con_fg(f,FG_YELLOW);
|
||||
con_fprintf(f,"Options for dos/exe:\n");
|
||||
@ -150,13 +154,43 @@ void show_help(int x)
|
||||
con_fprintf(f,
|
||||
" --8086 make compressed exe work on any 8086\n"
|
||||
" --no-reloc put no relocations in to the exe header\n"
|
||||
" --all-methods try all available compression methods\n"
|
||||
"\n");
|
||||
fg = con_fg(f,FG_YELLOW);
|
||||
con_fprintf(f,"Options for dos/sys:\n");
|
||||
fg = con_fg(f,fg);
|
||||
con_fprintf(f,
|
||||
" --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");
|
||||
#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);
|
||||
con_fprintf(f,"Options for watcom/le:\n");
|
||||
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"
|
||||
" --strip-relocs=0 do not strip relocations\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");
|
||||
#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,
|
||||
"file.. executables to (de)compress\n"
|
||||
"\n"
|
||||
"This version supports:\n "
|
||||
"\n");
|
||||
fg = con_fg(f,FG_YELLOW);
|
||||
con_fprintf(f,"This version supports:\n");
|
||||
fg = con_fg(f,fg);
|
||||
con_fprintf(f," "
|
||||
"atari/tos, "
|
||||
"bvmlinuz/386, "
|
||||
"djgpp2/coff, "
|
||||
"dos/com, "
|
||||
"dos/exe, "
|
||||
"dos/sys,\n "
|
||||
//"elks/8086, "
|
||||
"linux/386, "
|
||||
"linux/elf386, "
|
||||
"linux/sh386, "
|
||||
@ -204,6 +235,7 @@ void show_help(int x)
|
||||
"tmt/adam, "
|
||||
"vmlinuz/386,\n "
|
||||
"watcom/le, "
|
||||
//"win16/ne, "
|
||||
"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 type `upx -L'.\n"
|
||||
@ -280,9 +312,9 @@ void show_version(int x)
|
||||
#if defined(WITH_UCL)
|
||||
fprintf(f,"UCL data compression library %s\n", ucl_version_string());
|
||||
#endif
|
||||
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Markus Franz Xaver Johannes Oberhumer\n");
|
||||
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Laszlo Molnar\n");
|
||||
fprintf(f,"Copyright (C) 2000 John F. Reiser\n");
|
||||
fprintf(f,"Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer\n");
|
||||
fprintf(f,"Copyright (C) 1996-2001 Laszlo Molnar\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);
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
@ -30,6 +30,7 @@
|
||||
#include "version.h"
|
||||
#include "mygetopt.h"
|
||||
#include "file.h"
|
||||
#include "packer.h"
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
@ -44,7 +45,6 @@ void init_options(struct options_t *o)
|
||||
o->cmd = CMD_NONE;
|
||||
o->method = -1;
|
||||
o->level = -1;
|
||||
o->mem_level = -1;
|
||||
o->filter = -1;
|
||||
|
||||
o->backup = -1;
|
||||
@ -271,7 +271,12 @@ static void set_cmd(int cmd)
|
||||
static bool set_method(int m, int l)
|
||||
{
|
||||
if (m > 0)
|
||||
{
|
||||
if (!Packer::isValidCompressionMethod(m))
|
||||
return false;
|
||||
opt->method = m;
|
||||
opt->all_methods = false;
|
||||
}
|
||||
if (l > 0)
|
||||
opt->level = l;
|
||||
set_cmd(CMD_COMPRESS);
|
||||
@ -417,7 +422,7 @@ static int do_option(int optc, const char *arg)
|
||||
case 'f':
|
||||
opt->force++;
|
||||
break;
|
||||
case 901:
|
||||
case 902:
|
||||
set_cmd(CMD_FILEINFO);
|
||||
break;
|
||||
case 'h':
|
||||
@ -426,9 +431,11 @@ static int do_option(int optc, const char *arg)
|
||||
set_cmd(CMD_HELP);
|
||||
break;
|
||||
case 'h'+256:
|
||||
#if 0
|
||||
/* according to GNU standards */
|
||||
set_term(stdout);
|
||||
opt->console = CON_FILE;
|
||||
#endif
|
||||
show_help(1);
|
||||
e_exit(EXIT_OK);
|
||||
break;
|
||||
@ -487,16 +494,18 @@ static int do_option(int optc, const char *arg)
|
||||
if (!set_method(-1, optc - '0'))
|
||||
e_method(opt->method, optc);
|
||||
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))
|
||||
e_method(opt->method, 10);
|
||||
break;
|
||||
|
||||
// compression memory level
|
||||
case 902:
|
||||
getoptvar(&opt->mem_level, 1, 9);
|
||||
break;
|
||||
|
||||
// misc
|
||||
case 512:
|
||||
opt->console = CON_FILE;
|
||||
@ -525,6 +534,9 @@ static int do_option(int optc, const char *arg)
|
||||
opt->all_filters = true;
|
||||
opt->filter = -1;
|
||||
break;
|
||||
case 528:
|
||||
opt->all_methods = true;
|
||||
opt->method = -1;
|
||||
// compression parms
|
||||
case 531:
|
||||
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[] =
|
||||
{
|
||||
// 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
|
||||
{"fast", 0, 0, '1'}, // compress faster
|
||||
{"fileinfo", 0x10, 0, 901}, // display info about file
|
||||
{"fast", 0x10, 0, '1'}, // compress faster
|
||||
{"fileinfo", 0x10, 0, 902}, // display info about file
|
||||
{"help", 0, 0, 'h'+256}, // give help
|
||||
{"license", 0, 0, 'L'}, // display software license
|
||||
{"list", 0, 0, 'l'}, // list compressed exe
|
||||
@ -722,8 +735,8 @@ static const struct mfx_option longopts[] =
|
||||
{"nrv2d", 0x10, 0, 704}, // --nrv2d
|
||||
// compression settings
|
||||
{"all-filters", 0x10, 0, 527},
|
||||
{"all-methods", 0x10, 0, 528},
|
||||
{"filter", 0x31, 0, 526}, // --filter=
|
||||
{"mem", 0x31, 0, 902}, // --mem=
|
||||
{"small", 0x10, 0, 525},
|
||||
// compression runtime parameters
|
||||
{"crp-cf", 0x31, 0, 531},
|
||||
@ -785,8 +798,9 @@ static void get_envoptions(int argc, char **argv)
|
||||
static const struct mfx_option longopts[] =
|
||||
{
|
||||
// commands
|
||||
{"best", 0, 0, 900}, // compress best
|
||||
{"fast", 0, 0, '1'}, // compress faster
|
||||
{"best", 0x10, 0, 900}, // compress best
|
||||
{"brute", 0x10, 0, 901}, // compress best, brute force
|
||||
{"fast", 0x10, 0, '1'}, // compress faster
|
||||
|
||||
// options
|
||||
{"info", 0, 0, 'i'}, // info mode
|
||||
@ -1111,7 +1125,6 @@ int main(int argc, char *argv[])
|
||||
// invalidate compression options
|
||||
opt->method = 0;
|
||||
opt->level = 0;
|
||||
opt->mem_level = 0;
|
||||
memset(&opt->crp, 0xff, sizeof(opt->crp));
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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))
|
||||
return M_NRV2B_LE16;
|
||||
static const int m_nrv2b[] = { M_NRV2B_LE16, -1 };
|
||||
if (M_IS_NRV2B(method))
|
||||
return m_nrv2b;
|
||||
#if 0
|
||||
// NOT IMPLEMENTED
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_LE16;
|
||||
static const int m_nrv2d[] = { M_NRV2D_LE16, -1 };
|
||||
if (M_IS_NRV2D(method))
|
||||
return m_nrv2d;
|
||||
#endif
|
||||
return M_NRV2B_LE16;
|
||||
UNUSED(level);
|
||||
return m_nrv2b;
|
||||
}
|
||||
|
||||
|
||||
@ -191,23 +194,12 @@ void PackCom::pack(OutputFile *fo)
|
||||
|
||||
// prepare packheader
|
||||
ph.u_len = file_size;
|
||||
ph.filter = 0;
|
||||
// prepare filter
|
||||
Filter ft(opt->level);
|
||||
Filter ft(ph.level);
|
||||
ft.addvalue = getCallTrickOffset();
|
||||
|
||||
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;
|
||||
// compress
|
||||
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();
|
||||
MemBuffer loader(lsize);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_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 void pack(OutputFile *fo);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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))
|
||||
return M_NRV2B_LE32;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_LE32;
|
||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
||||
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||
|
||||
if (M_IS_NRV2B(method))
|
||||
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
|
||||
{
|
||||
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->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
|
||||
ph.u_len = usize;
|
||||
ph.filter = 0;
|
||||
// prepare filter
|
||||
Filter ft(opt->level);
|
||||
Filter ft(ph.level);
|
||||
ft.buf_len = usize - data->size;
|
||||
ft.addvalue = text->vaddr & ~0x1ff;
|
||||
|
||||
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)
|
||||
// choose best from all available filters
|
||||
strategy = 0;
|
||||
compressWithFilters(&ft, 512, strategy);
|
||||
#endif
|
||||
// compress
|
||||
compressWithFilters(&ft, 512);
|
||||
|
||||
// patch coff header #2
|
||||
const unsigned lsize = getLoaderSize();
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_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 void pack(OutputFile *fo);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
if (M_IS_NRV2D(method))
|
||||
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();
|
||||
|
||||
// prepare filter
|
||||
Filter ft(opt->level);
|
||||
Filter ft(ph.level);
|
||||
ft.buf_len = ph.u_len;
|
||||
ft.addvalue = kernel_entry;
|
||||
|
||||
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)
|
||||
// choose best from all available filters
|
||||
strategy = 0;
|
||||
compressWithFilters(&ft, overlap_range, strategy);
|
||||
// compress
|
||||
compressWithFilters(&ft, overlap_range);
|
||||
|
||||
const unsigned lsize = getLoaderSize();
|
||||
MemBuffer loader(lsize);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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))
|
||||
return M_NRV2B_8;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_8;
|
||||
return opt->level > 1 && ih_imagesize >= 300000 ? M_NRV2D_8 : M_NRV2B_8;
|
||||
static const int m_nrv2b[] = { M_NRV2B_8, M_NRV2D_8, -1 };
|
||||
static const int m_nrv2d[] = { M_NRV2D_8, M_NRV2B_8, -1 };
|
||||
|
||||
if (M_IS_NRV2B(method))
|
||||
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;
|
||||
}
|
||||
|
||||
Filter ft(opt->level);
|
||||
|
||||
// prepare packheader
|
||||
ph.u_len = ih_imagesize + relocsize;
|
||||
if (!compress(ibuf,obuf,0,MAXMATCH))
|
||||
throwNotCompressible();
|
||||
// prepare filter
|
||||
Filter ft(ph.level);
|
||||
// compress
|
||||
compressWithFilters(&ft, 32, 0, NULL, 0, MAXMATCH);
|
||||
if (ph.max_run_found + ph.max_match_found > 0x8000)
|
||||
throwCantPack("decompressor limit exceeded, send a bugreport");
|
||||
|
||||
@ -409,10 +415,9 @@ void PackExe::pack(OutputFile *fo)
|
||||
}
|
||||
#endif
|
||||
|
||||
ph.overlap_overhead = findOverlapOverhead(obuf,32);
|
||||
const unsigned lsize = buildLoader(&ft);
|
||||
int flag = fillExeHeader(&oh);
|
||||
|
||||
const unsigned lsize = getLoaderSize();
|
||||
MemBuffer loader(lsize);
|
||||
memcpy(loader,getLoader(),lsize);
|
||||
//OutputFile::dump("xxloader.dat", loader, lsize);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_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 void pack(OutputFile *fo);
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 2000 John F. Reiser
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
@ -64,9 +64,9 @@ PackLinuxI386elf::~PackLinuxI386elf()
|
||||
|
||||
const upx_byte *PackLinuxI386elf::getLoader() const
|
||||
{
|
||||
if (M_IS_NRV2B(opt->method))
|
||||
if (M_IS_NRV2B(ph.method))
|
||||
return linux_i386elf_nrv2b_loader;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
if (M_IS_NRV2D(ph.method))
|
||||
return linux_i386elf_nrv2d_loader;
|
||||
return NULL;
|
||||
}
|
||||
@ -76,9 +76,9 @@ int PackLinuxI386elf::getLoaderSize() const
|
||||
if (0 != lsize) {
|
||||
return lsize;
|
||||
}
|
||||
if (M_IS_NRV2B(opt->method))
|
||||
if (M_IS_NRV2B(ph.method))
|
||||
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 0;
|
||||
}
|
||||
@ -117,7 +117,7 @@ void PackLinuxI386elf::patchLoader()
|
||||
upx_uint const uncLsize = lsize - fold_begin;
|
||||
upx_uint 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)
|
||||
throwInternalError("loaded compression failed");
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 2000 John F. Reiser
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
@ -47,21 +47,26 @@ static const
|
||||
#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))
|
||||
return M_NRV2B_LE32;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_LE32;
|
||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
||||
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||
|
||||
if (M_IS_NRV2B(method))
|
||||
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
|
||||
{
|
||||
if (M_IS_NRV2B(opt->method))
|
||||
if (M_IS_NRV2B(ph.method))
|
||||
return linux_i386exec_nrv2b_loader;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
if (M_IS_NRV2D(ph.method))
|
||||
return linux_i386exec_nrv2d_loader;
|
||||
return NULL;
|
||||
}
|
||||
@ -72,9 +77,9 @@ int PackLinuxI386::getLoaderSize() const
|
||||
if (0!=lsize) {
|
||||
return lsize;
|
||||
}
|
||||
if (M_IS_NRV2B(opt->method))
|
||||
if (M_IS_NRV2B(ph.method))
|
||||
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 0;
|
||||
}
|
||||
@ -206,7 +211,7 @@ void PackLinuxI386::patchLoader()
|
||||
upx_uint const uncLsize = lsize - fold_begin;
|
||||
upx_uint 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)
|
||||
throwInternalError("loaded compression failed");
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
@ -41,7 +41,7 @@ public:
|
||||
PackLinuxI386(InputFile *f) : super(f) { }
|
||||
virtual int getFormat() const { return UPX_F_LINUX_i386; }
|
||||
virtual const char *getName() const { return "linux/386"; }
|
||||
virtual int getCompressionMethod() const;
|
||||
virtual const int *getCompressionMethods(int method, int level) const;
|
||||
|
||||
virtual bool canPack();
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 2000 John F. Reiser
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
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";
|
||||
}
|
||||
sprintf(script, "#!%s\n", name);
|
||||
if (M_IS_NRV2B(opt->method)) {
|
||||
if (M_IS_NRV2B(ph.method)) {
|
||||
script[strlen(script)-2] = 'b';
|
||||
return (upx_byte const *)script;
|
||||
}
|
||||
if (M_IS_NRV2D(opt->method)) {
|
||||
if (M_IS_NRV2D(ph.method)) {
|
||||
script[strlen(script)-2] = 'd';
|
||||
return (upx_byte const *)script;
|
||||
}
|
||||
@ -70,9 +70,9 @@ const upx_byte *PackLinuxI386sep::getLoader() const
|
||||
|
||||
int PackLinuxI386sep::getLoaderSize() const
|
||||
{
|
||||
if (M_IS_NRV2B(opt->method))
|
||||
if (M_IS_NRV2B(ph.method))
|
||||
return SCRIPT_SIZE;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
if (M_IS_NRV2D(ph.method))
|
||||
return SCRIPT_SIZE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 2000 John F. Reiser
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 2000 John F. Reiser
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
@ -63,9 +63,9 @@ PackLinuxI386sh::~PackLinuxI386sh()
|
||||
|
||||
const upx_byte *PackLinuxI386sh::getLoader() const
|
||||
{
|
||||
if (M_IS_NRV2B(opt->method))
|
||||
if (M_IS_NRV2B(ph.method))
|
||||
return linux_i386sh_nrv2b_loader;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
if (M_IS_NRV2D(ph.method))
|
||||
return linux_i386sh_nrv2d_loader;
|
||||
return NULL;
|
||||
}
|
||||
@ -75,9 +75,9 @@ int PackLinuxI386sh::getLoaderSize() const
|
||||
if (0 != lsize) {
|
||||
return lsize;
|
||||
}
|
||||
if (M_IS_NRV2B(opt->method))
|
||||
if (M_IS_NRV2B(ph.method))
|
||||
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 0;
|
||||
}
|
||||
@ -102,7 +102,7 @@ void PackLinuxI386sh::patchLoader()
|
||||
upx_uint const uncLsize = lsize - fold_begin;
|
||||
upx_uint 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)
|
||||
throwInternalError("loaded compression failed");
|
||||
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 2000 John F. Reiser
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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))
|
||||
return M_NRV2B_LE32;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_LE32;
|
||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
||||
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||
|
||||
if (M_IS_NRV2B(method))
|
||||
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()
|
||||
@ -171,7 +176,9 @@ int PackTmt::readFileHeader()
|
||||
|
||||
bool PackTmt::canPack()
|
||||
{
|
||||
return readFileHeader();
|
||||
if (!readFileHeader())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -221,41 +228,13 @@ void PackTmt::pack(OutputFile *fo)
|
||||
relocsize += 4;
|
||||
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
|
||||
ph.u_len = usize + relocsize;
|
||||
ph.filter = 0;
|
||||
// prepare filter
|
||||
Filter ft(opt->level);
|
||||
Filter ft(ph.level);
|
||||
ft.buf_len = usize;
|
||||
|
||||
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)
|
||||
// choose best from all available filters
|
||||
strategy = 0;
|
||||
compressWithFilters(&ft, 512, strategy);
|
||||
#endif
|
||||
// compress
|
||||
compressWithFilters(&ft, 512);
|
||||
|
||||
const unsigned lsize = getLoaderSize();
|
||||
MemBuffer loader(lsize);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_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 void pack(OutputFile *fo);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
@ -29,6 +29,7 @@
|
||||
#include "conf.h"
|
||||
|
||||
#include "file.h"
|
||||
#include "filter.h"
|
||||
#include "packer.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))
|
||||
return M_NRV2B_8;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_8;
|
||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_8 : M_NRV2B_8;
|
||||
static const int m_nrv2b[] = { M_NRV2B_8, M_NRV2D_8, -1 };
|
||||
static const int m_nrv2d[] = { M_NRV2D_8, M_NRV2B_8, -1 };
|
||||
|
||||
if (M_IS_NRV2B(method))
|
||||
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
|
||||
{
|
||||
if (M_IS_NRV2B(opt->method))
|
||||
if (M_IS_NRV2B(ph.method))
|
||||
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 NULL;
|
||||
}
|
||||
@ -85,9 +91,9 @@ const upx_byte *PackTos::getLoader() 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);
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
if (M_IS_NRV2D(ph.method))
|
||||
return opt->small ? sizeof(nrv2d_loader_small) : sizeof(nrv2d_loader);
|
||||
return 0;
|
||||
}
|
||||
@ -406,13 +412,14 @@ void PackTos::pack(OutputFile *fo)
|
||||
// alloc buffer
|
||||
obuf.allocForCompression(t + d_len + 512);
|
||||
|
||||
// compress (max_match = 65535)
|
||||
// prepare packheader
|
||||
ph.u_len = t;
|
||||
if (!compress(ibuf,obuf,0,65535))
|
||||
throwNotCompressible();
|
||||
// prepare filter
|
||||
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:
|
||||
ph.overlap_overhead = findOverlapOverhead(obuf, 512);
|
||||
unsigned offset = (ph.u_len + ph.overlap_overhead) - ph.c_len;
|
||||
|
||||
// compute addresses
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_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 void pack(OutputFile *fo);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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))
|
||||
return M_NRV2B_LE32;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_LE32;
|
||||
return opt->level > 1 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
||||
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||
|
||||
if (M_IS_NRV2B(method))
|
||||
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();
|
||||
|
||||
// prepare filter
|
||||
Filter ft(opt->level);
|
||||
Filter ft(ph.level);
|
||||
ft.buf_len = ph.u_len;
|
||||
ft.addvalue = kernel_entry;
|
||||
|
||||
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)
|
||||
// choose best from all available filters
|
||||
strategy = 0;
|
||||
compressWithFilters(&ft, 1 << 20, strategy);
|
||||
// compress
|
||||
compressWithFilters(&ft, 1 << 20);
|
||||
|
||||
const unsigned lsize = getLoaderSize();
|
||||
MemBuffer loader(lsize);
|
||||
@ -291,18 +289,11 @@ void PackBvmlinuzI386::pack(OutputFile *fo)
|
||||
readKernel();
|
||||
|
||||
// prepare filter
|
||||
Filter ft(opt->level);
|
||||
Filter ft(ph.level);
|
||||
ft.buf_len = ph.u_len;
|
||||
ft.addvalue = kernel_entry;
|
||||
|
||||
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)
|
||||
// choose best from all available filters
|
||||
strategy = 0;
|
||||
compressWithFilters(&ft, 512, strategy);
|
||||
// compress
|
||||
compressWithFilters(&ft, 512);
|
||||
|
||||
// align everything to dword boundary - it is easier to handle
|
||||
unsigned clen = ph.c_len;
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_VMLINUZ_i386; }
|
||||
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 void pack(OutputFile *fo);
|
||||
@ -116,7 +116,7 @@ public:
|
||||
PackElks8086(InputFile *f) : super(f) { }
|
||||
virtual int getFormat() const { return UPX_F_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 void pack(OutputFile *fo);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_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 void pack(OutputFile *fo);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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))
|
||||
return M_NRV2B_8;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_8;
|
||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_8 : M_NRV2B_8;
|
||||
static const int m_nrv2b[] = { M_NRV2B_8, M_NRV2D_8, -1 };
|
||||
static const int m_nrv2d[] = { M_NRV2D_8, M_NRV2B_8, -1 };
|
||||
|
||||
if (M_IS_NRV2B(method))
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_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 void pack(OutputFile *fo);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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))
|
||||
return M_NRV2B_LE32;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_LE32;
|
||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
||||
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||
|
||||
if (M_IS_NRV2B(method))
|
||||
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()
|
||||
{
|
||||
return readFileHeader();
|
||||
if (!readFileHeader())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1528,8 +1535,7 @@ void PackW32Pe::pack(OutputFile *fo)
|
||||
}
|
||||
|
||||
// check for NeoLite
|
||||
for (ic = 0; ic < 64; ic++)
|
||||
if (memcmp(ibuf + ih.entry + ic,"NeoLite",7) == 0)
|
||||
if (find(ibuf + ih.entry, 64+7, "NeoLite", 7) >= 0)
|
||||
throwCantPack("file is already compressed with another packer");
|
||||
|
||||
unsigned overlay = file_size - stripDebug(overlaystart);
|
||||
@ -1612,48 +1618,16 @@ void PackW32Pe::pack(OutputFile *fo)
|
||||
s += 4;
|
||||
ph.u_len += s;
|
||||
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
|
||||
ph.filter = 0;
|
||||
ph.u_len -= rvamin;
|
||||
// prepare filter
|
||||
Filter ft(opt->level);
|
||||
Filter ft(ph.level);
|
||||
ft.buf_len = ih.codesize;
|
||||
ft.addvalue = 0;
|
||||
|
||||
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;
|
||||
// compress
|
||||
int strategy = allow_filter ? 0 : -3;
|
||||
compressWithFilters(&ft, 2048, strategy,
|
||||
NULL, 0, 0, ih.codebase, rvamin);
|
||||
#endif
|
||||
|
||||
newvsize = (ph.u_len + rvamin + ph.overlap_overhead + oam1) &~ oam1;
|
||||
if (tlsindex && ((newvsize - ph.c_len - 1024 + oam1) &~ oam1) > tlsindex + 4)
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_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 void pack(OutputFile *fo);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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))
|
||||
return M_NRV2B_LE32;
|
||||
if (M_IS_NRV2D(opt->method))
|
||||
return M_NRV2D_LE32;
|
||||
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_LE32 : M_NRV2B_LE32;
|
||||
static const int m_nrv2b[] = { M_NRV2B_LE32, M_NRV2D_LE32, -1 };
|
||||
static const int m_nrv2d[] = { M_NRV2D_LE32, M_NRV2B_LE32, -1 };
|
||||
|
||||
if (M_IS_NRV2B(method))
|
||||
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()
|
||||
{
|
||||
return LeFile::readFileHeader();
|
||||
if (!LeFile::readFileHeader())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -479,7 +486,7 @@ void PackWcle::pack(OutputFile *fo)
|
||||
sofixups += 13;
|
||||
|
||||
// filter
|
||||
Filter ft(opt->level);
|
||||
Filter ft(ph.level);
|
||||
tryFilters(&ft, iimage+text_vaddr, text_size, text_vaddr);
|
||||
|
||||
encodeImage(&ft);
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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 getFormat() const { return UPX_F_WC_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 void pack(OutputFile *fo);
|
||||
|
||||
151
src/packer.cpp
151
src/packer.cpp
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// this is called directly after canPack() from class PackMaster
|
||||
void Packer::updatePackHeader()
|
||||
{
|
||||
// update our local options
|
||||
if (opt->level < 0)
|
||||
opt->level = file_size < 512*1024 ? 8 : 7;
|
||||
opt->method = getCompressionMethod();
|
||||
// set ph
|
||||
assert(opt->cmd == CMD_COMPRESS);
|
||||
//
|
||||
const int *m = getCompressionMethods(opt->method, opt->level);
|
||||
ph.method = m[0];
|
||||
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");
|
||||
#endif
|
||||
}
|
||||
if (ph.method < M_NRV2B_LE32 || ph.method > M_NRV2D_LE16)
|
||||
if (!isValidCompressionMethod(ph.method))
|
||||
throwCantUnpack("unknown compression method");
|
||||
|
||||
// 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
|
||||
**************************************************************************/
|
||||
@ -924,12 +934,12 @@ void Packer::initLoader(const void *pdata, int plen, int pinfo)
|
||||
"\n\0"
|
||||
"$Info: This file is packed with the UPX executable packer http://upx.tsx.org $"
|
||||
"\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";
|
||||
|
||||
static const char identsmall[] =
|
||||
"\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";
|
||||
|
||||
if (opt->small)
|
||||
@ -1059,8 +1069,8 @@ void Packer::addFilter32(int filter_id)
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// Try compression with several filters, choose the best or first one.
|
||||
// Needs buildLoader().
|
||||
// Try compression with several methods and filters, choose the best
|
||||
/ or first working one. Needs buildLoader().
|
||||
//
|
||||
// Required inputs:
|
||||
// this->ph
|
||||
@ -1072,18 +1082,18 @@ void Packer::addFilter32(int filter_id)
|
||||
//
|
||||
// - updates this->ph
|
||||
// - updates *ft
|
||||
// - ibuf[] is restored to unfiltered version
|
||||
// - ibuf[] is restored to the original unfiltered version
|
||||
// - obuf[] contains the best compressed version
|
||||
//
|
||||
// strategy:
|
||||
// 0: try all filters, use best one
|
||||
// n: try the first N filters in parm_filters[], use best one
|
||||
// n: try the first N filters, use best one
|
||||
// -1: try all filters, use first working one
|
||||
// -2: try only the opt->filter filter
|
||||
// -3: use no filter at all
|
||||
//
|
||||
// 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.
|
||||
**************************************************************************/
|
||||
@ -1114,23 +1124,39 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
||||
assert(orig_ft.id == 0);
|
||||
assert(filter_off + filter_len <= compress_buf_off + compress_buf_len);
|
||||
|
||||
// setup raw_filters
|
||||
static const int no_filters[] = { 0, -1 };
|
||||
int strategy_filters[] = { 0, -1 };
|
||||
// setup filter strategy
|
||||
if (strategy == 0)
|
||||
{
|
||||
if (opt->all_filters)
|
||||
// choose best from all available 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);
|
||||
|
||||
const int *raw_filters = parm_filters;
|
||||
// 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 = no_filters;
|
||||
if (strategy == -2)
|
||||
{
|
||||
assert(opt->filter >= 0);
|
||||
strategy_filters[0] = opt->filter;
|
||||
raw_filters = strategy_filters;
|
||||
raw_filters = tmp_filters;
|
||||
}
|
||||
else if (strategy == -3)
|
||||
raw_filters = no_filters;
|
||||
|
||||
// first pass - count number of filters
|
||||
int raw_nfilters = 0;
|
||||
@ -1140,7 +1166,7 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
||||
raw_nfilters++;
|
||||
}
|
||||
|
||||
// copy filters, eliminate duplicates, add a 0
|
||||
// copy filters, add a 0
|
||||
int nfilters = 0;
|
||||
bool zero_seen = false;
|
||||
autoheap_array(int, filters, raw_nfilters + 2);
|
||||
@ -1148,46 +1174,52 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
||||
{
|
||||
if (*f == 0)
|
||||
zero_seen = true;
|
||||
bool duplicate = false;
|
||||
for (int i = 0; i < nfilters; i++)
|
||||
if (filters[i] == *f)
|
||||
duplicate = true;
|
||||
if (!duplicate)
|
||||
filters[nfilters++] = *f;
|
||||
if (nfilters == strategy)
|
||||
break;
|
||||
}
|
||||
if (!zero_seen)
|
||||
filters[nfilters++] = 0;
|
||||
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
|
||||
if (strategy < 0)
|
||||
ui_total_passes += 1;
|
||||
ui_total_passes += 1 * nmethods;
|
||||
else
|
||||
{
|
||||
if (strategy > nfilters)
|
||||
nfilters = strategy;
|
||||
ui_total_passes += nfilters;
|
||||
}
|
||||
ui_total_passes += nfilters * nmethods;
|
||||
|
||||
// Working buffer for compressed data. Don't waste memory.
|
||||
upx_byte *otemp = obuf;
|
||||
MemBuffer otemp_buf;
|
||||
if (nfilters > 1 && strategy >= 0)
|
||||
{
|
||||
otemp_buf.allocForCompression(compress_buf_len);
|
||||
otemp = otemp_buf;
|
||||
}
|
||||
|
||||
// compress
|
||||
int nfilters_success = 0;
|
||||
for (int i = 0; i < nfilters; i++)
|
||||
for (int m = 0; m < nmethods; m++) // for all methods
|
||||
{
|
||||
for (int i = 0; i < nfilters; i++) // for all filters
|
||||
{
|
||||
// get fresh packheader
|
||||
ph = orig_ph;
|
||||
ph.method = methods[m];
|
||||
ph.filter = filters[i];
|
||||
// get fresh filter
|
||||
Filter ft = orig_ft;
|
||||
ft.init(filters[i], orig_ft.addvalue);
|
||||
ft.init(ph.filter, orig_ft.addvalue);
|
||||
// filter
|
||||
optimizeFilter(&ft, ibuf + filter_off, filter_len);
|
||||
bool success = ft.filter(ibuf + filter_off, filter_len);
|
||||
@ -1199,11 +1231,16 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
||||
if (!success)
|
||||
{
|
||||
// filter failed or was usesless
|
||||
if (strategy >= 0)
|
||||
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
|
||||
@ -1217,7 +1254,7 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
||||
lsize = buildLoader(&ft);
|
||||
}
|
||||
#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(),
|
||||
best_ph.c_len, best_ph_lsize, best_ph.c_len + best_ph_lsize);
|
||||
#endif
|
||||
@ -1226,8 +1263,15 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
||||
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)
|
||||
{
|
||||
@ -1246,13 +1290,13 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
||||
if (strategy < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// postconditions
|
||||
// postconditions 1)
|
||||
assert(nfilters_success > 0);
|
||||
assert(best_ph.u_len == orig_ph.u_len);
|
||||
assert(best_ph.filter == best_ft.id);
|
||||
assert(best_ph.filter_cto == best_ft.cto);
|
||||
assert(best_ph.overlap_overhead > 0);
|
||||
|
||||
// copy back results
|
||||
this->ph = best_ph;
|
||||
@ -1264,6 +1308,9 @@ void Packer::compressWithFilters(Filter *parm_ft,
|
||||
if (!checkCompressionRatio(best_ph.u_len, best_ph.c_len))
|
||||
throwNotCompressible();
|
||||
|
||||
// postconditions 2)
|
||||
assert(best_ph.overlap_overhead > 0);
|
||||
|
||||
// convenience
|
||||
buildLoader(&best_ft);
|
||||
}
|
||||
|
||||
14
src/packer.h
14
src/packer.h
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
@ -107,10 +107,10 @@ public:
|
||||
virtual ~Packer();
|
||||
|
||||
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 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;
|
||||
|
||||
// PackMaster entries
|
||||
@ -163,7 +163,7 @@ protected:
|
||||
// high-level compression drivers
|
||||
void compressWithFilters(Filter *ft,
|
||||
const unsigned overlap_range,
|
||||
int strategy,
|
||||
int strategy = 0,
|
||||
const int *filters = NULL,
|
||||
unsigned max_offset = 0, unsigned max_match = 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 unsigned unoptimizeReloc32(upx_byte **in,upx_byte *image,MemBuffer *out,int bs);
|
||||
|
||||
// compression method util
|
||||
public:
|
||||
static bool isValidCompressionMethod(int method);
|
||||
|
||||
|
||||
protected:
|
||||
InputFile *fi;
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
UPX and the UCL library are free software; you can redistribute them
|
||||
@ -95,6 +95,7 @@ static Packer* try_pack(Packer *p, InputFile *f)
|
||||
f->seek(0,SEEK_SET);
|
||||
if (p->canPack())
|
||||
{
|
||||
if (opt->cmd == CMD_COMPRESS)
|
||||
p->updatePackHeader();
|
||||
f->seek(0,SEEK_SET);
|
||||
return p;
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
This file is part of the UPX executable compressor.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; All Rights Reserved.
|
||||
;
|
||||
; 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.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; All Rights Reserved.
|
||||
;
|
||||
; 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.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; All Rights Reserved.
|
||||
;
|
||||
; UPX and the UCL library are free software; you can redistribute them
|
||||
@ -33,7 +33,7 @@
|
||||
db 10,0
|
||||
db '$Id: UPX '
|
||||
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
|
||||
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
;
|
||||
; This file is part of the UPX executable compressor.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; All Rights Reserved.
|
||||
;
|
||||
; UPX and the UCL library are free software; you can redistribute them
|
||||
@ -29,7 +29,7 @@
|
||||
; ------------- COPYRIGHT -------------
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
;
|
||||
; This file is part of the UPX executable compressor.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; All Rights Reserved.
|
||||
;
|
||||
; 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.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; All Rights Reserved.
|
||||
;
|
||||
; 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.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; All Rights Reserved.
|
||||
;
|
||||
; 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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
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
|
||||
and/or modify them under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
|
||||
@ -2,13 +2,11 @@
|
||||
;
|
||||
; This file is part of the UPX executable compressor.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; Copyright (C) 2000-2001 John F. Reiser
|
||||
; 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
|
||||
; and/or modify them under the terms of the GNU General Public License as
|
||||
; published by the Free Software Foundation; either version 2 of
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
All Rights Reserved.
|
||||
|
||||
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.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; Copyright (C) 2000-2001 John F. Reiser
|
||||
; 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
|
||||
; and/or modify them under the terms of the GNU General Public License as
|
||||
; published by the Free Software Foundation; either version 2 of
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
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
|
||||
and/or modify them under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
|
||||
@ -2,13 +2,11 @@
|
||||
;
|
||||
; This file is part of the UPX executable compressor.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; Copyright (C) 2000-2001 John F. Reiser
|
||||
; 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
|
||||
; and/or modify them under the terms of the GNU General Public License as
|
||||
; published by the Free Software Foundation; either version 2 of
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2000 Laszlo Molnar
|
||||
Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996-2001 Laszlo Molnar
|
||||
Copyright (C) 2000-2001 John F. Reiser
|
||||
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
|
||||
and/or modify them under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
|
||||
@ -2,13 +2,11 @@
|
||||
;
|
||||
; This file is part of the UPX executable compressor.
|
||||
;
|
||||
; Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2000 Laszlo Molnar
|
||||
; Copyright (C) 1996-2001 Markus Franz Xaver Johannes Oberhumer
|
||||
; Copyright (C) 1996-2001 Laszlo Molnar
|
||||
; Copyright (C) 2000-2001 John F. Reiser
|
||||
; 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
|
||||
; and/or modify them under the terms of the GNU General Public License as
|
||||
; 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