Source code of Windows XP (NT5)
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.

276 lines
10 KiB

  1. /******************************************************************************
  2. **
  3. ** Copyright 1999 Adaptec, Inc., All Rights Reserved.
  4. **
  5. ** This software contains the valuable trade secrets of Adaptec. The
  6. ** software is protected under copyright laws as an unpublished work of
  7. ** Adaptec. Notice is for informational purposes only and does not imply
  8. ** publication. The user of this software may make copies of the software
  9. ** for use with parts manufactured by Adaptec or under license from Adaptec
  10. ** and for no other use.
  11. **
  12. ******************************************************************************/
  13. /******************************************************************************
  14. **
  15. ** Module Name: ImageFile.h
  16. **
  17. ** Description:
  18. **
  19. ** Programmers: Daniel Evers (dle)
  20. **
  21. ** History: 1999 98 03 (dle) Initial creation for Millenium.
  22. **
  23. ** Notes: This file created using 4 spaces per tab.
  24. **
  25. ******************************************************************************/
  26. #ifndef __IMAGE_H__
  27. #define __IMAGE_H__
  28. /*
  29. ** Make sure structures are byte aligned and fields are undecorated.
  30. */
  31. #pragma pack(1)
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif //__cplusplus
  35. /*
  36. * Constant declarations section.
  37. */
  38. #define IMAGE_SIGNATURE 'araK'
  39. #define IMAGE_VERSION_EDIT ((DWORD)( 0x0001 ))
  40. #define IMAGE_VERSION_LO ((DWORD)( 0x02 ))
  41. #define IMAGE_VERSION_HI ((DWORD)( 0x01 ))
  42. #define IMAGE_VERSION ((( IMAGE_VERSION_HI << 24 ) & 0xff000000 ) | \
  43. (( IMAGE_VERSION_LO << 16 ) & 0x00ff0000 ) | \
  44. ( IMAGE_VERSION_EDIT & 0x0000ffff ))
  45. #define IMAGE_TYPE_REDBOOK_AUDIO_BLOCKSIZE 2352 // or 0x930
  46. #define IMAGE_TYPE_DATA_MODE1_BLOCKSIZE 2048 // or 0x800
  47. /*
  48. * Type definitions section.
  49. */
  50. // Following are the definitions used to describe the content of the
  51. // image file for various content types.
  52. typedef enum {
  53. eImageRecorderModeTrackAtOnce = 1,
  54. eImageRecorderModeSessionAtOnce,
  55. eImageRecorderModeDiscAtOnce,
  56. eImageRecorderModeMAX
  57. } IMAGE_RECORDER_MODE_ENUM;
  58. typedef enum {
  59. eImageDiscFormatDataMode1 = 1,
  60. eImageDiscFormatAudioRedbook,
  61. eImageDiscFormatMAX
  62. } IMAGE_DISC_FORMAT_ENUM;
  63. typedef enum {
  64. eImageSectionDescConstantBlockStash = 1,
  65. eImageSectionDescMAX
  66. } IMAGE_SECTION_DESCRIPTOR_TYPE_ENUM;
  67. typedef enum {
  68. eImageSectionDataDataMode1 = 1,
  69. eImageSectionDataAudioRedbook,
  70. eImageSectionDataMAX
  71. } IMAGE_SECTION_DATA_TYPE_ENUM;
  72. typedef enum {
  73. eImageSourceTypeStashFile = 1,
  74. eImageSourceTypeMAX
  75. } IMAGE_SOURCE_TYPE_ENUM;
  76. // The structure of the image file ready to be burned as a Redboook
  77. // audio disc is simply a series of tracks, already in the 2352-byte
  78. // block-size format:
  79. //
  80. //
  81. // |------------------------------------------------------------
  82. // | Track 1 (N1 blocks of 2352 bytes)
  83. // |------------------------------------------------------------
  84. // | Track 2 (N2 blocks of 2352 bytes)
  85. // |------------------------------------------------------------
  86. // | ...
  87. // |------------------------------------------------------------
  88. // | Track T (NT blocks of 2352 bytes)
  89. // |------------------------------------------------------------
  90. //
  91. // The structure of the image file ready to be burned as a Mode 1 Data disc:
  92. // This diagram is of a Joliet (a derivative of ISO 9660) data disc for example.
  93. // The on-disk structure is simply the complete set of 2048 blocks that are to
  94. // comprise the single data-track. Coincidentally, this is the strcture of
  95. // an ISO9660 image file, so tools like CDWorkshop may be used to view the
  96. // image in the on-disk stash file.
  97. //
  98. // |------------------------------------------------------------
  99. // | Block 0 (zeroes) (2048 bytes)
  100. // |------------------------------------------------------------
  101. // | Block 1 (zeroes) (2048 bytes)
  102. // |------------------------------------------------------------
  103. // | ...
  104. // |------------------------------------------------------------
  105. // | Block 15 (zeroes) (2048 bytes)
  106. // |------------------------------------------------------------
  107. // | Block 16 (ISO 9660 PVD) (2048 bytes)
  108. // |------------------------------------------------------------
  109. // | Block 17 (SVD) (2048 bytes)
  110. // |------------------------------------------------------------
  111. // | Block 18 (file system or data) (2048 bytes)
  112. // |------------------------------------------------------------
  113. // | Block 19 (file system or data) (2048 bytes)
  114. // |------------------------------------------------------------
  115. // | ...
  116. // |------------------------------------------------------------
  117. // | Block T (file system or data) (2048 bytes)
  118. // |------------------------------------------------------------
  119. //
  120. // The in-memory structure (the Content List) used to describe the
  121. // stash-file is as follows (structure definitions follow):
  122. //
  123. // |------------------------------------------------------------
  124. // | IMAGE_CONTENT_LIST
  125. // |------------------------------------------------------------
  126. // | IMAGE_DESCRIPTOR_HEADER
  127. // |------------------------------------------------------------
  128. // | IMAGE_SOURCE_DESCRIPTOR (including ndwSectionCount = N)
  129. // |------------------------------------------------------------
  130. // | IMAGE_SECTION_DESCRIPTOR 1
  131. // |------------------------------------------------------------
  132. // | IMAGE_SECTION_DESCRIPTOR 2
  133. // |------------------------------------------------------------
  134. // | ...
  135. // |------------------------------------------------------------
  136. // | IMAGE_SECTION_DESCRIPTOR N
  137. // |------------------------------------------------------------
  138. typedef struct {
  139. // Block size in source.
  140. DWORD dwBlockSize;
  141. // Number of blocks in the track.
  142. DWORD ndwBlockCount;
  143. // 1-based Track Number.
  144. DWORD idwTrackNumber;
  145. // Must be zero.
  146. DWORD dwaReserved[ 5 ];
  147. // liOffsetStart and liOffsetEnd point to the starting and
  148. // ending bytes within the image of the track. Subtracting
  149. // liOffsetStart from liOffsetEnd must equal (dwBlockSize * ndwBlockCount).
  150. LARGE_INTEGER liOffsetStart;
  151. LARGE_INTEGER liOffsetEnd;
  152. } IMAGE_SECTION_CONSTANT_BLOCK_TRACK, *PIMAGE_SECTION_CONSTANT_BLOCK_TRACK;
  153. typedef struct {
  154. // IMAGE_SECTION_DESCRIPTOR_TYPE_ENUM
  155. DWORD dwSectionDescType;
  156. // IMAGE_SECTION_DATA_TYPE_ENUM
  157. DWORD dwSectionDataType;
  158. DWORD dwDescriptorSize;
  159. // Flags:
  160. // None defined -- must be zero.
  161. DWORD dwFlags;
  162. // Must be IMAGE_SIGNATURE.
  163. DWORD dwSignature;
  164. DWORD dwaReserved[ 3 ];
  165. union {
  166. IMAGE_SECTION_CONSTANT_BLOCK_TRACK dataConstantBlockTrack;
  167. } dcbt;
  168. } IMAGE_SECTION_DESCRIPTOR, *PIMAGE_SECTION_DESCRIPTOR;
  169. typedef struct {
  170. HANDLE hStashFileHandle;
  171. void *pIDiscStash;
  172. DWORD dwaReserved[ 4 ];
  173. } IMAGE_SOURCE_TYPE_STASH, *PIMAGE_SOURCE_TYPE_STASH;
  174. typedef struct {
  175. // sizeof( IMAGE_SOURCE_DESCRIPTOR )
  176. DWORD dwHeaderSize;
  177. // None defined -- must be zero.
  178. DWORD dwFlags;
  179. // IMAGE_SIGNATURE
  180. DWORD dwSignature;
  181. // IMAGE_SOURCE_TYPE_ENUM
  182. DWORD dwSourceType;
  183. // Must be zero.
  184. DWORD dwaReserved[ 4 ];
  185. union {
  186. IMAGE_SOURCE_TYPE_STASH sourceStash;
  187. } ss;
  188. } IMAGE_SOURCE_DESCRIPTOR, *PIMAGE_SOURCE_DESCRIPTOR;
  189. typedef struct {
  190. // sizeof( IMAGE_DESCRIPTOR_HEADER )
  191. DWORD dwHeaderSize;
  192. // IMAGE_DISC_FORMAT_ENUM
  193. DWORD dwDiscFormat;
  194. // None defined -- must be zero.
  195. DWORD dwFlags;
  196. // IMAGE_RECORDER_MODE_ENUM
  197. DWORD dwRecorderMode;
  198. // Section count
  199. DWORD ndwSectionCount;
  200. // IMAGE_SIGNATURE
  201. DWORD dwSignature;
  202. // Must be IMAGE_VERSION.
  203. DWORD dwVersion;
  204. // Must be zero.
  205. DWORD dwaReserved[ 5 ];
  206. } IMAGE_DESCRIPTOR_HEADER, *PIMAGE_DESCRIPTOR_HEADER;
  207. typedef struct {
  208. // sizeof( IMAGE_CONTENT_LIST )
  209. DWORD dwHeaderSize;
  210. // None defined -- must be zero.
  211. DWORD dwFlags;
  212. // IMAGE_SIGNATURE
  213. DWORD dwSignature;
  214. // Must be IMAGE_VERSION.
  215. DWORD dwVersion;
  216. // Sum of all size of all sections.
  217. DWORD dwContentListSize;
  218. // Must be zero.
  219. DWORD dwaReserved[ 3 ];
  220. } IMAGE_CONTENT_LIST, *PIMAGE_CONTENT_LIST;
  221. /*
  222. * Macro definitions section.
  223. */
  224. #define IMAGE_GETVERSION_EDIT( Version ) LOWORD( Version )
  225. #define IMAGE_GETVERSION_LO( Version ) LOBYTE( HIWORD( Version ))
  226. #define IMAGE_GETVERSION_HI( Version ) HIBYTE( HIWORD( Version ))
  227. /*
  228. ** Restore compiler default packing and close off the C declarations.
  229. */
  230. #pragma pack()
  231. #ifdef __cplusplus
  232. }
  233. #endif //__cplusplus
  234. #endif //__IMAGE_H__