Pagesi

javascript:void(0)

Sunday 15 September 2013

7281

        RAR version 3.20 - Technical information
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 THE ARCHIVE FORMAT DESCRIBED BELOW IS ONLY VALID FOR VERSIONS SINCE 1.50

 ==========================================================================
                         RAR archive file format
 ==========================================================================

   Archive file consists of variable length blocks. The order of these
blocks may vary, but the first block must be a marker block followed by
an archive header block.

   Each block begins with the following fields:

HEAD_CRC       2 bytes     CRC of total block or block part
HEAD_TYPE      1 byte      Block type
HEAD_FLAGS     2 bytes     Block flags
HEAD_SIZE      2 bytes     Block size
ADD_SIZE       4 bytes     Optional field - added block size

   Field ADD_SIZE present only if (HEAD_FLAGS & 0x8000) != 0

   Total block size is HEAD_SIZE if (HEAD_FLAGS & 0x8000) == 0
and HEAD_SIZE+ADD_SIZE if the field ADD_SIZE is present - when
(HEAD_FLAGS & 0x8000) != 0.

   In each block the followings bits in HEAD_FLAGS have the same meaning:

  0x4000 - if set, older RAR versions will ignore the block
           and remove it when the archive is updated.
           if clear, the block is copied to the new archive
           file when the archive is updated;

  0x8000 - if set, ADD_SIZE field is present and the full block
           size is HEAD_SIZE+ADD_SIZE.

  Declared block types:

HEAD_TYPE=0x72          marker block
HEAD_TYPE=0x73          archive header
HEAD_TYPE=0x74          file header
HEAD_TYPE=0x75          old style comment header
HEAD_TYPE=0x76          old style authenticity information
HEAD_TYPE=0x77          old style subblock
HEAD_TYPE=0x78          old style recovery record
HEAD_TYPE=0x79          old style authenticity information
HEAD_TYPE=0x7a          subblock

   Comment block is actually used only within other blocks and doesn't
exist separately.

   Archive processing is made in the following manner:

1. Read and check marker block
2. Read archive header
3. Read or skip HEAD_SIZE-sizeof(MAIN_HEAD) bytes
4. If end of archive encountered then terminate archive processing,
   else read 7 bytes into fields HEAD_CRC, HEAD_TYPE, HEAD_FLAGS,
   HEAD_SIZE.
5. Check HEAD_TYPE.
   if HEAD_TYPE==0x74
     read file header ( first 7 bytes already read )
     read or skip HEAD_SIZE-sizeof(FILE_HEAD) bytes
     if (HEAD_FLAGS & 0x100)
       read or skip HIGH_PACK_SIZE*0x100000000+PACK_SIZE bytes
     else
       read or skip PACK_SIZE bytes
   else
     read corresponding HEAD_TYPE block:
       read HEAD_SIZE-7 bytes
       if (HEAD_FLAGS & 0x8000)
         read ADD_SIZE bytes
6. go to 4.

No comments:

Post a Comment