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.

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