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.

582 lines
16 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. fmifs.h
  5. Abstract:
  6. This header file contains the specification of the interface
  7. between the file manager and fmifs.dll for the purposes of
  8. accomplishing IFS functions.
  9. Author:
  10. Norbert P. Kusters (norbertk) 6-Mar-92
  11. --*/
  12. #if !defined( _FMIFS_DEFN_ )
  13. #define _FMIFS_DEFN_
  14. typedef LONG *PNTSTATUS;
  15. //
  16. // These are the defines for 'PacketType'.
  17. // Revisions: 02/03/98: Dave Sheldon - Added FmIfsNoMediaInDevice
  18. //
  19. typedef enum _FMIFS_PACKET_TYPE {
  20. FmIfsPercentCompleted,
  21. FmIfsFormatReport,
  22. FmIfsInsertDisk,
  23. FmIfsIncompatibleFileSystem,
  24. FmIfsFormattingDestination,
  25. FmIfsIncompatibleMedia,
  26. FmIfsAccessDenied,
  27. FmIfsMediaWriteProtected,
  28. FmIfsCantLock,
  29. FmIfsCantQuickFormat,
  30. FmIfsIoError,
  31. FmIfsFinished,
  32. FmIfsBadLabel,
  33. #if defined( DBLSPACE_ENABLED )
  34. FmIfsDblspaceCreateFailed,
  35. FmIfsDblspaceMountFailed,
  36. FmIfsDblspaceDriveLetterFailed,
  37. FmIfsDblspaceCreated,
  38. FmIfsDblspaceMounted,
  39. #endif // DBLSPACE_ENABLED
  40. FmIfsCheckOnReboot,
  41. FmIfsTextMessage,
  42. FmIfsHiddenStatus,
  43. FmIfsClusterSizeTooSmall,
  44. FmIfsClusterSizeTooBig,
  45. FmIfsVolumeTooSmall,
  46. FmIfsVolumeTooBig,
  47. FmIfsNoMediaInDevice
  48. } FMIFS_PACKET_TYPE, *PFMIFS_PACKET_TYPE;
  49. typedef struct _FMIFS_PERCENT_COMPLETE_INFORMATION {
  50. ULONG PercentCompleted;
  51. } FMIFS_PERCENT_COMPLETE_INFORMATION, *PFMIFS_PERCENT_COMPLETE_INFORMATION;
  52. //
  53. // These couple of bits are used in the ValuesInMB field of the structure
  54. // FMIFS_FORMAT_REPORT_INFORMATION. When set, the corresponding
  55. // ULONG value becomes in units of megabytes. If not set, the corresponding
  56. // ULONG value is in units of kilobytes.
  57. //
  58. #define TOTAL_DISK_SPACE_IN_MB 1
  59. #define BYTES_AVAILABLE_IN_MB 2
  60. typedef struct _FMIFS_FORMAT_REPORT_INFORMATION {
  61. ULONG KiloBytesTotalDiskSpace;
  62. ULONG KiloBytesAvailable;
  63. ULONG ValuesInMB;
  64. } FMIFS_FORMAT_REPORT_INFORMATION, *PFMIFS_FORMAT_REPORT_INFORMATION;
  65. // The packet for FmIfsDblspaceCreated is a Unicode string
  66. // giving the name of the Compressed Volume File; it is not
  67. // necessarily zero-terminated.
  68. //
  69. #define DISK_TYPE_GENERIC 0
  70. #define DISK_TYPE_SOURCE 1
  71. #define DISK_TYPE_TARGET 2
  72. #define DISK_TYPE_SOURCE_AND_TARGET 3
  73. typedef struct _FMIFS_INSERT_DISK_INFORMATION {
  74. ULONG DiskType;
  75. } FMIFS_INSERT_DISK_INFORMATION, *PFMIFS_INSERT_DISK_INFORMATION;
  76. typedef struct _FMIFS_IO_ERROR_INFORMATION {
  77. ULONG DiskType;
  78. ULONG Head;
  79. ULONG Track;
  80. } FMIFS_IO_ERROR_INFORMATION, *PFMIFS_IO_ERROR_INFORMATION;
  81. typedef struct _FMIFS_FINISHED_INFORMATION {
  82. BOOLEAN Success;
  83. } FMIFS_FINISHED_INFORMATION, *PFMIFS_FINISHED_INFORMATION;
  84. typedef struct _FMIFS_CHECKONREBOOT_INFORMATION {
  85. OUT BOOLEAN QueryResult; // TRUE for "yes", FALSE for "no"
  86. } FMIFS_CHECKONREBOOT_INFORMATION, *PFMIFS_CHECKONREBOOT_INFORMATION;
  87. typedef enum _TEXT_MESSAGE_TYPE {
  88. MESSAGE_TYPE_PROGRESS,
  89. MESSAGE_TYPE_RESULTS,
  90. MESSAGE_TYPE_FINAL
  91. } TEXT_MESSAGE_TYPE, *PTEXT_MESSAGE_TYPE;
  92. typedef struct _FMIFS_TEXT_MESSAGE {
  93. IN TEXT_MESSAGE_TYPE MessageType;
  94. IN PSTR Message;
  95. } FMIFS_TEXT_MESSAGE, *PFMIFS_TEXT_MESSAGE;
  96. //
  97. // This is a list of supported floppy media types for format.
  98. //
  99. typedef enum _FMIFS_MEDIA_TYPE {
  100. FmMediaUnknown,
  101. FmMediaF5_160_512, // 5.25", 160KB, 512 bytes/sector
  102. FmMediaF5_180_512, // 5.25", 180KB, 512 bytes/sector
  103. FmMediaF5_320_512, // 5.25", 320KB, 512 bytes/sector
  104. FmMediaF5_320_1024, // 5.25", 320KB, 1024 bytes/sector
  105. FmMediaF5_360_512, // 5.25", 360KB, 512 bytes/sector
  106. FmMediaF3_720_512, // 3.5", 720KB, 512 bytes/sector
  107. FmMediaF5_1Pt2_512, // 5.25", 1.2MB, 512 bytes/sector
  108. FmMediaF3_1Pt44_512, // 3.5", 1.44MB, 512 bytes/sector
  109. FmMediaF3_2Pt88_512, // 3.5", 2.88MB, 512 bytes/sector
  110. FmMediaF3_20Pt8_512, // 3.5", 20.8MB, 512 bytes/sector
  111. FmMediaRemovable, // Removable media other than floppy
  112. FmMediaFixed,
  113. FmMediaF3_120M_512, // 3.5", 120M Floppy
  114. #if defined(FE_SB)
  115. // FMR Sep.8.1994 SFT YAM
  116. // FMR Jul.14.1994 SFT KMR
  117. FmMediaF3_640_512, // 3.5" , 640KB, 512 bytes/sector
  118. FmMediaF5_640_512, // 5.25", 640KB, 512 bytes/sector
  119. FmMediaF5_720_512, // 5.25", 720KB, 512 bytes/sector
  120. // FMR Sep.8.1994 SFT YAM
  121. // FMR Jul.14.1994 SFT KMR
  122. FmMediaF3_1Pt2_512, // 3.5" , 1.2Mb, 512 bytes/sector
  123. // FMR Sep.8.1994 SFT YAM
  124. // FMR Jul.14.1994 SFT KMR
  125. FmMediaF3_1Pt23_1024, // 3.5" , 1.23Mb, 1024 bytes/sector
  126. FmMediaF5_1Pt23_1024, // 5.25", 1.23MB, 1024 bytes/sector
  127. FmMediaF3_128Mb_512, // 3.5" , 128MB, 512 bytes/sector 3.5"MO
  128. FmMediaF3_230Mb_512, // 3.5" , 230MB, 512 bytes/sector 3.5"MO
  129. FmMediaEndOfData // Total data count.
  130. #endif
  131. } FMIFS_MEDIA_TYPE, *PFMIFS_MEDIA_TYPE;
  132. //
  133. // The structure below defines information to be passed into ChkdskEx.
  134. // When new fields are added, the version number will have to be upgraded
  135. // so that only new code will reference those new fields.
  136. //
  137. typedef struct {
  138. UCHAR Major; // initial version is 1.0
  139. UCHAR Minor;
  140. ULONG Flags;
  141. } FMIFS_CHKDSKEX_PARAM, *PFMIFS_CHKDSKEX_PARAM;
  142. //
  143. // Internal definitions for Flags field in FMIFS_CHKDSKEX_PARAM
  144. //
  145. #define FMIFS_CHKDSK_RECOVER_FREE_SPACE 0x00000002UL
  146. #define FMIFS_CHKDSK_RECOVER_ALLOC_SPACE 0x00000004UL
  147. //
  148. // External definitions for Flags field in FMIFS_CHKDSKEX_PARAM
  149. //
  150. // FMIFS_CHKDSK_VERBOSE
  151. // - For FAT, chkdsk will print every filename being processed
  152. // - For NTFS, chkdsk will print clean up messages
  153. // FMIFS_CHKDSK_RECOVER
  154. // - Perform sector checking on free and allocated space
  155. // FMIFS_CHKDSK_EXTEND
  156. // - For NTFS, chkdsk will extend a volume
  157. // FMIFS_CHKDSK_DOWNGRADE (for NT5 or later but obsolete anyway)
  158. // - For NTFS, this downgrade a volume from most recent NTFS version
  159. // FMIFS_CHKDSK_ENABLE_UPGRADE (for NT5 or later but obsolete anyway)
  160. // - For NTFS, this upgrades a volume to most recent NTFS version
  161. // FMIFS_CHKDSK_CHECK_IF_DIRTY
  162. // - Perform consistency check only if the volume is dirty
  163. // FMIFS_CHKDSK_FORCE (for NT5 or later)
  164. // - Forces the volume to dismount first if necessary
  165. // FMIFS_CHKDSK_SKIP_INDEX_SCAN
  166. // - Skip the scanning of each index entry
  167. // FMIFS_CHKDSK_SKIP_CYCLE_SCAN
  168. // - Skip the checking of cycles within the directory tree
  169. #define FMIFS_CHKDSK_VERBOSE 0x00000001UL
  170. #define FMIFS_CHKDSK_RECOVER (FMIFS_CHKDSK_RECOVER_FREE_SPACE | \
  171. FMIFS_CHKDSK_RECOVER_ALLOC_SPACE)
  172. #define FMIFS_CHKDSK_EXTEND 0x00000008UL
  173. #define FMIFS_CHKDSK_DOWNGRADE 0x00000010UL
  174. #define FMIFS_CHKDSK_ENABLE_UPGRADE 0x00000020UL
  175. #define FMIFS_CHKDSK_CHECK_IF_DIRTY 0x00000080UL
  176. #define FMIFS_CHKDSK_FORCE 0x00000100UL
  177. #define FMIFS_CHKDSK_SKIP_INDEX_SCAN 0x00000200UL
  178. #define FMIFS_CHKDSK_SKIP_CYCLE_SCAN 0x00000400UL
  179. //
  180. // The structure below defines information to be passed into FormatEx2.
  181. // When new fields are added, the version number will have to be upgraded
  182. // so that only new code will reference those new fields.
  183. //
  184. typedef struct {
  185. UCHAR Major; // initial version is 1.0
  186. UCHAR Minor;
  187. ULONG Flags;
  188. PWSTR LabelString; // supplies the volume's label
  189. ULONG ClusterSize; // supplies the cluster size for the volume
  190. } FMIFS_FORMATEX2_PARAM, *PFMIFS_FORMATEX2_PARAM;
  191. //
  192. // External definitions for Flags field in FMIFS_FORMATEX2_PARAM
  193. //
  194. // FMIFS_FORMAT_QUICK
  195. // - Performs a quick format
  196. // FMIFS_FORMAT_BACKWARD_COMPATIBLE
  197. // - Formats a volume to be backward compatible to an older version of NTFS volume
  198. // FMIFS_FORMAT_FORCE
  199. // - Forces the volume to dismount first if necessary
  200. #define FMIFS_FORMAT_QUICK 0x00000001UL
  201. #define FMIFS_FORMAT_BACKWARD_COMPATIBLE 0x00000002UL
  202. #define FMIFS_FORMAT_FORCE 0x00000004UL
  203. //
  204. // Maximum length of file system format name string including version number in it
  205. // (e.g. FAT32, NTFS 5.0, NTFS 4.0, FAT, etc)
  206. //
  207. #define MAX_FILE_SYSTEM_FORMAT_VERSION_NAME_LEN 16
  208. //
  209. // Maximum length of file system name string (e.g. NTFS, FAT32, FAT, etc)
  210. //
  211. #define MAX_FILE_SYSTEM_FORMAT_NAME_LEN 9
  212. //
  213. // Function types/interfaces.
  214. //
  215. typedef BOOLEAN
  216. (*FMIFS_CALLBACK)(
  217. IN FMIFS_PACKET_TYPE PacketType,
  218. IN ULONG PacketLength,
  219. IN PVOID PacketData
  220. );
  221. typedef
  222. VOID
  223. (*PFMIFS_FORMAT_ROUTINE)(
  224. IN PWSTR DriveName,
  225. IN FMIFS_MEDIA_TYPE MediaType,
  226. IN PWSTR FileSystemName,
  227. IN PWSTR Label,
  228. IN BOOLEAN Quick,
  229. IN FMIFS_CALLBACK Callback
  230. );
  231. typedef
  232. VOID
  233. (*PFMIFS_FORMATEX_ROUTINE)(
  234. IN PWSTR DriveName,
  235. IN FMIFS_MEDIA_TYPE MediaType,
  236. IN PWSTR FileSystemName,
  237. IN PWSTR Label,
  238. IN BOOLEAN Quick,
  239. IN ULONG ClusterSize,
  240. IN FMIFS_CALLBACK Callback
  241. );
  242. typedef
  243. VOID
  244. (*PFMIFS_FORMATEX2_ROUTINE)(
  245. IN PWSTR DriveName,
  246. IN FMIFS_MEDIA_TYPE MediaType,
  247. IN PWSTR FileSystemName,
  248. IN PFMIFS_FORMATEX2_PARAM Param,
  249. IN FMIFS_CALLBACK Callback
  250. );
  251. typedef
  252. BOOLEAN
  253. (*PFMIFS_ENABLECOMP_ROUTINE)(
  254. IN PWSTR DriveName,
  255. IN USHORT CompressionFormat
  256. );
  257. typedef
  258. VOID
  259. (*PFMIFS_CHKDSK_ROUTINE)(
  260. IN PWSTR DriveName,
  261. IN PWSTR FileSystemName,
  262. IN BOOLEAN Fix,
  263. IN BOOLEAN Verbose,
  264. IN BOOLEAN OnlyIfDirty,
  265. IN BOOLEAN Recover,
  266. IN PWSTR PathToCheck,
  267. IN BOOLEAN Extend,
  268. IN FMIFS_CALLBACK Callback
  269. );
  270. typedef
  271. VOID
  272. (*PFMIFS_CHKDSKEX_ROUTINE)(
  273. IN PWSTR DriveName,
  274. IN PWSTR FileSystemName,
  275. IN BOOLEAN Fix,
  276. IN PFMIFS_CHKDSKEX_PARAM Param,
  277. IN FMIFS_CALLBACK Callback
  278. );
  279. typedef
  280. VOID
  281. (*PFMIFS_EXTEND_ROUTINE)(
  282. IN PWSTR DriveName,
  283. IN BOOLEAN Verify,
  284. IN FMIFS_CALLBACK Callback
  285. );
  286. typedef
  287. VOID
  288. (*PFMIFS_DISKCOPY_ROUTINE)(
  289. IN PWSTR SourceDrive,
  290. IN PWSTR DestDrive,
  291. IN BOOLEAN Verify,
  292. IN FMIFS_CALLBACK Callback
  293. );
  294. typedef
  295. BOOLEAN
  296. (*PFMIFS_SETLABEL_ROUTINE)(
  297. IN PWSTR DriveName,
  298. IN PWSTR Label
  299. );
  300. typedef
  301. BOOLEAN
  302. (*PFMIFS_QSUPMEDIA_ROUTINE)(
  303. IN PWSTR DriveName,
  304. OUT PFMIFS_MEDIA_TYPE MediaTypeArray OPTIONAL,
  305. IN ULONG NumberOfArrayEntries,
  306. OUT PULONG NumberOfMediaTypes
  307. );
  308. typedef
  309. VOID
  310. (*PFMIFS_DOUBLESPACE_CREATE_ROUTINE)(
  311. IN PWSTR HostDriveName,
  312. IN ULONG Size,
  313. IN PWSTR Label,
  314. IN PWSTR NewDriveName,
  315. IN FMIFS_CALLBACK Callback
  316. );
  317. #if defined( DBLSPACE_ENABLED )
  318. typedef
  319. VOID
  320. (*PFMIFS_DOUBLESPACE_DELETE_ROUTINE)(
  321. IN PWSTR DblspaceDriveName,
  322. IN FMIFS_CALLBACK Callback
  323. );
  324. typedef
  325. VOID
  326. (*PFMIFS_DOUBLESPACE_MOUNT_ROUTINE)(
  327. IN PWSTR HostDriveName,
  328. IN PWSTR CvfName,
  329. IN PWSTR NewDriveName,
  330. IN FMIFS_CALLBACK Callback
  331. );
  332. typedef
  333. VOID
  334. (*PFMIFS_DOUBLESPACE_DISMOUNT_ROUTINE)(
  335. IN PWSTR DblspaceDriveName,
  336. IN FMIFS_CALLBACK Callback
  337. );
  338. typedef
  339. BOOLEAN
  340. (*PFMIFS_DOUBLESPACE_QUERY_INFO_ROUTINE)(
  341. IN PWSTR DosDriveName,
  342. OUT PBOOLEAN IsRemovable,
  343. OUT PBOOLEAN IsFloppy,
  344. OUT PBOOLEAN IsCompressed,
  345. OUT PBOOLEAN Error,
  346. OUT PWSTR NtDriveName,
  347. IN ULONG MaxNtDriveNameLength,
  348. OUT PWSTR CvfFileName,
  349. IN ULONG MaxCvfFileNameLength,
  350. OUT PWSTR HostDriveName,
  351. IN ULONG MaxHostDriveNameLength
  352. );
  353. typedef
  354. BOOLEAN
  355. (*PFMIFS_DOUBLESPACE_SET_AUTMOUNT_ROUTINE)(
  356. IN BOOLEAN EnableAutomount
  357. );
  358. #endif // DBLSPACE_ENABLED
  359. VOID
  360. Format(
  361. IN PWSTR DriveName,
  362. IN FMIFS_MEDIA_TYPE MediaType,
  363. IN PWSTR FileSystemName,
  364. IN PWSTR Label,
  365. IN BOOLEAN Quick,
  366. IN FMIFS_CALLBACK Callback
  367. );
  368. VOID
  369. FormatEx(
  370. IN PWSTR DriveName,
  371. IN FMIFS_MEDIA_TYPE MediaType,
  372. IN PWSTR FileSystemName,
  373. IN PWSTR Label,
  374. IN BOOLEAN Quick,
  375. IN ULONG ClusterSize,
  376. IN FMIFS_CALLBACK Callback
  377. );
  378. BOOLEAN
  379. EnableVolumeCompression(
  380. IN PWSTR DriveName,
  381. IN USHORT CompressionFormat
  382. );
  383. VOID
  384. Chkdsk(
  385. IN PWSTR DriveName,
  386. IN PWSTR FileSystemName,
  387. IN BOOLEAN Fix,
  388. IN BOOLEAN Verbose,
  389. IN BOOLEAN OnlyIfDirty,
  390. IN BOOLEAN Recover,
  391. IN PWSTR PathToCheck,
  392. IN BOOLEAN Extend,
  393. IN FMIFS_CALLBACK Callback
  394. );
  395. VOID
  396. ChkdskEx(
  397. IN PWSTR DriveName,
  398. IN PWSTR FileSystemName,
  399. IN BOOLEAN Fix,
  400. IN PFMIFS_CHKDSKEX_PARAM Param,
  401. IN FMIFS_CALLBACK Callback
  402. );
  403. VOID
  404. Extend(
  405. IN PWSTR DriveName,
  406. IN BOOLEAN Verify,
  407. IN FMIFS_CALLBACK Callback
  408. );
  409. VOID
  410. DiskCopy(
  411. IN PWSTR SourceDrive,
  412. IN PWSTR DestDrive,
  413. IN BOOLEAN Verify,
  414. IN FMIFS_CALLBACK Callback
  415. );
  416. BOOLEAN
  417. SetLabel(
  418. IN PWSTR DriveName,
  419. IN PWSTR Label
  420. );
  421. BOOLEAN
  422. QuerySupportedMedia(
  423. IN PWSTR DriveName,
  424. OUT PFMIFS_MEDIA_TYPE MediaTypeArray OPTIONAL,
  425. IN ULONG NumberOfArrayEntries,
  426. OUT PULONG NumberOfMediaTypes
  427. );
  428. BOOLEAN
  429. QueryAvailableFileSystemFormat(
  430. IN ULONG Index,
  431. OUT PWSTR FileSystemName,
  432. OUT PUCHAR MajorVersion,
  433. OUT PUCHAR MinorVersion,
  434. OUT PBOOLEAN Latest
  435. );
  436. BOOLEAN
  437. QueryFileSystemName(
  438. IN PWSTR DriveName,
  439. OUT PWSTR FileSystemName,
  440. OUT PUCHAR MajorVersion,
  441. OUT PUCHAR MinorVersion,
  442. OUT PNTSTATUS ErrorCode
  443. );
  444. BOOLEAN
  445. QueryLatestFileSystemVersion(
  446. IN PWSTR FileSystemName,
  447. OUT PUCHAR MajorVersion,
  448. OUT PUCHAR MinorVersion
  449. );
  450. VOID
  451. DoubleSpaceCreate(
  452. IN PWSTR HostDriveName,
  453. IN ULONG Size,
  454. IN PWSTR Label,
  455. IN PWSTR NewDriveName,
  456. IN FMIFS_CALLBACK Callback
  457. );
  458. #if defined( DBLSPACE_ENABLED )
  459. VOID
  460. DoubleSpaceDelete(
  461. IN PWSTR DblspaceDriveName,
  462. IN FMIFS_CALLBACK Callback
  463. );
  464. VOID
  465. DoubleSpaceMount(
  466. IN PWSTR HostDriveName,
  467. IN PWSTR CvfName,
  468. IN PWSTR NewDriveName,
  469. IN FMIFS_CALLBACK Callback
  470. );
  471. VOID
  472. DoubleSpaceDismount(
  473. IN PWSTR DblspaceDriveName,
  474. IN FMIFS_CALLBACK Callback
  475. );
  476. // Miscellaneous prototypes:
  477. //
  478. BOOLEAN
  479. FmifsQueryDriveInformation(
  480. IN PWSTR DosDriveName,
  481. OUT PBOOLEAN IsRemovable,
  482. OUT PBOOLEAN IsFloppy,
  483. OUT PBOOLEAN IsCompressed,
  484. OUT PBOOLEAN Error,
  485. OUT PWSTR NtDriveName,
  486. IN ULONG MaxNtDriveNameLength,
  487. OUT PWSTR CvfFileName,
  488. IN ULONG MaxCvfFileNameLength,
  489. OUT PWSTR HostDriveName,
  490. IN ULONG MaxHostDriveNameLength
  491. );
  492. BOOLEAN
  493. FmifsSetAutomount(
  494. IN BOOLEAN EnableAutomount
  495. );
  496. #endif
  497. #endif // _FMIFS_DEFN_