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.

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