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.

194 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1991-2000 Microsoft Corporation
  3. Module Name:
  4. udfsa.hxx
  5. Abstract:
  6. This class supplies the UDF-only SUPERAREA methods.
  7. Author:
  8. Centis Biks (cbiks) 05-May-2000
  9. --*/
  10. #pragma once
  11. #include "supera.hxx"
  12. #include "hmem.hxx"
  13. #include "ScanADs.hxx"
  14. DECLARE_CLASS( UDF_SA );
  15. class UDF_SA : public SUPERAREA {
  16. public:
  17. UUDF_EXPORT
  18. DECLARE_CONSTRUCTOR(UDF_SA);
  19. VIRTUAL
  20. UUDF_EXPORT
  21. ~UDF_SA(
  22. );
  23. NONVIRTUAL
  24. UUDF_EXPORT
  25. BOOLEAN
  26. Initialize(
  27. IN OUT PLOG_IO_DP_DRIVE Drive,
  28. IN OUT PMESSAGE Message,
  29. IN USHORT FormatUDFRevision DEFAULT UDF_VERSION_201
  30. );
  31. NONVIRTUAL
  32. PVOID
  33. GetBuf(
  34. );
  35. NONVIRTUAL
  36. BOOLEAN
  37. Create(
  38. IN PCNUMBER_SET BadSectors,
  39. IN OUT PMESSAGE Message,
  40. IN PCWSTRING Label DEFAULT NULL,
  41. IN ULONG Flags DEFAULT FORMAT_BACKWARD_COMPATIBLE,
  42. IN ULONG ClusterSize DEFAULT 0,
  43. IN ULONG VirtualSize DEFAULT 0
  44. );
  45. NONVIRTUAL
  46. BOOLEAN
  47. VerifyAndFix(
  48. IN FIX_LEVEL FixLevel,
  49. IN OUT PMESSAGE Message,
  50. IN ULONG Flags DEFAULT FALSE,
  51. IN ULONG LogFileSize DEFAULT 0,
  52. IN USHORT Algorithm DEFAULT 0,
  53. OUT PULONG ExitStatus DEFAULT NULL,
  54. IN PCWSTRING DriveLetter DEFAULT NULL
  55. );
  56. NONVIRTUAL
  57. BOOLEAN
  58. RecoverFile(
  59. IN PCWSTRING FullPathFileName,
  60. IN OUT PMESSAGE Message
  61. );
  62. NONVIRTUAL
  63. PARTITION_SYSTEM_ID
  64. QuerySystemId(
  65. ) CONST;
  66. //
  67. //
  68. //
  69. BOOL Read
  70. (
  71. IN ULONGLONG StartingSector,
  72. IN SECTORCOUNT NumberOfSectors,
  73. OUT PVOID Buffer
  74. );
  75. BOOL Write
  76. (
  77. IN ULONGLONG StartingSector,
  78. IN SECTORCOUNT NumberOfSectors,
  79. OUT PVOID Buffer
  80. );
  81. ULONG QuerySectorSize() CONST;
  82. //
  83. //
  84. //
  85. BOOL ReadDescriptor( ULONGLONG blockNr, UINT* pNrBlocksRead, USHORT expectedTagId, USHORT* pTagId, LPBYTE* pMem );
  86. BOOL FindVolumeDescriptor( USHORT TagID, LPBYTE* DescriptorFound );
  87. //
  88. // This was added as a virtual funtion in SUPERAREA so we need
  89. // to implement it in order to compile....
  90. //
  91. NONVIRTUAL
  92. VOID
  93. PrintFormatReport (
  94. IN OUT PMESSAGE Message,
  95. IN PFILE_FS_SIZE_INFORMATION FsSizeInfo,
  96. IN PFILE_FS_VOLUME_INFORMATION FsVolInfo
  97. );
  98. private:
  99. //
  100. // Format routines.
  101. //
  102. BOOLEAN
  103. FormatVolumeRecognitionSequence();
  104. //
  105. //
  106. //
  107. NONVIRTUAL
  108. VOID
  109. Construct(
  110. );
  111. NONVIRTUAL
  112. VOID
  113. Destroy(
  114. );
  115. //
  116. //
  117. //
  118. BOOL ReadVolumeRecognitionSequence();
  119. BOOL GetAnchorVolumeDescriptorPointer( PNSR_ANCHOR pavdp );
  120. BOOL ReadAnchorVolumeDescriptorPointer( UINT Sector, PNSR_ANCHOR NsrAnchorFound );
  121. BOOL FindVolumeDescriptor( USHORT TagID, ULONGLONG ExtentStart, UINT ExtentLength, LPBYTE* DescriptorFound );
  122. NSR_ANCHOR _NsrAnchor;
  123. USHORT _FormatUDFRevision;
  124. HMEM _hmem;
  125. };
  126. BOOL VerifyDescriptorTag( LPBYTE buffer, UINT bufferLength, USHORT expectedTagId, PUSHORT pExportTagId );
  127. BOOL VerifyDescriptor( LPBYTE buffer, UINT numberOfBytesRead, USHORT expectedTagId, USHORT* pExportTagId );
  128. BOOL GetLengthOfDescriptor( LPBYTE, PUINT );
  129. INLINE
  130. PVOID
  131. UDF_SA::GetBuf(
  132. )
  133. /*++
  134. Routine Description:
  135. This routine returns a pointer to the write buffer for the UDF
  136. SUPERAREA.
  137. Arguments:
  138. None.
  139. Return Value:
  140. A pointer to the write buffer.
  141. --*/
  142. {
  143. return SECRUN::GetBuf();
  144. }