forked from upx/upx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
convert-repo
committed
May 19, 2000
0 parents
commit 1a9128a
Showing
130 changed files
with
31,392 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
ooooo ooo ooooooooo. ooooooo ooooo | ||
`888' `8' `888 `Y88. `8888 d8' | ||
888 8 888 .d88' Y888..8P | ||
888 8 888ooo88P' `8888' | ||
888 8 888 .8PY888. | ||
`88. .8' 888 d8' `888b | ||
`YbodP' o888o o888o o88888o | ||
|
||
|
||
The Ultimate Packer for eXecutables | ||
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar | ||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html | ||
http://www.nexus.hu/upx | ||
http://upx.tsx.org | ||
|
||
|
||
Things not (yet) supported: | ||
=========================== | ||
|
||
dos/exe | ||
------- | ||
* normal dos/exes with new exe headers | ||
* max ~24000 relocation records (...should be enough for everyone ;-) | ||
* exe + sys combined images | ||
|
||
wc/le | ||
----- | ||
* 16-bit selector alias fixups | ||
* 16-bit offset relocation for objects larger than 4 kbyte | ||
* 16:16 fixups | ||
|
||
If you need any of the above (they're very rare), send us an url of a | ||
test file. | ||
|
||
* 16-bit objects are not loaded into DOS memory | ||
* There is still a problem with the wdosx extender: if you compress a | ||
wc/le file which does NOT contain the wdosx extender, and after this | ||
you bind the wdosx stub to the compressed file, then it will work. | ||
Otherwise it won't. | ||
* unpacked pmwlite compressed programs might not work when compressed | ||
with upx (pmwunlite bug mainly :-) | ||
|
||
win32/pe | ||
-------- | ||
* writeable shared sections (`--force' *may* work) | ||
* certificates in the image | ||
|
||
djgpp2/coff | ||
----------- | ||
* all overlays (except Allegro pakfiles) are silently stripped | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
-----BEGIN PGP SIGNED MESSAGE----- | ||
|
||
|
||
ooooo ooo ooooooooo. ooooooo ooooo | ||
`888' `8' `888 `Y88. `8888 d8' | ||
888 8 888 .d88' Y888..8P | ||
888 8 888ooo88P' `8888' | ||
888 8 888 .8PY888. | ||
`88. .8' 888 d8' `888b | ||
`YbodP' o888o o888o o88888o | ||
|
||
|
||
The Ultimate Packer for eXecutables | ||
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar | ||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html | ||
http://www.nexus.hu/upx | ||
http://upx.tsx.org | ||
|
||
|
||
PLEASE CAREFULLY READ THIS LICENSE AGREEMENT, ESPECIALLY IF YOU PLAN | ||
TO MODIFY THE UPX SOURCE CODE OR USE A MODIFIED UPX VERSION. | ||
|
||
|
||
ABSTRACT | ||
======== | ||
|
||
UPX and UCL are copyrighted software distributed under the terms | ||
of the GNU General Public License (hereinafter the "GPL"). | ||
|
||
The stub which is imbedded in each UPX compressed program is part | ||
of UPX and UCL, and contains code that is under our copyright. The | ||
terms of the GNU General Public License still apply as compressing | ||
a program is a special form of linking with our stub. | ||
|
||
As a special exception we grant the free usage of UPX for all | ||
executables, including commercial programs. | ||
See below for details and restrictions. | ||
|
||
|
||
COPYRIGHT | ||
========= | ||
|
||
UPX and UCL are copyrighted software. All rights remain with the authors. | ||
|
||
UPX is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer | ||
UPX is Copyright (C) 1996-2000 Laszlo Molnar | ||
|
||
UCL is Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer | ||
|
||
|
||
GNU GENERAL PUBLIC LICENSE | ||
========================== | ||
|
||
UPX and the UCL library are free software; you can redistribute them | ||
and/or modify them under the terms of the GNU General Public License as | ||
published by the Free Software Foundation; either version 2 of | ||
the License, or (at your option) any later version. | ||
|
||
UPX and UCL are distributed in the hope that they will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program; see the file COPYING. | ||
|
||
|
||
SPECIAL EXCEPTION FOR COMPRESSED EXECUTABLES | ||
============================================ | ||
|
||
The stub which is imbedded in each UPX compressed program is part | ||
of UPX and UCL, and contains code that is under our copyright. The | ||
terms of the GNU General Public License still apply as compressing | ||
a program is a special form of linking with our stub. | ||
|
||
Hereby Markus F.X.J. Oberhumer and Laszlo Molnar grant you special | ||
permission to freely use and distribute all UPX compressed programs | ||
(including commercial ones), subject to the following restrictions: | ||
|
||
1. You must compress your program with a completely unmodified UPX | ||
version; either with our precompiled version, or (at your option) | ||
with a self compiled version of the unmodified UPX sources as | ||
distributed by us. | ||
2. This also implies that the UPX stub must be completely unmodfied, i.e. | ||
the stub imbedded in your compressed program must be byte-identical | ||
to the stub that is produced by the official unmodified UPX version. | ||
3. The decompressor and any other code from the stub must exclusively get | ||
used by the unmodified UPX stub for decompressing your program at | ||
program startup. No portion of the stub may get read, copied, | ||
called or otherwise get used or accessed by your program. | ||
|
||
|
||
ANNOTATIONS | ||
=========== | ||
|
||
- You can use a modified UPX version or modified UPX stub only for | ||
programs that are compatible with the GNU General Public License. | ||
|
||
- We grant you special permission to freely use and distribute all UPX | ||
compressed programs. But any modification of the UPX stub (such as, | ||
but not limited to, removing our copyright string or making your | ||
program non-decompressible) will immediately revoke your right to | ||
use and distribute a UPX compressed program. | ||
|
||
- UPX is not a software protection tool; by requiring that you use | ||
the unmodified UPX version for your proprietary programs we | ||
make sure that any user can decompress your program. This protects | ||
both you and your users as nobody can hide malicious code - | ||
any program that cannot be decompressed is highly suspicious | ||
by definition. | ||
|
||
- You can integrate all or part of UPX and UCL into projects that | ||
are compatible with the GNU GPL, but obviously you cannot grant | ||
any special exceptions beyond the GPL for our code in your project. | ||
|
||
- We want to actively support manufacturers of virus scanners and | ||
similar security software. Please contact us if you would like to | ||
incorporate parts of UPX or UCL into such a product. | ||
|
||
|
||
|
||
Markus F.X.J. Oberhumer Laszlo Molnar | ||
[email protected] [email protected] | ||
|
||
Linz, Austria, 25 Feb 2000 | ||
|
||
|
||
|
||
-----BEGIN PGP SIGNATURE----- | ||
Version: 2.6.3ia | ||
Charset: noconv | ||
|
||
iQCVAwUBOLaLS210fyLu8beJAQFYVAP/ShzENWKLTvedLCjZbDcwaBEHfUVcrGMI | ||
wE7frMkbWT2zmkdv9hW90WmjMhOBu7yhUplvN8BKOtLiolEnZmLCYu8AGCwr5wBf | ||
dfLoClxnzfTtgQv5axF1awp4RwCUH3hf4cDrOVqmAsWXKPHtm4hx96jF6L4oHhjx | ||
OO03+ojZdO8= | ||
=CS52 | ||
-----END PGP SIGNATURE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
This documentation was written for those brave souls who want to | ||
understand and/or modify the UPX assembly stubs - the small snippets | ||
that do the runtime decompression when a compressed program is started. | ||
|
||
So, how the runtime stub/loader generation works? | ||
|
||
You might have already noticed that for some file formats the loaders | ||
are quite simple (linux/i386 & tos) while in the other cases the | ||
loaders look very suspicious: they're full of `%ifdef's and contain | ||
loads of cryptic comments like `__PERELOC2__'. | ||
|
||
If you look at the C++ source files, however you can notice that these | ||
comment strings (without the leading and trailing underscores) are used | ||
in the following way (they are all 8 character length strings): | ||
|
||
addLoader("PEMAIN20", | ||
ih.entry ? "PEDOJUMP" : "PERETURN", | ||
"IDENTSTR""UPX1HEAD", | ||
NULL | ||
); | ||
|
||
Basically that's all you have to know: when you want to add a section | ||
of assembly code to the runtime loader, you just write | ||
|
||
l_foo.asm | ||
--------- | ||
;__FOOBAR00__ | ||
|
||
xor eax, eax | ||
label1: | ||
jmps label1 | ||
|
||
;__FOOBARZZ__ | ||
|
||
p_foo.cpp | ||
--------- | ||
|
||
addLoader("FOOBAR00", NULL); | ||
|
||
This will add the assembly section starting from __FOOBAR00__ and ending | ||
before __FOOBARZZ__ to the loader. You can add an %ifdef - %endif pair | ||
before these comments if you wish - but these conditionals will NOT be | ||
seen by the assembler, they are just syntactic sugar to make the code a | ||
little bit more readable and understandable. (Note however, that only | ||
%ifdefs which are started on the 1st column are removed by the upx | ||
assembly preprocessor program, so you can still use preprocessor | ||
conditionals if you wish - just write them starting from the 2nd | ||
column.) | ||
|
||
That's nice, you could say, but how cross section jumps and calls are | ||
handled? Well, that is the nicest part of this stuff - they are handled | ||
automatically. All you have to do is to add the required sections to the | ||
loader using `addLoader()' and the rest is done by upx. It will resolve | ||
every conditional or unconditional jumps or subrutine calls for you. | ||
|
||
This functionality (we could say it's a simple linker) is achived by the | ||
assembly preprocessor (src/stub/scripts/app.pl) and a little C++ module | ||
(src/linker.cpp). And of course NASM - the Netwide Assembler. You can | ||
see what's going on behind the scenes - just do: | ||
|
||
cd src/stubs | ||
make maintainer-clean | ||
make all | ||
|
||
This will rebuild all the loaders - and keep the temporary files (*.as[xy]) | ||
which are seen by the assembler. | ||
|
||
Currently this loader/stub building method only works with ix86 | ||
assembly - both app.pl and linker.cpp heavily rely on this when dealing | ||
with cross section references. | ||
|
||
And finally some important features/requirements you should be aware of: | ||
|
||
- as previously stated - preprocessor conditionals starting on the 1st | ||
column are removed by app.pl | ||
- sections are separated by comments in the form `;__X1234567__' | ||
- jumps are recognized by searching for a word which starts with `j' | ||
and followed by a label - this also means that `jmp short label1' | ||
will NOT be recognized (but you can use a macro called `jmps' for it | ||
by adding `%define jmps jmp short' to the beginning of the file) | ||
- at the end of the file you need something like this | ||
|
||
eof: | ||
; __XTHEENDX__ | ||
section .data | ||
dd -1 | ||
dw eof | ||
|
||
That's all for now. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Toplevel Makefile for UPX | ||
|
||
all: | ||
$(MAKE) -C src/stub | ||
$(MAKE) -C src | ||
$(MAKE) -C doc | ||
|
||
clean: | ||
$(MAKE) -C src/stub $@ | ||
$(MAKE) -C src $@ | ||
$(MAKE) -C doc $@ | ||
|
||
distclean: clean | ||
|
||
dist: | ||
sh ./maint/util/laszlo.sh | ||
|
||
.PHONY: all clean distclean dist | ||
|
||
.NOEXPORT: | ||
|
Oops, something went wrong.