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.

207 lines
4.8 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. NtfsBoot.h
  5. Abstract:
  6. This module defines globally used procedure and data structures used by Ntfs boot.
  7. Author:
  8. Gary Kimura [GaryKi] 10-Apr-1992
  9. Revision History:
  10. --*/
  11. #ifndef _NTFSBOOT_
  12. #define _NTFSBOOT_
  13. //
  14. // Some important manifest constants. These are the maximum byte size we'll ever
  15. // see for a file record or an index allocation buffer.
  16. //
  17. #define MAXIMUM_FILE_RECORD_SIZE (4096)
  18. #define MAXIMUM_INDEX_ALLOCATION_SIZE (4096)
  19. #define MAXIMUM_COMPRESSION_UNIT_SIZE (65536)
  20. //
  21. // The following structure is an mcb structure for storing cached retrieval pointer
  22. // information.
  23. //
  24. #define MAXIMUM_NUMBER_OF_MCB_ENTRIES (16)
  25. typedef struct _NTFS_MCB {
  26. //
  27. // The following fields indicate the number of entries in use by the mcb. and
  28. // the mcb itself. The mcb is just a collection of vbo - lbo pairs. The last
  29. // InUse entry Lbo's value is ignored, because it is only used to give the
  30. // length of the previous run.
  31. //
  32. ULONG InUse;
  33. LONGLONG Vbo[ MAXIMUM_NUMBER_OF_MCB_ENTRIES ];
  34. LONGLONG Lbo[ MAXIMUM_NUMBER_OF_MCB_ENTRIES ];
  35. } NTFS_MCB, *PNTFS_MCB;
  36. typedef const NTFS_MCB *PCNTFS_MCB;
  37. //
  38. // Define the Ntfs file context structure and the attribute context structure.
  39. //
  40. typedef struct _NTFS_FILE_CONTEXT {
  41. //
  42. // The following field indicates the type of attribute opened
  43. //
  44. ULONG TypeCode;
  45. //
  46. // The following field indicates the size of the data portion of the attribute
  47. //
  48. LONGLONG DataSize;
  49. //
  50. // The following two fields identify and locate the attribute on the volume.
  51. // The first number is the file record where the attribute header is located and
  52. // the second number is the offset in the file record of the attribute header
  53. //
  54. LONGLONG FileRecord;
  55. USHORT FileRecordOffset;
  56. //
  57. // The following field indicates if the attribute is resident
  58. //
  59. BOOLEAN IsAttributeResident;
  60. //
  61. // The following fields are only used if the data stream is compressed.
  62. // If it is compressed then the CompressionFormat field is not zero, and
  63. // contains the value to pass to the decompression engine. CompressionUnit
  64. // is the number of bytes in each unit of compression.
  65. //
  66. USHORT CompressionFormat;
  67. ULONG CompressionUnit;
  68. } NTFS_FILE_CONTEXT, *PNTFS_FILE_CONTEXT;
  69. typedef NTFS_FILE_CONTEXT NTFS_ATTRIBUTE_CONTEXT, *PNTFS_ATTRIBUTE_CONTEXT;
  70. typedef const NTFS_FILE_CONTEXT *PCNTFS_ATTRIBUTE_CONTEXT;
  71. //
  72. // Define the Ntfs volume structure context
  73. //
  74. typedef struct _NTFS_STRUCTURE_CONTEXT {
  75. //
  76. // This is the device that we talk to
  77. //
  78. ULONG DeviceId;
  79. //
  80. // Some volume specific constants that describe the size of various records
  81. //
  82. ULONG BytesPerCluster;
  83. ULONG BytesPerFileRecord;
  84. //
  85. // The following three fields describe the $DATA stream for the the MFT. We
  86. // need two Mcbs one holds the base of the mft and the other to hold any excess
  87. // retrival information. I.e., we must not loose the base mcb otherwise we
  88. // can't find anything.
  89. //
  90. NTFS_ATTRIBUTE_CONTEXT MftAttributeContext;
  91. NTFS_MCB MftBaseMcb;
  92. //
  93. // The following three fields hold a cached mcb that we use for non-resident
  94. // attributes other than the mft data stream. The first two fields identify the
  95. // attribute and the third field contains the cached mcb.
  96. //
  97. LONGLONG CachedMcbFileRecord[16];
  98. USHORT CachedMcbFileRecordOffset[16];
  99. NTFS_MCB CachedMcb[16];
  100. } NTFS_STRUCTURE_CONTEXT, *PNTFS_STRUCTURE_CONTEXT;
  101. typedef const NTFS_STRUCTURE_CONTEXT *PCNTFS_STRUCTURE_CONTEXT;
  102. //
  103. // Define file I/O prototypes.
  104. //
  105. ARC_STATUS
  106. NtfsClose (
  107. IN ULONG FileId
  108. );
  109. ARC_STATUS
  110. NtfsOpen (
  111. IN CHAR * FIRMWARE_PTR OpenPath,
  112. IN OPEN_MODE OpenMode,
  113. OUT ULONG * FIRMWARE_PTR FileId
  114. );
  115. ARC_STATUS
  116. NtfsRead (
  117. IN ULONG FileId,
  118. OUT VOID * FIRMWARE_PTR Buffer,
  119. IN ULONG Length,
  120. OUT ULONG * FIRMWARE_PTR Count
  121. );
  122. ARC_STATUS
  123. NtfsSeek (
  124. IN ULONG FileId,
  125. IN LARGE_INTEGER * FIRMWARE_PTR Offset,
  126. IN SEEK_MODE SeekMode
  127. );
  128. ARC_STATUS
  129. NtfsWrite (
  130. IN ULONG FileId,
  131. IN VOID * FIRMWARE_PTR Buffer,
  132. IN ULONG Length,
  133. OUT ULONG * FIRMWARE_PTR Count
  134. );
  135. ARC_STATUS
  136. NtfsGetFileInformation (
  137. IN ULONG FileId,
  138. OUT FILE_INFORMATION * FIRMWARE_PTR Buffer
  139. );
  140. ARC_STATUS
  141. NtfsSetFileInformation (
  142. IN ULONG FileId,
  143. IN ULONG AttributeFlags,
  144. IN ULONG AttributeMask
  145. );
  146. ARC_STATUS
  147. NtfsInitialize(
  148. VOID
  149. );
  150. #endif // _NTFSBOOT_