home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Cruncher / ulib4271.lha / UnpackLib / For_Programmers_Only / Programmers_Docs / UnpackLib_Docs < prev    next >
Encoding:
Text File  |  1995-11-15  |  40.2 KB  |  1,151 lines

  1. ***************************************************************************
  2. *                        UNPACK.LIBRARY V42.71 DOC                        *
  3. *                                                                         *
  4. *                                                                         *
  5. *                             Update 20-11-95                             *
  6. *                                                                         *
  7. *                                                                         *
  8. *                          SAFE HEX INTERNATIONAL                         *
  9. ***************************************************************************
  10.  
  11.  
  12. Welcome  to  the release version of this library. I hope it's a library you
  13. can  use  in your virus killer or whatever you are doing. One of the things
  14. this library can do, is to help a viruskiller programmer to scan files that
  15. are crunched.
  16.  
  17.  
  18.      o  This  library  is  copyrighted  by  SHI  and  may  NOT  be  used in
  19.         commercial programs without a written permission from SHI.
  20.  
  21.      o  SHI  members can of course use this library for free. (But remember
  22.         to get a written permission.
  23.  
  24.      o  All  Shareware programmers can be SHI members, if they full-fill to
  25.         support our anti-virus work. (But remember to send your address and
  26.         program idea to SHI, to get a written permission).
  27.  
  28.  
  29. It's  forbidden  to  reassemble  (reverse engining) in any way this library
  30. code.  All the ideas to the way we unpacks files are copyrighted by SHI. If
  31. you  don't  respect  our  copyright - or, if you use this library without a
  32. written permission, SHI will contact the police to stop you.
  33.  
  34. Please  add  the  "WantedHelp"  (a  list  containing  wanted  crunchers for
  35. update), and remember to credit the author (Thomas Neumann) and SHI in your
  36. program as stated in the following:
  37.  
  38. ---------------------------------------------------------------------------
  39.  
  40. ABOUT SAFE HEX INTERNATIONAL
  41. If you know a virus programmer you can get a reward of $ 1000 for supplying
  42. his  name  and  address.  The fact is that the law punishes data crime very
  43. severely. (5 years in jail in most countries).
  44.  
  45.  
  46. We  are  an international group with more than 500 members who have started
  47. trying to stop the spread of virus. Let me give you some example:
  48.  
  49.         . Our  organisation   "Safe  Hex  International", SHI, is a grass
  50.            roots  movement,  which  started  in 1987 with Amiga computers.
  51.            Today  we  are an organisation with around 600 members, who are
  52.            all more or less involved in our work.
  53.  
  54.          . The SHI motto is: "Safe Hex", who dares do anything else today?
  55.  
  56.          . SHI run non-profit, based on friendship and fairness.
  57.  
  58.          . A  virus  bank  containing  more than 1800 Amiga and PC viruses
  59.            for supporting good shareware antivirus programs.
  60.  
  61.          . We  help  people  to  get  money  back lost by virus infection.
  62.  
  63.          . We  write  articles  about virus problems for about 20 computer
  64.            magazines worldwide.
  65.  
  66.          . We  release  the  newest and the best virus killers around from
  67.            wellknown programmers worldwide.
  68.  
  69.          . We  have  more  than  35 PC and Amiga "Virus Centers" worldwide
  70.            where you can get free virus help by phoning our "Hotline", and
  71.            get  the newest killers translated in your own language at very
  72.            little cost reflecting the Fred Fish prices.
  73.  
  74.  
  75. For more information contact:
  76.  
  77.         SAFE HEX INTERNATIONAL            (Please send 2 "Coupon-Response
  78.         Erik Loevendahl Soerensen         International" and a self addres-
  79.         Snaphanevej 10                    sed envelope, if you want infor-
  80.         DK-4720 Praestoe                  mation about SHI by letter).
  81.         Denmark
  82.         Phone: + 45 55 99 25 12
  83.         Fax  : + 45 55 99 34 98
  84.       
  85.                
  86. We need your support too! - concerning new viruses and chrunchers for new
  87. future updates.
  88.  
  89.                       We  are thinking that you can see how important your
  90.                       support is too if you are using one of the following
  91.                       programs,  which are using our anti-virus.libraries:
  92.  
  93.  
  94.                       * Virus Checker by Johan Veldthuis
  95.  
  96.                       * Virus Scanner by Gabriele Greco
  97.  
  98.                       * Fides Professional by John Lohmeyer
  99.  
  100.                       * DMS by ParCon Software
  101.  
  102.                       * Virus Info Base by Safe Hex International
  103.  
  104.                       * D-Copy by Stefan Bernbo  
  105.  
  106.                       * X-Copy by Cachet Software (commercial)
  107.  
  108.                       * Xtruder BBS virus killer by Martin Wulffeld
  109.  
  110.                       * MT-Copy by Gert-Jan Strik
  111.  
  112.                       * Harboot virus analyser by Martin Harbo
  113.  
  114.                       * Bootwriter by Ralf Thanner
  115.  
  116.                       * DMSChecker by Martin Wulffeld
  117.  
  118.                       * AntiCicloVir by Mathias Gutt
  119.  
  120.  
  121.  
  122.   ATTENTION: ARE YOU USING SOME OF THE ABOVE PROGRAMS, YOU HAVE OF COURSE
  123.   INTERREST  TO HELP US, SO WE WE CAN HELP YOU TOO. THEREFORE REMEMBER TO
  124.   SEND ALL NEW VIRUSE TO SHI FOR FUTURE UPDATES. 
  125.  
  126.                                           THANK YOU VERY MUCH AND REGARDS
  127.  
  128. --------------------------------------------------------------------------
  129.  
  130. THE FUTURE NEW UPDATES DEPENDS ON YOU!
  131.  
  132. If you have a modem, please send all new viruses and new crunchers directly
  133. to one of the Safe Hex International bulletin board supports:
  134.  
  135.  
  136.  
  137.  
  138.      *  PROGRAMMER'S RESORT - SHI Main BBS
  139.         SysOp: Alex Holst
  140.  
  141.         ZyXEL: 45-98380575    ISDN: 96869090
  142.  
  143.         We hope to be running V34 soon...
  144.  
  145.         Login as 'Guest' with password 'Guest' for easy download of
  146.         viruskillers and anonymous upload of vira.
  147.  
  148.  
  149.  
  150.  
  151.      *  DAN BBS is one of the best and biggest BBS in Europe
  152.         CoSysOp: Anti-Virus PC & Amiga: Erik Loevendahl
  153.  
  154.         Server: 486DX2-66,32mb-RAM,Adaptec 2842VL
  155.         Micropolis 1528+4110 (Micro2:86127799)
  156.         Total  harddisks: 4.3 GIGA,
  157.         2/8 Giga Sony DAT streamer
  158.         CD-Server: 386-40mhz,4MB, 18 CD's online
  159.         ISDN workstation: 386-40mhz, 4MB, TELES
  160.  
  161.         Total 14 GB on-line
  162.         (More than 30 PC's in system)
  163.  
  164.         Linie  1 payment line          42643990  V-Fast 28.8
  165.         Linie  2                       43628230  ZyXEL/v32bis
  166.         Linie  3                       43627750  ZyXEL/v32bis
  167.         Linie  4                       43625880  ZyXEL/v32bis
  168.         Linie  5-19 payment lines!     4362XXXX  ZyXEL/v32bis
  169.         Linie 20                       42643827  V34/VFC 28.8
  170.         Linie 21                       43621655  VFC 28.8
  171.         Linie 22+23                    43661070  ISDN
  172.  
  173.         DAN BBS fax:                42643357 Group 3
  174.  
  175.  
  176.         What to do:
  177.  
  178.         Do you wish to contact our SHI free anti-virus areas for uploads
  179.         of  new virus or download of the newest SHI anti-virus stuff type:
  180.  
  181.         "Guest", "Guest" (for free files), and "V" (for the SHI anti-virus
  182.         free area)
  183.  
  184.         
  185.  
  186.      *  IDENTITY UNKNOWN BBS
  187.         (Swedish SHI support)
  188.  
  189.          SysOp Andreas Johansson        
  190.  
  191.          BBS: +46-(0)36-187803  VFC 28.8, Running CNet
  192.  
  193.  
  194.         IF YOU HAVE A MODEM PLEASE SEND NEW VIRUSES DIRECT TO OUR BBS
  195.         WITHOUT YOUR HELP THERE HAVE BEEN NO VIRUS KILLERS TO-DAY, BE
  196.         QUITE SURE!
  197.  
  198.  
  199.         Always the newest anti-virus stoff and a lot of texts
  200.         concerning data security. You are welcome, to get any
  201.         virus problem solved by our worldwide virus "HOT-LINE"
  202.         if you contact some of our local virus centers too.
  203.  
  204.  
  205. --------------------------------------------------------------------------
  206. SAFE HEX E-MAIL ADRESSES
  207.  
  208.  
  209. * Alex Holst Internet support              : i1g@dc5101.aalborges.dk
  210.  
  211.  
  212. * Lars Stockholm, SHI Packet Radio support : OZ1GYQ@OZ4BOX.SAX.LOL.DNK.EU
  213.  
  214.  
  215. * Andreas Johansson, swedish SHI support   : andreas_johansson@augs.se
  216.  
  217.  
  218. * Erik Loevendahl, Virus AmyNet support    : 39:141/127.17
  219.  
  220.  
  221. * Thomas Neumann, the unpack.lib programmer: E-Mail: tax@fiol.nbrock.dk
  222.  
  223.  
  224. ---------------------------------------------------------------------------
  225.  
  226. ***************************************************************************
  227. *                            Table of contents                            *
  228. ***************************************************************************
  229.  
  230. unpack.library/upAllocCInfo()
  231. unpack.library/upDetermineFile()
  232. unpack.library/upFreeCInfo()
  233. unpack.library/upFreeFile()
  234. unpack.library/upLoadFile()
  235. unpack.library/upGetUnpacker()
  236. unpack.library/upNewUnpackNum()
  237. unpack.library/upSendCmd()
  238. unpack.library/upTestHunk()
  239. unpack.library/upUnpack()
  240. unpack.library/upUnpackList()
  241. unpack.library/upUnpackListNext()
  242. unpack.library/upUnuseDrive()
  243. unpack.library/upUseDrive()
  244.  
  245. ---------------------------------------------------------------------------
  246.  
  247. ***************************************************************************
  248. *                    Offsets and functions destiptions                    *
  249. ***************************************************************************
  250.  
  251.  
  252. upAllocCInfo(34.0)                                       upAllocCInfo(34.0)
  253.  
  254.  
  255. NAME
  256.         upAllocCInfo - allocates an info structure.
  257.  
  258. SYNOPSIS
  259.         info = upAllocCInfo ()
  260.          D0        -30
  261.  
  262.         struct UnpackInfo *upAllocCInfo(void);
  263.  
  264. FUNCTION
  265.         upAllocCInfo() allocates an info structure the library uses when it
  266.         unpacks files. You just have to call this function in the beginning
  267.         of your program and then free it again with FreeCInfo() at the end.
  268.         I  have  made  this  function,  because  in future versions of this
  269.         library,  the  structure  will be bigger. Your program will then be
  270.         compatible for any future versions of this library.
  271.  
  272. INPUTS
  273.         None.
  274.  
  275. OUTPUTS
  276.         info  -  is a pointer to the allocated info structure. If there has
  277.                  occured an error, a zero is returned.
  278.  
  279. STRUCTURE
  280.         This is how the Info Structure is build:
  281.  
  282.         STRUCTURE UnpackInfo,0
  283.         APTR    UI_Filename
  284.         APTR    UI_Path
  285.         APTR    UI_Jump
  286.         APTR    UI_CruncherName
  287.         APTR    UI_DecrunchAdr
  288.         LONG    UI_DecrunchLen
  289.         UWORD   UI_ErrorNum
  290.         UWORD   UI_CrunchNum
  291.         UBYTE   UI_CrunchType
  292.         UBYTE   UI_Flag
  293.         APTR    UI_LoadNamePoi
  294.         LONG    UI_CrunchLen
  295.         APTR    UI_UserData             ;V35+
  296.         APTR    UI_TrackJump            ;V36+
  297.         APTR    UI_TrkErrJump           ;V36+
  298.         LONG    UI_Offset               ;V36+
  299.         UWORD   UI_Track                ;V36+
  300.         APTR    UI_ErrorMsg             ;V37+
  301.         APTR    UI_CrunchAdr            ;V37+
  302.         APTR    UI_LhaPattern           ;V38+
  303.         BOOL8   UI_UseFilenamePointer   ;V39+
  304.         UBYTE   UI_Pad
  305.         ULONG   UI_Address              ;V42+
  306.         ULONG   UI_JumpAdr              ;V42+
  307.         APTR    UI_Password             ;V42+
  308.  
  309. ; Private Data
  310.  
  311.         ....
  312.         STRUCT  UI_LoadName,2*108
  313.         ....
  314.  
  315.  
  316.         NOTE:
  317.         -----
  318.         The private area is a bad idea to use, because the different fields
  319.         will maybe be moved around in future versions.
  320.  
  321.  
  322.         UI_Filename     is a pointer to the filename you want to scan.
  323.  
  324.         UI_Path         is  a  pointer  to a zero-terminated path where the
  325.                         library have to unpack archive files, such as a LHA
  326.                         archive. Please select a path where you haven't got
  327.                         some  important  data,  because  ALL  files will be
  328.                         deleted in the path if the DELETE flag is on.
  329.  
  330.         UI_Jump         This  is  a  pointer  to your scan routine. If this
  331.                         pointer are zero, no jump will be made.
  332.  
  333.         UI_CruncherName This is a pointer to the crunchers name the file is
  334.                         crunched with. The name are zero-terminated.
  335.  
  336.         UI_DecrunchAdr  This  is  the start address of the decrunched file.
  337.                         Your  scan routine just have to read this field and
  338.                         the UI_DecrunchLen field and scan that memory.
  339.  
  340.         UI_DecrunchLen  This is the length of the decrunched file.
  341.  
  342.         UI_ErrorNum     If  an  error  occur, the error number is stored in
  343.                         this   field.   See  the  unpack.i  file  for  more
  344.                         information.
  345.  
  346.         UI_CrunchNum    Here  is  the cruncher number stored. Each cruncher
  347.                         has  a  number  so  you can find out which cruncher
  348.                         there are used on the file.
  349.  
  350.         UI_CrunchType   Here   is  a  number  that  tells  about  the  file
  351.                         (archive, data or object file). Bit 7 indicate that
  352.                         the file are encrypted.  It  will  be set after the
  353.                         call to DetermineFile() function.
  354.  
  355.         UI_Flag         You  can  select  some different things the library
  356.                         has  to  do  when  it tests the file. See below for
  357.                         more info.
  358.  
  359.         UI_LoadNamePoi  This  is  just  a pointer to the UI_LoadName field.
  360.                         Use  this if you want to use the UI_LoadName field,
  361.                         because the field will be moved in future versions.
  362.  
  363.         UI_LoadName     Here  is  the filename stored, the library is about
  364.                         to decrunch, if the file is an archive.
  365.  
  366.         UI_CrunchLen    This is the length of the crunched file.
  367.  
  368.         UI_UserData     This  value  will be stored in A1 when the Unpack()
  369.                         function jump through the UI_Jump field. (V35+)
  370.  
  371.         UI_TrackJump    This field have the same function as UI_Jump, exept
  372.                         that  the library will only jump through this field
  373.                         when its unpack a track crunched file, such as DMS.
  374.                         The  library  will jump for every track it unpacks.
  375.                         You  have  to  return a return value in D0. You can
  376.                         select  between  these  values: 0 means every thing
  377.                         are   okay,   just   continue  and  -1  means  stop
  378.                         unpacking.  If this field are zero, no jump will be
  379.                         made (V36+).
  380.  
  381.         UI_TrkErrJump   The  library  will  jump through this pointer if an
  382.                         error  occurs.  There  are a lot of errors, such as
  383.                         checksum  error  etc.  You  routine  can  read  the
  384.                         UI_ErrorNum field in the info structure to see what
  385.                         went  wrong.  In  D0  you  have  to return the same
  386.                         values as in UI_TrackJump (V36+).
  387.  
  388.         UI_Offset       Here  will  be  stored the offset on a disk, ex. if
  389.                         the library just have unpacked track 40, there will
  390.                         be  stored in this field: 40*22*512. Your tracksave
  391.                         routine can read this field, UI_DecrunchAdr and the
  392.                         UI_DecrunchLen  fields  and just call the SendCmd()
  393.                         function with these values as parameters (V36+).
  394.  
  395.         UI_Track        Here  are  stored  the  track the library just have
  396.                         unpacked (V36+).
  397.  
  398.         UI_ErrorMsg     If  an error occurs, a pointer to the error message
  399.                         will be stored here (V37+).
  400.  
  401.         UI_CrunchAdr    This  is a pointer to the crunched data. If you use
  402.                         the  NoLoad  flag,  you  have  to  store  the start
  403.                         address and the length of the crunched data in this
  404.                         field and the UI_CrunchLen field (V37+).
  405.  
  406.         UI_LhaPattern   Here can you store a pointer to a Lha pattern. This
  407.                         means,  the  zero-terminated  string  this  pointer
  408.                         points to, will be copied at the end of the execute
  409.                         string. If you ex. have a string containing: "a#?",
  410.                         the  unpack.library  will  only  unpack  all  files
  411.                         starting with an "a". Zero in this pointer means no
  412.                         pattern (V38+).
  413.  
  414.                         NOTE1: This pointer will be ignored if you have set
  415.                         the UFB_OneFile bit in the UI_Flag.
  416.  
  417.                         NOTE2: From version 41+, this is also used  in  the
  418.                         lzx unpacker routine.
  419.  
  420.         UI_UseFilenamePointer
  421.                         This  boolean  flag  will  be set to true, when you
  422.                         must    use    the   filename   pointed   to   with
  423.                         UI_LoadNamePoi.  If  false, you have to use you own
  424.                         filename.  This  flag  will  be  set  to  true when
  425.                         unpacking a file in an archive and the file type is
  426.                         not an archive. See example (V39+).
  427.  
  428.         UI_Address      If  the  crunched file was crunched with an address
  429.                         packer,  etc. TetraPacker, there will in this field
  430.                         be stored  the  start  address  the  file has to be
  431.                         copied to if you want to run it.
  432.  
  433.         UI_JumpAdr      This  is where you have to jump to start an address
  434.                         crunched file.
  435.  
  436.         UI_Password     Now  you can make your own password input routine!!
  437.                         You just have to set this to a routine that ask for
  438.                         the  password  from  the user. You will in A1 get a
  439.                         pointer to an  info structure.  In  all  the  other
  440.                         registers there  are  the  same  values as when you
  441.                         call the library.  You  have  to  return  in  D0  a
  442.                         pointer to the password or NULL if there isn't  any
  443.                         password. If you set this pointer  (UI_Password) to
  444.                         NULL,  the default password  input  routine will be
  445.                         used.
  446.  
  447.  
  448. The flag have the following functions:
  449.  
  450.  
  451. Name         Bit             Function
  452. ---------------------------------------------------------------------------
  453. UFB_OneFile  0          Select  to  unpack  one file at a time or the whole
  454.                         archive. If set, one file is selected.
  455.  
  456. UFB_Delete   1          Delete  files  after scanning. Set = Delete. If you
  457.                         set  this bit on, ALL files AND directories will be
  458.                         deleted,  not  only  the files there were stored in
  459.                         the archive.
  460.  
  461. UFB_NoFree   2          If this bit is set, the decrunched file will NOT be
  462.                         freed  from memory after the Unpack() function have
  463.                         called through the UI_Jump pointer. If you set this
  464.                         bit,  you  have to free the memory by yourself with
  465.                         the FreeFile() function. (V35+)
  466.  
  467. UFB_Banner   3          This  bit are the give banner bit. If set, you will
  468.                         get the banner text in UI_DecrunchAdr. Your routine
  469.                         the  UI_TrackJump  pointer  points to, have to test
  470.                         the  UI_Offset field to see it's a banner or normal
  471.                         track there are given. If the UI_Offset are -1, its
  472.                         a banner. (V36+)
  473.  
  474. UFB_NoLoad   4          If  this  bit  are  set,  the  DetermineFile()  and
  475.                         Unpack()  functions  will  not  load  the file into
  476.                         memory,  but  use the UI_CrunchAdr and UI_CrunchLen
  477.                         field  in  the  Unpack  Info  structure  to get the
  478.                         crunched data (V37+).
  479.  
  480. UFB_Protect  5          If you set this bit and the UFB_NoLoad are cleared,
  481.                         the   DetermineFile()   function  will  change  the
  482.                         protections  bit  on the file to determine. It will
  483.                         set the RWED bits (V38+).
  484.  
  485. UFB_NoA4     6          If you set this bit, you will not get a pointer  to
  486.                         the  info  structure  in  A4 when your function via
  487.                         the UI_Jump pointer. You will then  have  the  same
  488.                         values in all your registers as when you called the
  489.                         Unpack() function,  except for A0-A2.  You will get
  490.                         the pointer to your info structure in A2 instead.
  491.                         (V41+)
  492.  
  493. UFB_ChipMem  7          If this bit is set, the unpack.library will  unpack
  494.                         the crunched data  to  chip  memory.  This  can  be
  495.                         usefull  if  you  want  to  unpack some graphics or
  496.                         samples. (V42+)
  497.  
  498. BUGS
  499.         None known.
  500.  
  501. SEE ALSO
  502.         upFreeCInfo()
  503.  
  504. ---------------------------------------------------------------------------
  505.  
  506. upDetermineFile(34.0)                                 upDetermineFile(34.0)
  507.  
  508.  
  509. NAME
  510.         upDetermineFile - scans a file  to find out which cruncher that are
  511.                           used.
  512.  
  513. SYNOPSIS
  514.         success = upDetermineFile (info, filename)
  515.           D0           -42          A0      A1
  516.  
  517.         BOOL upDetermineFile (struct UnpackInfo *, char *);
  518.  
  519. FUNCTION
  520.         upDetermineFile()  scans a file to find out which cruncher the file
  521.         are  crunched with. If the library can't find out, an error message
  522.         is  returned.  You  have  to  call  this  function  first, then the
  523.         upUnpack() function, if no error has occured.
  524.  
  525.         V42.70:
  526.         -------
  527.         From now  on,  you can see the size of the file in the UI_CrunchLen
  528.         field.
  529.  
  530. INPUTS
  531.         info     - is  the  memory  address you got from the upAllocCInfo()
  532.                    function.
  533.  
  534.         filename - is  a  pointer  to  the  filename  you want to scan. The
  535.                    filename has to be zero-terminated.
  536.  
  537. OUTPUTS
  538.         success  - is an indicator that tells about the operation. If every
  539.                    thing is okay, a non-zero value is returned, else a zero
  540.                    will  be  returned. If you get an error, you can look at
  541.                    the  UI_ErrorNum  flag in the info structure to see what
  542.                    went wrong.
  543.  
  544. BUGS
  545.         None known.
  546.  
  547. SEE ALSO
  548.         upUnpack()
  549.  
  550. ---------------------------------------------------------------------------
  551.  
  552. upFreeCInfo(34.0)                                         upFreeCInfo(34.0)
  553.  
  554.  
  555. NAME
  556.         upFreeCInfo - frees the info structure again.
  557.  
  558. SYNOPSIS
  559.         upFreeCInfo (info)
  560.             -36       A0
  561.  
  562.         void upFreeCInfo (struct UnpackInfo *);
  563.  
  564. FUNCTION
  565.         upFreeCInfo() frees the info structure again. You have to call this
  566.         function at the end of your program.
  567.  
  568. INPUTS
  569.         info  - is  the  memory  address  you  got  from the upAllocCInfo()
  570.                 function.  If the memory address is zero, you will NOT take
  571.                 a  trip  to  India  (and visit the GURU) when you call this
  572.                 function.
  573.  
  574. OUTPUTS
  575.         None.
  576.  
  577. BUGS
  578.         None known.
  579.  
  580. SEE ALSO
  581.         upAllocCInfo()
  582.  
  583. ---------------------------------------------------------------------------
  584.  
  585. upFreeFile(34.20)                                         upFreeFile(34.20)
  586.  
  587.  
  588. NAME
  589.         upFreeFile - frees a file from memory.
  590.  
  591. SYNOPSIS
  592.         upFreeFile (info)
  593.            -84       A0
  594.  
  595.         void upFreeFile (struct UnpackInfo *);
  596.  
  597. FUNCTION
  598.         You   have  to  call  this  function  after  you  have  called  the
  599.         upLoadFile() function and are finished with the file. This function
  600.         frees the memory again.
  601.  
  602.         NOTE:  You MUST call this function instead of freeing the memory by
  603.         yourself!!
  604.  
  605. INPUTS
  606.         info - is   the  memory  address  you  got  from the upAllocCInfo()
  607.                function.  You  can  call  always this function, even if the
  608.                upLoadFile() function returned an error.
  609.  
  610. OUTPUTS
  611.         None.
  612.  
  613. BUGS
  614.         None known.
  615.  
  616. SEE ALSO
  617.         upLoadFile()
  618.  
  619. ---------------------------------------------------------------------------
  620.  
  621. upLoadFile(34.20)                                         upLoadFile(34.20)
  622.  
  623.  
  624. NAME
  625.         upLoadFile - loads a file into memory.
  626.  
  627. SYNOPSIS
  628.         success = upLoadFile (info)
  629.           D0         -78       A0
  630.  
  631.         BOOL upLoadFile (struct UnpackInfo *);
  632.  
  633. FUNCTION
  634.         This  function allocate some memory with the files length and loads
  635.         the file into it. The filename are taken from the UI_Filename field
  636.         in  the  info  structure.  The  length  and address of the file are
  637.         stored in UI_DecrunchLen and UI_DecrunchAdr.
  638.  
  639.         V36.30:
  640.         -------
  641.         If  the library runs under KS 37+, all caches will be cleared after
  642.         the file are loaded into the memory.
  643.  
  644. INPUTS
  645.         info    - is  the  memory  address  you got from the upAllocCInfo()
  646.                   function.
  647.  
  648. OUTPUTS
  649.         success - is  an indicator that tells about the operation. If every
  650.                   thing  is  okay, the file length is returned, else a zero
  651.                   will  be returned and the allocated memory will be freed.
  652.                   If you get an error, you can look at the UI_ErrorNum flag
  653.                   in the info structure to see what went wrong.
  654.  
  655. BUGS
  656.         None known.
  657.  
  658. SEE ALSO
  659.         upFreeFile()
  660.  
  661. ---------------------------------------------------------------------------
  662.  
  663. upGetUnpacker(42.70)                                   upGetUnpacker(42.70)
  664.  
  665.  
  666. NAME
  667.         upGetUnpacker - get info about a decruncher.
  668.  
  669. SYNOPSIS
  670.         uinfo = upGetUnpacker (info, number)
  671.          D0         -114        A0     D0
  672.  
  673.         struct UnpListStruct *upGetUnpacker (struct UnpackInfo *, UWORD);
  674.  
  675. FUNCTION
  676.         If  you want some information about the decrunchers in the library,
  677.         you  can use this function. It will return a pointer to a structure
  678.         where  you  can get a lot of information about each decruncher. You
  679.         just call this function in a loop and exit when it returns null.
  680.  
  681. INPUTS
  682.         info    - is  the  memory  address  you got from the upAllocCInfo()
  683.                   function.
  684.  
  685.         number  - is  the intern number you want information about starting
  686.                   with zero.
  687.  
  688. OUTPUTS
  689.         uinfo   - is a pointer to a UnpListStruct or null for end.
  690.  
  691. BUGS
  692.         None known.
  693.  
  694. SEE ALSO
  695.         upUnpackList(), upUnpackListNext()
  696.  
  697. ---------------------------------------------------------------------------
  698.  
  699. upNewUnpackNum(37.32)                                 upNewUnpackNum(37.32)
  700.  
  701.  
  702. NAME
  703.         upNewUnpackNum - gives the number of unpackers in a structure.
  704.  
  705. SYNOPSIS
  706.         number = upNewUnpackNum ()
  707.           A0         -108
  708.  
  709.         struct NumberStruct *upNewUnpackNum (void);
  710.  
  711. FUNCTION
  712.         upNewUnpackNum()  counts  the  number  of unpackers the library can
  713.         determine  and  unpack.  You  will  get  two  different  numbers of
  714.         unpackers. The first one (types) are the numbers of different types
  715.         the  library  can  unpack,  example  PowerPacker  Data, PowerPacker
  716.         Library etc. The second one (unpackers) is the number of unpackers,
  717.         example PowerPacker, Lha, Imploder etc.
  718.  
  719. INPUTS
  720.         None.
  721.  
  722. OUTPUTS
  723.         number - a pointer to a structure that look like this:
  724.  
  725.                 STRUCTURE NumberStruct,0
  726.                 UWORD   NS_Version      ;Library Version
  727.                 UWORD   NS_Revision     ;Library Revision
  728.                 UWORD   NS_Types
  729.                 UWORD   NS_Unpackers
  730.                 LABEL   NumberStruct_SIZEOF
  731.  
  732. BUGS
  733.         None known.
  734.  
  735. ---------------------------------------------------------------------------
  736.  
  737. upSendCmd(36.30)                                           upSendCmd(36.30)
  738.  
  739.  
  740. NAME
  741.         upSendCmd - sends a command to a devive.
  742.  
  743. SYNOPSIS
  744.         error = upSendCmd (dinfo, address, offset, length, cmd)
  745.          D0       -102      A0      A1       D1      D2    D0
  746.  
  747.         UBYTE upSendCmd (struct DriveStruct *, APTR, ULONG, ULONG, UBYTE);
  748.  
  749. FUNCTION
  750.         The  only  thing  this  function does, is send the command with the
  751.         parameters  to  the device opened by the upUseDrive() function. The
  752.         command will be sent by the DoIO() function.
  753.  
  754. INPUTS
  755.         dinfo   - is a pointer returned by the upUseDrive() function.
  756.  
  757.         address - is a pointer to the data area.
  758.  
  759.         offset  - is the offset on the disk.
  760.  
  761.         length  - is the number of bytes to send.
  762.  
  763.         cmd     - is the command to send, like a read, write or update.
  764.  
  765. OUTPUTS
  766.         error   - is the error number returned by the device.
  767.  
  768. BUGS
  769.         None known.
  770.  
  771. SEE ALSO
  772.         upUseDrive(), upUnuseDrive()
  773.  
  774. ---------------------------------------------------------------------------
  775.  
  776. upTestHunk(34.1)                                           upTestHunk(34.1)
  777.  
  778.  
  779. NAME
  780.         upTestHunk - tests the hunk structure in a file.
  781.  
  782. SYNOPSIS
  783.         success = upTestHunk (address)
  784.           D0         -54        A0
  785.  
  786.         BOOL upTestHunk (APTR);
  787.  
  788. FUNCTION
  789.         upTestHunk()  tests  a  file for the hunk structure. You have to be
  790.         sure,  that  the file you want to test is an object file, else this
  791.         routine  will  return  an  error. You can check this by look in the
  792.         UI_CrunchType  flag  in  the info structure. You don't need to call
  793.         this  function  by  yourself  before  you  calling  the  upUnpack()
  794.         function,  because the upUnpack() function does that by itself. I'm
  795.         not quite sure it handles the overlay hunk correctly, but it should
  796.         handle  it.  If you find a file you know are okay and this function
  797.         says it's defect, please send me the file so I can find the error.
  798.  
  799. INPUTS
  800.         address - is the start address of the file you want to test.
  801.  
  802. OUTPUTS
  803.         success - is  an indicator that tells about the operation. If every
  804.                   thing  is okay, a non-zero value is returned, else a zero
  805.                   will be returned.
  806.  
  807. BUGS
  808.         None known.
  809.  
  810. ---------------------------------------------------------------------------
  811.  
  812. upUnpack(34.0)                                               upUnpack(34.0)
  813.  
  814.  
  815. NAME
  816.         upUnpack - unpacks the file.
  817.  
  818. SYNOPSIS
  819.         success = upUnpack (info)
  820.           D0        -48      A0
  821.  
  822.         BOOL upUnpack (struct UnpackInfo *);
  823.  
  824. FUNCTION
  825.         upUnpack() loads the file into memory and unpacks it. When the file
  826.         is  unpacked,  the library will jump through the UI_Jump pointer to
  827.         your scan routine. If the UI_Jump contains a zero, the library will
  828.         not  jump.  All  what  your  scan  routine has to do, is to get the
  829.         UI_DecrunchAdr  and UI_DecrunchLen from the info structure and scan
  830.         that memory. If the file is an archive (Lha, zoo), the library will
  831.         unpack  the  archive  and  then read one file at a time and jump to
  832.         your scan routine.
  833.         If  you  need  a password to unpack a file, the library will open a
  834.         little  window  where  it asks for the password. The window will be
  835.         opened  on  the active screen, so if you open a screen by yourself,
  836.         the window will appear on it  (if it's active). You  can  from  V42
  837.         make your own password input routine.
  838.  
  839.         NOTE:
  840.         -----
  841.         After  an  archive  is  unpacked  and  scanned,  all  the files and
  842.         directories  in  the  path you have selected will be deleted if the
  843.         DELETE  flag  is  on,  not  just the files there were stored in the
  844.         archive,  but  ALL  files will be deleted, so be sure to use a temp
  845.         directory or something like that.
  846.  
  847.         V35.22:
  848.         -------
  849.         When this function jumps through the UI_Jump pointer, the following
  850.         registers will have these pointers:
  851.  
  852.         A0 = The start address of your routine (Unpack() makes a jsr (a0)).
  853.         A1 = Your pointer stored in the UI_UserData field.
  854.         A4 = The start address of the info structure.
  855.  
  856.         NOTE: If  you  set  the NoA4 bit in the flag byte, you will not get
  857.         the pointer to the info structure in A4. See the  desciption  above
  858.         for more information. (V41+)
  859.  
  860.         V36.30:
  861.         -------
  862.         If the library runs under KS V37+, all caches will be cleared after
  863.         the decrunching.
  864.  
  865.         Track Crunched Files:
  866.         ---------------------
  867.         This  function  will  jump  through UI_TrackJump instead of UI_Jump
  868.         when  it  unpacks  a  track crunched file. Such files are ex. a DMS
  869.         file.  The  routine have to return a value in D0. The values can be
  870.         0 to indicate that every things are ok and -1 to stop unpacking.
  871.  
  872.         V38.40:
  873.         -------
  874.         This  function  are  now  made  recursive.  That means it will call
  875.         itself  until  the  file  can't  be decrunched any more. Now it can
  876.         unpack  a  lha  file in a lha file or a file crunched with imploder
  877.         and  powerpacker  etc.  If you have ex. select to unpack a lha file
  878.         at  RAM:,  the  first lha file will be unpacked there. If there are
  879.         more  lha  files,  the next one will be unpacked in RAM:-xxx/ where
  880.         xxx is the name of the lha archive etc.
  881.  
  882.         NOTE:
  883.         -----
  884.         The  recursive  process  will  take a lot of stack and memory. Each
  885.         time  the  function  will  call itself, it will allocate a new info
  886.         structure and 256 bytes to the new path.
  887.  
  888. INPUTS
  889.         info     - is  the  memory  address you got from the upAllocCInfo()
  890.                    function.
  891.  
  892. OUTPUTS
  893.         success  - is an indicator that tells about the operation. If every
  894.                    thing is okay, a non-zero value is returned, else a zero
  895.                    will  be  returned. If you get an error, you can look at
  896.                    the  UI_ErrorNum  flag in the info structure to see what
  897.                    went wrong.
  898.  
  899. BUGS
  900.         The  DMS Deep decruncher will not work correctly. I try to fix this
  901.         bug as soon as possible.
  902.  
  903. SEE ALSO
  904.         upDetermineFile(), upAllocCInfo()
  905.  
  906. ---------------------------------------------------------------------------
  907.  
  908. upUnpackList(34.1)                                       upUnpackList(34.1)
  909.  
  910.  
  911. NAME
  912.         upUnpackList - makes an unpacker name list.
  913.  
  914. SYNOPSIS
  915.         name = upUnpackList (info)
  916.          A1        -66        A0
  917.  
  918.         char *upUnpackList (struct UnpackInfo *);
  919.  
  920. FUNCTION
  921.         upUnpackList()  gives  a  pointer to the first name to a packer the
  922.         library  can  determine & unpack. You can use this function, if you
  923.         want  to  make  a  list  over  all  the  unpackers  the library can
  924.         determine.    Call    this    function    first    and   then   use
  925.         upUnpackListNext().
  926.  
  927. INPUTS
  928.         info - is   the  memory  address  you  got  from the upAllocCInfo()
  929.                function.
  930.  
  931. OUTPUTS
  932.         name - is  a  pointer  to  a null-terminated string where the first
  933.                name are stored.
  934.  
  935. BUGS
  936.         None known.
  937.  
  938. SEE ALSO
  939.         upUnpackListNext(), upGetUnpacker()
  940.  
  941. ---------------------------------------------------------------------------
  942.  
  943. upUnpackListNext(34.1)                               upUnpackListNext(34.1)
  944.  
  945.  
  946. NAME
  947.         upUnpackListNext - reads the next name in the unpacker list.
  948.  
  949. SYNOPSIS
  950.         success,name = upUnpackListNext (info)
  951.           D0     A1          -72          A0
  952.  
  953.         BOOL,char *upUnpackListNext (struct UnpackInfo *);
  954.  
  955. FUNCTION
  956.         upUnpackListNext() gives a pointer to the next name to a packer the
  957.         library  can  determine & unpack. You can use this function, if you
  958.         want  to  make  a  list  over  all  the  unpackers  the library can
  959.         determine. Call the upUnpackList() function first and then use this
  960.         function.
  961.  
  962. INPUTS
  963.         info    - is  the  memory  address  you got from the upAllocCInfo()
  964.                   function.
  965.  
  966. OUTPUTS
  967.         name    - is  a  pointer to a null-terminated string where the next
  968.                   name are stored.
  969.  
  970.                   V37.32
  971.                   ------
  972.                   This  pointer will also be zero when the success flag are
  973.                   zero. This are only made for C-programmers.
  974.  
  975.         success - if  this  contains a zero, there are no more crunchers in
  976.                   the list. Otherwise it will contain a non-zero value.
  977.  
  978. BUGS
  979.         None known.
  980.  
  981. SEE ALSO
  982.         upUnpackList(), upGetUnpacker()
  983.  
  984. ---------------------------------------------------------------------------
  985.  
  986. upUnuseDrive(36.30)                                     upUnuseDrive(36.30)
  987.  
  988.  
  989. NAME
  990.         upUnuseDrive - give back the drive to DOS.
  991.  
  992. SYNOPSIS
  993.         upUnuseDrive (dinfo)
  994.             -96        A0
  995.  
  996.         void upUnuseDrive (struct DriveStruct *);
  997.  
  998. FUNCTION
  999.         This function closes the device again and make the drive unbusy.
  1000.  
  1001. INPUTS
  1002.         dinfo - is the pointer returned by the upUseDrive() function.
  1003.  
  1004. OUTPUTS
  1005.         Nothing.
  1006.  
  1007. BUGS
  1008.         None known.
  1009.  
  1010. SEE ALSO
  1011.         upUseDrive(), upSendCmd()
  1012.  
  1013. ---------------------------------------------------------------------------
  1014.  
  1015. upUseDrive(36.30)                                         upUseDrive(36.30)
  1016.  
  1017.  
  1018. NAME
  1019.         upUseDrive - make a drive busy and ready for use.
  1020.  
  1021. SYNOPSIS
  1022.         dinfo = upUseDrive (info, drive)
  1023.          D0        -90       A0     A1
  1024.  
  1025.         struct DriveStruct *upUseDrive (struct UnpackInfo *, char *);
  1026.  
  1027. FUNCTION
  1028.         This  function  find out which device the drive given uses and open
  1029.         it. Then it will make the drive busy, that means CLI/WorkBench will
  1030.         not  be  able  to  use that drive until you unuse it. It's only you
  1031.         that  can use it. This function are only made to give you a help to
  1032.         write a track crunched-file saver.
  1033.  
  1034. INPUTS
  1035.         info  - is  the  memory  address  you  got  from the upAllocCInfo()
  1036.                 function.
  1037.  
  1038.         drive - is a pointer to the drive you want to use, ex. DF0:, RAD:.
  1039.  
  1040. OUTPUTS
  1041.         dinfo - is  a  pointer  to  a  structure  used  by the device. This
  1042.                 structure  includes a IOStdReq structure and a message port
  1043.                 structure.  If  you  get  a zero back, an error occurs. You
  1044.                 can see in the UI_ErrorNum field to see want went wrong.
  1045.  
  1046. BUGS
  1047.         None known.
  1048.  
  1049. SEE ALSO
  1050.         upUnuseDrive(), upSendCmd()
  1051.  
  1052. ---------------------------------------------------------------------------
  1053.  
  1054.  BUG REPORT FORM
  1055.  
  1056.     If you happen to find a bug in the unpacker library please fill out the
  1057.     bug  report  form below and send it to me.  Please be sure to have read
  1058.     this documentation before jumping to any conclusions.
  1059.  
  1060.  
  1061. > Cut here <
  1062. ----------------------------------------------------------------------
  1063.  
  1064.                          BUG REPORT FORM             DATE:
  1065.  
  1066. ----------------------------------------------------------------------
  1067. NAME:
  1068. ----------------------------------------------------------------------
  1069. ADDRESS:
  1070. ----------------------------------------------------------------------
  1071. COUNTRY:                                   PHONE:
  1072. ----------------------------------------------------------------------
  1073. WHICH PROGRAM:                             VERSION:
  1074. ----------------------------------------------------------------------
  1075.  
  1076. YOUR MACHINE CONFIGURATION (use Sysinfo):
  1077. ----------------------------------------               
  1078. 1.  Amiga 500               Amiga 600                 Amiga 1000
  1079.     Amiga 2000 A            Amiga 2000 B              Amiga 2000 C
  1080.     Amiga 2500              Amiga 3000                Amiga 4030
  1081.     Amiga 1200              Amiga 4040
  1082.  
  1083.  
  1084. 2.  1/2 MB chipmem                       Fat Agnus (old) 8371 A 
  1085.     1/1 MB chipmem                       Big Agnus (Fatter) 8372 A
  1086.     2/1 MB chipmem                       ECS Agnus (Hires) 8372 B 
  1087.     Fast RAM                             Total RAM
  1088.  
  1089. 3.  Denise (old) 8362                   ECS Denise (new) 8363 
  1090.  
  1091. 4.  Kickstart 1.2     Kickstart 1.3     Kickstart 2.0     Kickstart 3.0
  1092.     Softkick ?.?
  1093.  
  1094. 5.  Special Boards and like (e.g. AT-Card, Action Replay, Turbo Card):
  1095.  
  1096.  
  1097.  
  1098.  
  1099. 6.  How old is your Amiga?
  1100.  
  1101. 7.  Where did you get unpacker.library?
  1102.  
  1103. --------------------------------------------------------------------------
  1104.  
  1105. Details of the bug:
  1106. ------------------
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120. Guru code:
  1121.  
  1122.  
  1123.  
  1124. The name of the unknown cruncher:
  1125. (Remember to send this unknown cruncer too if possible)
  1126.  
  1127. --------------------------------------------------------------------------
  1128. > Cut here <
  1129.  
  1130.  
  1131.  
  1132.         
  1133. I  really  hope  you  can use this library. See also the Unpack.IFF
  1134. file to see how to construct your program.
  1135.  
  1136.         
  1137. Please  remember  if  you  find any bugs in the library or if you have some
  1138. crunchers  there  are  not  implemented  in  the library, please send a bug
  1139. report  or  the  crunchers to me, thanks!  See in the "WantedHelp" for more
  1140. info!
  1141.  
  1142.  
  1143.    WE NEED YOUR HELP TO GET THIS LIBRARY EVEN BETTER, THANK YOU VERY MUCH!
  1144.  
  1145.  
  1146.         Thomas Neumann       Member of the SHI Anti Virus Group.
  1147.         Kongensgade 78
  1148.         3550 Slangerup
  1149.         Denmark
  1150.         E-Mail: tax@fiol.nbrock.dk
  1151.