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.

196 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. rootdir.hxx
  5. Abstract:
  6. This class is an implementation of FATDIR for the FAT root directory.
  7. --*/
  8. #if !defined(ROOTDIR_DEFN)
  9. #define ROOTDIR_DEFN
  10. #include "drive.hxx"
  11. #include "fatdir.hxx"
  12. #include "mem.hxx"
  13. #include "secrun.hxx"
  14. #if defined ( _AUTOCHECK_ ) || defined( _EFICHECK_ )
  15. #define UFAT_EXPORT
  16. #elif defined ( _UFAT_MEMBER_ )
  17. #define UFAT_EXPORT __declspec(dllexport)
  18. #else
  19. #define UFAT_EXPORT __declspec(dllimport)
  20. #endif
  21. DECLARE_CLASS( ROOTDIR );
  22. class ROOTDIR : public FATDIR {
  23. public:
  24. UFAT_EXPORT
  25. DECLARE_CONSTRUCTOR( ROOTDIR );
  26. UFAT_EXPORT
  27. VIRTUAL
  28. ~ROOTDIR(
  29. );
  30. NONVIRTUAL
  31. UFAT_EXPORT
  32. BOOLEAN
  33. Initialize(
  34. IN PMEM Mem,
  35. IN OUT PLOG_IO_DP_DRIVE Drive,
  36. IN LBN StartingSector,
  37. IN LONG NumberOfEntries
  38. );
  39. NONVIRTUAL
  40. BOOLEAN
  41. Read(
  42. );
  43. NONVIRTUAL
  44. BOOLEAN
  45. Write(
  46. );
  47. NONVIRTUAL
  48. PVOID
  49. GetDirEntry(
  50. IN LONG EntryNumber
  51. );
  52. NONVIRTUAL
  53. LONG
  54. QueryNumberOfEntries(
  55. );
  56. private:
  57. VOID
  58. Construct (
  59. );
  60. NONVIRTUAL
  61. VOID
  62. Destroy(
  63. );
  64. SECRUN _secrun;
  65. LONG _number_of_entries;
  66. };
  67. INLINE
  68. BOOLEAN
  69. ROOTDIR::Read(
  70. )
  71. /*++
  72. Routine Description:
  73. This routine reads the directory in from the disk.
  74. Arguments:
  75. None.
  76. Return Value:
  77. FALSE - Failure.
  78. TRUE - Success.
  79. --*/
  80. {
  81. return _secrun.Read();
  82. }
  83. INLINE
  84. BOOLEAN
  85. ROOTDIR::Write(
  86. )
  87. /*++
  88. Routine Description:
  89. This routine writes the drirectory to the disk.
  90. Arguments:
  91. None.
  92. Return Value:
  93. FALSE - Failure.
  94. TRUE - Success.
  95. --*/
  96. {
  97. return _secrun.Write();
  98. }
  99. INLINE
  100. PVOID
  101. ROOTDIR::GetDirEntry(
  102. IN LONG EntryNumber
  103. )
  104. /*++
  105. Routine Description:
  106. This routine returns a pointer to the beginning of the requested
  107. directory entry. The data may then be interpreted with a fat
  108. directory entry object. The return value will be NULL if a request
  109. for a directory entry is beyond the size of the directory.
  110. Arguments:
  111. EntryNumber - The desired entry number. The entries will be numbered
  112. 0, 1, 2, ... , n-1.
  113. Return Value:
  114. A pointer to the beginning of a directory entry or NULL.
  115. --*/
  116. {
  117. return (EntryNumber < _number_of_entries) ?
  118. (PCHAR) _secrun.GetBuf() + BytesPerDirent*EntryNumber : NULL;
  119. }
  120. INLINE
  121. LONG
  122. ROOTDIR::QueryNumberOfEntries(
  123. )
  124. /*++
  125. Routine Description:
  126. This routine returns the number of entries in the directory.
  127. Arguments:
  128. None.
  129. Return Value:
  130. The number of entries in the directory.
  131. --*/
  132. {
  133. return _number_of_entries;
  134. }
  135. #endif // ROOTDIR_DEFN