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.

265 lines
3.8 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. secrun.hxx
  5. Abstract:
  6. This class models a run of sectors. It is able to read in a run of
  7. sectors into memory and write a run of sectors in memory onto disk.
  8. --*/
  9. #if !defined(SECRUN_DEFN)
  10. #define SECRUN_DEFN
  11. #include "drive.hxx"
  12. #include "mem.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. DECLARE_CLASS( SECRUN );
  21. class SECRUN : public OBJECT {
  22. public:
  23. IFSUTIL_EXPORT
  24. DECLARE_CONSTRUCTOR( SECRUN );
  25. VIRTUAL
  26. IFSUTIL_EXPORT
  27. ~SECRUN(
  28. );
  29. NONVIRTUAL
  30. IFSUTIL_EXPORT
  31. BOOLEAN
  32. Initialize(
  33. IN OUT PMEM Mem,
  34. IN OUT PIO_DP_DRIVE Drive,
  35. IN BIG_INT StartSector,
  36. IN SECTORCOUNT NumSectors
  37. );
  38. NONVIRTUAL
  39. VOID
  40. Relocate(
  41. IN BIG_INT NewStartSector
  42. );
  43. VIRTUAL
  44. IFSUTIL_EXPORT
  45. BOOLEAN
  46. Read(
  47. );
  48. VIRTUAL
  49. IFSUTIL_EXPORT
  50. BOOLEAN
  51. Write(
  52. );
  53. NONVIRTUAL
  54. PVOID
  55. GetBuf(
  56. );
  57. NONVIRTUAL
  58. BIG_INT
  59. QueryStartSector(
  60. ) CONST;
  61. NONVIRTUAL
  62. LBN
  63. QueryStartLbn(
  64. ) CONST;
  65. NONVIRTUAL
  66. SECTORCOUNT
  67. QueryLength(
  68. ) CONST;
  69. NONVIRTUAL
  70. IFSUTIL_EXPORT
  71. PIO_DP_DRIVE
  72. GetDrive(
  73. );
  74. private:
  75. NONVIRTUAL
  76. VOID
  77. Construct (
  78. );
  79. NONVIRTUAL
  80. VOID
  81. Destroy(
  82. );
  83. PVOID _buf;
  84. PIO_DP_DRIVE _drive;
  85. BIG_INT _start_sector;
  86. SECTORCOUNT _num_sectors;
  87. };
  88. INLINE
  89. VOID
  90. SECRUN::Relocate(
  91. IN BIG_INT NewStartSector
  92. )
  93. /*++
  94. Routine Description:
  95. This routine relocates the secrun.
  96. Arguments:
  97. NewStartSector - Supplies the new starting sector.
  98. Return Value:
  99. None.
  100. --*/
  101. {
  102. _start_sector = NewStartSector;
  103. }
  104. INLINE
  105. PVOID
  106. SECRUN::GetBuf(
  107. )
  108. /*++
  109. Routine Description:
  110. This routine returns a pointer to the beginning of the read/write
  111. buffer.
  112. Arguments:
  113. None.
  114. Return Value:
  115. A pointer to a read/write buffer.
  116. --*/
  117. {
  118. return _buf;
  119. }
  120. INLINE
  121. BIG_INT
  122. SECRUN::QueryStartSector(
  123. ) CONST
  124. /*++
  125. Routine Description:
  126. This routine returns the starting sector number for the run of sectors.
  127. Arguments:
  128. None.
  129. Return Value:
  130. The starting sector number for the run of sectors.
  131. --*/
  132. {
  133. return _start_sector;
  134. }
  135. INLINE
  136. LBN
  137. SECRUN::QueryStartLbn(
  138. ) CONST
  139. /*++
  140. Routine Description:
  141. This routine returns the starting LBN for the run of sectors.
  142. Arguments:
  143. None.
  144. Return Value:
  145. The starting LBN for the run of sectors.
  146. --*/
  147. {
  148. DebugAssert(_start_sector.GetHighPart() == 0);
  149. return _start_sector.GetLowPart();
  150. }
  151. INLINE
  152. SECTORCOUNT
  153. SECRUN::QueryLength(
  154. ) CONST
  155. /*++
  156. Routine Description:
  157. This routine computes the number of sectors in this sector run.
  158. Arguments:
  159. None.
  160. Return Value:
  161. The number of sectors in this sector run.
  162. --*/
  163. {
  164. return _num_sectors;
  165. }
  166. INLINE
  167. PIO_DP_DRIVE
  168. SECRUN::GetDrive(
  169. )
  170. /*++
  171. Routine Description:
  172. This routine returns a pointer to the drive object.
  173. Arguments:
  174. None.
  175. Return Value:
  176. A pointer to the drive object.
  177. --*/
  178. {
  179. return _drive;
  180. }
  181. #endif // SECRUN_DEFN