home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Eagle Eye CD-ROM BBS Network
/
eagle-eye-cdrom-bbs-network.iso
/
recent
/
gus_170.arj
/
GUS.DOC
< prev
next >
Wrap
Text File
|
1993-04-14
|
58KB
|
1,184 lines
╔══════════════════════════════════════════╗
║ █▀▀▀▀▀▀█ █ █ █▀▀▀▀▀▀█ ║
║ █ █ █ █ ║
║ █ ▀▀██ █ ██ ▀▀▀▀▀▀██ ║
║ █ ██ █ ██ ▄ ██ ║
║ ████████ ████████ ████████ ║
║ ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ ║
║ General Unpack Shell ║
║ version 1.70 ║
╚══╤═════════════════════════════════════╤═╝
│Copyright (C) 1993 by TRI-SYSTEMS co.│
│ - ALL RIGHTS RESERVED - │
│ Written by Johan Zwiekhorst │
└─────────────────────────────────────┘
T A B L E O F C O N T E N T S
*********************************
1. LEGAL STUFF
The no-nonsense licence statement
Warranty
Contact
Payment
What you should have received
2. INTRODUCTION
3. USAGE
3.1. General Usage under DOS
SYSTEM REQUIREMENTS
COMMAND-LINE PARAMETERS
NOTE
EXAMPLES
EXIT CODES
3.2. Unpacking Mailarchives
3.3. Identifying Archive Types
4. BUILT-IN DEFINITIONS
4.1. Built-in Unpacker Definitions
4.2. How To Define Other Unpackers
5. GUS & OTHER SHELLS
6. HOW GUS IDENTIFIES ARCHIVES
6.1. Recognition patterns as used by GUS
6.2. Record layout of ARC/PAK/ARC+
6.3. How GUS identifies SFX (self-extracting) archives
6.4. Mandatory order of scanning the patterns
7. RUNTIME MESSAGES
[A] General information messages
[B] Warning messages
[C] Fatal error messages
8. ACKNOWLEDGEMENTS
9. REVISION HISTORY
═══════════════════════════════════════════════════════════════════════════════
╒════════════════╕
│ 1. LEGAL STUFF │
╘════════════════╛
This software is copyrighted (C) 1989, 1990, 1991, 1992, 1993
by TRI-SYSTEMS co., hereafter called the Owner.
All Rights Reserved.
The software was written by Johan Zwiekhorst, hereafter called the
Author.
The No-Nonsense Licence Statement
=================================
This software and everything enclosed with it are protected by both
Belgian copyright law and international treaty provisions.
It is called "freeware".
FREEWARE software may be used, copied and distributed freely for
NONCOMMERCIAL use only IF:
▀▀▀▀▀▀▀▀▀▀▀▀▀
NO FEE IS CHARGED FOR USE, COPYING OR DISTRIBUTION.
IT IS NOT MODIFIED IN ANY WAY.
It may be distributed ONLY in it's original, unmodified compressed
package file. ~~~~~~~~~~
This means you may not add comments to the compressed package file
(also known as an archive file or simply an archive), nor may you
delete files from or add files to the archive file, UNLESS YOU HAVE
A WRITTEN PERMISSION TO DO SO.
Converting the archive file to another compression method or
another archive file format is allowed, provided that the above
conditions are met.
The original package as released by me is in Robert Jung's ARJ
archive format. (See below for what you should have received.)
In order to extract the files from an ARJ archive, you will need
to get the file ARJ***.EXE, where '***' stands for the version
number of the program ARJ. At the time this is written, the
latest version is 2.30, so look for ARJ230.EXE.
Note, that recompressing the archive will nearly always result
in a bigger archive.
The use of FREEWARE software is prohibited in a governmental
or commercial situation. In these cases, this software must be
purchased and a Commercial Licence Statement will then be provided
for. You may write to TRI-SYSTEMS at the address below for more
information.
Warranty
========
This software is provided AS IS without any warranty, expressed or
implied, including but not limited to fitness for a particular
purpose.
IN NO EVENT SHALL THE AUTHOR/OWNER OF THIS PRODUCT BE LIABLE FOR
ANY DIRECT OR CONSEQUENTIAL LOSS OR DAMAGES WHICH MAY HAVE ARISEN
FROM THE USE OF THIS PRODUCT.
If your local law does not permit any of the statements made above,
or if you do not agree with any of them yourself, THEN YOU ARE NOT
LICENCED TO USE THIS PROGRAM!
Contact
=======
The Author can be reached via electronic mail at phone number
+32-89-762626.
This is the Tripod BBS. Network addresses:
Internet jz@f118.n292.z2.fidonet.org
Compuserve >INTERNET:jz@f118.n292.z2.fidonet.org
FIDOnet 2:292/118
SIGnet 27:332/0
The Owner can be contacted at the following address:
TRI-SYSTEMS co.
Langstraat 89
3630 MAASMECHELEN (Belgium)
Phone +32-89-764905 during office hours, Central European Time.
Payment
=======
If you would like to use this product in a commercial or
governmental situation, please contact TRI-SYSTEMS at the address
above. You will then learn the price of the product and a
Commercial Licence Statement will be made available to you.
For all others, this product is free, as mentioned before.
But if you would like to support the author and encourage him to
write more useful software, you're welcome to pay some money.
You may pay whatever you feel the product is worth to you.
Note that this kind of freeware products is developed entirely in
the author's leisure time and he receives absolutely no
compensation for it, apart from what you as a user would pay him.
If you pay at least U.S. $15 (BEF 500, NLG 30, DEM 25), you will
receive, when available, a 5.25" or 3.5" floppy diskette with the
next version. Please specify which.
Immediately after receiving your payment, I will send you
an acknowledgement and a list of the latest versions of all
freeware I wrote. Payments to the author can be sent in cash to the
address mentioned above or transferred to one of the following bank
accounts:
Bank Brussel Lambert (Belgium) - account number 335-0076382-89
Rabobank (Holland) - account number 1059.19.519
***NOTE THAT THIS IS FOR NON-COMMERCIAL SITUATIONS ONLY!
For all payments made: please specify NAME and VERSION NUMBER of
the product!
What you should have received:
==============================
You should have received the file
GUS_170.ARJ - (32432 bytes)
with the following contents:
┌──────────┐ ┌─────┐ ┌─────────────────────────┐
│ filename │ │bytes│ │ description │
└══════════┘ └═════┘ └═════════════════════════┘
GUS .DOC 58872 This documentation.
GUS .EXE 11873 The program file. CRC/32 = dec3b859
GUS_WCFG.PAS 6185 TP source for a program CRC/32 = 66948e00
that writes a new configur-
ation into GUS.EXE.
You may also use the program VALIDATE from McAfee Associates for
the purpose of checking the authenticity of the program file(s).
It should produce the following:
File Name: gus.exe gus_wcfg.pas
Size: 11,873 6,185
Date: 4-14-1993 4-14-1993
File Authentication:
Check Method 1 - 713A 5944
Check Method 2 - 1FA2 184D
╒═════════════════╕
│ 2. INTRODUCTION │
╘═════════════════╛
The General Unpack Shell, or GUS, identifies compressed file types
and calls the correct unpacker in order to extract the files from
them.
Its main purpose is, of course, to take work out of YOUR hands.
You can use GUS with its straight-forward and easy to remember
commands instead of having to learn a new set of commands each time
a new archiver sees the daylight.
GUS will also work nicely in automated tasks, where any type of
archive should be uncompressed, or where a certain file has to be
added to any given archive.
GUS was made to be command-line compatible with the ARCE.COM
unpacker program by Vernon Buerg. This makes it possible for you
to rename GUS.EXE to ARCE.COM and have it invoked by any program
that expects both ARCE and SEA's ARC-type compressed files, so that
such a program will in fact work with any archive format YOU
choose. Ben Baker's MAKENL is but one example of such a program.
GUS does not require you to fiddle with cumbersome and difficult
configuration files: it's just a single EXE file. You copy it into
your favourite utility directory and you can immediately start
using it, no hassles at all.
╒══════════╕
│ 3. USAGE │
╘══════════╛
GUS assumes you have located all archiver programs it has to invoke
somewhere in your system PATH.
GUS is small and it will only occupy about 21K while shelling out
to other programs, which should leave more than enough memory for
those archiver programs.
3.1. General Usage under DOS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SYSTEM REQUIREMENTS:
--------------------
GUS will run on any IBM PC compatible computer running DOS 3.0 or
greater, provided that at least 25K plus the memory the largest
archiver program to invoke would need is available.
COMMAND-LINE PARAMETERS:
------------------------
As said before, GUS is command-line compatible with ARCE.
Hence, the general syntax is:
GUS «compressed_filespec» [filespec(s)] [target_path] [switch(es)]
(Entries enclosed within [] are optional, those within « » are
mandatory. The [] and « » signs serve to indicate this only and
should never be typed!)
«compressed_filespec» ::= this specifies where to find the
compressed file. If an extension
is not given, GUS will assume '.*'.
Currently, the following archive types
are supported: ARC and ARC+, ARJ, DWC,
HA, HAP, HPK, HYP, LZH (both LHarc and LHA),
PAK, SQZ, ZIP and ZOO.
[filespec(s)] ::= specifies which files should be
unpacked. You may give more than one
file specification, all of which may
contain wild cards.
[target_path] ::= specifies where to locate the unpacked
files. In order to allow GUS to be as
flexible as possible, the ordering of
the file specifications and the target
path is not important. You may define
the target path first and then the
files to be extracted. It is even
allowed to put the target path in the
middle of a number of specifications of
files to extract! If you give more
than one directory, GUS will ignore all
but the last.
[switch(es)] ::= specifies one or more of the following
switches...
/D : Delete archive after successful unpacking
/I : Identify only, don't shell out (see 3.3 below)
/M : unpack Mailarchives only (see 3.2 below)
/N : do Not use embedded path while extracting
(for the sake of compatibility with ARCE, /5 may also be
used)
/P : Print file(s) on standard output device
/Q : Quiet mode, suppresses shell output
/R : Replace existing files
/T : Test archive integrity
/Gpswd : supply password 'pswd' for Garbled archive
All parameters have to separated by at least one blank. Switches
may be joined together without spaces, but the '/' character must
be present for each switch. GUS does not support the dash '-'
instead of the slash '/'.
Options may be given in no matter what case. Only the Delete option
_has_ to be in uppercase for safety reasons.
NOTE:
-----
Consistent with ARCE's behaviour, GUS will create any directories
contained within an archive if they do not exist. Both ARCE and GUS
have a commandline switch with which you can prevent this and have
them extract to the current directory.
If you are using the /M (mail archive) switch however, use of the
/N (No embedded paths) switch is automatically assumed and unpacking
will always be done in the current directory.
With /M, the option /D (Delete archive after successful unpacking) is
also automatically selected.
The /N switch is equally automatically invoked with /P (print) and /T
(test).
EXAMPLES:
---------
1) Extract all files from an archive CFILE.ANY:
> GUS CFILE.ANY
2) Extract all *.COM and *.EXE files from an archive UTILS.ANY
into a target directory D:\Utils and replace all existing ones:
> GUS UTILS.ANY *.COM *.EXE D:\UTILS /R/N
3) A batchfile LA.BAT which will list any text file inside any
archive:
LA.BAT: @echo off
GUS %1 %2 %3 %4 %5 %6 %7 %8 %9 /P|LIST/S
Then you can use this like: LA KBUI_200 *.DOC
4) Test the integrity of all archives in the directory F:\Arcs
> GUS F:\ARCS\* /T
5) Unpack all ZIPfiles PW*.ZIP protected with password JiMmY into
the directory D:\PWS, not replacing any existing files and using
any embedded paths:
> GUS PW*.ZIP D:\PWS /GJiMmY
EXIT CODES:
-----------
GUS will yield an errorlevel of 0 if all operations succeeded.
If something's wrong, it will pass on the errorlevel returned by
the child program invoked.
If the child program could not be started, GUS will return
errorlevel 202 = no such program file found in PATH
203 = non-existing directory
204 = too many open files (increase FILES=... parameter
in your CONFIG.SYS file)
205 = access denied
206 = invalid handle
208 = not enough memory to start the child program
210 = invalid environment
211 = invalid format
218 = no more files
Note, that GUS will not be able to handle a PATH of more than 255
characters properly.
3.2. Unpacking Mailarchives
~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you are a BBS SysOp or a Point connected to a Fidonet Technology
compatible electronic mail network, you receive mail packets
compressed and bundled within mailarchives. You obviously need to
unpack those mailarchives.
You can do that in two ways:
a) Have your mailprocessor call GUS to unpack the mailarchives.
+ If your mailprocessor allows you to specify which unpacker it
should invoke to decompress mailarchives, have it call GUS.
Example for ConfMail:
> CM IMPORT AREAS.BBS -K -N -F Conf.Imp -A GUS
This approach has the disadvantage that GUS will create any
directories embedded in the archive, should they not exist.
Another disadvantage is, that the mailprocessor is still in memory.
This occupies a lot more memory than is necessary.
+ If your mailprocessor does not allow you to specify which
unpacker to use, it will most likely expect ARCE or PKXARC/
PKUNPAK. Rename GUS.EXE to ARCE.COM or PKXARC.EXE or
PKUNPAK.EXE, whatever your mailprocessor wants.
If your mailprocessor wants to use an unpacker that needs a
specific decompress command (like PAK E Archive), you cannot
have it call GUS, since GUS would interpret its first
command-line argument as the archive name.
Use the method described in item b) to have GUS unpack your
mailarchives BEFORE your mailprocessor is started. Since your
mailprocessor will only see mail packets then and no
mailarchives, there will be no problem.
b) Have GUS unpack all mailarchives BEFORE you invoke your
mailprocessor. This is the preferred method.
You this by starting GUS with the following command-line:
GUS «Inbound_directory» /M
Instead of the archive name, you specify the path to the
directory where your inbound mail is located.
Suppose your inbound directory is D:\Opus\NetFiles. GUS will
unpack all mailarchives in that directory with the following
command:
> GUS D:\OPUS\NETFILES /M
After a mailarchive has been unpacked succesfully, GUS will
delete it automatically.
If a mailarchive cannot be unpacked succesfully, then GUS will
create a subdirectory BADARC.GUS in your inbound directory and
move that mailarchive to it. This allows you to inspect the
problematic mailarchives later on while retaining their original
name. Other unpack shells always rename a faulty archive to
BADARC.001, which makes it very difficult if you would like to
restore the archive to its original name after you have
inspected and maybe repaired it. I didn't like that procedure,
so I decided to let GUS move problematic archives to a special
subdirectory instead. Let me know how you feel.
3.3. Identifying Archive Types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
With the /I switch, you can have GUS simply report which archive
type is at hand and do nothing else.
This switch can be used just to get a list of archive types, like
this:
> GUS J:\Outbound\*.MO? /I
Type Archive Filename
---- ----------------
LZH J:\OUTBOUND\0009FE64.MO1
??? J:\OUTBOUND\8FDCB1E2.MO1
ZIP J:\OUTBOUND\8FDCB243.MO0
ARJ J:\OUTBOUND\FF24FFE9.MO0
LZH J:\OUTBOUND\8FDCB241.MO0
GUS yields something like the above list. The '???' means that GUS
was unable to determine the archive type, possibly because it isn't
an archive at all. In this case, it was a zero-length file.
A much more useful way of using this switch is to determine the
type of just one archive and act upon that. For instance, to add a
file to any archive that comes along.
If used with /I, GUS will return an errorlevel from 0 to 13,
indicating the archive type.
Archive Type: Unknown ARC ARC+ ARJ DWC HA HAP HPK HYP LZH PAK SQZ ZIP ZOO
Errorlevel : 0 1 2 3 4 5 6 7 8 9 10 11 12 13
Example: suppose you want to add a header text LOGO.TXT to ZIP and
ARJ files, and leave other archive types alone.
These batchfile instructions will take care of that:
GUS %1 /I
if not errorlevel 13 if errorlevel 12 goto IsZIP
if not errorlevel 4 if errorlevel 3 goto IsARJ
goto Finish
:IsZIP
PKZIP -z %1 <LOGO.TXT
goto Finish
:IsARJ
ARJ c -zLOGO.TXT %1
:Finish
Please be advised that the errorlevel codes assigned to each archive
type may change! If a new archive type is added to GUS, its extension
will be merged into the list shown above so that the order of the
extensions is alphabetical. If you don't like this and would rather see
new types simply be added to the end of the list, let me know. I will
comply with your wishes if enough people feel like that.
At this time, I like to have an alphabetical list and so do most of the
people I asked about this.
╒═════════════════════════╕
│ 4. BUILT-IN DEFINITIONS │
╘═════════════════════════╛
4.1. Built-In Unpacker Definitions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following unpackers are defined by default within GUS.EXE:
╔════╤════════════╤═══════╤═══════╤═══════╤═════╤═════╤════════╗
║Type│Program │Extract│Replace│Display│Test │Path │Password║
╟────┼────────────┼───────┼───────┼───────┼─────┼─────┼────────╢
║ARC │PKUNPAK .EXE│-n │-r │-c │-t │*****│g ║
║A7+ │XARC .EXE│ │/o │***** │*****│*****│/g ║
║ARJ │ARJ .EXE│e -uy │e -y │p │t │<x │─g ║
║DWC │DWC .EXE│xow │xw │p │t │r │g ║
║HA │HA .EXE│et │ety │***** │t │<x │***** ║
║HAP │PAH .EXE│e │e │***** │**** │*****│***** ║
║HPK │HPACK .EXE│x -on-r│x -oa-r│p -r │t -r │-p │-c ║
║HYP │HYPER .EXE│-x │-xo │***** │*****│p │***** ║
║LZH │LHA .EXE│e /m+ │e /m+c+│p /m+ │t /m+│x+ │***** ║
║PAK │PAK .EXE│e/WO │e/WA │p │t │/PATH│/g= ║
║SQZ │SQZ .EXE│e /o0 │e /o1 │p │t │<x │***** ║
║ZIP │PKUNZIP .EXE│-n │-o │-c │-t │-d │-s ║
║ZOO │ZOO .EXE│e:O │e:OS │e:p │e:N │// │***** ║
╟────┼────────────┼───────┼───────┼───────┼─────┼─────┼────────╢
║ 3 │ 12 │ 10 │ 10 │ 10 │ 10 │ 5 │ 5 ║
╚════╧════════════╧═══════╧═══════╧═══════╧═════╧═════╧════════╝
The numbers above indicate the number of characters provided for
each string.
Note that Extract, Replace, Display and Test are COMMANDS, while
Path and Password are OPTIONS. The difference is, that an OPTION
is always combined with a COMMAND and cannot be used alone.
If the first character of the Path option is a `<', however, it means
that the second character should be used to replace the first command
string character. This is currently only the case with ARJ, HA and SQZ,
who all need the `e' command to be replaced with `x' in order to
extract files while using embedded path information.
All spaces means that that particular program does not need any
parameters for that particular command.
All stars means that that particular program does not support that
command or that option.
ATTENTION! When encountering an ARC sfx made by SEA's MKSARC program,
GUS will identify it correctly, but PKUNPAK can't handle this sfx and
will therefore exit with an error. If you expect to handle a lot of
MKSARC sfx files, then you'd better replace PKUNPAK by ARC 6.02 in GUS'
configuration segment.
You may want to redefine some of those built-in definitions for
various reasons. To use another unpacker program, for instance.
Or to change some parameters.
4.2. How To Define Other Unpackers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are two ways to modify the built-in definitions.
You can grab a hex editor and change GUS.EXE directly. If you do,
please take note of the lengths of the strings as listed above in
section 4.1. All strings occupy the specified number of characters.
To achieve that, they were padded with spaces where necessary. If you
edit them, make sure you retain the number of characters and do NOT
change the funny looking character at the start of each string
(that's in fact the string length indicator byte). If a particular
parameter is not supported by a certain unpacker program, then you
should edit the appropriate field to contain all stars.
If you own a Turbo Pascal compiler v5.0 or later from Borland
International, you can edit the file GUS_WCG.PAS and re-compile it.
This small program will update the configuration information at the
end of GUS.EXE for you. Do *NOT* modify the record layout of that
information, since GUS will not recognize it anymore if you do.
Future versions of GUS may come with a complete setup program to
edit and save a new configuration.
╒═══════════════════════╕
│ 5. GUS & OTHER SHELLS │
╘═══════════════════════╛
Since GUS was first created, other authors have joined the club and
released their own versions of a utility that identifies archive
types and shells out to the appropriate unpacker programs.
Some of those other shell programs come with source, others don't.
Some have configuration files, others don't.
Some are large, others small.
Only one is GUS and all the others "ain't"! :-)
Why should you use GUS?
1. GUS is small and fast. Other shell programs typically use a lot
more memory than GUS does.
2. GUS provides you with all possible commands to allow not only
automatic use, but also easy DOS command-line usage.
3. While scanning a file to determine the archive type, the
identification bytes have to be investigated in a well-defined
order. Only then, the program will not be fooled by things like
archives within archives.
GUS is the only program that does this flawlessly: it will never
be fooled.
4. GUS has built-in code especially designed for archives that have
their identification code at the end of the file. If such an
archive has been transmitted by means of a protocol like
X-modem, some junk may have been appended to the file to make it
grow to the next 128 byte or even 1 K-byte boundary!
GUS is the *only* program that will recognize an archive with
appended junk because it can skip that while scanning.
(At this time, this is only needed for DWC archives, but you
never know...)
5. The HAP&PAH, HPack and DWC archivers require their compressed files
to have the respective extension '.HAP', 'HPK' and '.DWC' or else
they won't work with them. GUS knows this and will rename any such
archive that does not have the proper extension before calling
the dearchiver program and rename it back to the original name
afterwards.
6. Because *I* wrote it! <grin>
╒════════════════════════════════╕
│ 6. HOW GUS IDENTIFIES ARCHIVES │
╘════════════════════════════════╛
GUS recognizes archives by searching for well-defined patterns in the
archive file. Such a pattern can be from 1 to 5 bytes in length and
it is extremely important that they be checked in the PROPER ORDER!
That is what distinguishes GUS from all it's competitors: most
programs do search for the right patterns (with the exception of the
pattern for ZOO, which is almost always wrong), but don't do this in
the proper order. That can result in faulty identifications,
specifically when encoutering archives within archives.
6.1. Recognition patterns as used by GUS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ArcType Offset Pattern Comment
------- ------ ------------ -------------------------------
ARC 0 0x1A
ARC+ 0 0x1A Method byte (offset 1) of all
PAK entries needs to be scanned: if
HYP >= 0x0A then PAK;
>= 0x48 then HYP;
== 0x14 then ARC+
Note: PAK can also be recognized
by locating the byte 0xFE at offset
EOF-2, but GUS doesn't use that
because it is less accurate than
scanning the method bytes, which
has to be done anyway for identi-
fying ARC+ and HYP.
For completeness, the record layout
of an ARC archive will be given in
item 2.
ARJ 0 0x60 0xEA
HA 0 'HA' Offset 4 binary ANDed with 0xFC should
yield 0x20. This is an additional check.
DWC -3 'DWC' Offset -3 means the third LAST byte
of the archive file.
It is possible that some junk is
present at the end of an archive,
because of Xmodem transmissions for
example.
In order to avoid GUS not
recognizing the archive because of
this, the last 1028 bytes (or 343
triplets) are read into a buffer
and if that contains the string
'DWC', then we have a DWC archive.
An additional check will be done,
however. The `DWC' string will have
to be the last item in a 27 byte
structure of which the first two
items are ArcStrucSize=27 (2 bytes)
and DirStrucSize=34 (1 byte) before
GUS will accept the file to be a DWC
archive.
LZH 2 '-l??-' The '?' specifies a wildcard
character.
HAP 0 0x91 '3HF'
HPK 0 'HPAK'
ZIP 0 'PK' 0x03 0x04
ZOO 20 0xDC 0xA7 0xC4 0xFD
Most other programs search for the
string 'ZOO' at the front of the
archive, but that is wrong! Only
the ZOO archives made using MS-DOS
would be recognized this way. ZOO
archives made by an Amiga or a
computer running Unix would not be
necessarily be recognized this way.
SQZ 0 'HLSQZ'
6.2. Record layout of ARC/ARC+/PAK
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var
ArcHeader : record
Marker: Byte;
Method: Byte;
Name : array [1..13] of char;
Size : DWord;
Stamp : DWord;
CRC : Word;
Length: DWord;
end;
Procedure to scan all archive entries:
|begin
| seek(F,0);
| notOK:=false;
| YieldARC:=ARC;
| repeat
| {$I-}
| blockread(F,ArcHeader,sizeof(ArcHeader));
| {$I+}
| if IOresult=0
| then begin
| if ArcHeader.Method>=PAKid
| then begin
| notOK:=true;
| YieldARC:=PAK;
| if ArcHeader.Method>=HYPid
| then YieldARC:=HYP
| else if ArcHeader.Method=ARPid
| then YieldARC:=ARP
| end
| else MoveFilePtr(F,ArcHeader.Size);
| end
| else notOK:=true
| until notOK
|end;
This is of course all in Turbo Pascal, the language in which GUS was
written. The above are in fact literal excerpts from GUS's source
code.
6.3. How GUS identifies SFX (self-extracting) archives
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The basic principle is simple. A self-extracting archive consists of an
extraction program in EXE form followed by the archive itself as
appended data.
The header of an EXE file contains information to determine the size of
the EXE portion of the file and hence the offset where the appended data
starts.
This proved to be true for all archive types, except for SFXs made by
MKSARC, the ZIP/sfx as used in PKLTE115.EXE and the ZIP/sfx for OS/2.
GUS has those offset values hardcoded.
6.4. Mandatory order for scanning the patterns
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 - SQZ
2 - ZIP
3 - HPK
4 - HAP
5 - ZOO
6 - LZH
7 - HA
8 - ARJ
9 - DWC
10 - ARC/PAK/ARC+/HYP
This order is mandatory because it guarantees the greatest chance for
a correct recognition.
Every other order would enlarge the chance for a faulty result.
This is also the reason why the archive specifications are still
built into GUS and not given in a seperate configuration file (like
PolyXarc, for example): I still haven't found a good method to have
GUS determine automatically in which order the patterns have to be
scanned, if a possibility exists that new patterns would be added to
the list. I can't expect the users to include new patterns in the
proper order themselves, can I?
Therefore, I don't think providing GUS with a CFG file is very
important at this time. I see no problem for providing a new GUS when
a new and exciting archiver is released.
That's it folks! If you're curious: the TP source for GUS is about
870 lines in length. Those lines are `filled' in the same way as
those of the procedure quoted above.
NOTE: you may use the scanning and identification method as used by
GUS and as described above in your own programs, but please be so kind
and don't forget the reference indicating where you got the information!
╒═════════════════════╕
│ 7. RUNTIME MESSAGES │
╘═════════════════════╛
GUS may produce a number of messages while it's working.
I will list all messages below, with an explanation what's wrong.
[A] General information messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MESSAGE: Child program returns exit code #
-> this message is given when the invoked unpacker program returns
control to GUS. It shows the errorlevel returned by the
unpacker program. The "#" will be replaced by the actual
exit code.
[CHILD]: «unpacker_commandline»
-> this is shown in Quiet mode (/Q switch) instead of the
archiver's screen output. The «unpacker_commandline» will be
replaced by just that.
Extract: ALL files (XARC cannot extract specific files)
-> this message is shown when the first four characters of the
unpacker program definition string are "XARC". Any files to
extract specified on the command-line will be ignored.
[B] Warning messages
~~~~~~~~~~~~~~~~~~~~
WARNING: multiple target directories defined -- will use the LAST one!
-> you have defined more than one target path on the command-line.
GUS warns you that it will ignore all paths but the last.
WARNING: you need to use /D (capital!) to have the unpacked archive
deleted.
-> you have specified "/d" in lower case. For security reasons, GUS
will only accept a capital D for the Delete switch.
WARNING: unknown switch /X ignored
-> you have specified a switch that GUS doesn't know. In the above
warning message, the "X" will be replaced by the actual
character (converted to upper case) that you used.
GUS will continue but ignores this unknown switch.
WARNING: a slash by itself is not a valid option -- ignored
-> you have typed a slash "/" followed by a space or an end-of-line.
GUS will continue and ignore this.
WARNING: unknown parameter #9 «X» ignored
-> you have typed something on the command-line that GUS can't
decipher. The actual word you typed will be inserted instead of
"X" in the above message, and the number of that parameter on
the commandline will be shown instead of the "9" above.
WARNING: unable to determine archive type due to error
while opening file
-> for some reason, GUS can't open the file it has to investigate.
Bummer! GUS will simply skip it and continue with the next one, if
any.
WARNING: can't open NUL device -- Quiet command ignored
-> this occurs most often if the /Q (Quiet) command is used and when
one or more TSRs were loaded with their output redirected to NUL.
This yields a DOS sharing violation error, hence this message from
GUS.
WARNING: moving bad archive HHHHHHHH.XX9 to X:\Inbound\BADARC.GUS\
-> in mail unpack mode (/M switch), GUS was unable to unpack an
archive and warns you that it will be moved to the BADARC.GUS
subdirectory that GUS creates in the mail inbound directory.
The actual name of the bad archive will be inserted in the
message instead of "HHHHHHHH.XX9" and "X:\Inbound" will be
replaced by the path to your mail inbound directory.
WARNING: unsupported command -- will do normal extract instead
-> you tried to perform an action not supported by the particular
archiver defined within GUS (i.e., issue a /T [test] command
with the HYPER archiver program).
GUS warns you it will ignore that command and do a normal
extract instead.
WARNING: XXX type cannot be unpacked into embedded directories!
-> the unpacker program has no option to enable using embedded
directories or creating them, so all unpacking will be done
into the current directory, since that is the only way.
WARNING: XXX type cannot be garbled - ignoring password...
-> you supplied an extraction password for an archive whose
unpacker program does not support password-protection.
GUS will continue the command while ignoring the /G switch.
The "XXX" will be replaced by the actual archive type detected.
[C] Fatal error messages
~~~~~~~~~~~~~~~~~~~~~~~~
>ERROR<: cannot read configuration information!
MESSAGE: aborting with exit code 255...
-> GUS complains it can't find the configuration information at the
back of it's EXE file. This means something is terribly wrong
with that EXE file. You better delete it and get the original
release archive unpacked again! (You *did* save that one,
didn't you?)
>ERROR<: cannot create new filename for rename or move!
-> while trying to rename (like when an archiver need a fixed
extension) or move (like when a mailarchive couldn't be unpacked)
a file, GUS increments the filename (in case of a fixed extension)
or the extension (in case of a bad mailarchive) when it at first
doesn't succeed with the rename or move. If the filename or
extension cannot be incremented anymore and no other options are
left, GUS issues the above error message.
>ERROR<: cannot erase unpacked archive!
-> in mail unpack mode (/M switch) or if the Delete option (/D switch)
was used, GUS is unable to delete the archive after it has been
unpacked successfully.
This more than likely means that the archive was marked
Read/Only. You will have to unlock and delete it manually.
As mailarchives are created fresh upon receipt, it is very
unlikely that they would be marked R/O.
>ERROR<: can't rename fixed extension back to original, leaving as is...
-> GUS had to rename an archive to a name with the fixed extension
required by archivers like DWC, HAP or HPACK and now it can't rename
the file back to the original name. This can normally only happen
in a multitasking environment, for instance when the archive file
was renamed, moved or deleted before GUS could rename it back.
GUS issues this error message and leaves the file as it was.
>ERROR<: DOS couldn't execute «XXX» due to: YYY
-> GUS was unable to load and execute the unpacker program.
The path and name of that unpacker will be inserted in the error
message instead of "XXX" and the reason will be shown instead of
"YYY". That reason will be one of 9 possible problems
described in section 3.1. General Usage under DOS, EXIT CODES.
If the error code returned by DOS should be unknown to GUS, it
will display "DOS ERROR" followed by the error number instead.
>ERROR<: error locating directory XXX
will unpack in current directory.
-> You specified a target directory GUS was unable to find. The
target path specification will be ignored and the unpacking will
be done in the current directory.
>ERROR<: «XXX» is no archive file or a type unkown to GUS!
-> GUS encountered a file that is not one of the known archive
types. GUS will continue with the next file, if there is one.
"XXX" will be replaced by the actual archive name.
>ERROR<: no such file(s)!
-> GUS was started with an archive filename specification, but no
such file could be found. GUS will abort with errorlevel 1.
>ERROR<: no such mail directory!
-> you specified a mail inbound directory (/M switch) that GUS was
unable to locate. GUS will end with errorlevel 0.
╒═════════════════════╕
│ 8. ACKNOWLEDGEMENTS │
╘═════════════════════╛
+ PKUNPAK FAST! Archive Extract Utility Version 3.61 08-02-88
Copyright (c) 1986-1988 PKWARE Inc. All Rights Reserved.
+ PKUNZIP (R) FAST! Extract Utility Version 2.04g 02-01-93
Copr. 1989-1993 PKWARE Inc. All Rights Reserved. Shareware Version
PKUNZIP Reg. U.S. Pat. and Tm. Off.
+ XARC - to decompress a standard ARC Format Archive, Ver 7.1,
October, 1990
Copyright 1990 by System Enhancement Associates, Inc.;
ALL RIGHTS RESERVED
+ ARJ 2.39d PRE-RELEASE Copyright (c) 1990-93 Robert K Jung. Mar 06 1993
All Rights Reserved. U.S. Patent No. 5,140,321 and patent pending.
+ DWC - Archive utility, Release 5.10, Created 3/07/90
(C) Copyright 1986-90 by Dean W. Cooper; All rights reserved.
+ HA 0.98 Copyright (c) 1993 Harri Hirvola
+ Hamarsoft (R) Hap&Pah TM 3.00
Copyright (C) 1992 By Harald Feldmann.
Publicly Distributed evaluation copy.
+ HPACK - The multi-system archiver Version 0.78a0 (shareware version)
For Amiga, Archimedes, Macintosh, MSDOS, OS/2, and UNIX
Copyright (c) Peter Gutmann 1989 - 1992. Release date: 1 Sept 1992
+ Hyper - Pack Utility 2.5
Copyright (c) 1989,1990 P. Sawatzki and K.P. Nischke
+ LHA version 2.55b Copyright (c) Haruyasu Yoshizaki, 1988-92
+ Pak 2.51 Copyright 1988-90 NoGate Consulting
+ SQZ -- Squeeze It(1.08.3), Jan 24 1993, Copyright J I Hammarberg
+ Zoo archiver, Version 2.10 (1991/07/09 02:10:34)
(C) Copyright 1991 Rahul Dhesi -- Noncommercial use permitted
+ ARCE Copyright (c) 1986-91 Vernon D. Buerg.
Extract ARC files, Version 4.0g, 4/12/91. All rights reserved.
+ Conference Mail - Revision: 4.07 by Bob Hartman, FidoNet Node 132/101
(C) Copyright 1986, 1987 by Spark Software Inc. All rights reserved.
╒═════════════════════╕
│ 9. REVISION HISTORY │
╘═════════════════════╛
Ver. Comment
~~~~ ~~~~~~~
1.70 - Added support for the Dutch HAP archive format, which compresses
at least 10% better than PKZIP v2.04.
- Added support for the Finnish HA archiver, which beats PKZIP
v2.04 by more than 20%!
- Added the "/D" or Delete option.
- Added detection of SFX (self-extracting) archives.
GUS will recognize all EXE variants of the known archive types.
Note: GUS can't handle COM self-extractors made by LHarc 1.xx,
only the EXE sfx version.
- If the drive is full (0 bytes free), GUS is unable to move
a bad mailarchive away. It would take quite some time before
GUS would give up trying, though. Fixed: GUS will check
the drive space and abort the move if less than 32 bytes are
free. (32 bytes is what's need to create a new directory entry.)
- If a file could not be opened for the purpose of determining
the archive type, a runtime error 103 resulted. Fixed.
Added a message: «WARNING: unable to determine archive type due
to error while opening file».
- Some people experienced strange `runtime 162' errors.
Here's what happened...
GUS tried to open the NUL device and create it. Some environments
may have objected to that.
I changed the code so that the NUL device is opened for writing
only (no creation) and only if the /Q option is used, not always
like before.
This still caused some systems to yield that runtime error, so I
added an error check and disabled the Quiet mode in case the NUL
device cannot be opened. That should solve the `runtime 162'
problem once and for all...
Added a message: «WARNING: can't open NUL device -- Quiet command
ignored».
(This problem appeared mostly with system that loaded TSRs and
redirected their output to the NUL device. That causes DOS to
open but never close the NUL device, so when GUS tries to open
it, a sharing violation (runtime 162) occurs.)
1.61 - Fixed a bug which caused GUS to use the wrong archive name
when operating with an archiver that requires a fixed archive
extension (DWC and HPK at this time).
1.60 - Added support for the HPACK archiver from Peter Gutmann, which
makes the absolutely smallest archives at this time.
- Added support for the Swedish SQZ archiver, which compresses
better than ARJ 2.30 or the new PKZIP 1.93a!
- Previously, the first three archive types were: ARC (#1), ARJ
(#2) and ARC+ (#3). From now on, ARC+ will be #2 and ARJ #3.
This is more logical. (The reason for the previous order was
that GUS uses the abbreviation ARp internally for ARC+, and
ARp comes after ARJ alphabetically.)
- Due to a string length mismatch, GUS couldn't tell whether
UsePath or UsePassword options were supported or not. The
UsePath problem was reported by Wim Van Sebroeck (2:292/862)
and by checking that, I discovered that the same was true for
the UsePassword option. Corrected.
- Added code to allow the Path option to replace a command
instead of being added to it. (Indicated by `<' as the first
character in the Path option in GUS_WCFG.PAS)
Only needed for ARJ and SQZ at this time. (The previously used
`e -jf' for ARJ doesn't seem to work equal to `x', so that was
changed.)
- GUS `forgot' about the specification indicating which files had
to be extracted, once an ARC+ type archive had been worked on.
Reported by Wim Van Sebroeck (2:292/862) and fixed.
- If the specified target directory ended with a backslash (\),
GUS wouldn't recognize it as the target directory. Reported by
Wim Van Sebroeck (2:292/862) and fixed.
- Extract command for ARJ changed from `e -n' to `e -uy' and
modified some other archiver parameters in order to make the
behaviour of various archiver programs more homogenious.
GUS without /R option:
(1) XARC and HYPER will ask you if they should overwrite older
files. Unfortunately, these programs have no command
options to work in batchmode and avoid this.
(2) HPACK will never overwrite older files because it doesn't
have an option for this.
(3) all other archivers will overwrite older files and skip
the rest.
GUS with /R will cause existing files always to be
overwritten.
- If someone would combine several real commands on the GUS
commandline, the effects might not be what one desires.
Example: GUS * /T /R would start unpacking when one would
expect it to ignore the replace command and do a test only.
So I have changed the behaviour. The /T command now has priority
over all other commands. This means that if you specify multiple
commands, the /T (test) command will be executed and all others
ignored. If you specify /P and /R, the /P has a higher priority
and will be executed. The /R will be ignored. The priority of a
command increases if it can do less damage. So the priority order
for the GUS commands is in descending order: /I /T /P /R
(remember: the other switches are options, not commands!).
This problem was discovered after a tip by Alex Cleynhens
(2:292/500).
- Additional check for DWC archives. Apart from the string `DWC'
in the last 1K of the file, it is now required that this string
is the last item in a 27 byte structure for the file to be
identified as a DWC archive.
- GUS reported a runtime error when trying to rename an archive to
a fixed extension and if the new name existed already. Reported
by Wim Van Sebroeck (2:292/862). Fixed: the name is now
incremented. Modified the routine which moves bad mailarchives
to the BADARC.GUS subdirectory as well: if a file with the
same name already exists in the BADARC.GUS subdirectory, the
extension of the file to be moved is incremented.
- GUS had a problem if the target directory was a root directory.
In that case, it specified only the drive instead of the root
directory. Reported by Wim Van Sebroeck (2:292/862). Fixed.
- HPACK seems to require that its archives have a fixed extension
of .HPK (like DWC does). GUS directory /M /T doesn't move bad
archives into the BAD_ARC.GUS directory. Reported by Peter Smink
(2:285/1). Fixed.
- Various changes to the documentation.
1.50 - Added the /N (/5) switch to prevent GUS using or creating
paths embedded within archives.
- Made this switch automatic while working with mail archives
(/M). Thanks to John Lots (2:512/36.3@fidonet.org) and Eef
Hartman (2:281/603.5) for suggesting this and detecting the
problem with this in GUS 1.40.
/N is now also automatically invoked with /P and /T.
- Changed the way the configuration information is stored a bit,
since there was a useless amount of space being reserved for
the "Unknown" type, which of course shouldn't have been saved.
- Fixed a minor problem which caused a runtime error when
GUS.EXE was given a read/only attribute. Thanks to Rob
Essers (2:283/406.2) for reporting this.
- Cleaned up the batchfile listing in section 3.3 a bit.
Thanks to Roelof Heuvel (27:3331/5000@signet.ftn) for the
suggestion.
- Fixed a minor problem which caused GUS to not append '.*'
to a filename given without an extension when the pathame
would contain a dot somewhere. Thanks to Hans Siemons
(2:285/214@fidonet.org) for reporting it.
- Because of a space inserted between the appropriate switch to
supply a password to an unarchiver and the actual password it-
self, encrypted archives could never be unpacked. This is now
fixed.
- Made minor modifications for PKUNZIP 2.00, due to some changes
in the way that one handles its command options.
- The `use path' option was always supplied with the ZOO unpack
commands. Corrected.
1.40 - Removed MDCD archive support again, since nobody was likely
to use it -- unless you're looking for the worst performing
archiver ever, of course.
- Added support for the new LHA version 2 archiver from Yoshi,
which succeeds LHARC. The previous version of GUS could
already handle the new compression, but I didn't expect the
name of the program to be changed.
- Added support for the ARJ archiver program from Robert K.
Jung, which yields nearly always the best compression and
has a lot of features.
- Added support for the HYPER archiver program from Germany,
which seems to outperform every other archiver on 600..800K
logfiles ONLY. Weird.
- Added support for ARCfiles made by the new ARC version 7
compressor from SEA. At this time, only one public domain
extractor is available, which unfortunately lacks almost
every feature GUS has to offer.
My thanks to Donn Bly (1:236/7@fidonet.org) and Jeffrey
Nonken (1:273/715@fidonet.org) for providing me with all the
information on the ARC7+ archive format and the XARC
program.
- GUS is now fully commandline compatible with Vernon Buerg's
ARCE program. All of ARCE's switches are supported - except
for /5, which prevents ARCE from creating subdirectories
contained within ARCfile entries.
- GUS provides two extra options: /I will identify an archive
type by means of the exitcode (errorlevel) and /M will
unpack and delete mailarchives in Fidonet Technology
Networks.
- BUGFIXES:
* cleaned up handling zero-length and read/only files.
From now on, GUS won't abort with a runtime error on
those.
* you could only specify one single file to extract on GUS's
commandline, although the help screen and manual suggested
you could give more than one filespec.
That's also corrected now.
- OTHER IMPROVEMENTS:
* the code which detects the archive type has been completely
re-written and now is a *lot* faster than before!
1.31 - This version was never released, but mentioned in the
documentation of the ARCA*Simulator v2.31 (ASIM_231.LZH).
1.30 - This version was never released, but mentioned in the "Latest
Software Versions" column of the FidoNews magazine.
1.20M Added MDCD archives, corrected an error which made GUS not
recognize uncompressed file entries in an LZH archive, made sure
the new compression method of PAK is supported, added features to
allow selection of files and target directory for unpacking.
This is a maintenance release, hence the 'M' behind the version
number.
1.10 - Added LZH archives, and changed the way DWC archives are
identified in order to identify them even if up to 1K of rubbish
is appended to the end of a DWC archive. This is useful for DWC
archives which have been transferred by means of an Xmodem
protocol.
1.00 - Base version. (Turbo Pascal 5.0)
_______________________________________________________________________(eof)__