📄 upx.html
字号:
<HTML>
<HEAD>
<TITLE>upx - compress or expand executable files</TITLE>
<LINK REV="made" HREF="mailto:none">
</HEAD>
<BODY>
<!-- INDEX BEGIN -->
<!--
<UL>
<LI><A HREF="#NAME">NAME</A>
<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
<LI><A HREF="#ABSTRACT">ABSTRACT</A>
<LI><A HREF="#DISCLAIMER">DISCLAIMER</A>
<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
<LI><A HREF="#COMMANDS">COMMANDS</A>
<UL>
<LI><A HREF="#Compress">Compress</A>
<LI><A HREF="#Decompress">Decompress</A>
<LI><A HREF="#Test">Test</A>
<LI><A HREF="#List">List</A>
</UL>
<LI><A HREF="#OPTIONS">OPTIONS</A>
<LI><A HREF="#COMPRESSION_LEVELS_TUNING">COMPRESSION LEVELS & TUNING</A>
<LI><A HREF="#OVERLAY_HANDLING_OPTIONS">OVERLAY HANDLING OPTIONS</A>
<LI><A HREF="#ENVIRONMENT">ENVIRONMENT</A>
<LI><A HREF="#NOTES_FOR_THE_SUPPORTED_EXECUTAB">NOTES FOR THE SUPPORTED EXECUTABLE FORMATS</A>
<UL>
<LI><A HREF="#NOTES_FOR_ATARI_TOS">NOTES FOR ATARI/TOS</A>
<LI><A HREF="#NOTES_FOR_DOS_COM">NOTES FOR DOS/COM</A>
<LI><A HREF="#NOTES_FOR_DOS_EXE">NOTES FOR DOS/EXE</A>
<LI><A HREF="#NOTES_FOR_DOS_SYS">NOTES FOR DOS/SYS</A>
<LI><A HREF="#NOTES_FOR_DJGPP2_COFF">NOTES FOR DJGPP2/COFF</A>
<LI><A HREF="#NOTES_FOR_LINUX_i386">NOTES FOR LINUX/i386</A>
<LI><A HREF="#NOTES_FOR_RTM32_PE">NOTES FOR RTM32/PE</A>
<LI><A HREF="#NOTES_FOR_TMT_ADAM">NOTES FOR TMT/ADAM</A>
<LI><A HREF="#NOTES_FOR_WATCOM_LE">NOTES FOR WATCOM/LE</A>
<LI><A HREF="#NOTES_FOR_WIN32_PE">NOTES FOR WIN32/PE</A>
</UL>
<LI><A HREF="#DIAGNOSTICS">DIAGNOSTICS</A>
<LI><A HREF="#BUGS">BUGS</A>
<LI><A HREF="#AUTHORS">AUTHORS</A>
<LI><A HREF="#COPYRIGHT">COPYRIGHT</A>
</UL>
-->
<!-- INDEX END -->
<P>
<H1><A NAME="NAME">NAME</A></H1>
<P>
upx - compress or expand executable files
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<P>
<STRONG>upx</STRONG> [ <EM>command</EM> ] [ <EM>options</EM> ] <EM>filename</EM>...
<P>
<HR>
<H1><A NAME="ABSTRACT">ABSTRACT</A></H1>
<P>
<PRE> The Ultimate Packer for eXecutables
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
<A HREF="http://wildsau.idv.uni-linz.ac.at/mfx/upx.html">http://wildsau.idv.uni-linz.ac.at/mfx/upx.html</A>
<A HREF="http://www.nexus.hu/upx">http://www.nexus.hu/upx</A>
<A HREF="http://upx.tsx.org">http://upx.tsx.org</A>
</PRE>
<P>
<STRONG>UPX</STRONG> is a portable, extendable, high-performance executable packer for several
different executable formats. It achieves an excellent compression ratio
and offers <EM>*very*</EM> fast decompression. Your executables suffer no memory overhead or other
drawbacks for most of the formats supported.
<P>
While you may use UPX freely for both non-commercial and commercial
executables (for details see the file LICENSE), we would highly appreciate
if you credit UPX and ourselves in the documentation, possibly including a
reference to the UPX home page. Thanks.
<P>
[ Using UPX in non-OpenSource applications without proper credits is
considered not politically correct ;-) ]
<P>
<HR>
<H1><A NAME="DISCLAIMER">DISCLAIMER</A></H1>
<P>
UPX comes with ABSOLUTELY NO WARRANTY; for details see the file LICENSE.
<P>
Having said that, we think that UPX is quite stable now. Indeed we have
compressed lots of files without any problems. Also, the current version
has undergone several months of beta testing - actually it's almost 2 years
since our first public beta.
<P>
This is the first production quality release, and we plan that future 1.xx
releases will be backward compatible with this version.
<P>
Please report all problems or suggestions to the authors. Thanks.
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<STRONG>UPX</STRONG> is a versatile executable packer with the following features:
<P>
<PRE> - excellent compression ratio: compresses better than zip/gzip,
use UPX to decrease the size of your distribution !
</PRE>
<P>
<PRE> - very fast decompression: about 10 MB/sec even on my old Pentium 133
</PRE>
<P>
<PRE> - no memory overhead for your compressed executables for most of the
supported formats
</PRE>
<P>
<PRE> - safe: you can list, test and unpack your executables
Also, a checksum of both the compressed and uncompressed file is
maintained internally.
</PRE>
<P>
<PRE> - universal: UPX can pack a number of executable formats:
* dos/exe
* dos/sys
* dos/com
* djgpp2/coff
* watcom/le (supporting DOS4G, PMODE/W, DOS32a and CauseWay)
* win32/pe
* rtm32/pe
* tmt/adam
* linux/i386
* atari/tos
</PRE>
<P>
<PRE> - portable: UPX is written in portable endian-neutral C++
</PRE>
<P>
<PRE> - extendable: because of the class layout it's very easy to support
new executable formats or add new compression algorithms
</PRE>
<P>
<PRE> - free: UPX can be distributed and used freely. And from version 0.99
the full source code of UPX is released under the GNU General Public
License (GPL) !
</PRE>
<P>
You probably understand now why we call UPX the ``<EM>ultimate</EM>'' executable packer.
<P>
<HR>
<H1><A NAME="COMMANDS">COMMANDS</A></H1>
<P>
<HR>
<H2><A NAME="Compress">Compress</A></H2>
<P>
This is the default operation, eg. <STRONG>upx yourfile.exe</STRONG> will compress the file specified on the command line.
<P>
<HR>
<H2><A NAME="Decompress">Decompress</A></H2>
<P>
All UPX supported file formats can be unpacked using the <STRONG>-d</STRONG> switch, eg.
<STRONG>upx -d yourfile.exe</STRONG> will uncompress the file you've just compressed.
<P>
<HR>
<H2><A NAME="Test">Test</A></H2>
<P>
The <STRONG>-t</STRONG> command tests the integrity of the compressed and uncompressed data, eg. <STRONG>upx -t yourfile.exe</STRONG> check whether your file can be safely decompressed. Note, that this command
doesn't check the whole file, only the part that will be uncompressed
during program execution. This means that you should not use this command
instead of a virus checker.
<P>
<HR>
<H2><A NAME="List">List</A></H2>
<P>
The <STRONG>-l</STRONG> command prints out some information about the compressed files specified on
the command line as parameters, eg <STRONG>upx -l yourfile.exe</STRONG>
shows the compressed / uncompressed size and the compression ratio of
<EM>yourfile.exe</EM>.
<P>
<HR>
<H1><A NAME="OPTIONS">OPTIONS</A></H1>
<P>
<STRONG>-q</STRONG>: be quiet, suppress warnings
<P>
<STRONG>-q -q</STRONG> (or <STRONG>-qq</STRONG>): be very quiet, suppress errors
<P>
<STRONG>-q -q -q</STRONG> (or <STRONG>-qqq</STRONG>): produce no output at all
<P>
<STRONG>--help</STRONG>: prints the help
<P>
<STRONG>--version</STRONG>: print the version of UPX
<P>
<STRONG>--stdout</STRONG>: writes all output to stdout
<P>
[ ...to be written... - type `<STRONG>upx --help</STRONG>' for now ]
<P>
<HR>
<H1><A NAME="COMPRESSION_LEVELS_TUNING">COMPRESSION LEVELS & TUNING</A></H1>
<P>
<STRONG>UPX</STRONG> offers ten different compression levels from <STRONG>-1</STRONG> to <STRONG>-9</STRONG>, and <STRONG>--best</STRONG>. The default compression level is <STRONG>-7</STRONG>.
<UL>
<LI>
<P>
Compression levels 1, 2 and 3 are pretty fast.
<LI>
<P>
Compression levels 4, 5 and 6 achieve a good time/ratio performance.
<LI>
<P>
Compression levels 7, 8 and 9 favor compression ratio over speed.
<LI>
<P>
Compression level <STRONG>--best</STRONG> may take a very long time.
</UL>
<P>
Note that compression level <STRONG>-9</STRONG> can be quite slow for some large files, but you definitely should use it
when releasing a final version of your program. (E.g. it took about 20
minutes to compress the almost 5 MB MAME 0.34 with <STRONG>-9</STRONG> on my Pentium 133, but the resulting executable was still ~65 kB smaller
than when using <STRONG>-7</STRONG>.)
<P>
Since UPX 0.70 there is also an extra compression level <STRONG>--best</STRONG> which squeezes out even some more compression ratio. While it is usually
fine to use this option with your favorite .com file it may take several
hours to compress a multi-megabyte program. You have been warned.
<P>
Tips for even better compression:
<UL>
<LI>
<P>
Try if <STRONG>--overlay=strip</STRONG> works.
<LI>
<P>
For win32/pe programs there's <STRONG>--strip-relocs=0</STRONG>. See notes below.
</UL>
<P>
<HR>
<H1><A NAME="OVERLAY_HANDLING_OPTIONS">OVERLAY HANDLING OPTIONS</A></H1>
<P>
<STRONG>UPX</STRONG> handles overlays like many other executable packers do: it simply copies
the overlay after the compressed image. This works with some files, but
doesn't work with others.
<P>
Since version 0.90 UPX defaults to <STRONG>--overlay=copy</STRONG> for all executable formats.
<P>
<PRE> --overlay=copy Copy any extra data attached to the file. [DEFAULT]
</PRE>
<P>
<PRE> --overlay=strip Strip any overlay from the program instead of
copying it. Be warned, this may make the compressed
program crash or otherwise unusable.
</PRE>
<P>
<PRE> --overlay=skip Refuse to compress any program which has an overlay.
</PRE>
<P>
<HR>
<H1><A NAME="ENVIRONMENT">ENVIRONMENT</A></H1>
<P>
The environment variable <STRONG>UPX</STRONG> can hold a set of default options for UPX. These options are interpreted
first and can be overwritten by explicit command line parameters. For
example:
<P>
<PRE> for DOS/Windows: set UPX=-9 --compress-icons#1
for sh/ksh/zsh: UPX="-9 --compress-icons=1"; export UPX
for csh/tcsh: setenv UPX "-9 --compress-icons=1"
</PRE>
<P>
Under DOS/Windows you must use '#' instead of '=' when setting the
environment variable because of a command.com limitiation.
<P>
On Vax/VMS, the name of the environment variable is UPX_OPT, to avoid a
conflict with the symbol set for invocation of the program.
<P>
Not all of the options are valid in the environment variable - UPX will
tell you.
<P>
You can use the <STRONG>--no-env</STRONG> option to turn this support off.
<P>
<HR>
<H1><A NAME="NOTES_FOR_THE_SUPPORTED_EXECUTAB">NOTES FOR THE SUPPORTED EXECUTABLE FORMATS</A></H1>
<P>
<HR>
<H2><A NAME="NOTES_FOR_ATARI_TOS">NOTES FOR ATARI/TOS</A></H2>
<P>
This is the executable format used by the Atari ST, a 68000 based personal
computer which was popular in the late '80s. Support of this format is only
because of nostalgic feelings of one of the authors and serves no practical
purpose :-).
<P>
Packed programs will be byte-identical to the original after uncompression.
All debug information will be stripped, though.
<P>
Extra options available for this executable format:
<P>
<PRE> (none)
</PRE>
<P>
<HR>
<H2><A NAME="NOTES_FOR_DOS_COM">NOTES FOR DOS/COM</A></H2>
<P>
Obviously UPX won't work with executables that want to read data from
themselves (like some commandline utilities that ship with Win95/98).
<P>
Compressed programs only work on a 286+.
<P>
Packed programs will be byte-identical to the original after uncompression.
<P>
Maximum uncompressed size: ~65100 bytes.
<P>
Extra options available for this executable format:
<P>
<PRE> --8086 Create an executable that works on any 8086 CPU.
</PRE>
<P>
<HR>
<H2><A NAME="NOTES_FOR_DOS_EXE">NOTES FOR DOS/EXE</A></H2>
<P>
dos/exe stands for all ``normal'' 16-bit DOS executables.
<P>
Obviously UPX won't work with executables that want to read data from
themselves (like some command line utilities that ship with Win95/98).
<P>
Compressed programs only work on a 286+.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -