将 NTFS 文件属性存储在 Zip 存档中

问题描述 投票:0回答:1

我最近写了一个 DEFLATE 压缩器和解压缩器。据我了解,Windows 提供的 fstream 不包含 NTFS 属性,因为这些属性可以在 $MFT 中找到。我需要再次查看 NTFS 以弄清楚那里发生了什么。 Windows右键单击上下文菜单Zip似乎存储NTFS文件属性。我是否错误地认为 $MFT 标头(直到文件数据)只是被复制到 Zip Archives 本地文件标头的“额外字段”中?我说最多,因为如果我没记错的话,文件可以存储在 $MFT 属性中。

我尝试过查看规格并寻找类似的案例。没有发现病例。我将阅读本地文件头,并将解析额外字段以查看信息是否在下周存储在那里。

windows zip ntfs deflate
1个回答
0
投票

NTFS 额外字段记录在PKWare 应用说明中。如果你可以编写自己的 deflate 和 inflate,你可以编写自己的 zipper 和 unzipper 来生成和处理额外的字段。

   4.5.5 -NTFS Extra Field (0x000a):

      The following is the layout of the NTFS attributes 
      "extra" block. (Note: At this time the Mtime, Atime
      and Ctime values MAY be used on any WIN32 system.)  

      Note: all fields stored in Intel low-byte/high-byte order.

        Value      Size       Description
        -----      ----       -----------
(NTFS)  0x000a     2 bytes    Tag for this "extra" block type
        TSize      2 bytes    Size of the total "extra" block
        Reserved   4 bytes    Reserved for future use
        Tag1       2 bytes    NTFS attribute tag value #1
        Size1      2 bytes    Size of attribute #1, in bytes
        (var)      Size1      Attribute #1 data
         .
         .
         .
         TagN       2 bytes    NTFS attribute tag value #N
         SizeN      2 bytes    Size of attribute #N, in bytes
         (var)      SizeN      Attribute #N data

       For NTFS, values for Tag1 through TagN are as follows:
       (currently only one set of attributes is defined for NTFS)

         Tag        Size       Description
         -----      ----       -----------
         0x0001     2 bytes    Tag for attribute #1 
         Size1      2 bytes    Size of attribute #1, in bytes
         Mtime      8 bytes    File last modification time
         Atime      8 bytes    File last access time
         Ctime      8 bytes    File creation time
© www.soinside.com 2019 - 2024. All rights reserved.