Source code of Windows XP (NT5)
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.

225 lines
4.3 KiB

  1. /****************************************************************************************************************
  2. FILENAME: NtfsSubs.h
  3. COPYRIGHT 2001 Microsoft Corporation and Executive Software International, Inc.
  4. ***************************************************************************************************************/
  5. //Gets the extent list of an NTFS file.
  6. BOOL
  7. GetExtentList(
  8. DWORD dwEnabledStreams,
  9. FILE_RECORD_SEGMENT_HEADER* pFrs
  10. );
  11. BOOL
  12. FindStreamInFrs(
  13. IN PFILE_RECORD_SEGMENT_HEADER pFrs,
  14. OUT PATTRIBUTE_RECORD_HEADER* ppArh,
  15. EXTENT_LIST_DATA* pExtentData
  16. );
  17. BOOL
  18. FindNextStreamInFrs(
  19. IN PFILE_RECORD_SEGMENT_HEADER pFrs,
  20. OUT PATTRIBUTE_RECORD_HEADER* ppArh,
  21. EXTENT_LIST_DATA* pExtentData
  22. );
  23. BOOL
  24. AddMappingPointersToStream(
  25. IN PATTRIBUTE_RECORD_HEADER pArh,
  26. EXTENT_LIST_DATA* pExtentData
  27. );
  28. BOOL
  29. GetLargeStreamExtentList(
  30. IN PFILE_RECORD_SEGMENT_HEADER pFrs,
  31. IN PATTRIBUTE_RECORD_HEADER pArh,
  32. EXTENT_LIST_DATA* pExtentData
  33. );
  34. BOOL
  35. FindStreamInAttrList(
  36. ATTRIBUTE_LIST_ENTRY* pAleStart,
  37. ATTRIBUTE_LIST_ENTRY** ppAle,
  38. LONGLONG ValueLength,
  39. EXTENT_LIST_DATA* pExtentData
  40. );
  41. BOOL
  42. FindNextStreamInAttrList(
  43. ATTRIBUTE_LIST_ENTRY* pAleStart,
  44. ATTRIBUTE_LIST_ENTRY** ppAle,
  45. LONGLONG ValueLength,
  46. EXTENT_LIST_DATA* pExtentData
  47. );
  48. ATTRIBUTE_RECORD_HEADER*
  49. FindAttributeByInstanceNumber(
  50. HANDLE* phFrs,
  51. ATTRIBUTE_LIST_ENTRY* pAle,
  52. EXTENT_LIST_DATA* pExtentData
  53. );
  54. UCHAR
  55. AttributeFormCode(
  56. ATTRIBUTE_LIST_ENTRY* pAle,
  57. EXTENT_LIST_DATA* pExtentData
  58. );
  59. LONGLONG
  60. AttributeAllocatedLength(
  61. ATTRIBUTE_LIST_ENTRY* pAle,
  62. EXTENT_LIST_DATA* pExtentData
  63. );
  64. LONGLONG
  65. AttributeFileSize(
  66. ATTRIBUTE_LIST_ENTRY* pAle,
  67. EXTENT_LIST_DATA* pExtentData
  68. );
  69. BOOL
  70. GetHugeStreamExtentList(
  71. ATTRIBUTE_LIST_ENTRY* pAleStart,
  72. ATTRIBUTE_LIST_ENTRY** ppAle,
  73. LONGLONG ValueLength,
  74. EXTENT_LIST_DATA* pExtentData
  75. );
  76. BOOL
  77. LoadExtentDataToMem(
  78. ATTRIBUTE_RECORD_HEADER* pArh,
  79. HANDLE* phAle,
  80. DWORD* pdwByteLen
  81. );
  82. BOOL
  83. GetStreamExtentsByNameAndType(
  84. TCHAR* StreamName,
  85. ATTRIBUTE_TYPE_CODE StreamType,
  86. FILE_RECORD_SEGMENT_HEADER* pFrs
  87. );
  88. BOOL
  89. GetStreamExtentsByNumber(
  90. ULONG StreamNumber
  91. );
  92. BOOL
  93. GetStreamNumberFromNameAndType(
  94. ULONG* pStreamNumber,
  95. TCHAR* StreamName,
  96. ATTRIBUTE_TYPE_CODE TypeCode,
  97. FILE_RECORD_SEGMENT_HEADER* pFrs
  98. );
  99. BOOL
  100. GetStreamNameAndTypeFromNumber(
  101. ULONG StreamNumber,
  102. TCHAR* StreamName,
  103. ATTRIBUTE_TYPE_CODE* pTypeCode,
  104. FILE_RECORD_SEGMENT_HEADER* pFrs
  105. );
  106. BOOL
  107. GetNonDataStreamExtents(
  108. );
  109. BOOL
  110. IsNonresidentFile(
  111. DWORD dwEnabledStreams,
  112. FILE_RECORD_SEGMENT_HEADER* pFrs
  113. );
  114. #ifdef OFFLINEDK
  115. BOOL
  116. CheckFragged(
  117. );
  118. #endif
  119. BOOL
  120. GetNtfsVolumeStats(
  121. );
  122. //This gets a specified FRS from the MFT, or the next one that's in use if this one isn't.
  123. BOOL
  124. GetInUseFrs(
  125. IN HANDLE hVolume,
  126. IN OUT LONGLONG* pFileRecordNumber,
  127. OUT FILE_RECORD_SEGMENT_HEADER* pFrs,
  128. IN ULONG uBytesPerFRS
  129. );
  130. //Gets the path of a file by getting the MFT records for each of it's parent directories.
  131. BOOL
  132. GetNtfsFilePath(
  133. );
  134. //Get the name of a file from it's file record and those of it parent directories.
  135. BOOL
  136. GetNameFromFileRecord(
  137. IN FILE_RECORD_SEGMENT_HEADER* pFrs,
  138. OUT TCHAR* pcName,
  139. IN LONGLONG* pParentFileRecordNumber
  140. );
  141. //Gets the next file to defragment from the file lists.
  142. GetNextNtfsFile(
  143. IN CONST PRTL_GENERIC_TABLE pTable,
  144. IN CONST BOOLEAN Restart,
  145. IN CONST LONGLONG ClusterCount = 0,
  146. IN OUT PFILE_LIST_ENTRY pEntry = NULL
  147. );
  148. //Opens a file on an NTFS volume.
  149. BOOL
  150. OpenNtfsFile(
  151. );
  152. //Gets the extent list for the MFT and MFT mirror.
  153. BOOL
  154. GetSystemsExtentList(
  155. );
  156. #ifdef DFRGNTFS
  157. BOOL
  158. AddFileToListNtfs(
  159. IN PRTL_GENERIC_TABLE Table,
  160. IN LONGLONG FileRecordNumber
  161. );
  162. BOOL
  163. UpdateFileTables(
  164. IN OUT PRTL_GENERIC_TABLE pFragmentedTable,
  165. IN OUT PRTL_GENERIC_TABLE pContiguousTable
  166. );
  167. #else // DFRGNTFS
  168. //Adds the extent list for a file to a file list on an NTFS drive.
  169. BOOL
  170. AddFileToListNtfs(
  171. OUT FILE_LIST_ENTRY* pList,
  172. IN OUT ULONG* pListIndex,
  173. IN ULONG ListSize,
  174. IN LONGLONG FileRecordNumber,
  175. IN UCHAR* pExtentList
  176. );
  177. #endif // DFRGNTFS
  178. BOOL
  179. UpdateInFileList(
  180. );
  181. BOOL
  182. FindAttributeByType(
  183. IN ATTRIBUTE_TYPE_CODE TypeCode,
  184. IN PFILE_RECORD_SEGMENT_HEADER pFrs,
  185. OUT PATTRIBUTE_RECORD_HEADER* ppArh,
  186. IN ULONG uBytesPerFRS
  187. );