2024年3月11日发(作者:)

RAR version 3.40 - Technical information

技术信息

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

下面文档管理器格式的描述仅仅是对1.5以后的版本是有用的

=======================================================

===================

RAR archive file format

RAR文档管理器格式

=======================================================

===================

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

CRC的总块或者局部块

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

区域ADD_SIZE只有在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.

总块大小就是Head_size,如果add_size被提出的话那么就是head_size+add_size,这些都是在

head_flags==0的情况下

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

每一个块都有几个位来标志head_flags,他有这样的意思

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;

如果设定,老版本的rar会在更新的忽略这个块,并且移除它。如果清除,当更新的时候,

块会被复制到新的归档文件中

0x8000 - if set, ADD_SIZE field is present and the full block

size is HEAD_SIZE+ADD_SIZE.

如果设定,add_size区域会被提出,并且总块大小被设定为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

读或者是忽略head_size大小

4. If end of archive encountered then terminate archive processing,