Leaked source code of windows server 2003
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.

1414 lines
42 KiB

  1. /*++
  2. Copyright (c) 1991-2001 Microsoft Corporation
  3. Module Name:
  4. ntfssa.hxx
  5. Abstract:
  6. This class supplies the NTFS-only SUPERAREA methods.
  7. Author:
  8. Norbert P. Kusters (norbertk) 29-Jul-91
  9. --*/
  10. #if !defined(_NTFS_SUPERAREA_DEFN_)
  11. #define _NTFS_SUPERAREA_DEFN_
  12. #include "supera.hxx"
  13. #include "hmem.hxx"
  14. #include "untfs.hxx"
  15. #include "message.hxx"
  16. #include "ntfsbit.hxx"
  17. #include "numset.hxx"
  18. DECLARE_CLASS( NTFS_INDEX_TREE );
  19. DECLARE_CLASS( NTFS_MFT_INFO );
  20. #include "indxtree.hxx"
  21. #define CHKDSK_ALGORITHM_NOT_SPECIFIED 0xffff
  22. struct NTFS_CHKDSK_REPORT {
  23. BIG_INT NumUserFiles;
  24. BIG_INT BytesUserData;
  25. BIG_INT NumIndices;
  26. BIG_INT BytesInIndices;
  27. BIG_INT BytesLogFile;
  28. };
  29. DEFINE_POINTER_TYPES( NTFS_CHKDSK_REPORT );
  30. struct NTFS_CHKDSK_INFO {
  31. UCHAR major;
  32. UCHAR minor;
  33. VCN QuotaFileNumber;
  34. VCN ObjectIdFileNumber;
  35. VCN UsnJournalFileNumber;
  36. VCN ReparseFileNumber;
  37. BOOLEAN Verbose;
  38. ULONG NumFiles;
  39. ULONG BaseFrsCount;
  40. BIG_INT TotalNumFileNames;
  41. PUSHORT NumFileNames; // array of length 'NumFiles'
  42. PSHORT ReferenceCount; // array of length 'NumFiles'
  43. NTFS_BITMAP FilesWithIndices;
  44. ULONG CountFilesWithIndices;
  45. NTFS_BITMAP IndexEntriesToCheck;
  46. BOOLEAN IndexEntriesToCheckIsSet;
  47. NUMBER_SET FilesWithEas;
  48. NUMBER_SET ChildFrs;
  49. NUMBER_SET BadFiles;
  50. NTFS_BITMAP FilesWhoNeedData;
  51. BOOLEAN CrossLinkYet; // Is the following field valid.
  52. ULONG CrossLinkedFile; // File cross-linked with following.
  53. ULONG CrossLinkedAttribute;
  54. DSTRING CrossLinkedName;
  55. ULONG CrossLinkStart; // Start of cross-linked portion.
  56. ULONG CrossLinkLength; // Length of cross-link.
  57. NUMBER_SET FilesWithNoReferences;
  58. NUMBER_SET FilesWithTooManyFileNames;
  59. NUMBER_SET FilesWithObjectId;
  60. NTFS_BITMAP FilesWithReparsePoint;
  61. ULONG TotalNumSID;
  62. ULONG ExitStatus; // To be returned to chkdsk.exe
  63. #if defined(_AUTOCHECK_)
  64. ULONG AvailablePages;
  65. #endif
  66. };
  67. DEFINE_POINTER_TYPES( NTFS_CHKDSK_INFO );
  68. //
  69. // NTFS_CENSUS_INFO -- this is used by convert to determine how
  70. // much space will be needed to convert an NTFS volume.
  71. //
  72. struct NTFS_CENSUS_INFO {
  73. ULONG NumFiles; // Total number of files on volume.
  74. ULONG BytesLgResidentFiles; // Bytes in "large" resident files.
  75. ULONG BytesIndices; // Bytes in indices.
  76. ULONG BytesExternalExtentLists;
  77. ULONG BytesFileNames; // Total bytes in file name attributes.
  78. };
  79. DEFINE_POINTER_TYPES( NTFS_CENSUS_INFO );
  80. DECLARE_CLASS( LOG_IO_DP_DRIVE );
  81. DECLARE_CLASS( WSTRING );
  82. DECLARE_CLASS( NTFS_MASTER_FILE_TABLE );
  83. DECLARE_CLASS( NTFS_BITMAP );
  84. DECLARE_CLASS( NTFS_FILE_RECORD_SEGMENT );
  85. DECLARE_CLASS( NTFS_ATTRIBUTE );
  86. DECLARE_CLASS( NTFS_ATTRIBUTE_COLUMNS );
  87. DECLARE_CLASS( NTFS_FRS_STRUCTURE );
  88. DECLARE_CLASS( NTFS_ATTRIBUTE_LIST );
  89. DECLARE_CLASS( CONTAINER );
  90. DECLARE_CLASS( SEQUENTIAL_CONTAINER );
  91. DECLARE_CLASS( LIST );
  92. DECLARE_CLASS( NTFS_EXTENT_LIST );
  93. DECLARE_CLASS( NUMBER_SET );
  94. DECLARE_CLASS( NTFS_UPCASE_TABLE );
  95. DECLARE_CLASS( DIGRAPH );
  96. DECLARE_CLASS( NTFS_LOG_FILE );
  97. DECLARE_CLASS( NTFS_MFT_FILE );
  98. //
  99. // Types of message for SynchronizeMft()
  100. //
  101. enum MessageMode {
  102. CorrectMessage = 0,
  103. SuppressMessage,
  104. UpdateMessage
  105. };
  106. // This global variable used by CHKDSK to compute the largest
  107. // LSN on the volume.
  108. extern LSN LargestLsnEncountered;
  109. extern LARGE_INTEGER LargestUsnEncountered;
  110. extern ULONG64 FrsOfLargestUsnEncountered;
  111. CONST ULONG LsnResetThreshholdHighPart = 0x10000;
  112. CONST UCHAR UpdateSequenceArrayCheckValueMinorError = 2;// should always be non-zero
  113. CONST UCHAR UpdateSequenceArrayCheckValueOk = 1; // should always be non-zero
  114. BOOLEAN
  115. ExtractExtendInfo(
  116. IN OUT PNTFS_INDEX_TREE Index,
  117. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  118. IN OUT PMESSAGE Message
  119. );
  120. BOOLEAN
  121. UpdateChkdskInfo(
  122. IN OUT PNTFS_FRS_STRUCTURE Frs,
  123. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  124. IN OUT PMESSAGE Message
  125. );
  126. class NTFS_SA : public SUPERAREA {
  127. public:
  128. UNTFS_EXPORT
  129. DECLARE_CONSTRUCTOR(NTFS_SA);
  130. VIRTUAL
  131. UNTFS_EXPORT
  132. ~NTFS_SA(
  133. );
  134. NONVIRTUAL
  135. UNTFS_EXPORT
  136. BOOLEAN
  137. Initialize(
  138. IN OUT PLOG_IO_DP_DRIVE Drive,
  139. IN OUT PMESSAGE Message,
  140. IN LCN CvtStartZone DEFAULT 0,
  141. IN BIG_INT CvtZoneSize DEFAULT 0
  142. );
  143. VIRTUAL
  144. PVOID
  145. GetBuf(
  146. );
  147. VIRTUAL
  148. BOOLEAN
  149. Create(
  150. IN PCNUMBER_SET BadSectors,
  151. IN OUT PMESSAGE Message,
  152. IN PCWSTRING Label DEFAULT NULL,
  153. IN ULONG Flags DEFAULT FORMAT_BACKWARD_COMPATIBLE,
  154. IN ULONG ClusterSize DEFAULT 0,
  155. IN ULONG VirtualSectors DEFAULT 0
  156. );
  157. VIRTUAL
  158. BOOLEAN
  159. Create(
  160. IN PCNUMBER_SET BadSectors,
  161. IN ULONG ClusterFactor,
  162. IN ULONG FrsSize,
  163. IN ULONG ClustersPerIndexBuffer,
  164. IN ULONG InitialLogFileSize,
  165. IN BOOLEAN BackwardCompatible,
  166. IN OUT PMESSAGE Message,
  167. IN PCWSTRING Label DEFAULT NULL
  168. );
  169. NONVIRTUAL
  170. UNTFS_EXPORT
  171. BOOLEAN
  172. CreateElementaryStructures(
  173. IN OUT PNTFS_BITMAP VolumeBitmap,
  174. IN ULONG ClusterFactor,
  175. IN ULONG FrsSize,
  176. IN ULONG IndexBufferSize,
  177. IN ULONG InitialLogFileSize,
  178. IN PCNUMBER_SET BadSectors,
  179. IN BOOLEAN BackwardCompatible,
  180. IN BOOLEAN IsConvert,
  181. IN OUT PMESSAGE Message,
  182. IN PBIOS_PARAMETER_BLOCK OldBpb OPTIONAL,
  183. IN PCWSTRING Label DEFAULT NULL
  184. );
  185. STATIC
  186. UNTFS_EXPORT
  187. ULONG
  188. QuerySectorsInElementaryStructures(
  189. IN PCDP_DRIVE Drive,
  190. IN ULONG ClusterFactor DEFAULT 0,
  191. IN ULONG FrsSize DEFAULT 0,
  192. IN ULONG ClustersPerIndexBuffer DEFAULT 0,
  193. IN ULONG InitialLogFileSize DEFAULT 0
  194. );
  195. STATIC
  196. ULONG
  197. QueryDefaultClusterFactor(
  198. IN PCDP_DRIVE Drive
  199. );
  200. STATIC
  201. UNTFS_EXPORT
  202. ULONG
  203. QueryDefaultFrsSize(
  204. IN PCDP_DRIVE Drive,
  205. IN ULONG ClusterFactor
  206. );
  207. STATIC
  208. UNTFS_EXPORT
  209. ULONG
  210. QueryDefaultClustersPerIndexBuffer(
  211. IN PCDP_DRIVE Drive,
  212. IN ULONG ClusterFactor
  213. );
  214. VIRTUAL
  215. BOOLEAN
  216. VerifyAndFix(
  217. IN FIX_LEVEL FixLevel,
  218. IN OUT PMESSAGE Message,
  219. IN ULONG Flags,
  220. IN ULONG DesiredLogFileSize DEFAULT 0,
  221. IN USHORT Algorithm DEFAULT 0,
  222. OUT PULONG ExitStatus DEFAULT NULL,
  223. IN PCWSTRING DriveLetter DEFAULT NULL
  224. );
  225. VIRTUAL
  226. BOOLEAN
  227. RecoverFile(
  228. IN PCWSTRING FullPathFileName,
  229. IN OUT PMESSAGE Message
  230. );
  231. UNTFS_EXPORT
  232. BOOLEAN
  233. Read(
  234. );
  235. UNTFS_EXPORT
  236. BOOLEAN
  237. Read(
  238. IN OUT PMESSAGE Message
  239. );
  240. VIRTUAL
  241. BOOLEAN
  242. Write(
  243. );
  244. VIRTUAL
  245. BOOLEAN
  246. Write(
  247. IN OUT PMESSAGE Message
  248. );
  249. NONVIRTUAL
  250. BIG_INT
  251. QueryVolumeSectors(
  252. ) CONST;
  253. NONVIRTUAL
  254. VOID
  255. SetVolumeSectors(
  256. BIG_INT NewVolumeSectors
  257. );
  258. NONVIRTUAL
  259. UNTFS_EXPORT
  260. UCHAR
  261. QueryClusterFactor(
  262. ) CONST;
  263. NONVIRTUAL
  264. LCN
  265. QueryMftStartingLcn(
  266. ) CONST;
  267. NONVIRTUAL
  268. LCN
  269. QueryMft2StartingLcn(
  270. ) CONST;
  271. NONVIRTUAL
  272. VOID
  273. SetMftStartingLcn(
  274. IN LCN Lcn
  275. );
  276. NONVIRTUAL
  277. VOID
  278. SetMft2StartingLcn(
  279. IN LCN Lcn
  280. );
  281. UNTFS_EXPORT
  282. NONVIRTUAL
  283. BOOLEAN
  284. SetVolumeFlag(
  285. IN USHORT FlagsToSet,
  286. OUT PBOOLEAN CorruptVolume DEFAULT NULL
  287. );
  288. NONVIRTUAL
  289. ULONG
  290. QueryFrsSize(
  291. ) CONST;
  292. NONVIRTUAL
  293. PARTITION_SYSTEM_ID
  294. QuerySystemId(
  295. ) CONST;
  296. NONVIRTUAL
  297. LCN
  298. QueryCvtZone(
  299. ) CONST;
  300. NONVIRTUAL
  301. BIG_INT
  302. QueryCvtZoneSize(
  303. ) CONST;
  304. NONVIRTUAL
  305. UNTFS_EXPORT
  306. BOOLEAN
  307. WriteRemainingBootCode(
  308. );
  309. UNTFS_EXPORT
  310. NONVIRTUAL
  311. USHORT
  312. QueryVolumeFlagsAndLabel(
  313. OUT PBOOLEAN CorruptVolume DEFAULT NULL,
  314. OUT PUCHAR MajorVersion DEFAULT NULL,
  315. OUT PUCHAR MinorVersion DEFAULT NULL,
  316. OUT PWSTRING Label DEFAULT NULL
  317. );
  318. NONVIRTUAL
  319. BOOLEAN
  320. ClearVolumeFlag(
  321. IN USHORT FlagsToClear,
  322. IN OUT PNTFS_LOG_FILE LogFile OPTIONAL,
  323. IN BOOLEAN WriteSecondLogFilePage OPTIONAL,
  324. IN LSN LargestVolumeLsn OPTIONAL,
  325. OUT PBOOLEAN CorruptVolume DEFAULT NULL,
  326. IN BOOLEAN UpdateMirror DEFAULT FALSE
  327. );
  328. STATIC
  329. UCHAR
  330. PostReadMultiSectorFixup(
  331. IN OUT PVOID MultiSectorBuffer,
  332. IN ULONG BufferSize,
  333. IN OUT PIO_DP_DRIVE Drive,
  334. IN ULONG VaildSize DEFAULT MAXULONG
  335. );
  336. STATIC
  337. VOID
  338. PreWriteMultiSectorFixup(
  339. IN OUT PVOID MultiSectorBuffer,
  340. IN ULONG BufferSize
  341. );
  342. STATIC
  343. UNTFS_EXPORT
  344. BOOLEAN
  345. IsNtfsName(
  346. IN PCFILE_NAME FileName
  347. );
  348. STATIC
  349. UNTFS_EXPORT
  350. BOOLEAN
  351. IsDosName(
  352. IN PCFILE_NAME FileName
  353. );
  354. STATIC
  355. BOOLEAN
  356. IsValidLabel(
  357. IN PCWSTRING Label
  358. );
  359. NONVIRTUAL
  360. UNTFS_EXPORT
  361. BOOLEAN
  362. QueryFrsFromPath(
  363. IN PCWSTRING FullPathFileName,
  364. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  365. IN OUT PNTFS_BITMAP VolumeBitmap,
  366. OUT PNTFS_FILE_RECORD_SEGMENT TargetFrs,
  367. OUT PBOOLEAN SystemFile,
  368. OUT PBOOLEAN InternalError
  369. );
  370. NONVIRTUAL
  371. UNTFS_EXPORT
  372. BOOLEAN
  373. TakeCensus(
  374. IN PNTFS_MASTER_FILE_TABLE Mft,
  375. IN ULONG ResidentSizeThreshhold,
  376. OUT PNTFS_CENSUS_INFO Census
  377. );
  378. STATIC
  379. VOID
  380. SetVersionNumber(
  381. IN UCHAR Major,
  382. IN UCHAR Minor
  383. );
  384. STATIC
  385. VOID
  386. QueryVersionNumber(
  387. OUT PUCHAR Major,
  388. OUT PUCHAR Minor
  389. );
  390. STATIC
  391. BOOLEAN
  392. DumpMessagesToFile(
  393. IN PCWSTRING FileName,
  394. IN OUT PNTFS_MFT_FILE MftFile,
  395. IN OUT PMESSAGE Message
  396. );
  397. NONVIRTUAL
  398. BOOLEAN
  399. ResizeCleanLogFile(
  400. IN OUT PMESSAGE Message,
  401. IN BOOLEAN AlwaysResize,
  402. IN ULONG DesiredSize
  403. );
  404. NONVIRTUAL
  405. BOOLEAN
  406. DownGradeNtfs(
  407. IN OUT PMESSAGE Message,
  408. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  409. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo
  410. );
  411. NONVIRTUAL
  412. UCHAR
  413. GetNumberOfStages(
  414. );
  415. NONVIRTUAL
  416. VOID
  417. SetNumberOfStages(
  418. IN UCHAR Number
  419. );
  420. NONVIRTUAL
  421. NTSTATUS
  422. FilesReadAhead(
  423. IN BIG_INT TotalNumberOfFrs,
  424. IN PVCN FirstFrsNumber,
  425. IN PULONG NumberOfFrsToRead,
  426. IN PNTFS_FRS_STRUCTURE FrsStruc1,
  427. IN PNTFS_FRS_STRUCTURE FrsStruc2,
  428. IN PHMEM Hmem1,
  429. IN PHMEM Hmem2,
  430. OUT HANDLE ReadAhead,
  431. IN HANDLE ReadReady,
  432. IN PNTFS_ATTRIBUTE MftData,
  433. IN PNTFS_UPCASE_TABLE UpCaseTable
  434. );
  435. NONVIRTUAL
  436. NTSTATUS
  437. SDReadAhead(
  438. IN BIG_INT TotalNumberOfFrs,
  439. IN PVCN FirstFrsNumber,
  440. IN PULONG NumberOfFrsToRead,
  441. IN PNTFS_FILE_RECORD_SEGMENT Frs1,
  442. IN PNTFS_FILE_RECORD_SEGMENT Frs2,
  443. OUT HANDLE ReadAhead,
  444. IN HANDLE ReadReady,
  445. IN PNTFS_MASTER_FILE_TABLE Mft
  446. );
  447. VOID
  448. PrintFormatReport (
  449. IN OUT PMESSAGE Message,
  450. IN PFILE_FS_SIZE_INFORMATION FsSizeInfo,
  451. IN PFILE_FS_VOLUME_INFORMATION FsVolInfo
  452. );
  453. private:
  454. NONVIRTUAL
  455. BOOLEAN
  456. FetchMftDataAttribute(
  457. IN OUT PMESSAGE Message,
  458. OUT PNTFS_ATTRIBUTE MftData
  459. );
  460. NONVIRTUAL
  461. BOOLEAN
  462. RecoverMftDataAttribute(
  463. IN OUT PMESSAGE Message,
  464. OUT PNTFS_ATTRIBUTE MftData
  465. );
  466. NONVIRTUAL
  467. BOOLEAN
  468. ValidateAndAddExtent(
  469. IN VCN Vcn,
  470. IN LCN Lcn,
  471. IN BIG_INT RunLength,
  472. IN OUT PNTFS_EXTENT_LIST Extents
  473. );
  474. NONVIRTUAL
  475. BOOLEAN
  476. ValidateCriticalFrs(
  477. IN OUT PNTFS_ATTRIBUTE MftData,
  478. IN OUT PMESSAGE Message,
  479. IN FIX_LEVEL FixLevel
  480. );
  481. NONVIRTUAL
  482. BOOLEAN
  483. QueryDefaultAttributeDefinitionTable(
  484. OUT PNTFS_ATTRIBUTE_COLUMNS AttributeDefinitionTable,
  485. IN OUT PMESSAGE Message
  486. );
  487. NONVIRTUAL
  488. BOOLEAN
  489. FetchAttributeDefinitionTable(
  490. IN OUT PNTFS_ATTRIBUTE MftData,
  491. IN OUT PMESSAGE Message,
  492. OUT PNTFS_ATTRIBUTE_COLUMNS AttributeDefinitionTable
  493. );
  494. NONVIRTUAL
  495. BOOLEAN
  496. FetchUpcaseTable(
  497. IN OUT PNTFS_ATTRIBUTE MftData,
  498. IN OUT PMESSAGE Message,
  499. OUT PNTFS_UPCASE_TABLE UpcaseTable
  500. );
  501. NONVIRTUAL
  502. BOOLEAN
  503. VerifyAndFixMultiFrsFile(
  504. IN OUT PNTFS_FRS_STRUCTURE BaseFrs,
  505. IN OUT PNTFS_ATTRIBUTE_LIST AttributeList,
  506. IN PNTFS_ATTRIBUTE MftData,
  507. IN PCNTFS_ATTRIBUTE_COLUMNS AttributeDefTable,
  508. IN OUT PNTFS_BITMAP VolumeBitmap,
  509. IN OUT PNTFS_BITMAP MftBitmap,
  510. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  511. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  512. IN FIX_LEVEL FixLevel,
  513. IN OUT PMESSAGE Message,
  514. IN OUT PBOOLEAN DiskErrorsFound
  515. );
  516. NONVIRTUAL
  517. BOOLEAN
  518. QueryListOfFrs(
  519. IN PCNTFS_FRS_STRUCTURE BaseFrs,
  520. IN PCNTFS_ATTRIBUTE_LIST AttributeList,
  521. IN OUT PNTFS_ATTRIBUTE MftData,
  522. OUT PNUMBER_SET ChildFileNumbers,
  523. IN OUT PMESSAGE Message
  524. );
  525. NONVIRTUAL
  526. BOOLEAN
  527. VerifyAndFixChildFrs(
  528. IN PCNUMBER_SET ChildFileNumbers,
  529. IN PNTFS_ATTRIBUTE MftData,
  530. IN PCNTFS_ATTRIBUTE_COLUMNS AttributeDefTable,
  531. IN PNTFS_UPCASE_TABLE UpcaseTable,
  532. OUT PHMEM* ChildFrsHmemList,
  533. IN OUT PCONTAINER ChildFrsList,
  534. IN FIX_LEVEL FixLevel,
  535. IN OUT PMESSAGE Message,
  536. IN OUT PBOOLEAN DiskErrorsFound
  537. );
  538. NONVIRTUAL
  539. BOOLEAN
  540. EnsureWellDefinedAttrList(
  541. IN PNTFS_FRS_STRUCTURE BaseFrs,
  542. IN OUT PNTFS_ATTRIBUTE_LIST AttributeList,
  543. IN PCSEQUENTIAL_CONTAINER ChildFrsList,
  544. IN OUT PNTFS_BITMAP VolumeBitmap,
  545. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  546. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  547. IN FIX_LEVEL FixLevel,
  548. IN OUT PMESSAGE Message,
  549. IN OUT PBOOLEAN DiskErrorsFound
  550. );
  551. NONVIRTUAL
  552. BOOLEAN
  553. VerifyAndFixAttribute(
  554. IN PCLIST Attribute,
  555. IN OUT PNTFS_ATTRIBUTE_LIST AttributeList,
  556. IN OUT PNTFS_BITMAP VolumeBitmap,
  557. IN PCNTFS_FRS_STRUCTURE BaseFrs,
  558. OUT PBOOLEAN ErrorsFound,
  559. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  560. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  561. IN OUT PMESSAGE Message
  562. );
  563. NONVIRTUAL
  564. BOOLEAN
  565. EnsureSurjectiveAttrList(
  566. IN OUT PNTFS_FRS_STRUCTURE BaseFrs,
  567. IN PCNTFS_ATTRIBUTE_LIST AttributeList,
  568. IN OUT PSEQUENTIAL_CONTAINER ChildFrsList,
  569. IN FIX_LEVEL FixLevel,
  570. IN OUT PMESSAGE Message,
  571. IN OUT PBOOLEAN DiskErrorsFound
  572. );
  573. STATIC
  574. BOOLEAN
  575. AreBitmapsEqual(
  576. IN OUT PNTFS_ATTRIBUTE BitmapAttribute,
  577. IN PCNTFS_BITMAP Bitmap,
  578. IN BIG_INT MinimumBitmapSize OPTIONAL,
  579. IN OUT PMESSAGE Message,
  580. OUT PBOOLEAN CompleteFailure,
  581. OUT PBOOLEAN SecondIsSubset DEFAULT NULL
  582. );
  583. NONVIRTUAL
  584. BOOLEAN
  585. ValidateIndices(
  586. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  587. OUT PDIGRAPH DirectoryDigraph,
  588. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  589. IN PCNTFS_ATTRIBUTE_COLUMNS AttributeDefTable,
  590. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  591. IN OUT PNUMBER_SET BadClusters,
  592. IN USHORT Algorithm,
  593. IN BOOLEAN SkipEntriesScan,
  594. IN BOOLEAN SkipCycleScan,
  595. IN FIX_LEVEL FixLevel,
  596. IN OUT PMESSAGE Message,
  597. IN OUT PBOOLEAN DiskErrorsFound
  598. );
  599. NONVIRTUAL
  600. BOOLEAN
  601. VerifyAndFixIndex(
  602. IN PNTFS_CHKDSK_INFO ChkdskInfo,
  603. IN OUT PNTFS_ATTRIBUTE RootIndex,
  604. IN OUT PNTFS_ATTRIBUTE IndexAllocation OPTIONAL,
  605. OUT PNTFS_BITMAP AllocationBitmap OPTIONAL,
  606. IN VCN FileNumber,
  607. IN OUT PNUMBER_SET BadClusters,
  608. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  609. IN PCNTFS_ATTRIBUTE_COLUMNS AttributeDefTable,
  610. OUT PBOOLEAN Tube,
  611. IN OUT PLONG Order,
  612. IN FIX_LEVEL Fixlevel,
  613. IN OUT PMESSAGE Message,
  614. IN OUT PBOOLEAN DiskErrorsFound
  615. );
  616. NONVIRTUAL
  617. BOOLEAN
  618. TraverseIndexTree(
  619. IN OUT PINDEX_HEADER IndexHeader,
  620. IN ULONG IndexLength,
  621. IN OUT PNTFS_ATTRIBUTE IndexAllocation OPTIONAL,
  622. IN OUT PNTFS_BITMAP AllocationBitmap OPTIONAL,
  623. IN ULONG BytesPerBlock,
  624. OUT PBOOLEAN Tube,
  625. OUT PBOOLEAN Changes,
  626. IN VCN FileNumber,
  627. IN PCWSTRING AttributeName,
  628. IN INDEX_ENTRY_TYPE IndexEntryType,
  629. IN OUT PBOOLEAN RecoveredAttribute,
  630. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  631. IN OUT PNUMBER_SET BadClusters,
  632. OUT PINDEX_ENTRY FirstLeafIndexEntry,
  633. OUT PINDEX_ENTRY LastLeafIndexEntry,
  634. IN OUT PLONG Order,
  635. IN ULONG CollationRule,
  636. IN FIX_LEVEL FixLevel,
  637. IN OUT PMESSAGE Message,
  638. IN OUT PBOOLEAN DiskErrorsFound
  639. );
  640. NONVIRTUAL
  641. BOOLEAN
  642. ValidateEntriesInIndex(
  643. IN OUT PNTFS_INDEX_TREE Index,
  644. IN OUT PNTFS_FILE_RECORD_SEGMENT IndexFrs,
  645. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  646. IN OUT PDIGRAPH DirectoryDigraph,
  647. IN OUT PULONG PercentDone,
  648. IN OUT PBIG_INT NumFileNames,
  649. OUT PBOOLEAN Changes,
  650. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  651. IN BOOLEAN SkipEntriesScan,
  652. IN BOOLEAN SkipCycleScan,
  653. IN FIX_LEVEL FixLevel,
  654. IN OUT PMESSAGE Message,
  655. IN OUT PBOOLEAN DiskErrorsFound
  656. );
  657. NONVIRTUAL
  658. BOOLEAN
  659. ValidateEntriesInIndex(
  660. IN OUT PNTFS_INDEX_TREE Index,
  661. IN OUT PNTFS_FILE_RECORD_SEGMENT IndexFrs,
  662. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  663. IN PNTFS_MFT_INFO MftInfo,
  664. IN OUT PDIGRAPH DirectoryDigraph,
  665. IN OUT PULONG PercentDone,
  666. IN OUT PBIG_INT NumFileNames,
  667. OUT PBOOLEAN Changes,
  668. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  669. IN BOOLEAN SkipCycleScan,
  670. IN FIX_LEVEL FixLevel,
  671. IN OUT PMESSAGE Message,
  672. IN OUT PBOOLEAN DiskErrorsFound
  673. );
  674. NONVIRTUAL
  675. BOOLEAN
  676. ValidateEntriesInIndex2(
  677. IN OUT PNTFS_INDEX_TREE Index,
  678. IN OUT PNTFS_FILE_RECORD_SEGMENT IndexFrs,
  679. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  680. IN OUT PDIGRAPH DirectoryDigraph,
  681. OUT PBOOLEAN Changes,
  682. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  683. IN BOOLEAN SkipCycleScan,
  684. IN FIX_LEVEL FixLevel,
  685. IN OUT PMESSAGE Message,
  686. IN OUT PBOOLEAN DiskErrorsFound
  687. );
  688. NONVIRTUAL
  689. BOOLEAN
  690. ValidateEntriesInObjIdIndex(
  691. IN OUT PNTFS_INDEX_TREE Index,
  692. IN OUT PNTFS_FILE_RECORD_SEGMENT IndexFrs,
  693. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  694. OUT PBOOLEAN Changes,
  695. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  696. IN FIX_LEVEL FixLevel,
  697. IN OUT PMESSAGE Message,
  698. IN OUT PBOOLEAN DiskErrorsFound
  699. );
  700. NONVIRTUAL
  701. BOOLEAN
  702. ValidateEntriesInReparseIndex(
  703. IN OUT PNTFS_INDEX_TREE Index,
  704. IN OUT PNTFS_FILE_RECORD_SEGMENT IndexFrs,
  705. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  706. OUT PBOOLEAN Changes,
  707. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  708. IN FIX_LEVEL FixLevel,
  709. IN OUT PMESSAGE Message,
  710. IN OUT PBOOLEAN DiskErrorsFound
  711. );
  712. NONVIRTUAL
  713. BOOLEAN
  714. RecoverOrphans(
  715. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  716. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  717. IN OUT PDIGRAPH DirectoryDigraph,
  718. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  719. IN BOOLEAN SkipCycleScan,
  720. IN FIX_LEVEL FixLevel,
  721. IN OUT PMESSAGE Message
  722. );
  723. NONVIRTUAL
  724. BOOLEAN
  725. ProperOrphanRecovery(
  726. IN OUT PNUMBER_SET Orphans,
  727. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  728. IN OUT PDIGRAPH DirectoryDigraph,
  729. IN BOOLEAN SkipCycleScan,
  730. IN PCNTFS_CHKDSK_INFO ChkdskInfo,
  731. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  732. IN FIX_LEVEL FixLevel,
  733. IN OUT PMESSAGE Message
  734. );
  735. NONVIRTUAL
  736. BOOLEAN
  737. OldOrphanRecovery(
  738. IN OUT PNUMBER_SET Orphans,
  739. IN PCNTFS_CHKDSK_INFO ChkdskInfo,
  740. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  741. IN OUT PNTFS_FILE_RECORD_SEGMENT RootFrs,
  742. IN OUT PNTFS_INDEX_TREE RootIndex,
  743. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  744. IN FIX_LEVEL FixLevel,
  745. IN OUT PMESSAGE Message
  746. );
  747. NONVIRTUAL
  748. BOOLEAN
  749. HotfixMftData(
  750. IN OUT PNTFS_ATTRIBUTE MftData,
  751. IN OUT PNTFS_BITMAP VolumeBitmap,
  752. IN PNUMBER_SET UnreadableFrs,
  753. OUT PNUMBER_SET BadClusters,
  754. IN FIX_LEVEL FixLevel,
  755. IN OUT PMESSAGE Message
  756. );
  757. NONVIRTUAL
  758. BOOLEAN
  759. SynchronizeMft(
  760. IN OUT PNTFS_INDEX_TREE RootIndex,
  761. IN PNTFS_MASTER_FILE_TABLE InternalMft,
  762. OUT PBOOLEAN Errors,
  763. IN FIX_LEVEL FixLevel,
  764. IN OUT PMESSAGE Message,
  765. IN MessageMode MsgMode
  766. );
  767. NONVIRTUAL
  768. BOOLEAN
  769. CheckAllForData(
  770. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  771. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  772. IN FIX_LEVEL FixLevel,
  773. IN OUT PMESSAGE Message
  774. );
  775. NONVIRTUAL
  776. BOOLEAN
  777. ValidateSecurityDescriptors(
  778. IN PNTFS_CHKDSK_INFO ChkdskInfo,
  779. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  780. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  781. IN OUT PNUMBER_SET BadClusters,
  782. IN BOOLEAN SkipEntriesScan,
  783. IN FIX_LEVEL FixLevel,
  784. IN OUT PMESSAGE Message
  785. );
  786. NONVIRTUAL
  787. BOOLEAN
  788. ValidateUsnJournal(
  789. IN PNTFS_CHKDSK_INFO ChkdskInfo,
  790. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  791. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  792. IN OUT PNUMBER_SET BadClusters,
  793. IN FIX_LEVEL FixLevel,
  794. IN OUT PMESSAGE Message
  795. );
  796. NONVIRTUAL
  797. BOOLEAN
  798. CheckExtendSystemFiles(
  799. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  800. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  801. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  802. IN FIX_LEVEL FixLevel,
  803. IN OUT PMESSAGE Message
  804. );
  805. NONVIRTUAL
  806. BOOLEAN
  807. ResetLsns(
  808. IN OUT PMESSAGE Message,
  809. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  810. IN BOOLEAN SkipRootIndex
  811. );
  812. NONVIRTUAL
  813. BOOLEAN
  814. ResetUsns(
  815. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  816. IN FIX_LEVEL FixLevel,
  817. IN OUT PMESSAGE Message,
  818. IN OUT PNTFS_MASTER_FILE_TABLE Mft
  819. );
  820. NONVIRTUAL
  821. BOOLEAN
  822. FindHighestLsn(
  823. IN OUT PMESSAGE Message,
  824. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  825. OUT PLSN HighestLsn
  826. );
  827. NONVIRTUAL
  828. BOOLEAN
  829. LogFileMayNeedResize(
  830. );
  831. NONVIRTUAL
  832. BOOLEAN
  833. StartProcessingFiles(
  834. IN BIG_INT TotalNumberOfFrs,
  835. IN OUT PBOOLEAN DiskErrorFound,
  836. IN FIX_LEVEL FixLevel,
  837. IN OUT PNTFS_ATTRIBUTE MftData,
  838. IN OUT PNTFS_BITMAP MftBitmap,
  839. IN OUT PNTFS_BITMAP VolumeBitmap,
  840. IN OUT PNTFS_UPCASE_TABLE UpcaseTable,
  841. IN OUT PNTFS_ATTRIBUTE_COLUMNS AttributeDefTable,
  842. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  843. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  844. IN OUT PMESSAGE Message
  845. );
  846. NONVIRTUAL
  847. BOOLEAN
  848. ProcessFiles(
  849. IN BIG_INT TotalNumberOfFrs,
  850. OUT PVCN FirstFrsNumber,
  851. OUT PULONG NumberOfFrsToRead,
  852. IN OUT PBOOLEAN DiskErrorFound,
  853. IN PNTFS_FRS_STRUCTURE FrsStruc1,
  854. IN PNTFS_FRS_STRUCTURE FrsStruc2,
  855. IN HANDLE ReadReady,
  856. OUT HANDLE ReadAhead,
  857. IN HANDLE ThreadHandle,
  858. IN FIX_LEVEL FixLevel,
  859. IN OUT PNTFS_ATTRIBUTE MftData,
  860. IN OUT PNTFS_BITMAP MftBitmap,
  861. IN OUT PNTFS_BITMAP VolumeBitmap,
  862. IN OUT PNTFS_UPCASE_TABLE UpcaseTable,
  863. IN OUT PNTFS_ATTRIBUTE_COLUMNS AttributeDefTable,
  864. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  865. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  866. IN OUT PMESSAGE Message
  867. );
  868. NONVIRTUAL
  869. BOOLEAN
  870. StartProcessingSD(
  871. IN BIG_INT TotalNumberOfFrs,
  872. IN FIX_LEVEL FixLevel,
  873. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  874. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  875. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  876. IN OUT PNTFS_FILE_RECORD_SEGMENT SecurityFrs,
  877. IN OUT PNUMBER_SET BadClusters,
  878. IN OUT PULONG ErrFixedStatus,
  879. IN BOOLEAN SecurityDescriptorStreamPresent,
  880. IN OUT PNUMBER_SET SidEntries,
  881. IN OUT PNUMBER_SET SidEntries2,
  882. IN OUT PBOOLEAN HasErrors,
  883. IN BOOLEAN SkipEntriesScan,
  884. IN OUT PBOOLEAN ChkdskErrCouldNotFix,
  885. IN OUT PMESSAGE Message
  886. );
  887. NONVIRTUAL
  888. BOOLEAN
  889. ProcessSD(
  890. IN BIG_INT TotalNumberOfFrs,
  891. OUT PVCN FirstFrsNumber,
  892. OUT PULONG NumberOfFrsToRead,
  893. IN PNTFS_FILE_RECORD_SEGMENT Frs1,
  894. IN PNTFS_FILE_RECORD_SEGMENT Frs2,
  895. IN HANDLE ReadReady,
  896. OUT HANDLE ReadAhead,
  897. IN HANDLE ThreadHandle,
  898. IN FIX_LEVEL FixLevel,
  899. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  900. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  901. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  902. IN OUT PNTFS_FILE_RECORD_SEGMENT SecurityFrs,
  903. IN OUT PNUMBER_SET BadClusters,
  904. IN OUT PULONG ErrFixedStatus,
  905. IN BOOLEAN SecurityDescriptorStreamPresent,
  906. IN OUT PNUMBER_SET SidEntries,
  907. IN OUT PNUMBER_SET SidEntries2,
  908. IN OUT PBOOLEAN HasErrors,
  909. IN BOOLEAN SkipEntriesScan,
  910. IN OUT PBOOLEAN ChkdskErrCouldNotFix,
  911. IN OUT PMESSAGE Message
  912. );
  913. NONVIRTUAL
  914. BOOLEAN
  915. ProcessSD2(
  916. IN BIG_INT TotalNumberOfFrs,
  917. IN FIX_LEVEL FixLevel,
  918. IN OUT PNTFS_MASTER_FILE_TABLE Mft,
  919. IN OUT PNTFS_CHKDSK_REPORT ChkdskReport,
  920. IN OUT PNTFS_CHKDSK_INFO ChkdskInfo,
  921. IN OUT PNTFS_FILE_RECORD_SEGMENT SecurityFrs,
  922. IN OUT PNUMBER_SET BadClusters,
  923. IN OUT PULONG ErrFixedStatus,
  924. IN BOOLEAN SecurityDescriptorStreamPresent,
  925. IN OUT PNUMBER_SET SidEntries,
  926. IN OUT PNUMBER_SET SidEntries2,
  927. IN OUT PBOOLEAN HasErrors,
  928. IN BOOLEAN SkipEntriesScan,
  929. IN OUT PBOOLEAN ChkdskErrCouldNotFix,
  930. IN OUT PMESSAGE Message
  931. );
  932. HMEM _hmem; // memory for SECRUN
  933. PPACKED_BOOT_SECTOR _boot_sector; // packed boot sector
  934. BIOS_PARAMETER_BLOCK _bpb; // unpacked BPB
  935. BIG_INT _boot2; // alternate boot sector
  936. BIG_INT _boot3; // second alternate boot sector
  937. UCHAR _NumberOfStages;// minimum number of stages for chkdsk
  938. // to go thru
  939. NONVIRTUAL
  940. VOID
  941. Construct (
  942. );
  943. NONVIRTUAL
  944. VOID
  945. Destroy(
  946. );
  947. BOOLEAN _cleanup_that_requires_reboot;
  948. LCN _cvt_zone; // convert region for mft, logfile, etc.
  949. BIG_INT _cvt_zone_size; // convert region size in terms of clusters
  950. // This version number is used to determine what format
  951. // is used for the compressed mapping pairs of sparse
  952. // files. Ideally, this information should be tracked
  953. // on a per-volume basis; however, that would require
  954. // extensive changes to the UNTFS class interfaces.
  955. //
  956. STATIC UCHAR _MajorVersion, _MinorVersion;
  957. };
  958. INLINE
  959. PVOID
  960. NTFS_SA::GetBuf(
  961. )
  962. /*++
  963. Routine Description:
  964. This routine returns a pointer to the write buffer for the NTFS
  965. SUPERAREA. This routine also packs the bios parameter block.
  966. Arguments:
  967. None.
  968. Return Value:
  969. A pointer to the write buffer.
  970. --*/
  971. {
  972. PackBios(&_bpb, &(_boot_sector->PackedBpb));
  973. return SECRUN::GetBuf();
  974. }
  975. INLINE
  976. BOOLEAN
  977. NTFS_SA::Write(
  978. )
  979. /*++
  980. Routine Description:
  981. This routine simply calls the other write with the default message
  982. object.
  983. Arguments:
  984. None.
  985. Return Value:
  986. FALSE - Failure.
  987. TRUE - Success.
  988. --*/
  989. {
  990. MESSAGE msg;
  991. return Write(&msg);
  992. }
  993. INLINE
  994. BIG_INT
  995. NTFS_SA::QueryVolumeSectors(
  996. ) CONST
  997. /*++
  998. Routine Description:
  999. This routine returns the number of sectors on the volume as recorded in
  1000. the boot sector.
  1001. Arguments:
  1002. None.
  1003. Return Value:
  1004. The number of volume sectors.
  1005. --*/
  1006. {
  1007. return _boot_sector->NumberSectors;
  1008. }
  1009. INLINE
  1010. VOID
  1011. NTFS_SA::SetVolumeSectors(
  1012. BIG_INT NewNumberOfSectors
  1013. )
  1014. /*++
  1015. Routine Description:
  1016. This routine sets the number of sectors on the volume
  1017. in the boot sector.
  1018. Arguments:
  1019. NewVolumeSectors -- Supplies the new value of the number
  1020. of sectors on the volume.
  1021. Return Value:
  1022. None.
  1023. --*/
  1024. {
  1025. _boot_sector->NumberSectors.LowPart = NewNumberOfSectors.GetLowPart();
  1026. _boot_sector->NumberSectors.HighPart = NewNumberOfSectors.GetHighPart();
  1027. }
  1028. INLINE
  1029. LCN
  1030. NTFS_SA::QueryMftStartingLcn(
  1031. ) CONST
  1032. /*++
  1033. Routine Description:
  1034. This routine returns the starting logical cluster number
  1035. for the Master File Table.
  1036. Arguments:
  1037. None.
  1038. Return Value:
  1039. The starting LCN for the MFT.
  1040. --*/
  1041. {
  1042. return _boot_sector->MftStartLcn;
  1043. }
  1044. INLINE
  1045. LCN
  1046. NTFS_SA::QueryMft2StartingLcn(
  1047. ) CONST
  1048. /*++
  1049. Routine Description:
  1050. This routine returns the starting logical cluster number
  1051. for the mirror of the Master File Table.
  1052. Arguments:
  1053. None.
  1054. Return Value:
  1055. The starting LCN for the mirror of the MFT.
  1056. --*/
  1057. {
  1058. return _boot_sector->Mft2StartLcn;
  1059. }
  1060. INLINE
  1061. ULONG
  1062. NTFS_SA::QueryFrsSize(
  1063. ) CONST
  1064. /*++
  1065. Routine Description:
  1066. This routine computes the number of clusters per file record segment.
  1067. Arguments:
  1068. None.
  1069. Return Value:
  1070. The number of clusters per file record segment.
  1071. --*/
  1072. {
  1073. if (_boot_sector->ClustersPerFileRecordSegment < 0) {
  1074. LONG temp = LONG(_boot_sector->ClustersPerFileRecordSegment);
  1075. return 1 << -temp;
  1076. }
  1077. return _boot_sector->ClustersPerFileRecordSegment *
  1078. _bpb.SectorsPerCluster * _drive->QuerySectorSize();
  1079. }
  1080. INLINE
  1081. PARTITION_SYSTEM_ID
  1082. NTFS_SA::QuerySystemId(
  1083. ) CONST
  1084. /*++
  1085. Routine Description:
  1086. This routine computes the system ID for the volume.
  1087. Arguments:
  1088. None.
  1089. Return Value:
  1090. The system ID for the volume.
  1091. --*/
  1092. {
  1093. // unreferenced parameters
  1094. (void)(this);
  1095. return SYSID_IFS;
  1096. }
  1097. INLINE
  1098. LCN
  1099. NTFS_SA::QueryCvtZone(
  1100. ) CONST
  1101. /*++
  1102. Routine Description:
  1103. This routine returns the location of the convert zone.
  1104. Arguments:
  1105. None.
  1106. Return Value:
  1107. The LCN value of the convert zone.
  1108. --*/
  1109. {
  1110. return _cvt_zone;
  1111. }
  1112. INLINE
  1113. BIG_INT
  1114. NTFS_SA::QueryCvtZoneSize(
  1115. ) CONST
  1116. /*++
  1117. Routine Description:
  1118. This routine returns the size of the convert zone.
  1119. Arguments:
  1120. None.
  1121. Return Value:
  1122. The size of the convert zone.
  1123. --*/
  1124. {
  1125. return _cvt_zone_size;
  1126. }
  1127. INLINE
  1128. VOID
  1129. NTFS_SA::SetMftStartingLcn(
  1130. IN LCN Lcn
  1131. )
  1132. /*++
  1133. 836a861,879
  1134. Routine Description:
  1135. This routine sets the starting logical cluster number
  1136. for the Master File Table.
  1137. Arguments:
  1138. Lcn - The starting lcn.
  1139. Return Value:
  1140. None.
  1141. --*/
  1142. {
  1143. _boot_sector->MftStartLcn = Lcn;
  1144. }
  1145. INLINE
  1146. VOID
  1147. NTFS_SA::SetMft2StartingLcn(
  1148. IN LCN Lcn
  1149. )
  1150. /*++
  1151. Routine Description:
  1152. This routine sets the starting logical cluster number
  1153. for the mirror of the Master File Table.
  1154. Arguments:
  1155. Lcn - the starting lcn.
  1156. Return Value:
  1157. None.
  1158. --*/
  1159. {
  1160. _boot_sector->Mft2StartLcn = Lcn;
  1161. }
  1162. INLINE
  1163. UCHAR
  1164. NTFS_SA::GetNumberOfStages(
  1165. )
  1166. {
  1167. return _NumberOfStages;
  1168. }
  1169. INLINE
  1170. VOID
  1171. NTFS_SA::SetNumberOfStages(
  1172. IN UCHAR Number
  1173. )
  1174. {
  1175. _NumberOfStages = Number;
  1176. }
  1177. #endif // _NTFS_SUPERAREA_DEFN_