home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / sharewar / jar / jar101dx.exe / TECHNOTE.DOC < prev    next >
Text File  |  1996-11-11  |  6KB  |  227 lines

  1.  
  2.     JAR TECHNICAL INFORMATION                               October 1996
  3.  
  4.  
  5.     JAR archive identification scheme:
  6.  
  7.     A file is considered a JAR archive if it contains a predefined 64-byte
  8.     structure.
  9.  
  10.     Structure description:
  11.  
  12.        at byte offset 0 for 4 bytes:
  13.  
  14.           Whole structure CRC32 XOR-ed with 0xffffffff and shifted
  15.           cyclically 11 bits to the right (to the lowest bit). When
  16.           counting CRC32 this field itself is assumed to be 0.
  17.  
  18.        at byte offset 14 for 6 bytes:
  19.  
  20.           signature: 0x1A 'J' 'a' 'r' 0x1B 0x00
  21.  
  22.       other structure fields not defined.
  23.  
  24.     This structure does NOT necessarily start at the head of the file.
  25.  
  26.     For normal archives this structure resides at the head of the file.
  27.     However to support future JAR SFX-es you must search the first 128
  28.     kilobytes of the file for this structure (optional check for executable
  29.     'MZ' may also be done).
  30.  
  31.     Following pseudo-code illustrates JAR header check:
  32.  
  33.       int IsJARHeader ( FILE *f )
  34.       {
  35.         unsigned long dwStored,dwCounted ; /* unsigned 32-bit integer */
  36.         unsigned char b[0x40] ;
  37.  
  38.         fread(b,sizeof(b),1,f) ; /* at current position */
  39.  
  40.         /* checking signature */
  41.         if ( b[14]!='\x1a' || b[15]!='J' ||
  42.              b[16]!='a'    || b[17]!='r' ||
  43.              b[18]!='\x1b' || b[19]!='\x00' )
  44.           return 0 ;
  45.  
  46.         /* checking header CRC */
  47.         dwStored=*(unsigned long *)b ; /* Intel byte order */
  48.         dwStored=~((dwStored<<11)|(dwStored>>(32-11))) ;
  49.         *(unsigned long *)b=0 ;
  50.         dwCounted=CountCRC32(b,sizeof(b)) ;
  51.         if ( dwCounted!=dwStored ) return 0 ;
  52.         return 1 ;
  53.       }
  54.  
  55.  
  56.     The remaining part of this document contains a description of the JAR
  57.     archive header information that is dumped to a text file using the "lt"
  58.     command.
  59.  
  60.     The dump file should be treated as a text file. Each line has the same
  61.     syntax:
  62.  
  63.     <Keyword>=<value>
  64.  
  65.     These lines are assembled into a tree.  Subnodes are shifted with respect
  66.     to the parent node by using two ' ' (space) characters.  Example:
  67.  
  68.     Chapter=1
  69.       Created=1996-09-01 17:55:05.9800000
  70.       Modified=1996-09-01 17:55:05.9800000
  71.       Comment="Some\r\ncomment"
  72.       Flags=0
  73.     File=FIRST.BAT
  74.       Created=1996-09-01 17:20:41.4400000
  75.       Modified=1996-09-01 16:37:00.0000000
  76.       LastAccess=1996-09-01 00:00:00.0000000
  77.       Size=2160
  78.       ChaptersRange=1-2
  79.       Attributes=1
  80.     File=SECOND.BAT
  81.       Created=1996-09-01 17:20:41.4400000
  82.       Modified=1996-09-01 16:37:00.0000000
  83.       LastAccess=1996-09-01 00:00:00.0000000
  84.       Size=2160
  85.       ChaptersRange=1-2
  86.       Attributes=1
  87.  
  88.     Currently, the tree depth is two (only nodes and one-level subnodes) but
  89.     in future JAR versions, the depth may be increased.
  90.  
  91.     You should not rely on the order in which keywords are listed.  For
  92.     compatibility with future versions all unknown keywords must be
  93.     skipped.  Binary keyword values (such as ANSI comments) are quoted and
  94.     encoded using escape character '\'.
  95.  
  96.     This is a brief description of the currently used keywords:
  97.  
  98.  
  99.     Archive=
  100.  
  101.           Archive keyword. Subnodes describe global archive related
  102.           information.
  103.  
  104.       Created=1996-09-01 17:21:31.9100000
  105.  
  106.           Archive creation time YYYY-MM-DD HH:MM:SS.SSSSSSS
  107.  
  108.       Modified=1996-09-01 19:17:56.5100000
  109.  
  110.           Last time archive has been modified.
  111.  
  112.       VersionUsed=0101
  113.  
  114.           JAR version used to update archive (1.01 in this example).
  115.  
  116.       VersionToUpdate=0050
  117.  
  118.           JAR version required to update archive (0.50 in this example).
  119.  
  120.       VersionToExtract=0050
  121.  
  122.           JAR version required to extract files from archive.
  123.  
  124.       VersionToList=0050
  125.  
  126.           JAR version required to list files in archive.
  127.  
  128.       Flags=0
  129.  
  130.           Currently, JAR archive flags is the sum of the following
  131.           constants:
  132.  
  133.             1   LOCKED
  134.             2   AUTO_LOCK
  135.             4   RECOVERY RECORDS
  136.             8   SECURED
  137.            16   HIDDEN
  138.            32   ENCRYPTED/PROTECTED
  139.  
  140.  
  141.       Comment="Some\r\ncomment"
  142.  
  143.           Optional archive comment. Escape characters:
  144.  
  145.           \\     Backslash
  146.           \"     Double quotation mark
  147.           \b     Backspace
  148.           \n     Newline
  149.           \r     Carriage return
  150.           \t     Tab
  151.           \ddd   ASCII character in octal notation. 3 digits always used.
  152.  
  153.       MaxChapter=3
  154.  
  155.           Maximum chapter in archive.
  156.  
  157.  
  158.     Chapter=1
  159.  
  160.           Chapter (#1 in this example). Subnodes supply information about
  161.           chapter.
  162.  
  163.       Created=1996-09-01 17:21:31.9100000
  164.  
  165.           Creation time
  166.  
  167.       Modified=1996-09-01 17:21:31.9100000
  168.  
  169.           Modification time
  170.  
  171.       Flags=0
  172.  
  173.           Chapter flags is sum of following constants:
  174.  
  175.             1   LOCKED
  176.  
  177.       Comment="Some\r\ncomment"
  178.  
  179.           Optional chapter comment. Same format as in case of archive.
  180.  
  181.  
  182.     File=TESTJAR.BAT
  183.  
  184.           Filename. Subnodes contain information about file.
  185.  
  186.       Created=1996-09-01 17:20:41.4400000
  187.  
  188.           File creation time
  189.  
  190.       Modified=1996-09-01 16:37:00.0000000
  191.  
  192.           File modification time
  193.  
  194.       LastAccess=1996-09-01 00:00:00.0000000
  195.  
  196.           File last accessed time
  197.  
  198.       Size=2160
  199.  
  200.           File size in bytes
  201.  
  202.       ChaptersRange=1-2
  203.  
  204.           Chapter range to which file belongs
  205.  
  206.       Attributes=1
  207.  
  208.           Sum of:
  209.  
  210.             1   ARCHIVE
  211.             2   HIDDEN
  212.             4   SYSTEM
  213.             8   READONLY
  214.             16  DIRECTORY
  215.  
  216.       Comment="Some\r\ncomment"
  217.  
  218.           Optional file comment.
  219.  
  220.  
  221.     Actually, the JAR header contains more information than is currently
  222.     listed using the "lt" command.  In the future we will add additional
  223.     keywords.
  224.  
  225.  
  226.     end of document
  227.