Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1293 lines
49 KiB

  1. /*** ISO13346.H - ISO 13346 File System Disk Format
  2. *
  3. * Microsoft Confidential
  4. * Copyright (c) 1996-2000 Microsoft Corporation
  5. * All Rights Reserved
  6. *
  7. * This file defines the ISO 13346 Data Structures.
  8. *
  9. * The UDF file system uses these data structures to interpret the
  10. * media's contents.
  11. *
  12. */
  13. //
  14. // All 13346 structures are aligned on natural boundaries even though it will
  15. // not be obvious to the compiler. Disable compiler smarts for the duration
  16. // of the ISO definitions.
  17. //
  18. // As an example, the LONGAD definition is {ULONG {ULONG USHORT} UCHAR[6]} and
  19. // normal packing will pad out the internal NSRLBA, nevermind that the UCHAR
  20. // reserved field is doing exactly that.
  21. //
  22. #pragma pack(1)
  23. /*** ISO 13346 Part 1: General
  24. *
  25. *
  26. */
  27. /*** charspec - Character Set Specification (1/7.2.1)
  28. *
  29. */
  30. typedef struct CHARSPEC {
  31. UCHAR Type; // Character Set Type (CHARSPEC_T_...)
  32. UCHAR Info[63]; // Character Set Information
  33. } CHARSPEC, *PCHARSPEC;
  34. // CHARSPEC_T_... - Values for charspec_Type Character Set Types (1/7.2.1.1)
  35. #define CHARSPEC_T_CS0 0 // By Agreement
  36. #define CHARSPEC_T_CS1 1 // Unicode (according to ISO 2022)
  37. #define CHARSPEC_T_CS2 2 // 38 Glyphs
  38. #define CHARSPEC_T_CS3 3 // 65 Glyphs
  39. #define CHARSPEC_T_CS4 4 // 95 Glyphs
  40. #define CHARSPEC_T_CS5 5 // 191 Glyphs
  41. #define CHARSPEC_T_CS6 6 // Unicode or ISO 2022
  42. #define CHARSPEC_T_CS7 7 // Unicode or ISO 2022
  43. #define CHARSPEC_T_CS8 8 // 53 Glyphs
  44. /*** timestamp - Timestamp Structure (1/7.3)
  45. *
  46. */
  47. typedef struct TIMESTAMP {
  48. SHORT Zone:12; // Time Zone (+-1440 minutes from CUT)
  49. USHORT Type:4; // Timestamp Type (TIMESTAMP_T_...)
  50. USHORT Year; // Year (1..9999)
  51. UCHAR Month; // Month (1..12)
  52. UCHAR Day; // Day (1..31)
  53. UCHAR Hour; // Hour (0..23)
  54. UCHAR Minute; // Minute (0..59)
  55. UCHAR Second; // Second (0..59)
  56. UCHAR CentiSecond; // Centiseconds (0..99)
  57. UCHAR Usec100; // Hundreds of microseconds (0..99)
  58. UCHAR Usec; // microseconds (0..99)
  59. } TIMESTAMP, *PTIMESTAMP;
  60. // TIMESTAMP_T_... - Values for timestamp_Type (1/7.3.1)
  61. #define TIMESTAMP_T_CUT 0 // Coordinated Universal Time
  62. #define TIMESTAMP_T_LOCAL 1 // Local Time
  63. #define TIMESTAMP_T_AGREEMENT 2 // Time format by agreement
  64. // TIMESTAMP_Z_... Values for timestamp_Zone
  65. #define TIMESTAMP_Z_MIN (-1440) // Minimum timezone offset (minutes)
  66. #define TIMESTAMP_Z_MAX ( 1440) // Maximum timezone offset (minutes)
  67. #define TIMESTAMP_Z_NONE (-2047) // No timezone in timestamp_Zone
  68. /**** regid - Entity Identifier (1/7.4)
  69. *
  70. */
  71. typedef struct REGID {
  72. UCHAR Flags; // Flags (REGID_F_...)
  73. UCHAR Identifier[23]; // Identifier
  74. UCHAR Suffix[8]; // Identifier Suffix
  75. } REGID, *PREGID;
  76. // REGID_F_... - Definitions for regid_Flags bits
  77. #define REGID_F_DIRTY (0x01) // Information Modified
  78. #define REGID_F_PROTECTED (0x02) // Changes Locked Out
  79. // REGID_LENGTH_... - regid field lengths
  80. #define REGID_LENGTH_IDENT 23 // Length of regid_Identifier (bytes)
  81. #define REGID_LENGTH_SUFFIX 8 // Length of regid_Suffix (bytes)
  82. // REGID_ID_... - Values for regid_Identifier[0]
  83. #define REGID_ID_ISO13346 (0x2B) // regid_Identifier within ISO 13346
  84. #define REGID_ID_NOTREGISTERED (0x2D) // regid_Identifier is not registered
  85. /*** Various Structures from Parts 3 and 4 moved here for compilation.
  86. *
  87. */
  88. /*** extentad - Extent Address Descriptor (3/7.1)
  89. *
  90. */
  91. typedef struct EXTENTAD {
  92. ULONG Len; // Extent Length in Bytes
  93. ULONG Lsn; // Extent Logical Sector Number
  94. } EXTENTAD, *PEXTENTAD;
  95. /*** nsr_lba - Logical Block Address (4/7.1) (lb_addr)
  96. *
  97. */
  98. typedef struct NSRLBA {
  99. ULONG Lbn; // Logical Block Number
  100. USHORT Partition; // Partition Reference Number
  101. } NSRLBA, *PNSRLBA;
  102. /*** nsr_length - Format of a NSR allocation descriptor length field (4/14.14.1.1)
  103. *
  104. *
  105. */
  106. typedef struct NSRLENGTH {
  107. ULONG Length:30;
  108. ULONG Type:2;
  109. } NSRLENGTH, *PNSRLENGTH;
  110. #define NSRLENGTH_TYPE_RECORDED 0
  111. #define NSRLENGTH_TYPE_UNRECORDED 1
  112. #define NSRLENGTH_TYPE_UNALLOCATED 2
  113. #define NSRLENGTH_TYPE_CONTINUATION 3
  114. /*** Short Allocation Descriptor (4/14.14.1)
  115. *
  116. * Note that a SHORTAD precisely overlaps a LONGAD. Use this by defining
  117. * a generic allocation descriptor structure.
  118. */
  119. typedef struct SHORTAD {
  120. NSRLENGTH Length; // Extent Length
  121. ULONG Start; // Extent Logical Block Number
  122. } SHORTAD, *PSHORTAD;
  123. typedef SHORTAD AD_GENERIC, *PAD_GENERIC;
  124. /*** Long Allocation Descriptor (4/14.14.2)
  125. *
  126. */
  127. typedef struct LONGAD {
  128. NSRLENGTH Length; // Extent Length
  129. NSRLBA Start; // Extent Location
  130. UCHAR ImpUse[6]; // Implementation Use
  131. } LONGAD, *PLONGAD;
  132. /*** Extended Allocation Descriptor (4/14.14.3)
  133. *
  134. */
  135. typedef struct EXTAD {
  136. NSRLENGTH ExtentLen; // Extent Length
  137. NSRLENGTH RecordedLen; // Recorded Length
  138. ULONG InfoLen; // Information Length
  139. NSRLBA Start; // Extent Location
  140. UCHAR ImpUse[2]; // Implementation Use
  141. } EXTAD, *PEXTAD;
  142. /*** ISO 13346 Part 2: Volume and Boot Block Recognition
  143. *
  144. *
  145. */
  146. /*** vsd_generic - Generic Volume Structure Descriptor (2/9.1)
  147. *
  148. */
  149. typedef struct VSD_GENERIC {
  150. UCHAR Type; // Structure Type
  151. UCHAR Ident[5]; // Standard Identifier
  152. UCHAR Version; // Standard Version
  153. UCHAR Data[2041]; // Structure Data
  154. } VSD_GENERIC, *PVSD_GENERIC;
  155. // VSD_LENGTH_... - vsd field lengths
  156. #define VSD_LENGTH_IDENT 5 // Length of regid_Identifier (bytes)
  157. // VSD_IDENT_... - Values for vsd_generic_Ident
  158. #define VSD_IDENT_BEA01 "BEA01" // Begin Extended Area
  159. #define VSD_IDENT_TEA01 "TEA01" // Terminate Extended Area
  160. #define VSD_IDENT_CDROM "CDROM" // High Sierra Group (pre-ISO 9660)
  161. #define VSD_IDENT_CD001 "CD001" // ISO 9660
  162. #define VSD_IDENT_CDW01 "CDW01" // ECMA 168
  163. #define VSD_IDENT_CDW02 "CDW02" // ISO 13490
  164. #define VSD_IDENT_NSR01 "NSR01" // ECMA 167
  165. #define VSD_IDENT_NSR02 "NSR02" // ISO 13346
  166. #define VSD_IDENT_BOOT2 "BOOT2" // Boot Descriptor
  167. #define VSD_IDENT_NSR03 "NSR03" // ECMA 167 3rd Edition
  168. typedef enum _VSD_IDENT {
  169. VsdIdentBad = 0,
  170. VsdIdentBEA01,
  171. VsdIdentTEA01,
  172. VsdIdentCDROM,
  173. VsdIdentCD001,
  174. VsdIdentCDW01,
  175. VsdIdentCDW02,
  176. VsdIdentNSR01,
  177. VsdIdentNSR02,
  178. VsdIdentBOOT2,
  179. VsdIdentNSR03
  180. } VSD_IDENT, *PVSD_IDENT;
  181. /*** vsd_bea01 - Begin Extended Area Descriptor (2/9.2)
  182. *
  183. */
  184. typedef struct VSD_BEA01 {
  185. UCHAR Type; // Structure Type
  186. UCHAR Ident[5]; // Standard Identifier ('BEA01')
  187. UCHAR Version; // Standard Version
  188. UCHAR Data[2041]; // Structure Data
  189. } VSD_BEA01, *PVSD_BEA01;
  190. /*** vsd_tea01 - Terminate Extended Area Descriptor (2/9.3)
  191. *
  192. */
  193. typedef struct VSD_TEA01 {
  194. UCHAR Type; // Structure Type
  195. UCHAR Ident[5]; // Standard Identifier ('TEA01')
  196. UCHAR Version; // Standard Version
  197. UCHAR Data[2041]; // Structure Data
  198. } VSD_TEA01, *PVSD_TEA01;
  199. /*** vsd_boot2 - Boot Descriptor (2/9.4)
  200. *
  201. */
  202. typedef struct VSD_BOOT2 {
  203. UCHAR Type; // Structure Type
  204. UCHAR Ident[5]; // Standard Identifier ('BOOT2')
  205. UCHAR Version; // Standard Version
  206. UCHAR Res8; // Reserved Zero
  207. REGID Architecture; // Architecture Type
  208. REGID BootIdent; // Boot Identifier
  209. ULONG BootExt; // Boot Extent Start
  210. ULONG BootExtLen; // Boot Extent Length
  211. ULONG LoadAddr[2]; // Load Address
  212. ULONG StartAddr[2]; // Start Address
  213. TIMESTAMP Timestamp; // Creation Time
  214. USHORT Flags; // Flags (VSD_BOOT2_F_...)
  215. UCHAR Res110[32]; // Reserved Zeros
  216. UCHAR BootUse[1906]; // Boot Use
  217. } VSD_BOOT2, *PVSD_BOOT2;
  218. // VSD_BOOT2_F_... - Definitions for vsd_boot2_Flags bits
  219. #define VSD_BOOT2_F_ERASE (0x0001) // Ignore previous similar BOOT2 vsds
  220. //
  221. // Aligning this byte offset to a sector boundary by rounding up will
  222. // yield the starting offset of the Volume Recognition Area (2/8.3)
  223. //
  224. #define VRA_BOUNDARY_LOCATION (32767 + 1)
  225. /*** ISO 13346 Part 3: Volume Structure
  226. *
  227. *
  228. */
  229. /*** destag - Descriptor Tag (3/7.1 and 4/7.2)
  230. *
  231. * destag_Checksum = Byte sum of bytes 0-3 and 5-15 of destag.
  232. *
  233. * destag_CRC = CRC (X**16 + X**12 + X**5 + 1)
  234. *
  235. */
  236. typedef struct DESTAG {
  237. USHORT Ident; // Tag Identifier
  238. USHORT Version; // Descriptor Version
  239. UCHAR Checksum; // Tag Checksum
  240. UCHAR Res5; // Reserved
  241. USHORT Serial; // Tag Serial Number
  242. USHORT CRC; // Descriptor CRC
  243. USHORT CRCLen; // Descriptor CRC Length
  244. ULONG Lbn; // Tag Location (Logical Block Number)
  245. } DESTAG, *PDESTAG;
  246. // DESTAG_ID_... - Values for destag_Ident
  247. // Descriptor Tag Values from NSR Part 3 (3/7.2.1)
  248. #define DESTAG_ID_NOTSPEC 0 // Format Not Specified
  249. #define DESTAG_ID_NSR_PVD 1 // (3/10.1) Primary Volume Descriptor
  250. #define DESTAG_ID_NSR_ANCHOR 2 // (3/10.2) Anchor Volume Desc Pointer
  251. #define DESTAG_ID_NSR_VDP 3 // (3/10.3) Volume Descriptor Pointer
  252. #define DESTAG_ID_NSR_IMPUSE 4 // (3/10.4) Implementation Use Vol Desc
  253. #define DESTAG_ID_NSR_PART 5 // (3/10.5) Partition Descriptor
  254. #define DESTAG_ID_NSR_LVOL 6 // (3/10.6) Logical Volume Descriptor
  255. #define DESTAG_ID_NSR_UASD 7 // (3/10.8) Unallocated Space Desc
  256. #define DESTAG_ID_NSR_TERM 8 // (3/10.9) Terminating Descriptor
  257. #define DESTAG_ID_NSR_LVINTEG 9 // (3/10.10) Logical Vol Integrity Desc
  258. #define DESTAG_ID_MINIMUM_PART3 1 // The lowest legal DESTAG in Part 3
  259. #define DESTAG_ID_MAXIMUM_PART3 9 // The highest legal DESTAG in Part 3
  260. // DESTAG_ID_... - Values for destag_Ident, continued...
  261. // Descriptor Tag Values from NSR Part 4 (4/7.2.1)
  262. #define DESTAG_ID_NSR_FSD 256 // (4/14.1) File Set Descriptor
  263. #define DESTAG_ID_NSR_FID 257 // (4/14.4) File Identifier Descriptor
  264. #define DESTAG_ID_NSR_ALLOC 258 // (4/14.5) Allocation Extent Desc
  265. #define DESTAG_ID_NSR_ICBIND 259 // (4/14.7) ICB Indirect Entry
  266. #define DESTAG_ID_NSR_ICBTRM 260 // (4/14.8) ICB Terminal Entry
  267. #define DESTAG_ID_NSR_FILE 261 // (4/14.9) File Entry
  268. #define DESTAG_ID_NSR_EA 262 // (4/14.10) Extended Attribute Header
  269. #define DESTAG_ID_NSR_UASE 263 // (4/14.11) Unallocated Space Entry
  270. #define DESTAG_ID_NSR_SBP 264 // (4/14.12) Space Bitmap Descriptor
  271. #define DESTAG_ID_NSR_PINTEG 265 // (4/14.13) Partition Integrity
  272. #define DESTAG_ID_NSR_EXT_FILE 266 // (4/14.17) Extended File Entry (ECMA167r3+)
  273. #define DESTAG_ID_MINIMUM_PART4 256 // The lowest legal DESTAG in Part 4
  274. #define DESTAG_ID_MAXIMUM_PART4 265 // The highest legal DESTAG in Part 4 (NSR02)
  275. #define DESTAG_ID_MAXIMUM_PART4_NSR03 266 // The highest legal DESTAG in Part 4 (NSR03)
  276. // DESTAG_VER_... - Values for destag_Version (3/7.2.2)
  277. #define DESTAG_VER_NSR02 2 // Current Descriptor Tag Version
  278. #define DESTAG_VER_NSR03 3 // Current Descriptor Tag Version
  279. // DESTAG_SERIAL_... - Values for destag_Serial (3/7.2.5)
  280. #define DESTAG_SERIAL_NONE 0 // No Serial Number specified
  281. /*** Anchor Points (3/8.4.2.1)
  282. *
  283. */
  284. #define ANCHOR_SECTOR 256
  285. /*** vsd_nsr02 - NSR02/3 Volume Structure Descriptor (3/9.1)
  286. *
  287. */
  288. typedef struct VSD_NSR02 {
  289. UCHAR Type; // Structure Type
  290. UCHAR Ident[5]; // Standard Identifier ('NSR02' or 'NSR03')
  291. UCHAR Version; // Standard Version
  292. UCHAR Res7; // Reserved 0 Byte
  293. UCHAR Data[2040]; // Structure Data
  294. } VSD_NSR02, *PVSD_NSR02;
  295. // Values for vsd_nsr02_Type
  296. #define VSD_NSR02_TYPE_0 0 // Reserved 0
  297. // Values for vsd_nsr02_Version
  298. #define VSD_NSR02_VER 1 // Standard Version 1
  299. /*** nsr_vd_generic - Generic Volume Descriptor of 512 bytes
  300. *
  301. */
  302. typedef struct NSR_VD_GENERIC {
  303. DESTAG Destag; // Descriptor Tag
  304. ULONG Sequence; // Volume Descriptor Sequence Number
  305. UCHAR Data20[492]; // Descriptor Data
  306. } NSR_VD_GENERIC, *PNSR_VD_GENERIC;
  307. /*** nsr_pvd - NSR Primary Volume Descriptor (3/10.1)
  308. *
  309. * nsr_pvd_destag.destag_Ident = DESTAG_ID_NSR_PVD
  310. *
  311. */
  312. typedef struct NSR_PVD {
  313. DESTAG Destag; // Descriptor Tag (NSR_PVD)
  314. ULONG VolDescSeqNum; // Volume Descriptor Sequence Number
  315. ULONG Number; // Primary Volume Descriptor Number
  316. UCHAR VolumeID[32]; // Volume Identifier
  317. USHORT VolSetSeq; // Volume Set Sequence Number
  318. USHORT VolSetSeqMax; // Maximum Volume Set Sequence Number
  319. USHORT Level; // Interchange Level
  320. USHORT LevelMax; // Maximum Interchange Level
  321. ULONG CharSetList; // Character Set List (See 1/7.2.11)
  322. ULONG CharSetListMax; // Maximum Character Set List
  323. UCHAR VolSetID[128]; // Volume Set Identifier
  324. CHARSPEC CharsetDesc; // Descriptor Character Set
  325. CHARSPEC CharsetExplan; // Explanatory Character Set
  326. EXTENTAD Abstract; // Volume Abstract Location
  327. EXTENTAD Copyright; // Volume Copyright Notice Location
  328. REGID Application; // Application Identifier
  329. TIMESTAMP RecordTime; // Recording Time
  330. REGID ImpUseID; // Implementation Identifier
  331. UCHAR ImpUse[64]; // Implementation Use
  332. ULONG Predecessor; // Predecessor Vol Desc Seq Location
  333. USHORT Flags; // Flags
  334. UCHAR Res490[22]; // Reserved Zeros
  335. } NSR_PVD, *PNSR_PVD;
  336. // NSRPVD_F_... - Definitions for nsr_pvd_Flags
  337. #define NSRPVD_F_COMMON_VOLID (0x0001)// Volume ID is common across Vol Set
  338. /*** nsr_anchor - Anchor Volume Descriptor Pointer (3/10.2)
  339. *
  340. * nsr_anchor_destag.destag_Ident = DESTAG_ID_NSR_ANCHOR
  341. *
  342. */
  343. typedef struct NSR_ANCHOR {
  344. DESTAG Destag; // Descriptor Tag (NSR_ANCHOR)
  345. EXTENTAD Main; // Main Vol Desc Sequence Location
  346. EXTENTAD Reserve; // Reserve Vol Desc Sequence Location
  347. UCHAR Res32[480]; // Reserved Zeros
  348. } NSR_ANCHOR, *PNSR_ANCHOR;
  349. /*** nsr_vdp - Volume Descriptor Pointer (3/10.3)
  350. *
  351. * nsr_vdp_destag.destag_Ident = DESTAG_ID_NSR_VDP
  352. *
  353. */
  354. typedef struct NSR_VDP {
  355. DESTAG Destag; // Descriptor Tag (NSR_VDP)
  356. ULONG VolDescSeqNum; // Vol Desc Sequence Number
  357. EXTENTAD Next; // Next Vol Desc Sequence Location
  358. UCHAR Res28[484]; // Reserved Zeros
  359. } NSR_VDP, *PNSR_VDP;
  360. /*** nsr_impuse - Implementation Use Volume Descriptor (3/10.4)
  361. *
  362. * nsr_impuse_destag.destag_Ident = DESTAG_ID_NSR_IMPUSE
  363. *
  364. */
  365. typedef struct NSR_IMPUSE {
  366. DESTAG Destag; // Descriptor Tag (NSR_IMPUSE)
  367. ULONG VolDescSeqNum; // Vol Desc Sequence Number
  368. REGID ImpUseID; // Implementation Identifier
  369. UCHAR ImpUse[460]; // Implementation Use
  370. } NSR_IMPUSE, *PNSR_IMPUSE;
  371. /*** nsr_part - Partition Descriptor (3/10.5)
  372. *
  373. * nsr_part_destag.destag_Ident = DESTAG_ID_NSR_PART
  374. *
  375. */
  376. typedef struct NSR_PART {
  377. DESTAG Destag; // Descriptor Tag (NSR_PART)
  378. ULONG VolDescSeqNum; // Vol Desc Sequence Number
  379. USHORT Flags; // Partition Flags (NSR_PART_F_...)
  380. USHORT Number; // Partition Number
  381. REGID ContentsID; // Partition Contents ID
  382. UCHAR ContentsUse[128]; // Partition Contents Use
  383. ULONG AccessType; // Access Type
  384. ULONG Start; // Partition Starting Location
  385. ULONG Length; // Partition Length (sector count)
  386. REGID ImpUseID; // Implementation Identifier
  387. UCHAR ImpUse[128]; // Implementation Use
  388. UCHAR Res356[156]; // Reserved Zeros
  389. } NSR_PART, *PNSR_PART;
  390. // NSR_PART_F_... - Definitions for nsr_part_Flags
  391. #define NSR_PART_F_ALLOCATION (0x0001) // Volume Space Allocated
  392. // Values for nsr_part_ContentsID.regid_Identifier
  393. #define NSR_PART_CONTID_FDC01 "+FDC01" // ISO 9293-1987
  394. #define NSR_PART_CONTID_CD001 "+CD001" // ISO 9660
  395. #define NSR_PART_CONTID_CDW01 "+CDW01" // ECMA 168
  396. #define NSR_PART_CONTID_CDW02 "+CDW02" // ISO 13490
  397. #define NSR_PART_CONTID_NSR01 "+NSR01" // ECMA 167
  398. #define NSR_PART_CONTID_NSR02 "+NSR02" // ISO 13346
  399. #define NSR_PART_CONTID_NSR03 "+NSR03" // ECMA 167 r3
  400. typedef enum NSR_PART_CONTID {
  401. NsrPartContIdBad = 0,
  402. NsrPartContIdFDC01,
  403. NsrPartContIdCD001,
  404. NsrPartContIdCDW01,
  405. NsrPartContIdCDW02,
  406. NsrPartContIdNSR01,
  407. NsrPartContIdNSR02,
  408. NsrPartContIdNSR03
  409. } NSR_PART_CONTID, *PNSR_PART_CONTID;
  410. // Values for nsr_part_AccessType
  411. #define NSR_PART_ACCESS_NOSPEC 0 // Partition Access Unspecified
  412. #define NSR_PART_ACCESS_RO 1 // Read Only Access
  413. #define NSR_PART_ACCESS_WO 2 // Write-Once Access
  414. #define NSR_PART_ACCESS_RW_PRE 3 // Read/Write with preparation
  415. #define NSR_PART_ACCESS_RW_OVER 4 // Read/Write, fully overwritable
  416. /*** nsr_lvol - Logical Volume Descriptor (3/10.6)
  417. *
  418. * nsr_lvol_destag.destag_Ident = DESTAG_ID_NSR_LVOL
  419. *
  420. * The Logical Volume Contents Use field is specified here as a
  421. * File Set Descriptor Sequence (FSD) address. See (4/3.1).
  422. *
  423. */
  424. typedef struct NSR_LVOL {
  425. DESTAG Destag; // Descriptor Tag (NSR_LVOL)
  426. ULONG VolDescSeqNum; // Vol Desc Sequence Number
  427. CHARSPEC Charset; // Descriptor Character Set
  428. UCHAR VolumeID[128]; // Logical Volume ID
  429. ULONG BlockSize; // Logical Block Size (in bytes)
  430. REGID DomainID; // Domain Identifier
  431. LONGAD FSD; // Logical Volume Contents Use
  432. ULONG MapTableLength; // Map Table Length (bytes)
  433. ULONG MapTableCount; // Map Table Partition Maps Count
  434. REGID ImpUseID; // Implementaion Identifier
  435. UCHAR ImpUse[128]; // Implementation Use
  436. EXTENTAD Integrity; // Integrity Sequence Extent
  437. UCHAR MapTable[0]; // Partition Map Table (variant!)
  438. // The true length of this structure may vary!
  439. } NSR_LVOL, *PNSR_LVOL;
  440. #define ISONsrLvolConstantSize (FIELD_OFFSET( NSR_LVOL, MapTable ))
  441. #define ISONsrLvolSize( L ) (QuadAlign( ISONsrLvolConstantSize + (L)->MapTableLength ))
  442. /*** partmap_generic - Generic Partition Map (3/10.7.1)
  443. *
  444. */
  445. typedef struct PARTMAP_GENERIC {
  446. UCHAR Type; // Partition Map Type
  447. UCHAR Length; // Partition Map Length
  448. UCHAR Map[0]; // Partion Mapping (variant!)
  449. // The true length of this structure may vary!
  450. } PARTMAP_GENERIC, *PPARTMAP_GENERIC;
  451. // Values for partmap_g_Type
  452. #define PARTMAP_TYPE_NOTSPEC 0 // Partition Map Format Not Specified
  453. #define PARTMAP_TYPE_PHYSICAL 1 // Partition Map in Volume Set (Type 1)
  454. #define PARTMAP_TYPE_PROXY 2 // Partition Map by identifier (Type 2)
  455. /*** partmap_physical - Normal (Type 1) Partition Map (3/10.7.2)
  456. *
  457. * A Normal Partion Map specifies a partition number on a volume
  458. * within the same volume set.
  459. *
  460. */
  461. typedef struct PARTMAP_PHYSICAL {
  462. UCHAR Type; // Partition Map Type = 1
  463. UCHAR Length; // Partition Map Length = 6
  464. USHORT VolSetSeq; // Partition Volume Set Sequence Number
  465. USHORT Partition; // Partition Number
  466. } PARTMAP_PHYSICAL, *PPARTMAP_PHYSICAL;
  467. /*** partmap_proxy - Proxy (Type 2) Partition Map (3/10.7.3)
  468. *
  469. * A Proxy Partition Map is commonly not interchangeable.
  470. *
  471. */
  472. typedef struct PARTMAP_PROXY {
  473. UCHAR Type; // Partition Map Type = 2
  474. UCHAR Length; // Partition Map Length = 64
  475. UCHAR PartID[62]; // Partition Identifier (Proxy)
  476. } PARTMAP_PROXY, *PPARTMAP_PROXY;
  477. /*** nsr_uasd - Unallocated Space Descriptor (3/10.8)
  478. *
  479. * nsr_uasd_destag.destag_Ident = DESTAG_ID_NSR_UASD
  480. *
  481. * The true length of nsr_uasd_Extents is (nsr_uasd_ExtentCount * 8), and
  482. * the last logical sector of nsr_uasd_Extents is zero padded.
  483. *
  484. */
  485. typedef struct NSR_UASD {
  486. DESTAG Destag; // Descriptor Tag (NSR_UASD)
  487. ULONG VolDescSeqNum; // Vol Desc Sequence Number
  488. ULONG ExtentCount; // Number of Allocation Descriptors
  489. EXTENTAD Extents[0]; // Allocation Descriptors (variant!)
  490. // The true length of this structure may vary!
  491. // The true length of nsr_uasd_Extents is (nsr_uasd_ExtentCount * 8) bytes.
  492. // The last logical sector of nsr_uasd_Extents is zero padded.
  493. } NSR_UASD, *PNSR_UASD;
  494. /*** nsr_term - Terminating Descriptor (3/10.9 and 4/14.2)
  495. *
  496. * nsr_term_destag.destag_Ident = DESTAG_ID_NSR_TERM
  497. *
  498. */
  499. typedef struct NSR_TERM {
  500. DESTAG Destag; // Descriptor Tag (NSR_TERM)
  501. UCHAR Res16[496]; // Reserved Zeros
  502. } NSR_TERM, *PNSR_TERM;
  503. /*** nsr_lvhd - Logical Volume Header Descriptor (4/14.15)
  504. *
  505. * This descriptor is found in the Logical Volume Content Use
  506. * field of a Logical Volume Integrity Descriptor.
  507. *
  508. * This definition is moved to here to avoid forward reference.
  509. */
  510. typedef struct NSR_LVHD {
  511. ULONG UniqueID[2]; // Unique ID
  512. UCHAR Res8[24]; // Reserved Zeros
  513. } NSR_LVHD, *PNSR_LVHD;
  514. /*** nsr_integ - Logical Volume Integrity Descriptor (3/10.10)
  515. *
  516. * nsr_integ_destag.destag_Ident = DESTAG_ID_NSR_LVINTEG
  517. *
  518. * WARNING: WARNING: WARNING: nsr_integ is a multi-variant structure!
  519. *
  520. * The starting address of nsr_integ_Size is not acurrate.
  521. * Compensate for this nsr_integ_Size problem by adding the value of
  522. * (nsr_integ_PartitionCount-1) to the ULONG ARRAY INDEX.
  523. *
  524. * The starting address of nsr_integ_ImpUse[0] is not accurate.
  525. * Compensate for this nsr_integ_ImpUse problem by adding the value of
  526. * ((nsr_integ_PartitionCount-1)<<3) to the UCHAR ARRAY INDEX.
  527. *
  528. * This descriptor is padded with zero bytes to the end of the last
  529. * logical sector it occupies.
  530. *
  531. * The Logical Volume Contents Use field is specified here as a
  532. * Logical Volume Header Descriptor. See (4/3.1) second last point.
  533. */
  534. typedef struct NSR_INTEG {
  535. DESTAG Destag; // Descriptor Tag (NSR_LVINTEG)
  536. TIMESTAMP Time; // Recording Date
  537. ULONG Type; // Integrity Type (INTEG_T_...)
  538. EXTENTAD Next; // Next Integrity Extent
  539. NSR_LVHD LVHD; // Logical Volume Contents Use
  540. ULONG PartitionCount; // Number of Partitions
  541. ULONG ImpUseLength; // Length of Implementation Use
  542. ULONG Free[1]; // Free Space Table
  543. // nsr_integ_Free has a variant length = (4*nsr_integ_PartitionCount)
  544. ULONG Size[1]; // Size Table
  545. // nsr_integ_Size has a variant starting offset due to nsr_integ_Free
  546. // nsr_integ_Size has a variant length = (4*nsr_integ_PartitionCount)
  547. UCHAR ImpUse[0]; // Implementation Use
  548. // nsr_integ_ImpUse has a variant starting offset due to nsr_integ_Free and
  549. // nsr_integ_Size.
  550. // nsr_integ_ImpUse has a variant length = (nsr_integ_ImpUseLength)
  551. } NSR_INTEG, *PNSR_INTEG;
  552. // Values for nsr_integ_Type
  553. #define NSR_INTEG_T_OPEN 0 // Open Integrity Descriptor
  554. #define NSR_INTEG_T_CLOSE 1 // Close Integrity Descriptor
  555. /*** ISO 13346 Part 4: File Structure
  556. *
  557. * See DESTAG structure in Part 3 for definitions found in (4/7.2).
  558. *
  559. */
  560. /*** nsr_fsd - File Set Descriptor (4/14.1)
  561. *
  562. * nsr_fsd_destag.destag_Ident = DESTAG_ID_NSR_FSD
  563. */
  564. typedef struct NSR_FSD {
  565. DESTAG Destag; // Descriptor Tag (NSR_LVOL)
  566. TIMESTAMP Time; // Recording Time
  567. USHORT Level; // Interchange Level
  568. USHORT LevelMax; // Maximum Interchange Level
  569. ULONG CharSetList; // Character Set List (See 1/7.2.11)
  570. ULONG CharSetListMax; // Maximum Character Set List
  571. ULONG FileSet; // File Set Number
  572. ULONG FileSetDesc; // File Set Descriptor Number
  573. CHARSPEC CharspecVolID; // Volume ID Character Set
  574. UCHAR VolID[128]; // Volume ID
  575. CHARSPEC CharspecFileSet; // File Set Character Set
  576. UCHAR FileSetID[32]; // File Set ID
  577. UCHAR Copyright[32]; // Copyright File Name
  578. UCHAR Abstract[32]; // Abstract File Name
  579. LONGAD IcbRoot; // Root Directory ICB Address
  580. REGID DomainID; // Domain Identifier
  581. LONGAD NextExtent; // Next FSD Extent
  582. LONGAD StreamDirectoryICB; // >= UDF 2.00 only. System stream dir.
  583. // These bytes must be zero on discs
  584. // comforming to earlier revisions.
  585. UCHAR Res464[32]; // Reserved Zeros
  586. } NSR_FSD, *PNSR_FSD;
  587. /*** nsr_part_h - Partition Header Descriptor (4/14.3)
  588. *
  589. * No Descriptor Tag.
  590. *
  591. * This descriptor is found in the nsr_part_ContentsUse field of
  592. * an NSR02 Partition Descriptor. See NSR_PART_CONTID_NSR02.
  593. *
  594. */
  595. typedef struct NSR_PART_H {
  596. SHORTAD UASTable; // Unallocated Space Table
  597. SHORTAD UASBitmap; // Unallocated Space Bitmap
  598. SHORTAD IntegTable; // Integrity Table
  599. SHORTAD FreedTable; // Freed Space Table
  600. SHORTAD FreedBitmap; // Freed Space Bitmap
  601. UCHAR Res40[88]; // Reserved Zeros
  602. } NSR_PART_H, *PNSR_PART_H;
  603. /*** nsr_fid - File Identifier Descriptor (4/14.4)
  604. *
  605. * nsr_fid_destag.destag_Ident = DESTAG_ID_NSR_FID
  606. *
  607. * WARNING: WARNING: WARNING: nsr_fid is a multi-variant structure!
  608. *
  609. * The starting address of nsr_fid_FileID is not acurrate.
  610. * Compensate for this nsr_fid_FileID problem by adding the value of
  611. * (nsr_fid_ImpUseLen-1) to the UCHAR ARRAY INDEX.
  612. *
  613. * The starting address of nsr_fid_Padding is not acurrate.
  614. * Compensate for this nsr_fid_Padding problem by adding the value of
  615. * (nsr_fid_ImpUseLen+nsr_fid_FileIDLen-2) to the UCHAR ARRAY INDEX.
  616. *
  617. * The true total size of nsr_fid_s is
  618. * ((38 + nsr_fid_FileIDLen + nsr_fid_ImpUseLen) + 3) & ~3)
  619. *
  620. */
  621. typedef struct NSR_FID {
  622. DESTAG Destag; // Descriptor Tag (NSR_FID)
  623. USHORT Version; // File Version Number
  624. UCHAR Flags; // File Flags (NSR_FID_F_...)
  625. UCHAR FileIDLen; // File ID Length
  626. LONGAD Icb; // ICB (long) Address
  627. USHORT ImpUseLen; // Implementation Use Length
  628. UCHAR ImpUse[1]; // Implementation Use Area
  629. // nsr_fid_ImpUse has a variant length = nsr_fid_ImpUseLen
  630. UCHAR FileID[1]; // File Identifier
  631. // nsr_fid_FileID has a variant starting offset due to nsr_fid_ImpUse
  632. // nsr_fid_FileID has a variant length = nsr_fid_FileIDLen
  633. UCHAR Padding[1]; // Padding
  634. // nsr_fid_Paddinghas a variant starting offset due to nsr_fid_ImpUse and
  635. // nsr_fid_FileID
  636. // nsr_fid_Padding has a variant length. Round up to the next ULONG boundary.
  637. } NSR_FID, *PNSR_FID;
  638. #define ISONsrFidConstantSize (ULONG)(FIELD_OFFSET( NSR_FID, ImpUse ))
  639. #define ISONsrFidSize( F ) (LongAlign( ISONsrFidConstantSize + (F)->FileIDLen + (F)->ImpUseLen ))
  640. // NSR_FID_F_... - Definitions for nsr_fid_Flags (Characteristics, 4/14.4.3)
  641. #define NSR_FID_F_HIDDEN (0x01) // Hidden Bit
  642. #define NSR_FID_F_DIRECTORY (0x02) // Directory Bit
  643. #define NSR_FID_F_DELETED (0x04) // Deleted Bit
  644. #define NSR_FID_F_PARENT (0x08) // Parent Directory Bit
  645. #define NSR_FID_F_META (0x10) // (ECMAr3) Indicates impl. use
  646. // metadata stream.
  647. #define NSR_FID_OFFSET_FILEID 38 // Field Offset of nsr_fid_FileID[];
  648. /*** nsr_alloc - Allocation Extent Descriptor (4/14.5)
  649. *
  650. * nsr_alloc_destag.destag_Ident = DESTAG_ID_NSR_ALLOC
  651. *
  652. * This descriptor is immediately followed by AllocLen bytes
  653. * of allocation descriptors, which is not part of this
  654. * descriptor (so CRC calculation doesn't include it).
  655. *
  656. */
  657. typedef struct NSR_ALLOC {
  658. DESTAG Destag; // Descriptor Tag (NSR_ALLOC)
  659. ULONG Prev; // Previous Allocation Descriptor
  660. ULONG AllocLen; // Length of Allocation Descriptors
  661. } NSR_ALLOC, *PNSR_ALLOC;
  662. /*** icbtag - Information Control Block Tag (4/14.6)
  663. *
  664. * An ICBTAG is commonly preceeded by a Descriptor Tag (DESTAG).
  665. *
  666. */
  667. typedef struct ICBTAG {
  668. ULONG PriorDirectCount;// Prior Direct Entry Count
  669. USHORT StratType; // Strategy Type (ICBTAG_STRAT_...)
  670. USHORT StratParm; // Strategy Parameter (2 bytes)
  671. USHORT MaxEntries; // Maximum Number of Entries in ICB
  672. UCHAR Res10; // Reserved Zero
  673. UCHAR FileType; // File Type (ICBTAG_FILE_T_...)
  674. NSRLBA IcbParent; // Parent ICB Location
  675. USHORT Flags; // ICB Flags (ICBTAG_F_...)
  676. } ICBTAG, *PICBTAG;
  677. // ICBTAG_STRAT_T_... - ICB Strategy Types
  678. #define ICBTAG_STRAT_NOTSPEC 0 // ICB Strategy Not Specified
  679. #define ICBTAG_STRAT_TREE 1 // Strategy 1 (4/A.2) (Plain Tree)
  680. #define ICBTAG_STRAT_MASTER 2 // Strategy 2 (4/A.3) (Master ICB)
  681. #define ICBTAG_STRAT_BAL_TREE 3 // Strategy 3 (4/A.4) (Balanced Tree)
  682. #define ICBTAG_STRAT_DIRECT 4 // Strategy 4 (4/A.5) (One Direct)
  683. // ICBTAG_FILE_T_... - Values for icbtag_FileType
  684. #define ICBTAG_FILE_T_NOTSPEC 0 // Not Specified
  685. #define ICBTAG_FILE_T_UASE 1 // Unallocated Space Entry
  686. #define ICBTAG_FILE_T_PINTEG 2 // Partition Integrity Entry
  687. #define ICBTAG_FILE_T_INDIRECT 3 // Indirect Entry
  688. #define ICBTAG_FILE_T_DIRECTORY 4 // Directory
  689. #define ICBTAG_FILE_T_FILE 5 // Ordinary File
  690. #define ICBTAG_FILE_T_BLOCK_DEV 6 // Block Special Device
  691. #define ICBTAG_FILE_T_CHAR_DEV 7 // Character Special Device
  692. #define ICBTAG_FILE_T_XA 8 // Extended Attributes
  693. #define ICBTAG_FILE_T_FIFO 9 // FIFO file
  694. #define ICBTAG_FILE_T_C_ISSOCK 10 // Socket
  695. #define ICBTAG_FILE_T_TERMINAL 11 // Terminal Entry
  696. #define ICBTAG_FILE_T_PATHLINK 12 // Symbolic Link with a pathname
  697. // ICBTAG_F_... - Values for icbtag_Flags
  698. #define ICBTAG_F_ALLOC_MASK (0x0007)// Mask for Allocation Descriptor Info
  699. #define ICBTAG_F_ALLOC_SHORT 0 // Short Allocation Descriptors Used
  700. #define ICBTAG_F_ALLOC_LONG 1 // Long Allocation Descriptors Used
  701. #define ICBTAG_F_ALLOC_EXTENDED 2 // Extended Allocation Descriptors Used
  702. #define ICBTAG_F_ALLOC_IMMEDIATE 3 // File Data Recorded Immediately
  703. #define ISOAllocationDescriptorSize(T) ( (T) == ICBTAG_F_ALLOC_SHORT ? sizeof(SHORTAD) : \
  704. (T) == ICBTAG_F_ALLOC_LONG ? sizeof(LONGAD) : \
  705. sizeof(EXTAD) )
  706. #define ICBTAG_F_SORTED (0x0008)// Directory is Sorted (4/8.6.1)
  707. #define ICBTAG_F_NO_RELOCATE (0x0010)// Data is not relocateable
  708. #define ICBTAG_F_ARCHIVE (0x0020)// Archive Bit
  709. #define ICBTAG_F_SETUID (0x0040)// S_ISUID Bit
  710. #define ICBTAG_F_SETGID (0x0080)// S_ISGID Bit
  711. #define ICBTAG_F_STICKY (0x0100)// C_ISVTX Bit
  712. #define ICBTAG_F_CONTIGUOUS (0x0200)// File Data is Contiguous
  713. #define ICBTAG_F_SYSTEM (0x0400)// System Bit
  714. #define ICBTAG_F_TRANSFORMED (0x0800)// Data Transformed
  715. #define ICBTAG_F_MULTIVERSIONS (0x1000)// Multi-version Files in Directory
  716. /*** icbind - Indirect ICB Entry (4/14.7)
  717. *
  718. */
  719. typedef struct ICBIND {
  720. DESTAG Destag; // Descriptor Tag (ID_NSR_ICBIND)
  721. ICBTAG Icbtag; // ICB Tag (ICBTAG_FILE_T_INDIRECT)
  722. LONGAD Icb; // ICB Address
  723. } ICBIND, *PICBIND;
  724. /*** icbtrm - Terminal ICB Entry (4/14.8)
  725. *
  726. */
  727. typedef struct ICBTRM {
  728. DESTAG Destag; // Descriptor Tag (ID_NSR_ICBTRM)
  729. ICBTAG Icbtag; // ICB Tag (ICBTAG_FILE_T_TERMINAL)
  730. } ICBTRM, *PICBTRM;
  731. /*** icbfile - File ICB Entry (4/14.9)
  732. *
  733. * WARNING: WARNING: WARNING: icbfile is a multi-variant structure!
  734. *
  735. * The starting address of icbfile_Allocs is not acurrate.
  736. * Compensate for this icbfile_Allocs problem by adding the value of
  737. * (icbfile_XALength-1) to the UCHAR ARRAY INDEX.
  738. *
  739. * icbfile_XALength is a multiple of 4.
  740. *
  741. */
  742. typedef struct ICBFILE {
  743. DESTAG Destag; // Descriptor Tag (ID_NSR_FILE)
  744. ICBTAG Icbtag; // ICB Tag (ICBTAG_FILE_T_FILE)
  745. ULONG UID; // User ID of file's owner
  746. ULONG GID; // Group ID of file's owner
  747. ULONG Permissions; // File Permissions
  748. USHORT LinkCount; // File hard-link count
  749. UCHAR RecordFormat; // Record Format
  750. UCHAR RecordDisplay; // Record Display Attributes
  751. ULONG RecordLength; // Record Length
  752. ULONGLONG InfoLength; // Information Length (file size)
  753. ULONGLONG BlocksRecorded; // Logical Blocks Recorded
  754. TIMESTAMP AccessTime; // Last-Accessed Time
  755. TIMESTAMP ModifyTime; // Last-Modification Time
  756. TIMESTAMP AttributeTime; // Last-Attribute-Change Time
  757. ULONG Checkpoint; // File Checkpoint
  758. LONGAD IcbEA; // Extended Attribute ICB
  759. REGID ImpUseID; // Implementation Use Identifier
  760. ULONGLONG UniqueID; // Unique ID
  761. ULONG EALength; // Length of Extended Attributes
  762. ULONG AllocLength; // Length of Allocation Descriptors
  763. UCHAR EAs[1]; // Extended Attributes
  764. // icbfile_EAs has a variant length = icbfile_EALength
  765. UCHAR Allocs[0]; // Allocation Descriptors.
  766. // icbfile_Allocs has a variant starting offset due to icbfile_EAs.
  767. // icbfile_Allocs has a variant length = icbfile_AllocLen.
  768. } ICBFILE, *PICBFILE;
  769. /*** icbextfile - Extended File ICB Entry (4/14.17 ECMA167r3 and later)
  770. *
  771. * WARNING: WARNING: WARNING: icbextfile is a multi-variant structure!
  772. *
  773. * The starting address of icbfile_Allocs is not acurrate.
  774. * Compensate for this icbfile_Allocs problem by adding the value of
  775. * (icbfile_XALength-1) to the UCHAR ARRAY INDEX.
  776. *
  777. * icbfile_XALength is a multiple of 4.
  778. *
  779. */
  780. typedef struct ICBEXTFILE {
  781. DESTAG Destag; // Descriptor Tag (DESTAG_ID_NSR_EXT_FILE)
  782. ICBTAG Icbtag; // ICB Tag (ICBTAG_FILE_T_FILE)
  783. ULONG UID; // User ID of file's owner
  784. ULONG GID; // Group ID of file's owner
  785. ULONG Permissions; // File Permissions
  786. USHORT LinkCount; // File hard-link count
  787. UCHAR RecordFormat; // Record Format
  788. UCHAR RecordDisplay; // Record Display Attributes
  789. ULONG RecordLength; // Record Length
  790. ULONGLONG InfoLength; // Information Length (file size)
  791. ULONGLONG ObjectSize; // Object Size (Sum of InfoLengths for all streams)
  792. // THE ABOVE FIELD IS NEW IN THE EXT FE vs BASIC
  793. // FE. FIELDS AFTER THIS POINT ARE DISPLACED AND SHOULD
  794. // BE ACCESSED USING THE MACROS BELOW WHEN
  795. // MANIPULATING RAW, MAPPED, FEs
  796. ULONGLONG BlocksRecorded; // Logical Blocks Recorded
  797. TIMESTAMP AccessTime; // Last-Accessed Time
  798. TIMESTAMP ModifyTime; // Last-Modification Time
  799. TIMESTAMP CreationTime; // Creation Time
  800. TIMESTAMP AttributeTime; // Last-Attribute-Change Time
  801. ULONG Checkpoint; // File Checkpoint
  802. ULONG Reserved;
  803. LONGAD IcbEA; // Extended Attribute ICB
  804. LONGAD IcbStream; // Stream Directory ICB
  805. REGID ImpUseID; // Implementation Use Identifier
  806. ULONGLONG UniqueID; // Unique ID
  807. ULONG EALength; // Length of Extended Attributes
  808. ULONG AllocLength; // Length of Allocation Descriptors
  809. UCHAR EAs[1]; // Extended Attributes
  810. // icbfile_EAs has a variant length = icbfile_EALength
  811. UCHAR Allocs[0]; // Allocation Descriptors.
  812. // icbfile_Allocs has a variant starting offset due to icbfile_EAs.
  813. // icbfile_Allocs has a variant length = icbfile_AllocLen.
  814. } ICBEXTFILE, *PICBEXTFILE;
  815. //
  816. // Macros for accessing FEs and EXT FEs transparently. Note that we
  817. // only need these for fields after the first new (in ext fe) field (which is
  818. // ObjectSize) and only for fields that we actually access.
  819. //
  820. // All of the following macros expect a parameter of type PICBFILE
  821. //
  822. #define FeBlocksRecorded( F) (((F)->Destag.Ident == DESTAG_ID_NSR_FILE) ? \
  823. (F)->BlocksRecorded : ((PICBEXTFILE)(F))->BlocksRecorded)
  824. #define PFeAccessTime( F) (((F)->Destag.Ident == DESTAG_ID_NSR_FILE) ? \
  825. &(F)->AccessTime : &((PICBEXTFILE)(F))->AccessTime)
  826. #define PFeModifyTime( F) (((F)->Destag.Ident == DESTAG_ID_NSR_FILE) ? \
  827. &(F)->ModifyTime : &((PICBEXTFILE)(F))->ModifyTime)
  828. #define PFeCreationTime( F) (((F)->Destag.Ident == DESTAG_ID_NSR_FILE) ? \
  829. &(F)->ModifyTime : &((PICBEXTFILE)(F))->CreationTime)
  830. #define FeEALength( F) (((F)->Destag.Ident == DESTAG_ID_NSR_FILE) ? \
  831. (F)->EALength : ((PICBEXTFILE)(F))->EALength)
  832. #define FeAllocLength( F) (((F)->Destag.Ident == DESTAG_ID_NSR_FILE) ? \
  833. (F)->AllocLength : ((PICBEXTFILE)(F))->AllocLength)
  834. #define FeEAs( F) (((F)->Destag.Ident == DESTAG_ID_NSR_FILE) ? \
  835. (F)->EAs : ((PICBEXTFILE)(F))->EAs)
  836. #define FeEAsFieldOffset( F) (((F)->Destag.Ident == DESTAG_ID_NSR_FILE) ? \
  837. FIELD_OFFSET( ICBFILE, EAs ) : FIELD_OFFSET( ICBEXTFILE, EAs ))
  838. #define UdfFEIsExtended( F) ((F)->Destag.Ident == DESTAG_ID_NSR_EXT_FILE)
  839. // Definitions for icbfile_Permissions (4/14.9.6)
  840. #define ICBFILE_PERM_OTH_X (0x00000001) // Other: Execute OK
  841. #define ICBFILE_PERM_OTH_W (0x00000002) // Other: Write OK
  842. #define ICBFILE_PERM_OTH_R (0x00000004) // Other: Read OK
  843. #define ICBFILE_PERM_OTH_A (0x00000008) // Other: Set Attributes OK
  844. #define ICBFILE_PERM_OTH_D (0x00000010) // Other: Delete OK
  845. #define ICBFILE_PERM_GRP_X (0x00000020) // Group: Execute OK
  846. #define ICBFILE_PERM_GRP_W (0x00000040) // Group: Write OK
  847. #define ICBFILE_PERM_GRP_R (0x00000080) // Group: Read OK
  848. #define ICBFILE_PERM_GRP_A (0x00000100) // Group: Set Attributes OK
  849. #define ICBFILE_PERM_GRP_D (0x00000200) // Group: Delete OK
  850. #define ICBFILE_PERM_OWN_X (0x00000400) // Owner: Execute OK
  851. #define ICBFILE_PERM_OWN_W (0x00000800) // Owner: Write OK
  852. #define ICBFILE_PERM_OWN_R (0x00001000) // Owner: Read OK
  853. #define ICBFILE_PERM_OWN_A (0x00002000) // Owner: Set Attributes OK
  854. #define ICBFILE_PERM_OWN_D (0x00004000) // Owner: Delete OK
  855. // (4/14.9.7) Record Format
  856. // Skipped
  857. // (4/14.9.8) Record Display Attributes
  858. // Skipped
  859. /*** nsr_eah - Extended Attributes Header Descriptor (4/14.10.1)
  860. *
  861. */
  862. typedef struct NSR_EAH {
  863. DESTAG Destag; // Descriptor Tag (ID_NSR_XA)
  864. ULONG EAImp; // Implementation Attributes Location
  865. ULONG EAApp; // Application Attributes Location
  866. } NSR_EAH, *PNSR_EAH;
  867. /*** nsr_ea_g - Generic Extended Attributes Format (4/14.10.2)
  868. *
  869. */
  870. typedef struct NSR_EA_GENERIC {
  871. ULONG EAType; // Extended Attribute Type
  872. UCHAR EASubType; // Extended Attribute Sub Type
  873. UCHAR Res5[3]; // Reserved Zeros
  874. ULONG EALength; // Extended Attribute Length
  875. UCHAR EAData[0]; // Extended Attribute Data (variant!)
  876. } NSR_EA_GENERIC, *PNSR_EA_GENERIC;
  877. //
  878. // Extended Attribute Types (14.4.10)
  879. //
  880. #define EA_TYPE_CHARSET 1
  881. #define EA_TYPE_ALTPERM 3
  882. #define EA_TYPE_FILETIMES 5
  883. #define EA_TYPE_INFOTIMES 6
  884. #define EA_TYPE_DEVICESPEC 12
  885. #define EA_TYPE_IMPUSE 2048
  886. #define EA_TYPE_APPUSE 65536
  887. #define EA_SUBTYPE_BASE 1
  888. // (4/14.10.3) Character Set Information Extended Attribute Format
  889. // Skipped
  890. // (4/14.10.4) Alternate Permissions Extended Attribute Format
  891. // Skipped
  892. // (4/14.10.5) File Times Extended Attribute Format
  893. typedef struct NSR_EA_FILETIMES {
  894. ULONG EAType; // Extended Attribute Type
  895. UCHAR EASubType; // Extended Attribute Sub Type
  896. UCHAR Res5[3]; // Reserved Zeros
  897. ULONG EALength; // Extended Attribute Length
  898. ULONG DataLength; // EAData Length
  899. ULONG Existence; // Specifies which times are recorded
  900. TIMESTAMP Stamps[0]; // Timestamps (variant!)
  901. } NSR_EA_FILETIMES, *PNSR_EA_FILETIMES;
  902. // Definitions for nsr_ea_filetimes_Existence (4/14.10.5.6)
  903. #define EA_FILETIMES_E_CREATION (0x00000001)
  904. #define EA_FILETIMES_E_DELETION (0x00000004)
  905. #define EA_FILETIMES_E_EFFECTIVE (0x00000008)
  906. #define EA_FILETIMES_E_LASTBACKUP (0x00000020)
  907. // (4/14.10.6) Information Times Extended Attribute Format
  908. //
  909. // Exactly the same as an NSR_EA_FILETIMES
  910. // Definitions for nsr_ea_infotimes_Existence (4/14.10.6.6)
  911. #define EA_INFOTIMES_E_CREATION (0x00000001)
  912. #define EA_INFOTIMES_E_MODIFICATION (0x00000002)
  913. #define EA_INFOTIMES_E_EXPIRATION (0x00000004)
  914. #define EA_INFOTIMES_E_EFFECTIVE (0x00000008)
  915. // (4/14.10.7) Device Specification Extended Attribute Format
  916. // Skipped
  917. // (4/14.10.8) Implementation Use Extended Attribute Format
  918. // Skipped
  919. // (4/14.10.9) Application Use Extended Attribute Format
  920. // Skipped
  921. /*** icbuase - Unallocated Space Entry (4/14.11)
  922. *
  923. * icbuase_destag.destag_Ident = DESTAG_ID_NSR_UASE
  924. * icbuase_icbtag.icbtag_FileType = ICBTAG_FILE_T_UASE
  925. *
  926. */
  927. typedef struct ICBUASE {
  928. DESTAG Destag; // Descriptor Tag (ID_NSR_ICBUASE)
  929. ICBTAG Icbtag; // ICB Tag (ICBTAG_FILE_T_UASE)
  930. ULONG AllocLen; // Allocation Descriptors Length
  931. UCHAR Allocs[0]; // Allocation Descriptors (variant!)
  932. // The true length of this structure may vary!
  933. // icbuase_Allocs has a variant length = icbuase_AllocLen;
  934. } ICBUASE, *PICBUASE;
  935. /*** nsr_sbd - Space Bitmap Descriptor (4/14.12)
  936. *
  937. * nsr_sbd_destag.destag_Ident = DESTAG_ID_NSR_SBD
  938. *
  939. */
  940. typedef struct NSR_SBD {
  941. DESTAG Destag; // Descriptor Tag (DESTAG_ID_NSR_SBD)
  942. ULONG BitCount; // Number of bits in Space Bitmap
  943. ULONG ByteCount; // Number of bytes in Space Bitmap
  944. UCHAR Bits[0]; // Space Bitmap (variant!)
  945. // The true length of this structure may vary!
  946. // nsr_sbd_Bits has a variant length = nsr_sbd_ByteCount;
  947. } NSR_SBD, *PNSR_SBD;
  948. /*** icbpinteg - Partition Integrity ICB Entry (4/14.13)
  949. *
  950. */
  951. typedef struct ICBPINTEG {
  952. DESTAG Destag; // Descriptor Tag (ID_NSR_PINTEG)
  953. ICBTAG Icbtag; // ICB Tag (ICBTAG_FILE_T_PINTEG)
  954. TIMESTAMP Recording; // Recording Time
  955. UCHAR IntegType; // Integrity Type (ICBPINTEG_T_...)
  956. UCHAR Res49[175]; // Reserved Zeros
  957. REGID ImpUseID; // Implemetation Use Identifier
  958. UCHAR ImpUse[256]; // Implemetation Use Area
  959. } ICBPINTEG, *PICBPINTEG;
  960. // ICBPINTEG_T_... - Values for icbpinteg_IntegType
  961. #define ICBPINTEG_T_OPEN 0 // Open Partition Integrity Entry
  962. #define ICBPINTEG_T_CLOSE 1 // Close Partition Integrity Entry
  963. #define ICBPINTEG_T_STABLE 2 // Stable Partition Integrity Entry
  964. /*** (4/14.14.1) Short Allocation Descriptor
  965. *** (4/14.14.2) Long Allocation Descriptor
  966. *** (4/14.14.3) Extended Allocation Descriptor
  967. *
  968. * See SHORTAD, LONGAD, EXTAD, already defined above.
  969. *
  970. */
  971. /*** nsr_lvhd - Logical Volume Header Descriptor (4/14.15)
  972. *
  973. * The definition is moved to before Logical Volume Integrity
  974. * Descriptor.
  975. *
  976. */
  977. /*** nsr_path - Path Component (4/14.16)
  978. *
  979. */
  980. typedef struct NSR_PATH {
  981. UCHAR Type; // Path Component Type (NSR_PATH_T_...)
  982. UCHAR CompLen; // Path Component Length
  983. UCHAR CompVer; // Path Component Version
  984. UCHAR Comp[0]; // Path Component Identifier (variant!)
  985. // nsr_path_Comp has a variant length = nsr_path_CompLen
  986. } NSR_PATH, *PNSR_PATH;
  987. // NSR_PATH_T_... - Values for nsr_path_Type
  988. #define NSR_PATH_T_RESERVED 0 // Reserved Value
  989. #define NSR_PATH_T_OTHER_ROOT 1 // Another root directory, by agreement
  990. #define NSR_PATH_T_ROOTDIR 2 // Root Directory ('\')
  991. #define NSR_PATH_T_PARENTDIR 3 // Parent Directory ('..')
  992. #define NSR_PATH_T_CURDIR 4 // Current Directory ('.')
  993. #define NSR_PATH_T_FILE 5 // File
  994. /*** ISO 13346 Part 5: Record Structure
  995. *
  996. * Skipped
  997. *
  998. */
  999. //
  1000. // Restore the standard structure packing.
  1001. //
  1002. #pragma pack()