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.

225 lines
3.9 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. eaheader.hxx
  5. Abstract:
  6. This class models the header and tables of the EA file.
  7. Notes:
  8. Luckily all the structures are well aligned.
  9. --*/
  10. #if !defined(EA_HEADER_DEFN)
  11. #define EA_HEADER_DEFN
  12. #include "cluster.hxx"
  13. #if defined ( _AUTOCHECK_ ) || defined( _EFICHECK_ )
  14. #define UFAT_EXPORT
  15. #elif defined ( _UFAT_MEMBER_ )
  16. #define UFAT_EXPORT __declspec(dllexport)
  17. #else
  18. #define UFAT_EXPORT __declspec(dllimport)
  19. #endif
  20. //
  21. // Forward references
  22. //
  23. DECLARE_CLASS( EA_HEADER );
  24. DECLARE_CLASS( FAT );
  25. DECLARE_CLASS( FAT_SA );
  26. DECLARE_CLASS( LOG_IO_DP_DRIVE );
  27. DECLARE_CLASS( MEM );
  28. struct _EA_FILE_HEADER {
  29. USHORT Signature;
  30. USHORT FormatType;
  31. USHORT LogType;
  32. USHORT Cluster1;
  33. USHORT NewCValue1;
  34. USHORT Cluster2;
  35. USHORT NewCValue2;
  36. USHORT Cluster3;
  37. USHORT NewCValue3;
  38. USHORT Handle;
  39. USHORT NewHOffset;
  40. UCHAR Reserved[10];
  41. };
  42. DEFINE_TYPE( struct _EA_FILE_HEADER, EA_FILE_HEADER );
  43. CONST BaseTableSize = 240;
  44. struct _EA_MAP_TBL {
  45. USHORT BaseTab[BaseTableSize];
  46. USHORT OffTab[1];
  47. };
  48. DEFINE_TYPE( struct _EA_MAP_TBL, EA_MAP_TBL );
  49. struct _EA_HEADER_AND_TABLE {
  50. EA_FILE_HEADER Header;
  51. EA_MAP_TBL Table;
  52. };
  53. DEFINE_TYPE( struct _EA_HEADER_AND_TABLE, EA_HEADER_AND_TABLE );
  54. CONST USHORT HeaderSignature = 0x4445;
  55. CONST USHORT CurrentFormatType = 0;
  56. CONST USHORT CurrentLogType = 0;
  57. CONST USHORT Bit15 = 0x8000;
  58. CONST USHORT InvalidHandle = 0xFFFF;
  59. class EA_HEADER : public CLUSTER_CHAIN {
  60. public:
  61. UFAT_EXPORT
  62. DECLARE_CONSTRUCTOR( EA_HEADER );
  63. VIRTUAL
  64. UFAT_EXPORT
  65. ~EA_HEADER(
  66. );
  67. NONVIRTUAL
  68. UFAT_EXPORT
  69. BOOLEAN
  70. Initialize(
  71. IN OUT PMEM Mem,
  72. IN OUT PLOG_IO_DP_DRIVE Drive,
  73. IN PFAT_SA FatSuperArea,
  74. IN PCFAT Fat,
  75. IN ULONG StartingCluster,
  76. IN ULONG LengthOfChain DEFAULT 0
  77. );
  78. NONVIRTUAL
  79. PEA_FILE_HEADER
  80. GetEaFileHeader(
  81. );
  82. NONVIRTUAL
  83. PEA_MAP_TBL
  84. GetMapTable(
  85. );
  86. NONVIRTUAL
  87. LONG
  88. QueryOffTabSize(
  89. ) CONST;
  90. NONVIRTUAL
  91. UFAT_EXPORT
  92. USHORT
  93. QueryEaSetClusterNumber(
  94. IN USHORT Handle
  95. ) CONST;
  96. private:
  97. NONVIRTUAL
  98. VOID
  99. Construct(
  100. );
  101. NONVIRTUAL
  102. VOID
  103. Destroy(
  104. );
  105. PEA_HEADER_AND_TABLE _ht;
  106. LONG _off_tab_size;
  107. };
  108. INLINE
  109. PEA_FILE_HEADER
  110. EA_HEADER::GetEaFileHeader(
  111. )
  112. /*++
  113. Routine Description:
  114. This routine returns a pointer to the EA file header. Dereferencing
  115. this pointer will allow the client to examine and modify the
  116. EA file header. These changes will take effect on disk when the
  117. client issues a 'Write' command.
  118. Arguments:
  119. None.
  120. Return Value:
  121. A pointer to the EA file header.
  122. --*/
  123. {
  124. return _ht ? &_ht->Header : NULL;
  125. }
  126. INLINE
  127. PEA_MAP_TBL
  128. EA_HEADER::GetMapTable(
  129. )
  130. /*++
  131. Routine Description:
  132. This routine returns a pointer to the EA mapping table. Dereferencing
  133. this pointer will allow the client to examine and modify the
  134. EA mapping table. These changes will take effect on disk when the
  135. client issues a 'Write' command.
  136. Arguments:
  137. None.
  138. Return Value:
  139. A pointer to the EA mapping table.
  140. --*/
  141. {
  142. return _ht ? &_ht->Table : NULL;
  143. }
  144. INLINE
  145. LONG
  146. EA_HEADER::QueryOffTabSize(
  147. ) CONST
  148. /*++
  149. Routine Description:
  150. Computes the number of entries in the offset table.
  151. Arguments:
  152. None.
  153. Return Value:
  154. Returns the number of entries in the offset table.
  155. --*/
  156. {
  157. return _off_tab_size;
  158. }
  159. #endif // EA_HEADER_DEFN