home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 September / Chip_2000-09_cd1.bin / sharewar / Slunec / app / 16 / ARCHIVES.SWG / 0015_ZIP.pas < prev    next >
Pascal/Delphi Source File  |  1996-09-03  |  8KB  |  180 lines

  1. --------A-ZIP---------------------------
  2.  
  3. Files stored in arbitrary order.  Large zipfiles can span multiple
  4. diskette media.
  5.  
  6.           Local File Header 1
  7.                     file 1 extra field
  8.                     file 1 comment
  9.                file data 1
  10.           Local File Header 2
  11.                     file 2 extra field
  12.                     file 2 comment
  13.                file data 2
  14.           .
  15.           .
  16.           .
  17.           Local File Header n
  18.                     file n extra field
  19.                     file n comment
  20.                file data n
  21.      Central Directory
  22.                central extra field
  23.                central comment
  24.           End of Central Directory
  25.                     end comment
  26. EOF
  27.  
  28.  
  29. LOCAL FILE HEADER
  30. -----------------
  31.  
  32. OFFSET LABEL       TYP  VALUE        DESCRIPTION
  33. ------ ----------- ---- ----------- ----------------------------------
  34. 00     ZIPLOCSIG   HEX  04034B50    ;Local File Header Signature
  35. 04     ZIPVER      DW   0000        ;Version needed to extract
  36. 06     ZIPGENFLG   DW   0000        ;General purpose bit flag
  37. 08     ZIPMTHD     DW   0000        ;Compression method
  38. 0A     ZIPTIME     DW   0000        ;Last mod file time (MS-DOS)
  39. 0C     ZIPDATE     DW   0000        ;Last mod file date (MS-DOS)
  40. 0E     ZIPCRC      HEX  00000000    ;CRC-32
  41. 12     ZIPSIZE     HEX  00000000    ;Compressed size
  42. 16     ZIPUNCMP    HEX  00000000    ;Uncompressed size
  43. 1A     ZIPFNLN     DW   0000        ;Filename length
  44. 1C     ZIPXTRALN   DW   0000        ;Extra field length
  45. 1E     ZIPNAME     DS   ZIPFNLN     ;filename
  46. --     ZIPXTRA     DS   ZIPXTRALN   ;extra field
  47.  
  48. CENTRAL DIRECTORY STRUCTURE
  49. ---------------------------
  50.  
  51. OFFSET LABEL       TYP  VALUE        DESCRIPTION
  52. ------ ----------- ---- ----------- ----------------------------------
  53. 00     ZIPCENSIG   HEX  02014B50    ;Central file header signature
  54. 04     ZIPCVER     DB   00          ;Version made by
  55. 05     ZIPCOS      DB   00          ;Host operating system
  56. 06     ZIPCVXT     DB   00          ;Version needed to extract
  57. 07     ZIPCEXOS    DB   00          ;O/S of version needed for extraction
  58. 08     ZIPCFLG     DW   0000        ;General purpose bit flag
  59. 0A     ZIPCMTHD    DW   0000        ;Compression method
  60. 0C     ZIPCTIM     DW   0000        ;Last mod file time (MS-DOS)
  61. 0E     ZIPCDAT     DW   0000        ;Last mod file date (MS-DOS)
  62. 10     ZIPCCRC     HEX  00000000    ;CRC-32
  63. 14     ZIPCSIZ     HEX  00000000    ;Compressed size
  64. 18     ZIPCUNC     HEX  00000000    ;Uncompressed size
  65. 1C     ZIPCFNL     DW   0000        ;Filename length
  66. 1E     ZIPCXTL     DW   0000        ;Extra field length
  67. 20     ZIPCCML     DW   0000        ;File comment length
  68. 22     ZIPDSK      DW   0000        ;Disk number start
  69. 24     ZIPINT      DW   0000        ;Internal file attributes
  70.  
  71.        LABEL       BIT        DESCRIPTION
  72.        ----------- --------- -----------------------------------------
  73.        ZIPINT         0       if = 1, file is apparently an ASCII or
  74.                               text file
  75.                       0       if = 0, file apparently contains binary
  76.                               data
  77.  
  78.                      1-7      unused in version 1.0.
  79.  
  80. 26     ZIPEXT      HEX  00000000    ;External file attributes, host
  81.                                     ;system dependent
  82. 2A     ZIPOFST     HEX  00000000    ;Relative offset of local header
  83.                                     ;from the start of the first disk
  84.                                     ;on which this file appears
  85. 2E     ZIPCFN      DS   ZIPCFNL     ;Filename or path - should not
  86.                                     ;contain a drive or device letter,
  87.                                     ;or a leading slash. All slashes
  88.                                     ;should be forward slashes '/'
  89. --     ZIPCXTR     DS   ZIPCXTL     ;extra field
  90. --     ZIPCOM      DS   ZIPCCML     ;file comment
  91.  
  92.  
  93. END OF CENTRAL DIR STRUCTURE
  94. ----------------------------
  95.  
  96. OFFSET LABEL       TYP  VALUE        DESCRIPTION
  97. ------ ----------- ---- ----------- ----------------------------------
  98. 00     ZIPESIG     HEX  06064B50    ;End of central dir signature
  99. 04     ZIPEDSK     DW   0000        ;Number of this disk
  100. 06     ZIPECEN     DW   0000        ;Number of disk with start central dir
  101. 08     ZIPENUM     DW   0000        ;Total number of entries in central dir
  102.                                     ;on this disk
  103. 0A     ZIPECENN    DW   0000        ;total number entries in central dir
  104. 0C     ZIPECSZ     HEX  00000000    ;Size of the central directory
  105. 10     ZIPEOFST    HEX  00000000    ;Offset of start of central directory
  106.                                     ;with respect to the starting disk
  107.                                     ;number
  108. 14     ZIPECOML    DW   0000        ;zipfile comment length
  109. 16     ZIPECOM     DS   ZIPECOML    ;zipfile comment
  110.  
  111.  
  112. ZIP VALUES LEGEND
  113. -----------------
  114.  
  115.        HOST O/S
  116.  
  117.        VALUE  DESCRIPTION               VALUE  DESCRIPTION
  118.        ----- -------------------------- ----- ------------------------
  119.        0      MS-DOS and OS/2 (FAT)     5      Atari ST
  120.        1      Amiga                     6      OS/2 1.2 extended file sys
  121.        2      VMS                       7      Macintosh
  122.        3      *nix                      8 thru
  123.        4      VM/CMS                    255    unused
  124.  
  125.  
  126.        GENERAL PURPOSE BIT FLAG
  127.  
  128.        LABEL       BIT        DESCRIPTION
  129.        ----------- --------- -----------------------------------------
  130.        ZIPGENFLG      0       If set, file is encrypted
  131.           or          1       If file Imploded and this bit is set, 8K
  132.        ZIPCFLG                sliding dictionary was used. If clear, 4K
  133.                               sliding dictionary was used.
  134.                       2       If file Imploded and this bit is set, 3
  135.                               Shannon-Fano trees were used. If clear, 2
  136.                               Shannon-Fano trees were used.
  137.                      3-4      unused
  138.                      5-7      used internaly by ZIP
  139.  
  140.        Note:  Bits 1 and 2 are undefined if the compression method is
  141.               other than type 6 (Imploding).
  142.  
  143.  
  144.        COMPRESSION METHOD
  145.  
  146.        NAME        METHOD  DESCRIPTION
  147.        ----------- ------ --------------------------------------------
  148.        Stored         0    No compression used
  149.        Shrunk         1    LZW, 8K buffer, 9-13 bits with partial clearing
  150.        Reduced-1      2    Probalistic compression, L(X) = lower 7 bits
  151.        Reduced-2      3    Probalistic compression, L(X) = lower 6 bits
  152.        Reduced-3      4    Probalistic compression, L(X) = lower 5 bits
  153.        Reduced-4      5    Probalistic compression, L(X) = lower 4 bits
  154.        Imploded       6    2 Shanno-Fano trees, 4K sliding dictionary
  155.        Imploded       7    3 Shanno-Fano trees, 4K sliding dictionary
  156.        Imploded       8    2 Shanno-Fano trees, 8K sliding dictionary
  157.        Imploded       9    3 Shanno-Fano trees, 8K sliding dictionary
  158.  
  159.  
  160.        EXTRA FIELD
  161.  
  162.        OFFSET LABEL       TYP  VALUE       DESCRIPTION
  163.        ------ ----------- ---- ---------- ----------------------------
  164.        00     EX1ID       DW   0000        ;0-31 reserved by PKWARE
  165.        02     EX1LN       DW   0000
  166.        04     EX1DAT      DS   EX1LN       ;Specific data for individual
  167.        .                                   ;files. Data field should begin
  168.        .                                   ;with a s/w specific unique ID
  169.        EX1LN+4
  170.               EXnID       DW   0000
  171.               EXnLN       DW   0000
  172.  
  173.               EXnDAT      DS   EXnLN       ;entire header may not exceed 64k
  174.  
  175. EXTENSION:ZIP
  176. OCCURENCES:PC,Amiga,ST
  177. PROGRAMS:PkZIP,WinZIP
  178. REFERENCE:Technote.APP
  179.  
  180.