extrafld.txt 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609
  1. The following are the known types of zipfile extra fields as of this
  2. writing. Extra fields are documented in PKWARE's appnote.txt and are
  3. intended to allow for backward- and forward-compatible extensions to
  4. the zipfile format. Multiple extra-field types may be chained together,
  5. provided that the total length of all extra-field data is less than 64KB.
  6. (In fact, PKWARE requires that the total length of the entire file header,
  7. including timestamp, file attributes, filename, comment, extra field, etc.,
  8. be no more than 64KB.)
  9. Each extra-field type (or subblock) must contain a four-byte header con-
  10. sisting of a two-byte header ID and a two-byte length (little-endian) for
  11. the remaining data in the subblock. If there are additional subblocks
  12. within the extra field, the header for each one will appear immediately
  13. following the data for the previous subblock (i.e., with no padding for
  14. alignment).
  15. All integer fields in the descriptions below are in little-endian (Intel)
  16. format unless otherwise specified. Note that "Short" means two bytes,
  17. "Long" means four bytes, and "Long-Long" means eight bytes, regardless
  18. of their native sizes. Unless specifically noted, all integer fields should
  19. be interpreted as unsigned (non-negative) numbers.
  20. Christian Spieler, Ed Gordon, 20080717
  21. -------------------------
  22. Header ID's of 0 thru 31 are reserved for use by PKWARE.
  23. The remaining ID's can be used by third party vendors for
  24. proprietary usage.
  25. The current Header ID mappings defined by PKWARE are:
  26. 0x0001 Zip64 extended information extra field
  27. 0x0007 AV Info
  28. 0x0008 Reserved for extended language encoding data (PFS)
  29. 0x0009 OS/2 extended attributes (also Info-ZIP)
  30. 0x000a NTFS (Win9x/WinNT FileTimes)
  31. 0x000c OpenVMS (also Info-ZIP)
  32. 0x000d UNIX
  33. 0x000e Reserved for file stream and fork descriptors
  34. 0x000f Patch Descriptor
  35. 0x0014 PKCS#7 Store for X.509 Certificates
  36. 0x0015 X.509 Certificate ID and Signature for
  37. individual file
  38. 0x0016 X.509 Certificate ID for Central Directory
  39. 0x0017 Strong Encryption Header
  40. 0x0018 Record Management Controls
  41. 0x0019 PKCS#7 Encryption Recipient Certificate List
  42. 0x0065 IBM S/390 (Z390), AS/400 (I400) attributes
  43. - uncompressed
  44. 0x0066 Reserved for IBM S/390 (Z390), AS/400 (I400)
  45. attributes - compressed
  46. 0x4690 POSZIP 4690 (reserved)
  47. The Header ID mappings defined by Info-ZIP and third parties are:
  48. 0x07c8 Info-ZIP Macintosh (old, J. Lee)
  49. 0x2605 ZipIt Macintosh (first version)
  50. 0x2705 ZipIt Macintosh v 1.3.5 and newer (w/o full filename)
  51. 0x2805 ZipIt Macintosh 1.3.5+
  52. 0x334d Info-ZIP Macintosh (new, D. Haase's 'Mac3' field)
  53. 0x4154 Tandem NSK
  54. 0x4341 Acorn/SparkFS (David Pilling)
  55. 0x4453 Windows NT security descriptor (binary ACL)
  56. 0x4704 VM/CMS
  57. 0x470f MVS
  58. 0x4854 Theos, old inofficial port
  59. 0x4b46 FWKCS MD5 (see below)
  60. 0x4c41 OS/2 access control list (text ACL)
  61. 0x4d49 Info-ZIP OpenVMS (obsolete)
  62. 0x4d63 Macintosh SmartZIP, by Macro Bambini
  63. 0x4f4c Xceed original location extra field
  64. 0x5356 AOS/VS (binary ACL)
  65. 0x5455 extended timestamp
  66. 0x554e Xceed unicode extra field
  67. 0x5855 Info-ZIP UNIX (original; also OS/2, NT, etc.)
  68. 0x6375 Info-ZIP UTF-8 comment field
  69. 0x6542 BeOS (BeBox, PowerMac, etc.)
  70. 0x6854 Theos
  71. 0x7075 Info-ZIP UTF-8 name field
  72. 0x7441 AtheOS (AtheOS/Syllable attributes)
  73. 0x756e ASi UNIX
  74. 0x7855 Info-ZIP UNIX (16-bit UID/GID info)
  75. 0x7875 Info-ZIP UNIX 3rd generation (generic UID/GID, ...)
  76. 0xa220 Microsoft Open Packaging Growth Hint
  77. 0xfb4a SMS/QDOS
  78. The following are detailed descriptions of the known extra-field block types:
  79. -Zip64 Extended Information Extra Field (0x0001):
  80. ===============================================
  81. The following is the layout of the zip64 extended
  82. information "extra" block. If one of the size or
  83. offset fields in the Local or Central directory
  84. record is too small to hold the required data,
  85. a zip64 extended information record is created.
  86. The order of the fields in the zip64 extended
  87. information record is fixed, but the fields will
  88. only appear if the corresponding Local or Central
  89. directory record field is set to 0xFFFF or 0xFFFFFFFF.
  90. Note: all fields stored in Intel low-byte/high-byte order.
  91. Value Size Description
  92. ----- ---- -----------
  93. (ZIP64) 0x0001 2 bytes Tag for this "extra" block type
  94. Size 2 bytes Size of this "extra" block
  95. Original
  96. Size 8 bytes Original uncompressed file size
  97. Compressed
  98. Size 8 bytes Size of compressed data
  99. Relative Header
  100. Offset 8 bytes Offset of local header record
  101. Disk Start
  102. Number 4 bytes Number of the disk on which
  103. this file starts
  104. This entry in the Local header must include BOTH original
  105. and compressed file size fields. If encrypting the
  106. central directory and bit 13 of the general purpose bit
  107. flag is set indicating masking, the value stored in the
  108. Local Header for the original file size will be zero.
  109. -OS/2 Extended Attributes Extra Field (0x0009):
  110. =============================================
  111. The following is the layout of the OS/2 extended attributes "extra"
  112. block. (Last Revision 19960922)
  113. Note: all fields stored in Intel low-byte/high-byte order.
  114. Local-header version:
  115. Value Size Description
  116. ----- ---- -----------
  117. (OS/2) 0x0009 Short tag for this extra block type
  118. TSize Short total data size for this block
  119. BSize Long uncompressed EA data size
  120. CType Short compression type
  121. EACRC Long CRC value for uncompressed EA data
  122. (var.) variable compressed EA data
  123. Central-header version:
  124. Value Size Description
  125. ----- ---- -----------
  126. (OS/2) 0x0009 Short tag for this extra block type
  127. TSize Short total data size for this block (4)
  128. BSize Long size of uncompressed local EA data
  129. The value of CType is interpreted according to the "compression
  130. method" section above; i.e., 0 for stored, 8 for deflated, etc.
  131. The OS/2 extended attribute structure (FEA2LIST) is
  132. compressed and then stored in its entirety within this
  133. structure. There will only ever be one "block" of data in
  134. the variable-length field.
  135. -OS/2 Access Control List Extra Field:
  136. ====================================
  137. The following is the layout of the OS/2 ACL extra block.
  138. (Last Revision 19960922)
  139. Local-header version:
  140. Value Size Description
  141. ----- ---- -----------
  142. (ACL) 0x4c41 Short tag for this extra block type ("AL")
  143. TSize Short total data size for this block
  144. BSize Long uncompressed ACL data size
  145. CType Short compression type
  146. EACRC Long CRC value for uncompressed ACL data
  147. (var.) variable compressed ACL data
  148. Central-header version:
  149. Value Size Description
  150. ----- ---- -----------
  151. (ACL) 0x4c41 Short tag for this extra block type ("AL")
  152. TSize Short total data size for this block (4)
  153. BSize Long size of uncompressed local ACL data
  154. The value of CType is interpreted according to the "compression
  155. method" section above; i.e., 0 for stored, 8 for deflated, etc.
  156. The uncompressed ACL data consist of a text header of the form
  157. "ACL1:%hX,%hd\n", where the first field is the OS/2 ACCINFO acc_attr
  158. member and the second is acc_count, followed by acc_count strings
  159. of the form "%s,%hx\n", where the first field is acl_ugname (user
  160. group name) and the second acl_access. This block type will be
  161. extended for other operating systems as needed.
  162. -Windows NT Security Descriptor Extra Field (0x4453):
  163. ===================================================
  164. The following is the layout of the NT Security Descriptor (another
  165. type of ACL) extra block. (Last Revision 19960922)
  166. Local-header version:
  167. Value Size Description
  168. ----- ---- -----------
  169. (SD) 0x4453 Short tag for this extra block type ("SD")
  170. TSize Short total data size for this block
  171. BSize Long uncompressed SD data size
  172. Version Byte version of uncompressed SD data format
  173. CType Short compression type
  174. EACRC Long CRC value for uncompressed SD data
  175. (var.) variable compressed SD data
  176. Central-header version:
  177. Value Size Description
  178. ----- ---- -----------
  179. (SD) 0x4453 Short tag for this extra block type ("SD")
  180. TSize Short total data size for this block (4)
  181. BSize Long size of uncompressed local SD data
  182. The value of CType is interpreted according to the "compression
  183. method" section above; i.e., 0 for stored, 8 for deflated, etc.
  184. Version specifies how the compressed data are to be interpreted
  185. and allows for future expansion of this extra field type. Currently
  186. only version 0 is defined.
  187. For version 0, the compressed data are to be interpreted as a single
  188. valid Windows NT SECURITY_DESCRIPTOR data structure, in self-relative
  189. format.
  190. -PKWARE Win95/WinNT Extra Field (0x000a):
  191. =======================================
  192. The following description covers PKWARE's "NTFS" attributes
  193. "extra" block, introduced with the release of PKZIP 2.50 for
  194. Windows. (Last Revision 20001118)
  195. (Note: At this time the Mtime, Atime and Ctime values may
  196. be used on any WIN32 system.)
  197. [Info-ZIP note: In the current implementations, this field has
  198. a fixed total data size of 32 bytes and is only stored as local
  199. extra field.]
  200. Value Size Description
  201. ----- ---- -----------
  202. (NTFS) 0x000a Short Tag for this "extra" block type
  203. TSize Short Total Data Size for this block
  204. Reserved Long for future use
  205. Tag1 Short NTFS attribute tag value #1
  206. Size1 Short Size of attribute #1, in bytes
  207. (var.) SubSize1 Attribute #1 data
  208. .
  209. .
  210. .
  211. TagN Short NTFS attribute tag value #N
  212. SizeN Short Size of attribute #N, in bytes
  213. (var.) SubSizeN Attribute #N data
  214. For NTFS, values for Tag1 through TagN are as follows:
  215. (currently only one set of attributes is defined for NTFS)
  216. Tag Size Description
  217. ----- ---- -----------
  218. 0x0001 2 bytes Tag for attribute #1
  219. Size1 2 bytes Size of attribute #1, in bytes (24)
  220. Mtime 8 bytes 64-bit NTFS file last modification time
  221. Atime 8 bytes 64-bit NTFS file last access time
  222. Ctime 8 bytes 64-bit NTFS file creation time
  223. The total length for this block is 28 bytes, resulting in a
  224. fixed size value of 32 for the TSize field of the NTFS block.
  225. The NTFS filetimes are 64-bit unsigned integers, stored in Intel
  226. (least significant byte first) byte order. They determine the
  227. number of 1.0E-07 seconds (1/10th microseconds!) past WinNT "epoch",
  228. which is "01-Jan-1601 00:00:00 UTC".
  229. -PKWARE OpenVMS Extra Field (0x000c):
  230. ===================================
  231. The following is the layout of PKWARE's OpenVMS attributes
  232. "extra" block. (Last Revision 12/17/91)
  233. Note: all fields stored in Intel low-byte/high-byte order.
  234. Value Size Description
  235. ----- ---- -----------
  236. (VMS) 0x000c Short Tag for this "extra" block type
  237. TSize Short Total Data Size for this block
  238. CRC Long 32-bit CRC for remainder of the block
  239. Tag1 Short OpenVMS attribute tag value #1
  240. Size1 Short Size of attribute #1, in bytes
  241. (var.) Size1 Attribute #1 data
  242. .
  243. .
  244. .
  245. TagN Short OpenVMS attribute tag value #N
  246. SizeN Short Size of attribute #N, in bytes
  247. (var.) SizeN Attribute #N data
  248. Rules:
  249. 1. There will be one or more of attributes present, which
  250. will each be preceded by the above TagX & SizeX values.
  251. These values are identical to the ATR$C_XXXX and
  252. ATR$S_XXXX constants which are defined in ATR.H under
  253. OpenVMS C. Neither of these values will ever be zero.
  254. 2. No word alignment or padding is performed.
  255. 3. A well-behaved PKZIP/OpenVMS program should never produce
  256. more than one sub-block with the same TagX value. Also,
  257. there will never be more than one "extra" block of type
  258. 0x000c in a particular directory record.
  259. -Info-ZIP VMS Extra Field:
  260. ========================
  261. The following is the layout of Info-ZIP's VMS attributes extra
  262. block for VAX or Alpha AXP. The local-header and central-header
  263. versions are identical. (Last Revision 19960922)
  264. Value Size Description
  265. ----- ---- -----------
  266. (VMS2) 0x4d49 Short tag for this extra block type ("JM")
  267. TSize Short total data size for this block
  268. ID Long block ID
  269. Flags Short info bytes
  270. BSize Short uncompressed block size
  271. Reserved Long (reserved)
  272. (var.) variable compressed VMS file-attributes block
  273. The block ID is one of the following unterminated strings:
  274. "VFAB" struct FAB
  275. "VALL" struct XABALL
  276. "VFHC" struct XABFHC
  277. "VDAT" struct XABDAT
  278. "VRDT" struct XABRDT
  279. "VPRO" struct XABPRO
  280. "VKEY" struct XABKEY
  281. "VMSV" version (e.g., "V6.1"; truncated at hyphen)
  282. "VNAM" reserved
  283. The lower three bits of Flags indicate the compression method. The
  284. currently defined methods are:
  285. 0 stored (not compressed)
  286. 1 simple "RLE"
  287. 2 deflated
  288. The "RLE" method simply replaces zero-valued bytes with zero-valued
  289. bits and non-zero-valued bytes with a "1" bit followed by the byte
  290. value.
  291. The variable-length compressed data contains only the data corre-
  292. sponding to the indicated structure or string. Typically multiple
  293. VMS2 extra fields are present (each with a unique block type).
  294. -Info-ZIP Macintosh Extra Field:
  295. ==============================
  296. The following is the layout of the (old) Info-ZIP resource-fork extra
  297. block for Macintosh. The local-header and central-header versions
  298. are identical. (Last Revision 19960922)
  299. Value Size Description
  300. ----- ---- -----------
  301. (Mac) 0x07c8 Short tag for this extra block type
  302. TSize Short total data size for this block
  303. "JLEE" beLong extra-field signature
  304. FInfo 16 bytes Macintosh FInfo structure
  305. CrDat beLong HParamBlockRec fileParam.ioFlCrDat
  306. MdDat beLong HParamBlockRec fileParam.ioFlMdDat
  307. Flags beLong info bits
  308. DirID beLong HParamBlockRec fileParam.ioDirID
  309. VolName 28 bytes volume name (optional)
  310. All fields but the first two are in native Macintosh format
  311. (big-endian Motorola order, not little-endian Intel). The least
  312. significant bit of Flags is 1 if the file is a data fork, 0 other-
  313. wise. In addition, if this extra field is present, the filename
  314. has an extra 'd' or 'r' appended to indicate data fork or resource
  315. fork. The 28-byte VolName field may be omitted.
  316. -ZipIt Macintosh Extra Field (long):
  317. ==================================
  318. The following is the layout of the ZipIt extra block for Macintosh.
  319. The local-header and central-header versions are identical.
  320. (Last Revision 19970130)
  321. Value Size Description
  322. ----- ---- -----------
  323. (Mac2) 0x2605 Short tag for this extra block type
  324. TSize Short total data size for this block
  325. "ZPIT" beLong extra-field signature
  326. FnLen Byte length of FileName
  327. FileName variable full Macintosh filename
  328. FileType Byte[4] four-byte Mac file type string
  329. Creator Byte[4] four-byte Mac creator string
  330. -ZipIt Macintosh Extra Field (short, for files):
  331. ==============================================
  332. The following is the layout of a shortened variant of the
  333. ZipIt extra block for Macintosh (without "full name" entry).
  334. This variant is used by ZipIt 1.3.5 and newer for entries of
  335. files (not directories) that do not have a MacBinary encoded
  336. file. The local-header and central-header versions are identical.
  337. (Last Revision 20030602)
  338. Value Size Description
  339. ----- ---- -----------
  340. (Mac2b) 0x2705 Short tag for this extra block type
  341. TSize Short total data size for this block (min. 12)
  342. "ZPIT" beLong extra-field signature
  343. FileType Byte[4] four-byte Mac file type string
  344. Creator Byte[4] four-byte Mac creator string
  345. fdFlags beShort attributes from FInfo.frFlags,
  346. may be omitted
  347. 0x0000 beShort reserved, may be omitted
  348. -ZipIt Macintosh Extra Field (short, for directories):
  349. ====================================================
  350. The following is the layout of a shortened variant of the
  351. ZipIt extra block for Macintosh used only for directory
  352. entries. This variant is used by ZipIt 1.3.5 and newer to
  353. save some optional Mac-specific information about directories.
  354. The local-header and central-header versions are identical.
  355. Value Size Description
  356. ----- ---- -----------
  357. (Mac2c) 0x2805 Short tag for this extra block type
  358. TSize Short total data size for this block (12)
  359. "ZPIT" beLong extra-field signature
  360. frFlags beShort attributes from DInfo.frFlags, may
  361. be omitted
  362. View beShort ZipIt view flag, may be omitted
  363. The View field specifies ZipIt-internal settings as follows:
  364. Bits of the Flags:
  365. bit 0 if set, the folder is shown expanded (open)
  366. when the archive contents are viewed in ZipIt.
  367. bits 1-15 reserved, zero;
  368. -Info-ZIP Macintosh Extra Field (new):
  369. ====================================
  370. The following is the layout of the (new) Info-ZIP extra
  371. block for Macintosh, designed by Dirk Haase.
  372. All values are in little-endian.
  373. (Last Revision 19981005)
  374. Local-header version:
  375. Value Size Description
  376. ----- ---- -----------
  377. (Mac3) 0x334d Short tag for this extra block type ("M3")
  378. TSize Short total data size for this block
  379. BSize Long uncompressed finder attribute data size
  380. Flags Short info bits
  381. fdType Byte[4] Type of the File (4-byte string)
  382. fdCreator Byte[4] Creator of the File (4-byte string)
  383. (CType) Short compression type
  384. (CRC) Long CRC value for uncompressed MacOS data
  385. Attribs variable finder attribute data (see below)
  386. Central-header version:
  387. Value Size Description
  388. ----- ---- -----------
  389. (Mac3) 0x334d Short tag for this extra block type ("M3")
  390. TSize Short total data size for this block
  391. BSize Long uncompressed finder attribute data size
  392. Flags Short info bits
  393. fdType Byte[4] Type of the File (4-byte string)
  394. fdCreator Byte[4] Creator of the File (4-byte string)
  395. The third bit of Flags in both headers indicates whether
  396. the LOCAL extra field is uncompressed (and therefore whether CType
  397. and CRC are omitted):
  398. Bits of the Flags:
  399. bit 0 if set, file is a data fork; otherwise unset
  400. bit 1 if set, filename will be not changed
  401. bit 2 if set, Attribs is uncompressed (no CType, CRC)
  402. bit 3 if set, date and times are in 64 bit
  403. if zero date and times are in 32 bit.
  404. bit 4 if set, timezone offsets fields for the native
  405. Mac times are omitted (UTC support deactivated)
  406. bits 5-15 reserved;
  407. Attributes:
  408. Attribs is a Mac-specific block of data in little-endian format with
  409. the following structure (if compressed, uncompress it first):
  410. Value Size Description
  411. ----- ---- -----------
  412. fdFlags Short Finder Flags
  413. fdLocation.v Short Finder Icon Location
  414. fdLocation.h Short Finder Icon Location
  415. fdFldr Short Folder containing file
  416. FXInfo 16 bytes Macintosh FXInfo structure
  417. FXInfo-Structure:
  418. fdIconID Short
  419. fdUnused[3] Short unused but reserved 6 bytes
  420. fdScript Byte Script flag and number
  421. fdXFlags Byte More flag bits
  422. fdComment Short Comment ID
  423. fdPutAway Long Home Dir ID
  424. FVersNum Byte file version number
  425. may be not used by MacOS
  426. ACUser Byte directory access rights
  427. FlCrDat ULong date and time of creation
  428. FlMdDat ULong date and time of last modification
  429. FlBkDat ULong date and time of last backup
  430. These time numbers are original Mac FileTime values (local time!).
  431. Currently, date-time width is 32-bit, but future version may
  432. support be 64-bit times (see flags)
  433. CrGMTOffs Long(signed!) difference "local Creat. time - UTC"
  434. MdGMTOffs Long(signed!) difference "local Modif. time - UTC"
  435. BkGMTOffs Long(signed!) difference "local Backup time - UTC"
  436. These "local time - UTC" differences (stored in seconds) may be
  437. used to support timestamp adjustment after inter-timezone transfer.
  438. These fields are optional; bit 4 of the flags word controls their
  439. presence.
  440. Charset Short TextEncodingBase (Charset)
  441. valid for the following two fields
  442. FullPath variable Path of the current file.
  443. Zero terminated string (C-String)
  444. Currently coded in the native Charset.
  445. Comment variable Finder Comment of the current file.
  446. Zero terminated string (C-String)
  447. Currently coded in the native Charset.
  448. -SmartZIP Macintosh Extra Field:
  449. ====================================
  450. The following is the layout of the SmartZIP extra
  451. block for Macintosh, designed by Marco Bambini.
  452. Local-header version:
  453. Value Size Description
  454. ----- ---- -----------
  455. 0x4d63 Short tag for this extra block type ("cM")
  456. TSize Short total data size for this block (64)
  457. "dZip" beLong extra-field signature
  458. fdType Byte[4] Type of the File (4-byte string)
  459. fdCreator Byte[4] Creator of the File (4-byte string)
  460. fdFlags beShort Finder Flags
  461. fdLocation.v beShort Finder Icon Location
  462. fdLocation.h beShort Finder Icon Location
  463. fdFldr beShort Folder containing file
  464. CrDat beLong HParamBlockRec fileParam.ioFlCrDat
  465. MdDat beLong HParamBlockRec fileParam.ioFlMdDat
  466. frScroll.v Byte vertical pos. of folder's scroll bar
  467. fdScript Byte Script flag and number
  468. frScroll.h Byte horizontal pos. of folder's scroll bar
  469. fdXFlags Byte More flag bits
  470. FileName Byte[32] full Macintosh filename (pascal string)
  471. All fields but the first two are in native Macintosh format
  472. (big-endian Motorola order, not little-endian Intel).
  473. The extra field size is fixed to 64 bytes.
  474. The local-header and central-header versions are identical.
  475. -Acorn SparkFS Extra Field:
  476. =========================
  477. The following is the layout of David Pilling's SparkFS extra block
  478. for Acorn RISC OS. The local-header and central-header versions are
  479. identical. (Last Revision 19960922)
  480. Value Size Description
  481. ----- ---- -----------
  482. (Acorn) 0x4341 Short tag for this extra block type ("AC")
  483. TSize Short total data size for this block (20)
  484. "ARC0" Long extra-field signature
  485. LoadAddr Long load address or file type
  486. ExecAddr Long exec address
  487. Attr Long file permissions
  488. Zero Long reserved; always zero
  489. The following bits of Attr are associated with the given file
  490. permissions:
  491. bit 0 user-writable ('W')
  492. bit 1 user-readable ('R')
  493. bit 2 reserved
  494. bit 3 locked ('L')
  495. bit 4 publicly writable ('w')
  496. bit 5 publicly readable ('r')
  497. bit 6 reserved
  498. bit 7 reserved
  499. -VM/CMS Extra Field:
  500. ==================
  501. The following is the layout of the file-attributes extra block for
  502. VM/CMS. The local-header and central-header versions are
  503. identical. (Last Revision 19960922)
  504. Value Size Description
  505. ----- ---- -----------
  506. (VM/CMS) 0x4704 Short tag for this extra block type
  507. TSize Short total data size for this block
  508. flData variable file attributes data
  509. flData is an uncompressed fldata_t struct.
  510. -MVS Extra Field:
  511. ===============
  512. The following is the layout of the file-attributes extra block for
  513. MVS. The local-header and central-header versions are identical.
  514. (Last Revision 19960922)
  515. Value Size Description
  516. ----- ---- -----------
  517. (MVS) 0x470f Short tag for this extra block type
  518. TSize Short total data size for this block
  519. flData variable file attributes data
  520. flData is an uncompressed fldata_t struct.
  521. -PKWARE Unix Extra Field (0x000d):
  522. ================================
  523. The following is the layout of PKWARE's Unix "extra" block.
  524. It was introduced with the release of PKZIP for Unix 2.50.
  525. Note: all fields are stored in Intel low-byte/high-byte order.
  526. (Last Revision 19980901)
  527. This field has a minimum data size of 12 bytes and is only stored
  528. as local extra field.
  529. Value Size Description
  530. ----- ---- -----------
  531. (Unix0) 0x000d Short Tag for this "extra" block type
  532. TSize Short Total Data Size for this block
  533. AcTime Long time of last access (UTC/GMT)
  534. ModTime Long time of last modification (UTC/GMT)
  535. UID Short Unix user ID
  536. GID Short Unix group ID
  537. (var) variable Variable length data field
  538. The variable length data field will contain file type
  539. specific data. Currently the only values allowed are
  540. the original "linked to" file names for hard or symbolic
  541. links, and the major and minor device node numbers for
  542. character and block device nodes. Since device nodes
  543. cannot be either symbolic or hard links, only one set of
  544. variable length data is stored. Link files will have the
  545. name of the original file stored. This name is NOT NULL
  546. terminated. Its size can be determined by checking TSize -
  547. 12. Device entries will have eight bytes stored as two 4
  548. byte entries (in little-endian format). The first entry
  549. will be the major device number, and the second the minor
  550. device number.
  551. [Info-ZIP note: The fixed part of this field has the same layout as
  552. Info-ZIP's abandoned "Unix1 timestamps & owner ID info" extra field;
  553. only the two tag bytes are different.]
  554. -PATCH Descriptor Extra Field (0x000f):
  555. =====================================
  556. The following is the layout of the Patch Descriptor "extra"
  557. block.
  558. Note: all fields stored in Intel low-byte/high-byte order.
  559. Value Size Description
  560. ----- ---- -----------
  561. (Patch) 0x000f Short Tag for this "extra" block type
  562. TSize Short Size of the total "extra" block
  563. Version Short Version of the descriptor
  564. Flags Long Actions and reactions (see below)
  565. OldSize Long Size of the file about to be patched
  566. OldCRC Long 32-bit CRC of the file about to be patched
  567. NewSize Long Size of the resulting file
  568. NewCRC Long 32-bit CRC of the resulting file
  569. Actions and reactions
  570. Bits Description
  571. ---- ----------------
  572. 0 Use for auto detection
  573. 1 Treat as a self-patch
  574. 2-3 RESERVED
  575. 4-5 Action (see below)
  576. 6-7 RESERVED
  577. 8-9 Reaction (see below) to absent file
  578. 10-11 Reaction (see below) to newer file
  579. 12-13 Reaction (see below) to unknown file
  580. 14-15 RESERVED
  581. 16-31 RESERVED
  582. Actions
  583. Action Value
  584. ------ -----
  585. none 0
  586. add 1
  587. delete 2
  588. patch 3
  589. Reactions
  590. Reaction Value
  591. -------- -----
  592. ask 0
  593. skip 1
  594. ignore 2
  595. fail 3
  596. Patch support is provided by PKPatchMaker(tm) technology and is
  597. covered under U.S. Patents and Patents Pending. The use or
  598. implementation in a product of certain technological aspects set
  599. forth in the current APPNOTE, including those with regard to
  600. strong encryption, patching, or extended tape operations requires
  601. a license from PKWARE. Please contact PKWARE with regard to
  602. acquiring a license.
  603. -PKCS#7 Store for X.509 Certificates (0x0014):
  604. ============================================
  605. This field contains information about each of the certificates
  606. files may be signed with. When the Central Directory Encryption
  607. feature is enabled for a ZIP file, this record will appear in
  608. the Archive Extra Data Record, otherwise it will appear in the
  609. first central directory record and will be ignored in any
  610. other record.
  611. Note: all fields stored in Intel low-byte/high-byte order.
  612. Value Size Description
  613. ----- ---- -----------
  614. (Store) 0x0014 2 bytes Tag for this "extra" block type
  615. TSize 2 bytes Size of the store data
  616. SData TSize Data about the store
  617. SData
  618. Value Size Description
  619. ----- ---- -----------
  620. Version 2 bytes Version number, 0x0001 for now
  621. StoreD (variable) Actual store data
  622. The StoreD member is suitable for passing as the pbData
  623. member of a CRYPT_DATA_BLOB to the CertOpenStore() function
  624. in Microsoft's CryptoAPI. The SSize member above will be
  625. cbData + 6, where cbData is the cbData member of the same
  626. CRYPT_DATA_BLOB. The encoding type to pass to
  627. CertOpenStore() should be
  628. PKCS_7_ANS_ENCODING | X509_ASN_ENCODING.
  629. -X.509 Certificate ID and Signature for individual file (0x0015):
  630. ===============================================================
  631. This field contains the information about which certificate in
  632. the PKCS#7 store was used to sign a particular file. It also
  633. contains the signature data. This field can appear multiple
  634. times, but can only appear once per certificate.
  635. Note: all fields stored in Intel low-byte/high-byte order.
  636. Value Size Description
  637. ----- ---- -----------
  638. (CID) 0x0015 2 bytes Tag for this "extra" block type
  639. CSize 2 bytes Size of Method
  640. Method (variable)
  641. Method
  642. Value Size Description
  643. ----- ---- -----------
  644. Version 2 bytes Version number, for now 0x0001
  645. AlgID 2 bytes Algorithm ID used for signing
  646. IDSize 2 bytes Size of Certificate ID data
  647. CertID (variable) Certificate ID data
  648. SigSize 2 bytes Size of Signature data
  649. Sig (variable) Signature data
  650. CertID
  651. Value Size Description
  652. ----- ---- -----------
  653. Size1 4 bytes Size of CertID, should be (IDSize - 4)
  654. Size1 4 bytes A bug in version one causes this value
  655. to appear twice.
  656. IssSize 4 bytes Issuer data size
  657. Issuer (variable) Issuer data
  658. SerSize 4 bytes Serial Number size
  659. Serial (variable) Serial Number data
  660. The Issuer and IssSize members are suitable for creating a
  661. CRYPT_DATA_BLOB to be the Issuer member of a CERT_INFO
  662. struct. The Serial and SerSize members would be the
  663. SerialNumber member of the same CERT_INFO struct. This
  664. struct would be used to find the certificate in the store
  665. the file was signed with. Those structures are from the MS
  666. CryptoAPI.
  667. Sig and SigSize are the actual signature data and size
  668. generated by signing the file with the MS CryptoAPI using a
  669. hash created with the given AlgID.
  670. -X.509 Certificate ID and Signature for central directory (0x0016):
  671. =================================================================
  672. This field contains the information about which certificate in
  673. the PKCS#7 store was used to sign the central directory structure.
  674. When the Central Directory Encryption feature is enabled for a
  675. ZIP file, this record will appear in the Archive Extra Data Record,
  676. otherwise it will appear in the first central directory record,
  677. along with the store. The data structure is the
  678. same as the CID, except that SigSize will be 0, and there
  679. will be no Sig member.
  680. This field is also kept after the last central directory
  681. record, as the signature data (ID 0x05054b50, it looks like
  682. a central directory record of a different type). This
  683. second copy of the data is the Signature Data member of the
  684. record, and will have a SigSize that is non-zero, and will
  685. have Sig data.
  686. Note: all fields stored in Intel low-byte/high-byte order.
  687. Value Size Description
  688. ----- ---- -----------
  689. (CDID) 0x0016 2 bytes Tag for this "extra" block type
  690. TSize 2 bytes Size of data that follows
  691. TData TSize Data
  692. -Strong Encryption Header (0x0017):
  693. =================================
  694. Value Size Description
  695. ----- ---- -----------
  696. 0x0017 2 bytes Tag for this "extra" block type
  697. TSize 2 bytes Size of data that follows
  698. Format 2 bytes Format definition for this record
  699. AlgID 2 bytes Encryption algorithm identifier
  700. Bitlen 2 bytes Bit length of encryption key
  701. Flags 2 bytes Processing flags
  702. CertData TSize-8 Certificate decryption extra field data
  703. (refer to the explanation for CertData
  704. in the section describing the
  705. Certificate Processing Method under
  706. the Strong Encryption Specification)
  707. -Record Management Controls (0x0018):
  708. ===================================
  709. Value Size Description
  710. ----- ---- -----------
  711. (Rec-CTL) 0x0018 2 bytes Tag for this "extra" block type
  712. CSize 2 bytes Size of total extra block data
  713. Tag1 2 bytes Record control attribute 1
  714. Size1 2 bytes Size of attribute 1, in bytes
  715. Data1 Size1 Attribute 1 data
  716. .
  717. .
  718. .
  719. TagN 2 bytes Record control attribute N
  720. SizeN 2 bytes Size of attribute N, in bytes
  721. DataN SizeN Attribute N data
  722. -PKCS#7 Encryption Recipient Certificate List (0x0019):
  723. =====================================================
  724. This field contains information about each of the certificates
  725. used in encryption processing and it can be used to identify who is
  726. allowed to decrypt encrypted files. This field should only appear
  727. in the archive extra data record. This field is not required and
  728. serves only to aide archive modifications by preserving public
  729. encryption key data. Individual security requirements may dictate
  730. that this data be omitted to deter information exposure.
  731. Note: all fields stored in Intel low-byte/high-byte order.
  732. Value Size Description
  733. ----- ---- -----------
  734. (CStore) 0x0019 2 bytes Tag for this "extra" block type
  735. TSize 2 bytes Size of the store data
  736. TData TSize Data about the store
  737. TData:
  738. Value Size Description
  739. ----- ---- -----------
  740. Version 2 bytes Format version number - must 0x0001 at this time
  741. CStore (var) PKCS#7 data blob
  742. -MVS Extra Field (PKWARE, 0x0065):
  743. ================================
  744. The following is the layout of the MVS "extra" block.
  745. Note: Some fields are stored in Big Endian format.
  746. All text is in EBCDIC format unless otherwise specified.
  747. Value Size Description
  748. ----- ---- -----------
  749. (MVS) 0x0065 2 bytes Tag for this "extra" block type
  750. TSize 2 bytes Size for the following data block
  751. ID 4 bytes EBCDIC "Z390" 0xE9F3F9F0 or
  752. "T4MV" for TargetFour
  753. (var) TSize-4 Attribute data
  754. -OS/400 Extra Field (0x0065):
  755. ===========================
  756. The following is the layout of the OS/400 "extra" block.
  757. Note: Some fields are stored in Big Endian format.
  758. All text is in EBCDIC format unless otherwise specified.
  759. Value Size Description
  760. ----- ---- -----------
  761. (OS400) 0x0065 2 bytes Tag for this "extra" block type
  762. TSize 2 bytes Size for the following data block
  763. ID 4 bytes EBCDIC "I400" 0xC9F4F0F0 or
  764. "T4MV" for TargetFour
  765. (var) TSize-4 Attribute data
  766. -Info-ZIP Unicode Path Extra Field:
  767. =================================
  768. Stores the UTF-8 version of the entry path as stored in the
  769. local header and central directory header.
  770. (Last Revision 20070912)
  771. Value Size Description
  772. ----- ---- -----------
  773. (UPath) 0x7075 Short tag for this extra block type ("up")
  774. TSize Short total data size for this block
  775. Version Byte version of this extra field, currently 1
  776. NameCRC32 Long CRC-32 checksum of standard name field
  777. UnicodeName variable UTF-8 version of the entry file name
  778. Currently Version is set to the number 1. If there is a need
  779. to change this field, the version will be incremented. Changes
  780. may not be backward compatible so this extra field should not be
  781. used if the version is not recognized.
  782. The NameCRC32 is the standard zip CRC32 checksum of the File Name
  783. field in the header. This is used to verify that the header
  784. File Name field has not changed since the Unicode Path extra field
  785. was created. This can happen if a utility renames the entry but
  786. does not update the UTF-8 path extra field. If the CRC check fails,
  787. this UTF-8 Path Extra Field should be ignored and the File Name field
  788. in the header should be used instead.
  789. The UnicodeName is the UTF-8 version of the contents of the File
  790. Name field in the header, without any trailing NUL. The standard
  791. name field in the Zip entry header remains filled with the entry
  792. name coded in the local machine's extended ASCII system charset.
  793. As UnicodeName is defined to be UTF-8, no UTF-8 byte order mark
  794. (BOM) is used. The length of this field is determined by
  795. subtracting the size of the previous fields from TSize.
  796. If both the File Name and Comment fields are UTF-8, the new General
  797. Purpose Bit Flag, bit 11 (Language encoding flag (EFS)), should be
  798. used to indicate that both the header File Name and Comment fields
  799. are UTF-8 and, in this case, the Unicode Path and Unicode Comment
  800. extra fields are not needed and should not be created. Note that,
  801. for backward compatibility, bit 11 should only be used if the native
  802. character set of the paths and comments being zipped up are already
  803. in UTF-8. The same method, either general purpose bit 11 or extra
  804. fields, should be used in both the Local and Central Directory Header
  805. for a file.
  806. Utilisation rules:
  807. 1. This field shall never be created for names consisting solely of
  808. 7-bit ASCII characters.
  809. 2. On a system that already uses UTF-8 as system charset, this field
  810. shall not repeat the string pattern already stored in the Zip
  811. entry's standard name field. Instead, a field of exactly 9 bytes
  812. (70 75 05 00 01 and 4 bytes CRC) should be created.
  813. In this form with 5 data bytes, the field serves as indicator
  814. for the UTF-8 encoding of the standard Zip header's name field.
  815. 3. This field shall not be used whenever the calculated CRC-32 of
  816. the entry's standard name field does not match the provided
  817. CRC checksum value. A mismatch of the CRC check indicates that
  818. the standard name field was changed by some non-"up"-aware
  819. utility without synchronizing this UTF-8 name e.f. block.
  820. -Info-ZIP Unicode Comment Extra Field:
  821. ====================================
  822. Stores the UTF-8 version of the entry comment as stored in the
  823. central directory header.
  824. (Last Revision 20070912)
  825. Value Size Description
  826. ----- ---- -----------
  827. (UCom) 0x6375 Short tag for this extra block type ("uc")
  828. TSize Short total data size for this block
  829. Version 1 byte version of this extra field, currently 1
  830. ComCRC32 4 bytes Comment Field CRC32 Checksum
  831. UnicodeCom Variable UTF-8 version of the entry comment
  832. Currently Version is set to the number 1. If there is a need
  833. to change this field, the version will be incremented. Changes
  834. may not be backward compatible so this extra field should not be
  835. used if the version is not recognized.
  836. The ComCRC32 is the standard zip CRC32 checksum of the Comment
  837. field in the central directory header. This is used to verify that
  838. the comment field has not changed since the Unicode Comment extra
  839. field was created. This can happen if a utility changes the Comment
  840. field but does not update the UTF-8 Comment extra field. If the CRC
  841. check fails, this Unicode Comment extra field should be ignored and
  842. the Comment field in the header used.
  843. The UnicodeCom field is the UTF-8 version of the entry comment field
  844. in the header. As UnicodeCom is defined to be UTF-8, no UTF-8 byte
  845. order mark (BOM) is used. The length of this field is determined by
  846. subtracting the size of the previous fields from TSize. If both the
  847. File Name and Comment fields are UTF-8, the new General Purpose Bit
  848. Flag, bit 11 (Language encoding flag (EFS)), can be used to indicate
  849. both the header File Name and Comment fields are UTF-8 and, in this
  850. case, the Unicode Path and Unicode Comment extra fields are not
  851. needed and should not be created. Note that, for backward
  852. compatibility, bit 11 should only be used if the native character set
  853. of the paths and comments being zipped up are already in UTF-8. The
  854. same method, either bit 11 or extra fields, should be used in both
  855. the local and central directory headers.
  856. -Extended Timestamp Extra Field:
  857. ==============================
  858. The following is the layout of the extended-timestamp extra block.
  859. (Last Revision 19970118)
  860. Local-header version:
  861. Value Size Description
  862. ----- ---- -----------
  863. (time) 0x5455 Short tag for this extra block type ("UT")
  864. TSize Short total data size for this block
  865. Flags Byte info bits
  866. (ModTime) Long time of last modification (UTC/GMT)
  867. (AcTime) Long time of last access (UTC/GMT)
  868. (CrTime) Long time of original creation (UTC/GMT)
  869. Central-header version:
  870. Value Size Description
  871. ----- ---- -----------
  872. (time) 0x5455 Short tag for this extra block type ("UT")
  873. TSize Short total data size for this block
  874. Flags Byte info bits (refers to local header!)
  875. (ModTime) Long time of last modification (UTC/GMT)
  876. The central-header extra field contains the modification time only,
  877. or no timestamp at all. TSize is used to flag its presence or
  878. absence. But note:
  879. If "Flags" indicates that Modtime is present in the local header
  880. field, it MUST be present in the central header field, too!
  881. This correspondence is required because the modification time
  882. value may be used to support trans-timezone freshening and
  883. updating operations with zip archives.
  884. The time values are in standard Unix signed-long format, indicating
  885. the number of seconds since 1 January 1970 00:00:00. The times
  886. are relative to Coordinated Universal Time (UTC), also sometimes
  887. referred to as Greenwich Mean Time (GMT). To convert to local time,
  888. the software must know the local timezone offset from UTC/GMT.
  889. The lower three bits of Flags in both headers indicate which time-
  890. stamps are present in the LOCAL extra field:
  891. bit 0 if set, modification time is present
  892. bit 1 if set, access time is present
  893. bit 2 if set, creation time is present
  894. bits 3-7 reserved for additional timestamps; not set
  895. Those times that are present will appear in the order indicated, but
  896. any combination of times may be omitted. (Creation time may be
  897. present without access time, for example.) TSize should equal
  898. (1 + 4*(number of set bits in Flags)), as the block is currently
  899. defined. Other timestamps may be added in the future.
  900. -Info-ZIP Unix Extra Field (type 1):
  901. ==================================
  902. The following is the layout of the old Info-ZIP extra block for
  903. Unix. It has been replaced by the extended-timestamp extra block
  904. (0x5455) and the Unix type 2 extra block (0x7855).
  905. (Last Revision 19970118)
  906. Local-header version:
  907. Value Size Description
  908. ----- ---- -----------
  909. (Unix1) 0x5855 Short tag for this extra block type ("UX")
  910. TSize Short total data size for this block
  911. AcTime Long time of last access (UTC/GMT)
  912. ModTime Long time of last modification (UTC/GMT)
  913. UID Short Unix user ID (optional)
  914. GID Short Unix group ID (optional)
  915. Central-header version:
  916. Value Size Description
  917. ----- ---- -----------
  918. (Unix1) 0x5855 Short tag for this extra block type ("UX")
  919. TSize Short total data size for this block
  920. AcTime Long time of last access (GMT/UTC)
  921. ModTime Long time of last modification (GMT/UTC)
  922. The file access and modification times are in standard Unix signed-
  923. long format, indicating the number of seconds since 1 January 1970
  924. 00:00:00. The times are relative to Coordinated Universal Time
  925. (UTC), also sometimes referred to as Greenwich Mean Time (GMT). To
  926. convert to local time, the software must know the local timezone
  927. offset from UTC/GMT. The modification time may be used by non-Unix
  928. systems to support inter-timezone freshening and updating of zip
  929. archives.
  930. The local-header extra block may optionally contain UID and GID
  931. info for the file. The local-header TSize value is the only
  932. indication of this. Note that Unix UIDs and GIDs are usually
  933. specific to a particular machine, and they generally require root
  934. access to restore.
  935. This extra field type is obsolete, but it has been in use since
  936. mid-1994. Therefore future archiving software should continue to
  937. support it. Some guidelines:
  938. An archive member should either contain the old "Unix1"
  939. extra field block or the new extra field types "time" and/or
  940. "Unix2".
  941. If both the old "Unix1" block type and one or both of the new
  942. block types "time" and "Unix2" are found, the "Unix1" block
  943. should be considered invalid and ignored.
  944. Unarchiving software should recognize both old and new extra
  945. field block types, but the info from new types overrides the
  946. old "Unix1" field.
  947. Archiving software should recognize "Unix1" extra fields for
  948. timestamp comparison but never create it for updated, freshened
  949. or new archive members. When copying existing members to a new
  950. archive, any "Unix1" extra field blocks should be converted to
  951. the new "time" and/or "Unix2" types.
  952. -Info-ZIP UNIX Extra Field (type 2):
  953. ==================================
  954. The following is the layout of the new Info-ZIP extra block for
  955. Unix. (Last Revision 19960922)
  956. Local-header version:
  957. Value Size Description
  958. ----- ---- -----------
  959. (Unix2) 0x7855 Short tag for this extra block type ("Ux")
  960. TSize Short total data size for this block (4)
  961. UID Short Unix user ID
  962. GID Short Unix group ID
  963. Central-header version:
  964. Value Size Description
  965. ----- ---- -----------
  966. (Unix2) 0x7855 Short tag for this extra block type ("Ux")
  967. TSize Short total data size for this block (0)
  968. The data size of the central-header version is zero; it is used
  969. solely as a flag that UID/GID info is present in the local-header
  970. extra field. If additional fields are ever added to the local
  971. version, the central version may be extended to indicate this.
  972. Note that Unix UIDs and GIDs are usually specific to a particular
  973. machine, and they generally require root access to restore.
  974. -Info-ZIP New Unix Extra Field:
  975. ====================================
  976. Currently stores Unix UIDs/GIDs up to 32 bits.
  977. (Last Revision 20080509)
  978. Value Size Description
  979. ----- ---- -----------
  980. (UnixN) 0x7875 Short tag for this extra block type ("ux")
  981. TSize Short total data size for this block
  982. Version 1 byte version of this extra field, currently 1
  983. UIDSize 1 byte Size of UID field
  984. UID Variable UID for this entry
  985. GIDSize 1 byte Size of GID field
  986. GID Variable GID for this entry
  987. Currently Version is set to the number 1. If there is a need
  988. to change this field, the version will be incremented. Changes
  989. may not be backward compatible so this extra field should not be
  990. used if the version is not recognized.
  991. UIDSize is the size of the UID field in bytes. This size should
  992. match the size of the UID field on the target OS.
  993. UID is the UID for this entry in standard little endian format.
  994. GIDSize is the size of the GID field in bytes. This size should
  995. match the size of the GID field on the target OS.
  996. GID is the GID for this entry in standard little endian format.
  997. If both the old 16-bit Unix extra field (tag 0x7855, Info-ZIP Unix2)
  998. and this extra field are present, the values in this extra field
  999. supercede the values in that extra field.
  1000. -ASi UNIX Extra Field:
  1001. ====================
  1002. The following is the layout of the ASi extra block for Unix. The
  1003. local-header and central-header versions are identical.
  1004. (Last Revision 19960916)
  1005. Value Size Description
  1006. ----- ---- -----------
  1007. (Unix3) 0x756e Short tag for this extra block type ("nu")
  1008. TSize Short total data size for this block
  1009. CRC Long CRC-32 of the remaining data
  1010. Mode Short file permissions
  1011. SizDev Long symlink'd size OR major/minor dev num
  1012. UID Short user ID
  1013. GID Short group ID
  1014. (var.) variable symbolic link filename
  1015. Mode is the standard Unix st_mode field from struct stat, containing
  1016. user/group/other permissions, setuid/setgid and symlink info, etc.
  1017. If Mode indicates that this file is a symbolic link, SizDev is the
  1018. size of the file to which the link points. Otherwise, if the file
  1019. is a device, SizDev contains the standard Unix st_rdev field from
  1020. struct stat (includes the major and minor numbers of the device).
  1021. SizDev is undefined in other cases.
  1022. If Mode indicates that the file is a symbolic link, the final field
  1023. will be the name of the file to which the link points. The file-
  1024. name length can be inferred from TSize.
  1025. [Note that TSize may incorrectly refer to the data size not counting
  1026. the CRC; i.e., it may be four bytes too small.]
  1027. -BeOS Extra Field:
  1028. ================
  1029. The following is the layout of the file-attributes extra block for
  1030. BeOS. (Last Revision 19970531)
  1031. Local-header version:
  1032. Value Size Description
  1033. ----- ---- -----------
  1034. (BeOS) 0x6542 Short tag for this extra block type ("Be")
  1035. TSize Short total data size for this block
  1036. BSize Long uncompressed file attribute data size
  1037. Flags Byte info bits
  1038. (CType) Short compression type
  1039. (CRC) Long CRC value for uncompressed file attribs
  1040. Attribs variable file attribute data
  1041. Central-header version:
  1042. Value Size Description
  1043. ----- ---- -----------
  1044. (BeOS) 0x6542 Short tag for this extra block type ("Be")
  1045. TSize Short total data size for this block (5)
  1046. BSize Long size of uncompr. local EF block data
  1047. Flags Byte info bits
  1048. The least significant bit of Flags in both headers indicates whether
  1049. the LOCAL extra field is uncompressed (and therefore whether CType
  1050. and CRC are omitted):
  1051. bit 0 if set, Attribs is uncompressed (no CType, CRC)
  1052. bits 1-7 reserved; if set, assume error or unknown data
  1053. Currently the only supported compression types are deflated (type 8)
  1054. and stored (type 0); the latter is not used by Info-ZIP's Zip but is
  1055. supported by UnZip.
  1056. Attribs is a BeOS-specific block of data in big-endian format with
  1057. the following structure (if compressed, uncompress it first):
  1058. Value Size Description
  1059. ----- ---- -----------
  1060. Name variable attribute name (null-terminated string)
  1061. Type Long attribute type (32-bit unsigned integer)
  1062. Size Long Long data size for this sub-block (64 bits)
  1063. Data variable attribute data
  1064. The attribute structure is repeated for every attribute. The Data
  1065. field may contain anything--text, flags, bitmaps, etc.
  1066. -AtheOS Extra Field:
  1067. ==================
  1068. The following is the layout of the file-attributes extra block for
  1069. AtheOS. This field is a very close spin-off from the BeOS e.f.
  1070. The only differences are:
  1071. - a new extra field signature
  1072. - numeric field in the attributes data are stored in little-endian
  1073. format ("i386" was initial hardware for AtheOS)
  1074. (Last Revision 20040908)
  1075. Local-header version:
  1076. Value Size Description
  1077. ----- ---- -----------
  1078. (AtheOS) 0x7441 Short tag for this extra block type ("At")
  1079. TSize Short total data size for this block
  1080. BSize Long uncompressed file attribute data size
  1081. Flags Byte info bits
  1082. (CType) Short compression type
  1083. (CRC) Long CRC value for uncompressed file attribs
  1084. Attribs variable file attribute data
  1085. Central-header version:
  1086. Value Size Description
  1087. ----- ---- -----------
  1088. (AtheOS) 0x7441 Short tag for this extra block type ("At")
  1089. TSize Short total data size for this block (5)
  1090. BSize Long size of uncompr. local EF block data
  1091. Flags Byte info bits
  1092. The least significant bit of Flags in both headers indicates whether
  1093. the LOCAL extra field is uncompressed (and therefore whether CType
  1094. and CRC are omitted):
  1095. bit 0 if set, Attribs is uncompressed (no CType, CRC)
  1096. bits 1-7 reserved; if set, assume error or unknown data
  1097. Currently the only supported compression types are deflated (type 8)
  1098. and stored (type 0); the latter is not used by Info-ZIP's Zip but is
  1099. supported by UnZip.
  1100. Attribs is a AtheOS-specific block of data in little-endian format
  1101. with the following structure (if compressed, uncompress it first):
  1102. Value Size Description
  1103. ----- ---- -----------
  1104. Name variable attribute name (null-terminated string)
  1105. Type Long attribute type (32-bit unsigned integer)
  1106. Size Long Long data size for this sub-block (64 bits)
  1107. Data variable attribute data
  1108. The attribute structure is repeated for every attribute. The Data
  1109. field may contain anything--text, flags, bitmaps, etc.
  1110. -SMS/QDOS Extra Field:
  1111. ====================
  1112. The following is the layout of the file-attributes extra block for
  1113. SMS/QDOS. The local-header and central-header versions are identical.
  1114. (Last Revision 19960929)
  1115. Value Size Description
  1116. ----- ---- -----------
  1117. (QDOS) 0xfb4a Short tag for this extra block type
  1118. TSize Short total data size for this block
  1119. LongID Long extra-field signature
  1120. (ExtraID) Long additional signature/flag bytes
  1121. QDirect 64 bytes qdirect structure
  1122. LongID may be "QZHD" or "QDOS". In the latter case, ExtraID will
  1123. be present. Its first three bytes are "02\0"; the last byte is
  1124. currently undefined.
  1125. QDirect contains the file's uncompressed directory info (qdirect
  1126. struct). Its elements are in native (big-endian) format:
  1127. d_length beLong file length
  1128. d_access byte file access type
  1129. d_type byte file type
  1130. d_datalen beLong data length
  1131. d_reserved beLong unused
  1132. d_szname beShort size of filename
  1133. d_name 36 bytes filename
  1134. d_update beLong time of last update
  1135. d_refdate beLong file version number
  1136. d_backup beLong time of last backup (archive date)
  1137. -AOS/VS Extra Field:
  1138. ==================
  1139. The following is the layout of the extra block for Data General
  1140. AOS/VS. The local-header and central-header versions are identical.
  1141. (Last Revision 19961125)
  1142. Value Size Description
  1143. ----- ---- -----------
  1144. (AOSVS) 0x5356 Short tag for this extra block type ("VS")
  1145. TSize Short total data size for this block
  1146. "FCI\0" Long extra-field signature
  1147. Version Byte version of AOS/VS extra block (10 = 1.0)
  1148. Fstat variable fstat packet
  1149. AclBuf variable raw ACL data ($MXACL bytes)
  1150. Fstat contains the file's uncompressed fstat packet, which is one of
  1151. the following:
  1152. normal fstat packet (P_FSTAT struct)
  1153. DIR/CPD fstat packet (P_FSTAT_DIR struct)
  1154. unit (device) fstat packet (P_FSTAT_UNIT struct)
  1155. IPC file fstat packet (P_FSTAT_IPC struct)
  1156. AclBuf contains the raw ACL data; its length is $MXACL.
  1157. -Tandem NSK Extra Field:
  1158. ======================
  1159. The following is the layout of the file-attributes extra block for
  1160. Tandem NSK. The local-header and central-header versions are
  1161. identical. (Last Revision 19981221)
  1162. Value Size Description
  1163. ----- ---- -----------
  1164. (TA) 0x4154 Short tag for this extra block type ("TA")
  1165. TSize Short total data size for this block (20)
  1166. NSKattrs 20 Bytes NSK attributes
  1167. -THEOS Extra Field:
  1168. =================
  1169. The following is the layout of the file-attributes extra block for
  1170. Theos. The local-header and central-header versions are identical.
  1171. (Last Revision 19990206)
  1172. Value Size Description
  1173. ----- ---- -----------
  1174. (Theos) 0x6854 Short 'Th' signature
  1175. size Short size of extra block
  1176. flags Byte reserved for future use
  1177. filesize Long file size
  1178. fileorg Byte type of file (see below)
  1179. keylen Short key length for indexed and keyed files,
  1180. data segment size for 16 bits programs
  1181. reclen Short record length for indexed,keyed and direct,
  1182. text segment size for 16 bits programs
  1183. filegrow Byte growing factor for indexed,keyed and direct
  1184. protect Byte protections (see below)
  1185. reserved Short reserved for future use
  1186. File types
  1187. ==========
  1188. 0x80 library (keyed access list of files)
  1189. 0x40 directory
  1190. 0x10 stream file
  1191. 0x08 direct file
  1192. 0x04 keyed file
  1193. 0x02 indexed file
  1194. 0x0e reserved
  1195. 0x01 16 bits real mode program (obsolete)
  1196. 0x21 16 bits protected mode program
  1197. 0x41 32 bits protected mode program
  1198. Protection codes
  1199. ================
  1200. User protection
  1201. ---------------
  1202. 0x01 non readable
  1203. 0x02 non writable
  1204. 0x04 non executable
  1205. 0x08 non erasable
  1206. Other protection
  1207. ----------------
  1208. 0x10 non readable
  1209. 0x20 non writable
  1210. 0x40 non executable Theos before 4.0
  1211. 0x40 modified Theos 4.x
  1212. 0x80 not hidden
  1213. -THEOS old inofficial Extra Field:
  1214. ================================
  1215. The following is the layout of an inoffical former version of a
  1216. Theos file-attributes extra blocks. This layout was never published
  1217. and is no longer created. However, UnZip can optionally support it
  1218. when compiling with the option flag OLD_THEOS_EXTRA defined.
  1219. Both the local-header and central-header versions are identical.
  1220. (Last Revision 19990206)
  1221. Value Size Description
  1222. ----- ---- -----------
  1223. (THS0) 0x4854 Short 'TH' signature
  1224. size Short size of extra block
  1225. flags Short reserved for future use
  1226. filesize Long file size
  1227. reclen Short record length for indexed,keyed and direct,
  1228. text segment size for 16 bits programs
  1229. keylen Short key length for indexed and keyed files,
  1230. data segment size for 16 bits programs
  1231. filegrow Byte growing factor for indexed,keyed and direct
  1232. reserved 3 Bytes reserved for future use
  1233. -FWKCS MD5 Extra Field (0x4b46):
  1234. ==============================
  1235. The FWKCS Contents_Signature System, used in automatically
  1236. identifying files independent of filename, optionally adds
  1237. and uses an extra field to support the rapid creation of
  1238. an enhanced contents_signature.
  1239. There is no local-header version; the following applies
  1240. only to the central header. (Last Revision 19961207)
  1241. Central-header version:
  1242. Value Size Description
  1243. ----- ---- -----------
  1244. (MD5) 0x4b46 Short tag for this extra block type ("FK")
  1245. TSize Short total data size for this block (19)
  1246. "MD5" 3 bytes extra-field signature
  1247. MD5hash 16 bytes 128-bit MD5 hash of uncompressed data
  1248. (low byte first)
  1249. When FWKCS revises a .ZIP file central directory to add
  1250. this extra field for a file, it also replaces the
  1251. central directory entry for that file's uncompressed
  1252. file length with a measured value.
  1253. FWKCS provides an option to strip this extra field, if
  1254. present, from a .ZIP file central directory. In adding
  1255. this extra field, FWKCS preserves .ZIP file Authenticity
  1256. Verification; if stripping this extra field, FWKCS
  1257. preserves all versions of AV through PKZIP version 2.04g.
  1258. FWKCS, and FWKCS Contents_Signature System, are
  1259. trademarks of Frederick W. Kantor.
  1260. (1) R. Rivest, RFC1321.TXT, MIT Laboratory for Computer
  1261. Science and RSA Data Security, Inc., April 1992.
  1262. ll.76-77: "The MD5 algorithm is being placed in the
  1263. public domain for review and possible adoption as a
  1264. standard."
  1265. -Microsoft Open Packaging Growth Hint (0xa220):
  1266. =============================================
  1267. Value Size Description
  1268. ----- ---- -----------
  1269. 0xa220 Short tag for this extra block type
  1270. TSize Short size of Sig + PadVal + Padding
  1271. Sig Short verification signature (A028)
  1272. PadVal Short Initial padding value
  1273. Padding variable filled with NULL characters