ECMA119.h
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:10k
源码类别:

DVD

开发平台:

Others

  1. /****************************************************************************************
  2.  *  Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
  3.  *  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
  4.  *
  5.  *  File: $Workfile: ECMA119.h $             
  6.  *
  7.  * Description:
  8.  * ============
  9.  * 
  10.  * 
  11.  * Log:
  12.  * ====
  13.  * $Revision: 3 $
  14.  * Last Modified by $Author: Leslie $ at $Modtime: 03-01-30 16:34 $ 
  15.  ****************************************************************************************
  16.  * Updates:
  17.  ****************************************************************************************
  18.  * $Log: /SourceCode/I64_Common/I64_Reference/Playcore/FileSys/ISO9660/ECMA119.h $
  19.  * 
  20.  * 3     03-01-30 23:13 Leslie
  21.  * Add new FILEREC struct type
  22.  * 
  23.  * 5     23/04/02 9:30 Nirm
  24.  * - Added dependency in "Config.h".
  25.  * 
  26.  * 4     27/01/02 17:32 Nirm
  27.  * Added support for Short Filenames (to reduce memory consumption).
  28.  * 
  29.  * 3     1/10/02 15:29 Idan
  30.  * Corrected Include-Paths + added a define for memory optimization
  31.  * 
  32.  * 2     12/31/01 19:46 Idan
  33.  * initializing the ISO9660 FS is working.
  34.  * 
  35.  * 1     12/27/01 14:19 Idan
  36.  * 
  37.  ****************************************************************************************/
  38. /////////////////////////////////////////////////////////////////////////////
  39. // ECMA119.h - Definitions and Data-Structures described in ECMA-119 (ISO-9660)
  40. //
  41. // Author: Nir Milstein
  42. #include "Config.h" // Global Configuration - do not remove!
  43. #ifndef __ECMA_119_H_
  44. #define __ECMA_119_H_
  45. #include "IncludeSysDefs.h"
  46. // NOTE: All of the structures MUST be packed, since they represent
  47. //  data-structures resident on the Medium!
  48. #pragma pack(1)
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Constants
  51. #define VOLUME_RECOGNITION_SEQUENCE_START_LSN 16
  52. #define LOGICAL_BLOCK_SIZE 2048
  53. /////////////////////////////////////////////////////////////////////////////
  54. // Recording of Descriptor Fields (ECMA-119 7)
  55. // 16-bit Numerical Value (ECMA-167 7.2)
  56. typedef UINT16 LB16; // A Little-Endian 16-bit (ECMA-119 7.2.1)
  57. typedef UINT16 MB16; // A Big-Endian 16-bit (ECMA-119 7.2.2)
  58. // Both-Bytes 16-bit (ECMA-119 7.2.3)
  59. typedef struct BB16_TAG {
  60. LB16 wLE16; // Little-Endian
  61. MB16 wBE16; // Big-Endian
  62. } BB16;
  63. // 32-bit Numerical Value (ECMA-167 7.3)
  64. typedef UINT32 LB32; // A Little-Endian 32-bit (ECMA-119 7.3.1)
  65. typedef UINT32 MB32; // A Big-Endian 32-bit (ECMA-119 7.3.2)
  66. // Both-Bytes 32-bit (ECMA-119 7.3.3)
  67. typedef struct BB32_TAG {
  68. LB32 dwLE32; // Little-Endian
  69. MB32 dwBE32; // Big-Endian
  70. } BB32;
  71. // Separators (ECMA-119 7.4.3)
  72. #define SEPARATOR1 0x2E
  73. #define SEPARATOR2 0x3B
  74. // File-Identifier (ECMA-119 7.5.1)
  75. #define SHORT_ID_LENGTH 32
  76. /////////////////////////////////////////////////////////////////////////////
  77. // Volume Descriptors (ECMA-119 8)
  78. #define VOLUME_DESC_LEN 2048
  79. #define STANDARD_ID_LEN 5
  80. // Generic Volume Descriptor (ECMA-119 8.1)
  81. struct GenericVolumeStructureDesc {
  82. UINT8 uVolumeDescType;
  83. BYTE aStandardID[STANDARD_ID_LEN];
  84. UINT8 uVolumeDescVersion;
  85. BYTE aReserved[2041];
  86. };
  87. #define STANDARD_ID_CD001 "CD001"
  88. #define DESC_TYPE_BOOT 0
  89. #define DESC_TYPE_PRIMARY_VOLUME 1
  90. #define DESC_TYPE_SUPPL_VOLUME 2
  91. #define DESC_TYPE_VOLUME_PARTITION 3
  92. #define DESC_TYPE_TERMINATOR 255
  93. // Boot Record (ECMA-119 8.2)
  94. struct BootRecordDesc {
  95. UINT8 uVolumeDescType;
  96. BYTE aStandardID[STANDARD_ID_LEN];
  97. UINT8 uVolumeDescVersion;
  98. BYTE sBootSystemID[32];
  99. BYTE sBootID[32];
  100. BYTE aBootSystemUse[1977];
  101. };
  102. // Volume Descriptor-Set Terminator (ECMA-119 8.3)
  103. #define VolumeDescriptorSetTerminator GenericVolumeStructureDesc
  104. // Root-Directory Record (ECMA-119 8.9.1)
  105. // Record Timestamp (ECMA-119 9.1.5)
  106. typedef struct RecordTimestamp_TAG {
  107. BYTE uYear; // Since 1900
  108. BYTE uMonth;
  109. BYTE uDay;
  110. BYTE uHour;
  111. BYTE uMinute;
  112. BYTE uSecond;
  113. BYTE uGMT_Offset;
  114. } RecordTimestamp;
  115. struct ReservedDirRecord {
  116. UINT8 cbLengthOfDirRecord;
  117. UINT8 cbExtendedAttrRecordLength;
  118. BB32 dwExtentLocation;
  119. BB32 dwDataLength;
  120. RecordTimestamp rtsRecording;
  121. UINT8 uFlags;
  122. UINT8 uFileUnitSize;
  123. UINT8 uInterleaveGapSize;
  124. BB16 uVolumeSequenceNumber;
  125. UINT8 cbLengthOfDirID;
  126. BYTE cDirID;
  127. };
  128. // Primary-Volume Descriptor (ECMA-119 8.4)
  129. #define MAX_ID_LENGTH 128
  130. // Volume Timestamp (ECMA-119 8.4.26.1)
  131. typedef struct VolumeTimestamp_TAG {
  132. BYTE sYear[4];
  133. BYTE sMonth[2];
  134. BYTE sDay[2];
  135. BYTE sHour[2];
  136. BYTE sMinute[2];
  137. BYTE sSecond[2];
  138. BYTE sHundredthsOfSec[2];
  139. BYTE uGMT_Offset;
  140. } VolumeTimestamp;
  141. struct PrimaryVolumeDesc {
  142. UINT8 uVolumeDescType;
  143. BYTE  aStandardID[STANDARD_ID_LEN];
  144. UINT8 uVolumeDescVersion;
  145. UINT8 uUnused1;
  146. BYTE sSystemID[32];
  147. BYTE sVolumeID[32];
  148. BYTE aUnused2[8];
  149. BB32 dwVolumeSpaceSize;
  150. BYTE aUnused3[32];
  151. BB16 uVolumeSetSize;
  152. BB16 uVolumeSequenceNumber;
  153. BB16 uLogicalBlockSize;
  154. BB32 dwPathTableSize;
  155. LB32 dwLocationOfLPathTable;
  156. LB32 dwLocationOfOptionalLPathTable;
  157. MB32 dwLoactionOfMPathTable;
  158. MB32 dwLoactionOfOptionalMPathTable;
  159. struct ReservedDirRecord rdrRootDir;
  160. BYTE sVolumeSetID[MAX_ID_LENGTH];
  161. BYTE sPublisherID[MAX_ID_LENGTH];
  162. BYTE sDataPreparerID[MAX_ID_LENGTH];
  163. BYTE sApplicationID[MAX_ID_LENGTH];
  164. BYTE sCopyrightFileID[37];
  165. BYTE sAbstractFileID[37];
  166. BYTE sBibliographicFileID[37];
  167. VolumeTimestamp vtsCreation;
  168. VolumeTimestamp vtsModification;
  169. VolumeTimestamp vtsExpiration;
  170. VolumeTimestamp vtsEffective;
  171. UINT8 uFileStructureVersion;
  172. UINT8 uReserved;
  173. BYTE aApplicationUse[512];
  174. BYTE aReserved[653];
  175. };
  176. // Supplementary Volume Descriptor (ECMA-119 8.5)
  177. struct SupplementaryVolumeDesc {
  178. UINT8 uVolumeDescType;
  179. BYTE  aStandardID[STANDARD_ID_LEN];
  180. UINT8 uVolumeDescVersion;
  181. UINT8 uVolumeFlags;
  182. BYTE sSystemID[32];
  183. BYTE sVolumeID[32];
  184. BYTE aUnused1[8];
  185. BB32 dwVolumeSpaceSize;
  186. BYTE aEscapeSequences[32];
  187. BB16 uVolumeSetSize;
  188. BB16 uVolumeSequenceNumber;
  189. BB16 uLogicalBlockSize;
  190. BB32 dwPathTableSize;
  191. LB32 dwLocationOfLPathTable;
  192. LB32 dwLocationOfOptionalLPathTable;
  193. MB32 dwLoactionOfMPathTable;
  194. MB32 dwLoactionOfOptionalMPathTable;
  195. struct ReservedDirRecord rdrRootDir;
  196. BYTE sVolumeSetID[MAX_ID_LENGTH];
  197. BYTE sPublisherID[MAX_ID_LENGTH];
  198. BYTE sDataPreparerID[MAX_ID_LENGTH];
  199. BYTE sApplicationID[MAX_ID_LENGTH];
  200. BYTE sCopyrightFileID[37];
  201. BYTE sAbstractFileID[37];
  202. BYTE sBibliographicFileID[37];
  203. VolumeTimestamp vtsCreation;
  204. VolumeTimestamp vtsModification;
  205. VolumeTimestamp vtsExpiration;
  206. VolumeTimestamp vtsEffective;
  207. UINT8 uFileStructureVersion;
  208. UINT8 uReserved;
  209. BYTE aApplicationUse[512];
  210. BYTE aReserved[653];
  211. };
  212. // Volume Partition Descriptor (ECMA-119 8.6)
  213. struct VolumePartitionDesc {
  214. UINT8 uVolumeDescType;
  215. BYTE  aStandardID[STANDARD_ID_LEN];
  216. UINT8 uVolumeDescVersion;
  217. UINT8 uUnused;
  218. BYTE aSystemID[32];
  219. BYTE aVolumePartitionID[32];
  220. BB32 dwVolumePartitionLocation;
  221. BB32 dwVolumePartitionSize;
  222. BYTE aSystemUse[1960];
  223. };
  224. /////////////////////////////////////////////////////////////////////////////
  225. // File and Directory Descriptors (ECMA-119 9)
  226. // Directory/File Record (ECMA-119 9.1)
  227. struct DirFileRecord {
  228. UINT8 cbLengthOfDirRecord;
  229. UINT8 cbExtendedAttrRecordLength;
  230. BB32  dwExtentLocation;
  231. BB32  dwDataLength;
  232. RecordTimestamp rtsRecording;
  233. UINT8 uFlags;
  234. UINT8 uFileUnitSize;
  235. UINT8 uInterleaveGapSize;
  236. BB16  uVolumeSequenceNumber;
  237. UINT8 cbLengthOfFileID;
  238. BYTE sFileID[];
  239. BYTE aPadding[];
  240. BYTE aSystemUse[];
  241. };
  242. struct FILEREC
  243. {  // Total size MUST fit a multiple of DWORDs 
  244.      UINT32 StartAddr;   /* 4 bytes : Location start block address */
  245.     UINT32 Size;      /* 4 bytes : File size in Bytes */
  246.      WCHAR Name[CLIPS_MAX_FILENAME_LEN];      /* xx bytes : File Name */
  247. UINT8  FileType;  /* 1 byte ; index of the file type */
  248. };
  249. #define FILE_FLAGS_HIDDEN 0x01
  250. #define FILE_FLAGS_DIRECTORY 0x02
  251. #define FILE_FLAGS_ASSOCIATED 0x04
  252. #define FILE_FLAGS_RECORD_VALID 0x08
  253. #define FILE_FLAGS_PROTECTION 0x10
  254. #define FILE_FLAGS_MULTI_EXT 0x80
  255. #define FILE_FILEID_CURRENT "0"
  256. #define FILE_FILEID_PARENT "1"
  257. // The following two variants of the Dir/File Record are used to access the
  258. // members in a 32-bit Word-aligned manner.
  259. struct DirFileRecord_Aligned {
  260. BYTE aPadding[2];
  261. struct DirFileRecord dfrRec;
  262. };
  263. struct ReservedDirRecord_Aligned {
  264. BYTE aPadding[2];
  265. struct ReservedDirRecord rdrRec;
  266. };
  267. // DVD Copyright-Management Information of System-Use (DVD-ROM Spec., Part 2: File-System, 3.7.2)
  268. struct DirFileRecordSystemUse_DVD {
  269. BYTE  ucCGMSInfo;
  270. UINT8 uDataStructureType;
  271. BYTE  aProtectionSystemInfo[4];
  272. };
  273. // Path-Table Record (ECMA-119 9.4)
  274. struct PathTableRecord {
  275. UINT8 cbLengthOfDirID;
  276. UINT8 cbExtendedAttrRecordLength;
  277. #ifdef MOTOROLA
  278. MB32  dwExtentLocation;
  279. MB16  uParentDirNumber;
  280. #else
  281. LB32  dwExtentLocation;
  282. LB16  uParentDirNumber;
  283. #endif //MOTOROLA
  284. BYTE  sDirID[];
  285. BYTE  aPadding[];
  286. };
  287. // The following variant of the Path-Table Record is used to access the
  288. // members in a 32-bit Word-aligned manner.
  289. struct PathTableRecord_Aligned {
  290. BYTE aPadding[2];
  291. struct PathTableRecord ptrRec;
  292. };
  293. // Extended Attribute Record (ECMA-119 9.5)
  294. // Note: This class is not required
  295. /////////////////////////////////////////////////////////////////////////////
  296. // Implementation-Specific auxiliary structures
  297. struct GenericVolumeStructureDesc_Base {
  298. UINT8 uVolumeDescType;
  299. BYTE aStandardID[STANDARD_ID_LEN];
  300. UINT8 uVolumeDescVersion;
  301. };
  302. #define PARTIAL_VOLUME_DESC_OFFSET 40
  303. #define DATA_PREPARER_IDENTIFIER_OFFSET    446
  304. struct VolumeDesc_Partial {
  305. BYTE sVolumeID[32];
  306. BYTE aUnused2[8];
  307. BB32 dwVolumeSpaceSize;
  308. BYTE aEscapeSequences[32];
  309. BB16 uVolumeSetSize;
  310. BB16 uVolumeSequenceNumber;
  311. BB16 uLogicalBlockSize;
  312. BB32 dwPathTableSize;
  313. LB32 dwLocationOfLPathTable;
  314. LB32 dwLocationOfOptionalLPathTable;
  315. MB32 dwLoactionOfMPathTable;
  316. MB32 dwLoactionOfOptionalMPathTable;
  317. struct ReservedDirRecord rdrRootDir;
  318. };
  319. #pragma pack()
  320. #endif //__ECMA_119_H_