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.

308 lines
5.9 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. supera.hxx
  5. Abstract:
  6. This class models the root of a file system. This abstract class is
  7. currently the base class of an HPFS and a FAT super area.
  8. --*/
  9. #if !defined(SUPERA_DEFN)
  10. #define SUPERA_DEFN
  11. #include "secrun.hxx"
  12. #include "volume.hxx"
  13. #if defined ( _AUTOCHECK_ ) || defined( _EFICHECK_ )
  14. #define IFSUTIL_EXPORT
  15. #elif defined ( _IFSUTIL_MEMBER_ )
  16. #define IFSUTIL_EXPORT __declspec(dllexport)
  17. #else
  18. #define IFSUTIL_EXPORT __declspec(dllimport)
  19. #endif
  20. enum PHYSTYPE { // ptype
  21. PHYS_REMOVABLE, // physical drive is removable
  22. PHYS_FIXED = 0x80 // physical drive is fixed
  23. };
  24. //
  25. // These symbols are used by Chkdsk functions to return an appropriate
  26. // exit status to the chkdsk program.
  27. // In order of most important first, the error level order are as follows:
  28. // 3 > 1 > 2 > 0
  29. // An error level of 3 will overwrite an error level of 1, 2, or 0.
  30. #define CHKDSK_EXIT_SUCCESS 0
  31. #define CHKDSK_EXIT_ERRS_FIXED 1
  32. #define CHKDSK_EXIT_MINOR_ERRS 2 // whether or not "/f"
  33. #define CHKDSK_EXIT_CLEANUP_WORK 2 // whether or not "/f"
  34. #define CHKDSK_EXIT_COULD_NOT_CHK 3
  35. #define CHKDSK_EXIT_ERRS_NOT_FIXED 3
  36. #define CHKDSK_EXIT_COULD_NOT_FIX 3
  37. //
  38. // This macros updates the exit status of CHKDSK_INFO at the end of
  39. // a routine. It will not overwrite the exit status if an error
  40. // of level 3 has occurred.
  41. //
  42. #define UPDATE_EXIT_STATUS_FIXED(x, y) \
  43. if ((x) != CHKDSK_EXIT_SUCCESS && \
  44. (y)->ExitStatus != CHKDSK_EXIT_ERRS_NOT_FIXED) \
  45. (y)->ExitStatus = CHKDSK_EXIT_ERRS_FIXED;
  46. DECLARE_CLASS( SUPERAREA );
  47. DECLARE_CLASS( NUMBER_SET );
  48. DECLARE_CLASS( MESSAGE );
  49. DECLARE_CLASS( WSTRING );
  50. class SUPERAREA : public SECRUN {
  51. public:
  52. VIRTUAL
  53. IFSUTIL_EXPORT
  54. ~SUPERAREA(
  55. );
  56. VIRTUAL
  57. PVOID
  58. GetBuf(
  59. );
  60. VIRTUAL
  61. BOOLEAN
  62. Create(
  63. IN PCNUMBER_SET BadSectors,
  64. IN OUT PMESSAGE Message,
  65. IN PCWSTRING Label DEFAULT NULL,
  66. IN BOOLEAN BackwardCompatible DEFAULT TRUE,
  67. IN ULONG ClusterSize DEFAULT 0,
  68. IN ULONG VirtualSize DEFAULT 0
  69. ) PURE;
  70. VIRTUAL
  71. BOOLEAN
  72. VerifyAndFix(
  73. IN FIX_LEVEL FixLevel,
  74. IN OUT PMESSAGE Message,
  75. IN ULONG Flags DEFAULT FALSE,
  76. IN ULONG LogFileSize DEFAULT 0,
  77. OUT PULONG ExitStatus DEFAULT NULL,
  78. IN PCWSTRING DriveLetter DEFAULT NULL
  79. ) PURE;
  80. VIRTUAL
  81. BOOLEAN
  82. RecoverFile(
  83. IN PCWSTRING FullPathFileName,
  84. IN OUT PMESSAGE Message
  85. ) PURE;
  86. VIRTUAL
  87. PARTITION_SYSTEM_ID
  88. QuerySystemId(
  89. ) CONST PURE;
  90. STATIC
  91. IFSUTIL_EXPORT
  92. VOLID
  93. ComputeVolId(
  94. IN VOLID Seed DEFAULT 0
  95. );
  96. NTSTATUS
  97. FormatNotification(
  98. PWSTRING Label
  99. );
  100. NONVIRTUAL
  101. IFSUTIL_EXPORT
  102. PMESSAGE
  103. GetMessage(
  104. );
  105. NONVIRTUAL
  106. IFSUTIL_EXPORT
  107. PIO_DP_DRIVE
  108. GetDrive(
  109. );
  110. protected:
  111. IFSUTIL_EXPORT
  112. DECLARE_CONSTRUCTOR( SUPERAREA );
  113. NONVIRTUAL
  114. IFSUTIL_EXPORT
  115. BOOLEAN
  116. Initialize(
  117. IN OUT PMEM Mem,
  118. IN OUT PLOG_IO_DP_DRIVE Drive,
  119. IN SECTORCOUNT NumberOfSectors,
  120. IN OUT PMESSAGE Message
  121. );
  122. #if !defined( _SETUP_LOADER_ )
  123. NONVIRTUAL
  124. BOOLEAN
  125. SetSystemId(
  126. );
  127. #endif // _SETUP_LOADER_
  128. PLOG_IO_DP_DRIVE _drive;
  129. PUCHAR _bootcode;
  130. ULONG _bootcodesize;
  131. private:
  132. NONVIRTUAL
  133. VOID
  134. Construct(
  135. );
  136. NONVIRTUAL
  137. VOID
  138. Destroy(
  139. );
  140. };
  141. INLINE
  142. PVOID
  143. SUPERAREA::GetBuf(
  144. )
  145. /*++
  146. Routine Description:
  147. This routine returns a pointer to the beginning of the read/write
  148. buffer.
  149. Arguments:
  150. None.
  151. Return Value:
  152. A pointer to a read/write buffer.
  153. --*/
  154. {
  155. return SECRUN::GetBuf();
  156. }
  157. #if !defined( _SETUP_LOADER_ )
  158. INLINE
  159. BOOLEAN
  160. SUPERAREA::SetSystemId(
  161. )
  162. /*++
  163. Routine Description:
  164. Set the current volume's file system sub-type.
  165. The volume stores the file system type on disk with a
  166. strong bias to the FAT. However, this may not continue
  167. in the future so a common interface to this type is supported.
  168. The current on disk file system subtypes are:
  169. UNKNOWN, no format done yet
  170. 12 bit fat
  171. 16 bit fat on a < 32M volume
  172. 16 bit fat on a >= 32M volume
  173. IFS
  174. OS/2 2.0 does not support this interface so we must set the
  175. information via the MBR, NT will provide an ioctl to set this
  176. information.
  177. This information MUST be maintained to stay disk compatable.
  178. This activity should only be done by format so this is
  179. a protected method.
  180. Arguments:
  181. None.
  182. Return Value:
  183. FALSE - Failure.
  184. TRUE - Success.
  185. --*/
  186. {
  187. return _drive->SetSystemId(QuerySystemId());
  188. }
  189. INLINE
  190. PMESSAGE
  191. SUPERAREA::GetMessage(
  192. )
  193. /*++
  194. Routine Description:
  195. Retrieve the message object.
  196. Arguments:
  197. N/A
  198. Return Value:
  199. The message object.
  200. --*/
  201. {
  202. if (_drive)
  203. return _drive->GetMessage();
  204. else
  205. return NULL;
  206. }
  207. INLINE
  208. PIO_DP_DRIVE
  209. SUPERAREA::GetDrive(
  210. )
  211. /*++
  212. Routine Description:
  213. Retrieve the drive object.
  214. Arguments:
  215. N/A
  216. Return Value:
  217. The drive object.
  218. --*/
  219. {
  220. return _drive;
  221. }
  222. #endif // _SETUP_LOADER_
  223. #endif // SUPERA_DEFN