home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / sqz1083e.zip / TECH.ENG < prev    next >
Text File  |  1993-01-22  |  9KB  |  255 lines

  1. The information in this document may, or may not, be correct, but is given
  2. as a bonus. Someone might find it useful. 1993/01/11
  3. -------------------------------------------------------------------------------
  4.  
  5. DOSversion:    3.3 and onwards,
  6.         2.0 to 3.2 will work as long as you use UPPERCASE in all
  7.         filenames and don't use SFX/SFXjr.
  8.  
  9.  
  10. Memory:     For packing;    ≈400 kB, but more than 380 kB
  11.         Decoding;    ≈96 kB
  12.  
  13.         These figures does not include SQZ itself which requires
  14.         ≈50 kB and filenames which call for their length + 5 bytes
  15.         in overhead (450/420 : 150).
  16.  
  17.         These figures can be shrinked at cost of speed.
  18.  
  19.         It's a real memory eater, ain't it;-)
  20.  
  21.  
  22. Others:     Given filespec may result in a maximum of 4096 filenames
  23.         per run. The archive in itself will handle any number
  24.         of files.
  25.  
  26.         A maximum of 64 filespec's for files to skip.
  27.  
  28.         A maximum of 16 extension's for files to copy.
  29.  
  30.  
  31. -------------------------------------------------------------------------------
  32. Archive header:
  33.     offset  0..4:   Id:     HLSQZ        (072d 076d 083d 081d 090d)
  34.         5:        Version:    1        (049d)
  35.         6:        OS:     76543210
  36.                 xxxxx000    0   PC-DOS
  37.                 xxxxx001    1   OS/2
  38.                 xxxxx010    2   MVS
  39.                 xxxxx011    3   HPSF(OS/2)
  40.                 xxxxx100    4   Amiga
  41.                 xxxxx101    5   Macintosh
  42.                 xxxxx110    6   *nix
  43.                 xxxxx111    7   Future use
  44.                 XXXXXxxx        Future use
  45.         7:        Flag    76543210
  46.                 xxxxxxxX        byte order
  47.                    0        Little Endian, Motorola order
  48.                    1        Big Endian, Intel order
  49.                 xxxxxxXx        Format for Data and time
  50.                   0        UNIX format. Number of seconds
  51.                         since 1:st of january 1970.
  52.                   1        DOS format for Date and Time
  53.                         in file: E8631E19.
  54.                         Decoded:    1992/08/30 12.31.32
  55.                         MSB             LSB
  56.                         19        1E        63        E8
  57.                         76543210765432107654321076543210
  58.                         00011001000111100110001111101000
  59.                         YYYYYYYMMMMDDDDDHHHHHMMMMMM22222
  60.                         12       8   30   12     31    16
  61.                         +=1980               *=2
  62.                         1992   08  30   12     31    32
  63.                 xxxxx1xx        Security Envelope
  64.                         No modifications allowed!
  65.                         If you do any thing, you'll ruin it
  66.                 xxxx1xxx        Whole archive encrypted! Keep OUT
  67.                         When I say whole, I mean WHOLE.
  68.                         There's nothing that you can do,
  69.                         just stay out of trouble.
  70.                         This archive can't be used until
  71.                         it's decrypted.
  72.                 xxx1xxxx        Unified data
  73.                 XXXxxxxx        Future use
  74.  
  75.  
  76. -------------------------------------------------------------------------------
  77. File header:
  78.  
  79.     offset  Size    Comment
  80.     0        1        Header size and type
  81.             0    ->  End of archive
  82.             1..18    Se below (Extra data)
  83.             19..    ->  normal file header
  84.             if normal file
  85.     1        1        Header algebraic sum  & 0FFh
  86.     0        1:76543210
  87.           xxxxXXXX    Method 0..4(15)
  88.           XXXXxxxx    Future use
  89.     1        4        Compressed size
  90.     5        4        Original size
  91.     9        4        Last DateTime
  92.     13        1        Attributes
  93.     14        4        CRC
  94.     18..    (size-18)    filename, w/o \0.
  95.  
  96.  
  97. -------------------------------------------------------------------------------
  98. How to read a SQZ-archive
  99.  
  100. Do
  101. If  > 18. Normal file
  102.     Read HeaderSum(1 byte)
  103.     Read size bytes
  104.     Calculate headersum
  105.     {short i; unsigned short s = 0U;
  106.     for(i = 0; i < size; i++)
  107.         s += header[i];
  108.     if(headersum != (unsigned char)s) WRONG HEADERSUM
  109.     header[size] = '\0';    // just to makes things easier to handle, ie.
  110.                 // zero terminate filename
  111.  
  112. If  == 0. End of archive. Terminate
  113.  
  114. If  <= 18. Extra data, se below
  115.     switch
  116.     case 1: COMMENT
  117.     case 2: PASSWORD
  118.     case 3: POSTFIX
  119.     case 4: SECURITY ENVELOPE
  120.     case 5: VOLUME LABEL
  121.     case 6: DIRECTORY
  122.     case 7: COMMENT, version 2
  123.     else    Read one word and then skip that many bytes.
  124.     end
  125.     Read one word (size)
  126.     skip that many bytes, if you don't know how to handle it.
  127.  
  128. while not End of archive
  129.  
  130.  
  131. -------------------------------------------------------------------------------
  132. Extra data
  133.  
  134.     00d     END_OF_ARC: Well, what's there to say?
  135.  
  136.     01d     COMMENT: Created by SQZ 1.08.2
  137.     0   2        Number of bytes in comment
  138.             Uncompressed size = this field - 7
  139.     2   2        Number of bytes compressed
  140.     4   1:76543210
  141.           xxxxXXXX    Method 0..4(15)
  142.           XXXXxxxx    Future use
  143.     5   4        CRC
  144.     9   size-7    Comment
  145.  
  146.  
  147.     02d     PASSWORD:
  148.     0   2        n
  149.     2   1    76543210
  150.         xxxxxxx1    Public
  151.         xxxxxx1x    Not public
  152.         xxxxx1xx    Signature included
  153.         XXXXXxxx    Future use
  154.     3   n-1
  155.         **************************************************************
  156.         I'm not done thinking about this one yet, so I'll be in touch.
  157.         I've been thinking and... see ya l'ter
  158.         **************************************************************
  159.  
  160.     03d     POSTFIX:    This code are among the last one in the archive (<256)
  161.     0   2        5
  162.     2   5        HLSQZ
  163.             Postfix are automatically added when closing a modified
  164.             archive, but, who knows, it might change in the future
  165.             so please check the last 256 bytes, just not the last
  166.             nine ones, 'cause who knows, someone might have been
  167.             using XModem...
  168.  
  169.     04d     SECURITY ENVELOPE:
  170.     0   2        n
  171.     2   2        SE version (major.minor.test.mask)0010
  172.         76543210
  173.         testmask
  174.         majomino
  175.     2   2        SE revision.
  176.     6   n-2     None of your business
  177.  
  178.     05d     VOLUME LABEL
  179.     0   2        Number of bytes
  180.     2   4        Time for creation of volume
  181.     6   1        Attribute, bit 3 always set (if DOS)
  182.     7   4        Serial number, if available, otherwise 00000000h
  183.        11   n        Label
  184.             Number of bytes - 9 -> length of label.
  185.  
  186.     06d     DIRECTORY
  187.     0   2        Number of bytes
  188.     2   1        Algebraic sum & 0xFF
  189.     3   4        Time for creation of directory
  190.     7   1        Attribute
  191.     8   n        Path
  192.             Number of bytes - 6 --> length of path
  193.  
  194.     07d     COMMENT: Created by SQZ 1.08.3 and later
  195.     0   2        Number of bytes in field
  196.             Compressed size = this field - 7
  197.     2   2        Number of uncompressed bytes
  198.     4   1:76543210
  199.           xxxxXXXX    Method 0..4(15)
  200.           XXXXxxxx    Future use
  201.     5   4        CRC
  202.     9   size-7    Comment
  203.  
  204.     ??d     OTHERWISE:
  205.     0   2        Number of bytes to skip
  206.  
  207.  
  208. -------------------------------------------------------------------------------
  209. Errorlevels
  210. #define EC_NO            0        No error
  211. #define EC_NOMEM        1        Out of memory
  212. #define EC_WRITE_ARC        2        Error writing to archive file
  213. #define EC_WRITE_TMP        3        Error writing to temp archive file
  214. #define EC_WRITE_OUT        4        Error writing to extracted file
  215. #define EC_READ_ARC        5        Error reading from archive file
  216. #define EC_READ_INP        6        Error reading from file to archive
  217. #define EC_OPEN_ARC        7        Error opening archive file
  218. #define EC_OPEN_INP        8        Error opening file to archive
  219. #define EC_OPEN_SFX        9        Error opening SFX/SFXjr.exe
  220. #define EC_OPEN_TMP        10        Error opening temp (archive) file
  221. #define EC_CREATE_ARC        11        Error creating archive file
  222. #define EC_CREATE_TMP        12        Error creating temp archive file
  223. #define EC_CREATE_OUT        13        Error creating file to extract
  224. #define EC_CREATE_SFX        14        Error creating archive file EXE
  225. #define EC_CLOSE_ARC        15        Error closing archive file
  226. #define EC_CLOSE_TMP        16        Error closing temp archive file
  227. #define EC_CLOSE_INP        17        Error closing file to archive
  228. #define EC_CLOSE_OUT        18        Error closing extracted file
  229. #define EC_HEADER_SUM        19        Archive corrupted
  230. #define EC_CORRUPT_HDR        20        Archive corrupted
  231. #define EC_2_MANY_EXT        21        Too many extensions to copy (<= 16)
  232. #define EC_UNKNOWN_SWITCH   22        Unknown switch given
  233. #define EC_ILL_COMB_SW        23        Illegal combination of switches, eg.
  234.                     include subdirectories and strip path
  235. #define EC_CBREAK        24        User C-Break
  236. #define EC_UNKNOWN        25        Unknown type of archive file
  237. #define EC_NOT_ON_SFX        26        Those commands not allowed on SFX
  238. #define EC_NOT_MS_DOS        27        Archive file was not for MS-DOS
  239. #define EC_CRC            28        CRC-errors in Extracting/Testing
  240. #define EC_SQZ_CORRUPT        29        Someone has tangled with SQZ,
  241.                     look out for virii or a hacker.
  242. #define EC_CORRUPT_ARC        30        Corrupted archive file.
  243. #define EC_OPS_SEC_ARC        31        Can't handle this SECURE ARCHIVE
  244.                     Mostly due to version/revision
  245. #define EC_SEC_ARC        32        Secured Archive, modifications not allowed
  246. #define EC_NOTHING_2_DO    128        This one are not considered to be an error!
  247.                     It's given when no files matches, eg.
  248.                     SQZ E TST *.PCK and there's no *.PCK to
  249.                     extract.
  250. #define EC_NOT_REMOVED       129        Couldn't MOVE files.
  251.  
  252.         I'm sorry for those of you who check's for != 0, you'll
  253.         now have to check for ((ret_code > 0 && ret_code < 0x80))
  254.         to catch any errors, again, I'm sorry.
  255.