The Naughty Unpacker

From Atari Wiki
Jump to navigation Jump to search

                      The Naughty Unpacker

                    Version 2.5 documentation

                       October 8th, 1992


                THIS VERSION WAS MADE EXCLUSIVELY
                      FOR THE DISK MAGAZINE
                             ST NEWS
                               ÿÿÿÿÿÿÿ


         ****************  DISCLAIMER  *******************

           USE THIS PROGRAM ENTIRELY AT YOUR OWN RISK!
        I ACCEPT NO RESPONSIBILITY FOR ANY DAMAGE CAUSED
             BY THE USE (OR MISUSE) OF THIS PROGRAM!

1. Introduction
---------------

  Like many other users, I like trading off a little time against
more disk space, i.e. I use packers to compress many programs on
my hard disk. Unfortunately, not all packers have the option to
unpack a packed program, so this had to be done "by hand" whenever
necessary. With this in mind, I started to write TUU, "The Universal
Unpacker" back in 1990, and soon I could unpack most of the files
I had packed with popular packers like "Pack-Ice" or the "Jek Packers".
TUU could also unpack pack several types of packed data files. To
achieve this, it was necessary to include the unpacking routines of
all supported packer types, and obviously this wasn't very flexible -
even newer versions of the same packer weren't recognized when they
were released. Thus, I had to think of something else, and what I
came up with is this program. It uses a quite clever trick (IMHO)
to spot the unpacking routine in the packed programs, executes them,
and returns just before the program is relocated. Then, the unpacked
program can be saved. To keep the program flexible, I decided not to
include any checks for specific packers, so that it's up to you to
make sure the program you choose is packed. Hence the name of this
program ("Naughty") - it's likely to crash if you insist on trying
it on a "normal" (not packed) program. Of course, it will check for
certain "signs" of an unpacking routine, and it will warn you if
the program contains relocation information - most packed programs
are PC-relative (when they are packed), and the few packers that
need to add relocation bits to the packed program are recognized
automatically.

2. History
----------

  In the meantime, there are quite a few different versions of
Naughty floating around. I can't remember myself how many, but
it must be more than half a dozen. The first versions (1.X) used
to have a crude, .TOS-style user interface, and they were programmed
in 100% assembly language. Some TOS bugs (or perhaps my bad programming)
were responsible for problems with two TOS versions: 1.2 and 1.6.
These problems all disappeared (thanks to Richard Clarkson BTW, who
first reported those problems) when I rewrote the user-interface in
C, with the main routines still being in assembly language. Anyway,
these are the major versions, and what had changed in each of these:
(Please forgive me for keeping the information is brief and technical!)
[In brackets are later comments]

Version 1.0, 2 Feb 1992:
------------------------
 The first version, tested with Pack-Ice, Pack-Fire, and many other
 packers. No checks being made at all.

Version 1.1, 3 Feb 1992:
------------------------
 - Fixed incompatibility with Pompey Packer v2.6
 - Added some Alert-boxes for easier use.
 - Added checks for executability, relocation, symbol table.
 - Wrote a documentation (fingers still hurting :)
 - Fixed a bug which caused the program to crash after trying
   3 files...

Version 1.2, 12 Feb 1992:
-------------------------
 - Relocatable programs can now be unpacked, if they have been
   packed with the Happy Packer or Pompey Packers (I hope!)
 - First version of Packers list (PACKERS.LST). Thanks to Richard
   Clarkson for the idea!

Version 1.3, 16 Feb 1992:
-------------------------
 - I finally managed to test the program with PP v1.9a packed files,
   and fixed it so that they are recognized (they are relocated too).
 - (Potential) unpacking routines which used the following sequence:
   move #2/#3,-(sp)
   trap #14
   addq.w/.l #2,sp
   to find out the screen address and copy the unpacking routine
   below that address are now forced to use a safer address...
 - The JAM Packer versions 3.0 pre-release and release 1.1 are now
   supported (pre-release only LZH compression), due to the above
   change!

Version 1.4, not released.
--------------------------
 - some bugs fixed.

Version 1.5, 29. March 1992
---------------------------
 - Programs that had a symbol table can now be unpacked.
 - Unpacking routines which copy themselves into the space
   after screen memory on 512K computers ($7fd00) are forced to
   use a safe area.
 - Unpacking on exactly the same memory location is now allowed.
 - The sequence move.l (a0)+,d0; add.l d1,(a2,d0.l) is now
   recognized as relocation preparation (used at least by one
   packed file I have).
 - If the header of the file has larger values for TEXT-length and
   DATA-length than the file size, it is assumed to be a copy of
   the header of the unpacked file (the file is assumed to packed).
   At least one I know of uses this.
 - Added Atomik v3.5 compatibility
 - From now on, Naughty MUST NOT have the 'fastload' flag set. This
   is not a new problem, but I can't protect unused memory from ALL
   unpacking routines...
   [Since 2.X this 'fastload' is OK!]

Version 1.6, 28th April 1992
----------------------------
 - Some bugs fixed again, I hope it works on all TOS versions now.
 - From now on you may choose whether to continue if file with
   relocation information has been chosen! This is very risky,
   and not recommended... It could be the only way though if you
   have a very exotic file format. Better only use it if you are
   100% sure this is a packed file!

[ some versions missing here ... extensive beta-testing by other
  people, mainly W. Alan B. Evans! Thanks a lot! ]

Version 2.0ž, June 1992
-----------------------
 - First version with GEM user interface! Added some nice things
   like "stay-on" dialogs to show what's happening. There seem
   to be no more TOS incompatibilities!
 - The resources look a bit weird on colour monitors...

Version 2.1ž, July 1992
-----------------------
 - This is the first single-file version after 2.0ž, the resource-
   file is now included in the program file.

Version 2.2, August 13th, 1992
------------------------------
 - Added support for the BAPACK program. Thanks Michael for the
   packer! This version was made for you!
 - Fixed the .RSC file - all objects are character-aligned now,
   and should look the same in all resolutions...

Version 2.3, August 18th, 1992
------------------------------
 - Fixed one minor bug, which caused the menu buttons to be redrawn
   incorrectly. Thanks to Peaci for spotting this...
   I'm sure that there are several other bugs in the GUI, but I'm
   too lazy to search for them! ;-)

Version 2.5, September 24th, 1992 (ST News version)
---------------------------------------------------
 - A bug was removed that occured when the disk for the unpacked
   file was write-protected (thanks to Richard Karsmakers for
   spotting this!)
 - Half-written files (when disk had become full) are now deleted.
 - Unpacking statistics added (as requested by Jakey).
 - Added Sentry Packer support.
 - Better check for relocation info.
 - Several new packers tested and added to the list (thanks
   Michael Darlison!)
 - There is now an option to save the screen before unpacking and
   restore it afterwards, so that some of the nastier unpacking
   routines won't leave messages all over the screen.
 - Options may be saved.
      
3. Usage
--------

  I don't think there's much to say at this point, basically you'll
have to click one of the buttons on the main dialog, which has the
thing you want to do on top of it! :) I think the whole thing is
rather self-explanatory... If something doesn't work, check if the
program you tried to unpack was packed (or let someone who knows
what he's doing have a look at it), and if it was, please let me
know! I can be reached by e-mail or by snail-mail, my address is
somewhere in this text!
  The only feature worth mentioning here is the 'SAVE SETUP' option,
with which you can save your favourite setup permamently. In order to
do this, the program file NAUGHTY.PRG must not be packed or modified
in any other way (writing to it may damage it!) so if you prefer to
keep it packed, unpack it first, then save the setup, and pack it
again.
  Oh yes, before I forget it: As I have written earlier in this text,
unpacking a program without knowing the type of packer used is risky
business, so you'd better not keep valuable things in a ramdisk while
you try it - you never know whether Naughty crashes or not, even though
with 99% of all files which are NOT protected in any way it works fine.

4. Copying
----------

 This program may be copied freely, as long as both files
(NAUGHTY.PRG and NAUGHTY.DOC) are copied, and they are not
modified in any way. If you find hacked versions of this program
anywhere, please let me know! Feel free to copy this program to
your friends, and let me know if you don't like something about
it! Perhaps you can just let me know if it's any use to you -
just send me an e-mail if it doesn't cost you anything (and
if you have e-mail access!). I might send you a new version in
return (if there is one) or some other things (PD)...

5. List Of Packers (*drum rolls*)
---------------------------------

 This is a list of all packers, which have been reported to
work with the latest version of Naughty, plus some technical
information about them:

                                                   information:
 Packer:                       date:  supported:  |R|M|S|Other
 -------------------------------------------------|-|-|-|-----------
 ATOMIC 3.1                     ???      yes      |?| |?|(atomic)
 ATOMIC 3.3B                    ???      yes      |?|?|?|  -"-
 ATOMIC 3.3                     ???      yes      |?|?|?|  -"-
 ATOMIC 3.5                     ???      yes      |x|s|x|  -"-
 Automation 2.31                ???      yes      | |s|x|(auto)
 Automation 2.4                 ???      ???      |?|?|x|  -"-
 Automation 2.51                ???      ???      |?|?|x|  -"-
 Automation 5.01                ???      ???      |?|?|x|  -"-
 BAPACK 1.0                              yes      | |?| |
 ByteKiller 1.4                 1989     no       |?|?|?|
 Bytekiller 2.0                          no       |?|7|?|
 Bytekiller 3.0                          no       |?|g|?|(bk3)
 DC Squish  1.4                          no!?     |?| |?|(DCSq)
 DEK Packer 1.3                          yes      |?|?|?|
 Happy Packer                            yes      |x|?|?|
 I-Tech No Quick Cruncher                no       |x|?|?|(see pack20)
 JAM Packer 1.1 (.TTP version)           yes      | |s| |(jam)
 JAM Packer 3.0 pre-release              yes(LZH) | |s|x| -"-
 JAM Packer 3.0 release 1.1              yes      | |s|x| -"-
 JAM Packer 4.0                          yes      | |s| | -"-
 JEK Packer 1.2                 ???      yes      | |s| |(jek1)
 JEK Packer 1.3                 ???      yes      | |s| |
 JEK Packer 1.4               13.06.89   yes      | |s| |
 L.S.D. Packer 1.2            18.01.89   yes      | |s| |
 MCA-Crunch                              ???      |x|?|x|(mcacr)
 Pack 2.0                                no       |x| | |(pack20)
 Pack-Fire 1.01               03.08.90   yes      | | | |
 Pack-Fire 2.01               19.02.91   yes      | | | |
 Pack-Ice 1.13                20.05.90   yes      | | | |
 Pack-Ice 2.12                22.06.90   yes      | | | |
 Pack-Ice 2.20                21.11.90   yes      | | | |
 Pack-Ice 2.31                19.02.91   yes      | | | |
 Pack-Ice 2.40                14.08.91   yes      | | | |
 PFX Packer 1.5                          yes      | | | |
 PFX Packer 1.7                          yes      | | | |
 PFX Packer 1.8                          yes      | | | |
 Pompey Packer 1.9a                      yes      |x| |x|(pp19)
 Sentry Packer 2.05                      yes      |?|?|?|
 Speed Packer 2.0                        yes      | | | |
 Thunder Packer 1.0                      yes      |x| |x|
 VAT Pack 1.0                            yes      |?|?|?|
 ------------------------------------------------------------------------

 Legend (confusing, isn't it?):

R = adds relocation information
    (x=yes, blank=no, ?=don't know)

M = unpacking routine accesses dangerous memory areas, such as just
    below $78000 - usually to copy the unpacking routine there.

    7 = uses area below $78000 (very dangerous! avoid!)
    s = uses area below screen memory (a little risky)
    g = uses gemdos buffer area (dangerous!)
    blank = no

    Most unpacking routines however DO access memory that doesn't belong
    to them, which is after the data segment and is needed for the
    decompression (as a buffer). This is not very dangerous though.

S = Packer is not programmed safely i.e. has problems with new TOS or
    harddisks, ACC's etc.
    (x=yes, blank=no, ?=don't know)

Packer-specific stuff:
----------------------

(atomic): Version 3.5 compresses better than any other packer I know of,
          including Pack-Ice/Pack-Fire. Unfortunately, all versions I
          know of have bugs in the unpacking header - or better incomplete
          headers, so that eg. packed accessories won't load correctly.
          I have heard of one hacked version though, which has this 
          fixed, I think Ford Perfect of BMT did the job, but I might
          be wrong!

  (auto): All these packers crash (when packing), so I can't test if
          the files created can be uncompressed. Please try that for
          me if you can...
          Automation 2.31 almost the same as LSD packer and JEK Packers...
          Automation 2.4 (actually Crown Of Creation Compacter v2.4)
          packed programs crash on TOS 2.05 when unpacked.

   (bk3): The Bytekiller v3.0 by M.Coates does not use a correct unpacking
          routine, it can't unpack PC-relative programs. This is the
          main reason it is not supported.

  (DCSq): I WILL NOT SUPPORT THAT ONE!!! (Spaghetti-code!! looks like
          a compiled-C unpacking routine!)
          Strangely, some programs packed with DC Squish DO unpack!
          Weird but true! :-)

 (mcacr): This one crashes all the time (TOS 2.05), if you can use it,
          please tell me if it works...
          Actually, not even programs packed with MCA Crunch will unpack
          and run on TOS 2.05!!!

(pack20): contains very stupid code, which would have to be checked for
          separately, use the unpack.tos supplied with it instead!!
          Also, this one doesn't like the fastload/TT bits... You must
          remove those before packing with removsym.prg.

  (pp19): Crashes all the time too. Can be unpacked though (I hope!)
          Special message to the Pompey Pirates: GEM may have some bugs,
          but it's not GEM's fault if you don't know how to use it...
          Try to write a serious TOS-version-independent program!

  (jek1): The JEK Packers 1.1 - 1.4 and the LSD Packer are very much
          alike...

   (jam): The JAM Packers v3.0 are now supported too. However, with TOS
          2.05 the compressed files can not be loaded from the desktop,
          only if uncompressed first with Naughty!!
          Also, the JAM-packer 3.0 pre-release V2-compressed programs
          cannot be unpacked with Naughty (at least the ones I tested)
          as it seems because of a bug in the packer.

 Please help me to complete this list, if you have any packers that
work (or don't) and are not listed here, please let me know!

6. My contact address(es):
--------------------------

 The safest way to contact me, is to send a "common" letter to
following address:

    Marinos Yannikos
    Wulfeniaweg 3
  A-9100 V”lkermarkt
    AUSTRIA (Europe)

 If my landlord doesn't throw me out soon, I can be reached faster
at this address (in Vienna, where I'm studying...)

    Marinos Yannikos
    Blumberggasse 14/1
  A-1160 Wien
    AUSTRIA

 Alternatively, at least until the end of 1992, you can reach me by
e-mail with this address:

    nino@vmars.tuwien.ac.at

 And if you feel really daring, you can try to call me (after 9pm local
time, that's GMT+2 more or less...) at this number:

   (+int) 0222/4550305

7. What now?
------------

 OK, now it's time for the greetings (in no particular order):

 Hi to:

 All S.O.T.E. members (esp. Thomas), Eye of the Brainwash Company,
Michael Darlison, Richard Clarkson, Hackbear, Wizzcat, Drag (the
insanely witty - nice diskmag!)
John & Takis Pournaras in Greece, Kasper of Electra, Lazer,
New Mode, Slime, Karl, Daniel, Chaos Inc. (all of Delta Force),
Alexander Herzlinger, Thomas Schulze, Peaci, and the other
IRC guys with the nicknames Pit, Haq, Knightman, Abel, D_Gently,
Godsend, rosebud, Cep, Goemon, st-guru, Robo, Gero, hmallat,
all the guys I met at the Mega Leif Convention '92 (Nic, Powa,
Kasper, ...?)

 Special Greetings to the ST News team for spreading this program
with one of their issues, and for making the best disk magazine
on the ST (and possibly on all systems, but who cares about the
other ones!). Special thanks go to Richard for putting up with
me and answering so many letters all that time! :-)

 ...and all the other guys who I'm sorry to have forgotten because
my brain is really burned out after some heavy C-coding at the
university and some 3 hours coding and writing this stuff! I'll
remember you next time!

                              Have fun!

                             Zork/Marinos


Back to Packer/Depacker