home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
disk
/
antivirus_utils
/
bbbf
/
unpacklib
/
unpackdoc
< prev
next >
Wrap
Text File
|
1995-02-27
|
19KB
|
543 lines
****************************************************************************
* UNPACK.LIBRARY V34.21 DOC *
* *
* *
* Update 24-08-93 *
* *
* *
* SAFE HEX INTERNATIONAL *
****************************************************************************
Welcome to this release version of this library. I hope it's a library
you can use in your virus killer or whatever you are doing. This library
purpose is to help a viruskiller programmer to scan files that are
crunched.
This library is copyrighted by SHI and may NOT be used in commercial
programs without a written permission from SHI. All the SHI members and
shareware programmers can of course use this library for free. Remember to
send your address and program to SHI, to get a written premission.
Please add the "Wanted.Crunchers.txt" (a list containing wanted crunchers
for update), and remember to credit the author (Thomas Neumann) and SHI in
your program as stated in the following:
Here is a little message about SHI:
----------------------------------------------------------------------------
ABOUT SAFE HEX INTERNATIONAL
If you know a virus programmer you can get a reward of $ 1000 for
supplying his name and address. The fact is that the law punishes data
crime very severely. (5 years in jail in most countries).
We are an international group with more than 500 members who have started
trying to stop the spread of virus. Let me give you some example:
1. Our motto is: "Safe Hex", who dares do anything else today?".
2. A virus bank containing more than 1800 Amiga and PC viruses for
supporting good shareware antivirus programs.
3. We help people to get money back lost by virus infection.
4. We write articles about virus problems for about 20 computer
magazines worldwide.
5. We release the newest and the best virus killers around from
about 25 wellknown programmers worldwide.
6. We have more than 35 PC and Amiga "Virus Centers" worldwide
where you can get free virus help by phoning our "Hotline", and
the newest killers translated in your own language at very
little cost.
For more information contact:
SAFE HEX INTERNATIONAL (Please send 2 "Coupon-Response
Erik Loevendahl Soerensen International" and a self addres-
Snaphanevej 10 sed envelope, if you want infor-
DK-4720 Praestoe mation about SHI by letter).
Denmark
Phone: + 45 55 99 25 12
Fax : + 45 55 99 34 98
----------------------------------------------------------------------------
****************************************************************************
* Offsets and functions destiptions *
****************************************************************************
AllocCInfo(34.0) AllocCInfo(34.0)
NAME
AllocCInfo - allocates an info structure.
SYNOPSIS
info = AllocCInfo ()
D0 -30
FUNCTION
AllocCInfo() allocates an info structure the library uses when it
unpacks files. You just have to call this function in the beginning
of your program and then free it again with FreeCInfo() in the end.
I have made this function, because in future versions of this
library, the structure will be bigger. Your program will then be
compatible for any future versions of this library.
INPUTS
None.
OUTPUTS
info - is a pointer to the allocated info structure. If there has
occured an error, a zero is returned.
STRUCTURE
This is how the Info Structure is build:
STRUCTURE UnpackInfo,0
APTR UI_Filename
APTR UI_Path
APTR UI_Jump
APTR UI_CruncherName
APTR UI_DecrunchAdr
LONG UI_DecrunchLen
UWORD UI_ErrorNum
UWORD UI_CrunchNum
UBYTE UI_CrunchType
UBYTE UI_Flag
APTR UI_LoadNamePoi
LONG UI_CrunchLen
; This Is Private, Do NOT Touch
APTR UI_CrunchAdr
LONG UI_CrunchLenTemp
LONG UI_FileHandler
LONG UI_Lock
LONG UI_OldLock
APTR UI_InfoAdr
APTR UI_UnpackPoi
ULONG UI_Temp
STRUCT UI_LoadName,128
STRUCT UI_ExecuteString,256
LABEL UnpackInfo_SIZEOF
NOTE:
-----
The private area is a bad idea to use, because the different
fields will maybe be moved around in future versions.
UI_Filename is a pointer to the filename you want to scan.
UI_Path is a pointer to a zero-terminated path where the
library have to unpack archive files, such as a LHA
archive. Please select a path where you haven't got
some important data, because ALL files will be
deleted in the path if the DELETE flag is on.
UI_Jump This is a pointer to your scan routine. If this
pointer are zero, no jump will be made.
UI_CruncherName This is a pointer to the crunchers name the file is
crunched with. The name are zero-terminated.
UI_DecrunchAdr This is the start address of the decrunched file.
Your scan routine just have to read this field and
the UI_DecrunchLen field and scan that memory.
UI_DecrunchLen This is the length of the decrunched file.
UI_ErrorNum If an error occur, the error number is stored in
this field. See the unpack.i file for more
information.
NOTE: When you call a function and you success,
don't read this flag, because there are
stored an error number, but it's false.
UI_CrunchNum Here is the cruncher number stored. Each cruncher
has a number so you can find out which cruncher is
used on the file.
UI_CrunchType Here is a number that tells about the file (archive,
data or object file).
UI_Flag You can select some different things the library has
to do when it tests the file. See below for more
info.
UI_LoadNamePoi This is just a pointer to the UI_LoadName field. Use
this if you want to use the UI_LoadName field,
because the field will be moved in future versions.
UI_LoadName Here is the filename stored, the library is about
to decrunch, if the file is an archive.
UI_CrunchLen This is the length of the crunched file.
The flag have the following functions:
Bit Function
--------------------------------------------------------------
0 Select to unpack one file at a time or the
whole archive. If set, one file is selected
1 Delete files after scanning. Set = Delete. If you
set this bit on, ALL files AND directories will be
deleted, not only the files there were stored in
the archive.
2-7 Reserved
BUGS
None known.
SEE ALSO
FreeCInfo()
----------------------------------------------------------------------------
FreeCInfo(34.0) FreeCInfo(34.0)
NAME
FreeCInfo - frees the info structure again.
SYNOPSIS
FreeCInfo (info)
-36 A0
FUNCTION
FreeCInfo() frees the info structure again. You have to call this
function in the end of your program.
INPUTS
info - is the memory address you got from the AllocCInfo() function.
If the memory address is zero, you will NOT take a trip to
India (and visit the GURU) when you call this function.
OUTPUTS
None.
BUGS
None known.
SEE ALSO
AllocCInfo()
----------------------------------------------------------------------------
DetermineFile(34.0) DetermineFile(34.0)
NAME
DetermineFile - scans a file to find out which cruncher that are
used.
SYNOPSIS
success = DetermineFile (info, filename)
D0 -42 A0 A1
FUNCTION
DetermineFile() scans a file to find out which cruncher the file is
crunched with. If the library can't find out, an error message is
returned. You have to call this function first, then the Unpack()
function, if no error has occured.
INPUTS
info - is the memory address you got from the AllocCInfo()
function.
filename - is a pointer to the filename you want to scan. The
filename has to be zero-terminated.
OUTPUTS
success - is an indicator that tells about the operation. If every
thing is okay, a non-zero value is returned, else a zero
will be returned. If you get an error, you can look at
the UI_ErrorNum flag in the info structure to see what
went wrong.
BUGS
None known.
SEE ALSO
Unpack()
----------------------------------------------------------------------------
Unpack(34.0) Unpack(34.0)
NAME
Unpack - unpacks the file.
SYNOPSIS
success = Unpack (info)
D0 -48 A0
FUNCTION
Unpack() loads the file into memory and unpacks it. When the file
is unpacked, the library will jump through the UI_Jump pointer to
your scan routine. If the UI_Jump contains a zero, the library will
not jump. All what your scan routine has to do, is to get the
UI_DecrunchAdr and UI_DecrunchLen from the info structure and
scan that memory. If the file is an archive (Lha, zoo), the library
will unpack the archive and then read one file at a time and jump
to your scan routine.
If you need a password to unpack a file, the library will open a
little window where it asks for the password. The window will be
opened on the active screen, so if you open a screen by yourself,
the window will appear on it (if it's active).
NOTE:
-----
After an archive is unpacked and scanned, all the files and
directories in the path you have selected will be deleted if the
DELETE flag is on, not just the files there were stored in the
archive, but ALL files will be deleted, so be sure to use a temp
directory or something like that.
INPUTS
info - is the memory address you got from the AllocCInfo()
function.
OUTPUTS
success - is an indicator that tells about the operation. If every
thing is okay, a non-zero value is returned, else a zero
will be returned. If you get an error, you can look at
the UI_ErrorNum flag in the info structure to see what
went wrong.
BUGS
None known.
SEE ALSO
DetermineFile()
----------------------------------------------------------------------------
TestHunk(34.1) TestHunk(34.1)
NAME
TestHunk - tests the hunk structure in a file.
SYNOPSIS
success = TestHunk (address)
D0 -54 A0
FUNCTION
TestHunk() tests a file for the hunk structure. You have to be sure,
that the file you want to test is an object file, else this routine
will return an error. You can check this by look in the
UI_CrunchType flag in the info structure. You don't need to call
this function by yourself before you calling the Unpack() function,
because the Unpack() function does that by itself. I'm not quite
sure it handles the overlay hunk correctly, but it should handle it.
If you find a file you know are okay and this function says it's
defect, please send me the file so I can find the error.
INPUTS
address - is the start address of the file you want to test.
OUTPUTS
success - is an indicator that tells about the operation. If every
thing is okay, a non-zero value is returned, else a zero
will be returned.
BUGS
None known.
----------------------------------------------------------------------------
UnpackNum(34.1) UnpackNum(34.1)
NAME
UnpackNum - gives the number of unpackers.
SYNOPSIS
version,revision,types,unpackers=UnpackNum ()
D0 D1 D2 D3 -60
FUNCTION
UnpackNum() counts the number of unpackers the library can determine
and unpack. You will get two different numbers of unpackers. The
first one (types) are the numbers of different types the library
can unpack, example PowerPacker Data, PowerPacker Library etc.
The second one (unpackers) is the number of unpackers, example
PowerPacker, Lha, Imploder etc.
INPUTS
None.
OUTPUTS
version - is the library version number.
revision - is the library revision number.
types - is the number of different types of unpackers.
unpackers - is the number of unpackers the library can determine.
BUGS
None known.
----------------------------------------------------------------------------
UnpackList(34.1) UnpackList(34.1)
NAME
UnpackList - makes an unpacker name list.
SYNOPSIS
name=UnpackList (info)
A1 -66 A0
FUNCTION
UnpackList() gives a pointer to the first name of a packer the
library can determine & unpack. You can use this function, if you
want to make a list over all the unpackers the library can
determine. Call this function first and then use UnpackListNext().
INPUTS
info - is the memory address you got from the AllocCInfo()
function.
OUTPUTS
name - is a pointer to a null-terminated string where the first
name is stored.
BUGS
None known.
SEE ALSO
UnpackListNext()
----------------------------------------------------------------------------
UnpackListNext(34.1) UnpackListNext(34.1)
NAME
UnpackListNext - reads the next name in the unpacker list.
SYNOPSIS
success,name=UnpackListNext (info)
D0 A1 -72 A0
FUNCTION
UnpackListNext() gives a pointer to the next name of a packer the
library can determine & unpack. You can use this function, if you
want to make a list over all the unpackers the library can
determine. Call the UnpackList() function first and then use this
function.
INPUTS
info - is the memory address you got from the AllocCInfo()
function.
OUTPUTS
name - is a pointer to a null-terminated string where the next
name is stored.
success - if this contains a zero, there are no more crunchers in
the list. Otherwise it will contain a non-zero value.
BUGS
None known.
SEE ALSO
UnpackList()
----------------------------------------------------------------------------
LoadFile(34.20) LoadFile(34.20)
NAME
LoadFile - loads a file into memory.
SYNOPSIS
success=LoadFile (info)
D0 -78 A0
FUNCTION
This function allocate some memory with the files length and loads
the file into it. The filename are taken from the UI_Filename field
in the info structure. The length and address of the file are
stored in UI_DecrunchLen and UI_DecrunchAdr.
INPUTS
info - is the memory address you got from the AllocCInfo()
function.
OUTPUTS
success - is an indicator that tells about the operation. If every
thing is okay, the file length is returned, else a zero
will be returned. If you get an error, you can look at
the UI_ErrorNum flag in the info structure to see what
went wrong.
BUGS
None known.
SEE ALSO
FreeFile()
----------------------------------------------------------------------------
FreeFile(34.20) FreeFile(34.20)
NAME
FreeFile - frees a file from memory.
SYNOPSIS
FreeFile (info)
-84 A0
FUNCTION
You have to call this function after you have called the LoadFile()
function and are finished with the file. This function frees the
memory again.
NOTE: You MUST call this function instead of freeing the memory by
yourself!!
INPUTS
info - is the memory address you got from the AllocCInfo()
function. You can pass a zero to this function.
OUTPUTS
None.
BUGS
None known.
SEE ALSO
LoadFile()
----------------------------------------------------------------------------
I really hope you can use this library. See also the
Unpack.construct.iff file to see how to construct your program.
If you find any grammatical errors in this doc file, feel free to
correct them, and send them to me. And of course any new crunchers.
Please see in the "Wanted-Crunchers.Txt" for more info!
WE NEED YOUR HELP TO GET THIS LIBRARY EVEN BETTER, THANK YOU VERY MUCH!
Thomas Neumann Member of the SHI Anti Virus Group.
Kongensgade 78
3550 Slangerup
Denmark