ReactOS 0.4.16-dev-106-g10b08aa
fmifs.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TEXTOUTPUT
 
struct  _DEVICE_INFORMATION
 

Macros

#define MEMORYSTICK_FORMAT_CAPABLE   0x10
 
#define MEMORYSTICK_SUPPORTS_PROGRESS_BAR   0x20
 
#define DEVICE_HOTPLUG   0x40
 
#define DEVICE_MEMORYSTICK   0x41
 

Typedefs

typedef struct TEXTOUTPUTPTEXTOUTPUT
 
typedef struct _DEVICE_INFORMATION DEVICE_INFORMATION
 
typedef struct _DEVICE_INFORMATIONPDEVICE_INFORMATION
 
typedef BOOLEAN(NTAPIPFMIFSCALLBACK) (IN CALLBACKCOMMAND Command, IN ULONG SubAction, IN PVOID ActionInfo)
 
typedef BOOLEAN(NTAPIPULIB_CHKDSK) (IN PUNICODE_STRING DriveRoot, IN PFMIFSCALLBACK Callback, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PVOID pUnknown1, IN PVOID pUnknown2, IN PVOID pUnknown3, IN PVOID pUnknown4, IN PULONG ExitStatus)
 
typedef BOOLEAN(NTAPIPULIB_FORMAT) (IN PUNICODE_STRING DriveRoot, IN PFMIFSCALLBACK Callback, IN BOOLEAN QuickFormat, IN BOOLEAN BackwardCompatible, IN MEDIA_TYPE MediaType, IN PUNICODE_STRING Label, IN ULONG ClusterSize)
 

Enumerations

enum  FMIFS_MEDIA_FLAG {
  FMIFS_UNKNOWN0 , FMIFS_UNKNOWN1 , FMIFS_UNKNOWN2 , FMIFS_UNKNOWN3 ,
  FMIFS_UNKNOWN4 , FMIFS_UNKNOWN5 , FMIFS_UNKNOWN6 , FMIFS_UNKNOWN7 ,
  FMIFS_FLOPPY , FMIFS_UNKNOWN9 , FMIFS_UNKNOWN10 , FMIFS_REMOVABLE ,
  FMIFS_HARDDISK , FMIFS_UNKNOWN13 , FMIFS_UNKNOWN14 , FMIFS_UNKNOWN15 ,
  FMIFS_UNKNOWN16 , FMIFS_UNKNOWN17 , FMIFS_UNKNOWN18 , FMIFS_UNKNOWN19 ,
  FMIFS_UNKNOWN20 , FMIFS_UNKNOWN21 , FMIFS_UNKNOWN22 , FMIFS_UNKNOWN23 ,
  FMIFS_UNKNOWN0 , FMIFS_UNKNOWN1 , FMIFS_UNKNOWN2 , FMIFS_UNKNOWN3 ,
  FMIFS_UNKNOWN4 , FMIFS_UNKNOWN5 , FMIFS_UNKNOWN6 , FMIFS_UNKNOWN7 ,
  FMIFS_FLOPPY , FMIFS_UNKNOWN9 , FMIFS_UNKNOWN10 , FMIFS_REMOVABLE ,
  FMIFS_HARDDISK , FMIFS_UNKNOWN13 , FMIFS_UNKNOWN14 , FMIFS_UNKNOWN15 ,
  FMIFS_UNKNOWN16 , FMIFS_UNKNOWN17 , FMIFS_UNKNOWN18 , FMIFS_UNKNOWN19 ,
  FMIFS_UNKNOWN20 , FMIFS_UNKNOWN21 , FMIFS_UNKNOWN22 , FMIFS_UNKNOWN23
}
 
enum  CALLBACKCOMMAND {
  PROGRESS , DONEWITHSTRUCTURE , UNKNOWN2 , UNKNOWN3 ,
  UNKNOWN4 , UNKNOWN5 , INSUFFICIENTRIGHTS , FSNOTSUPPORTED ,
  VOLUMEINUSE , UNKNOWN9 , UNKNOWNA , DONE ,
  UNKNOWNC , UNKNOWND , OUTPUT , STRUCTUREPROGRESS ,
  CLUSTERSIZETOOSMALL , PROGRESS , DONEWITHSTRUCTURE , UNKNOWN2 ,
  UNKNOWN3 , UNKNOWN4 , UNKNOWN5 , INSUFFICIENTRIGHTS ,
  FSNOTSUPPORTED , VOLUMEINUSE , UNKNOWN9 , UNKNOWNA ,
  DONE , UNKNOWNC , UNKNOWND , OUTPUT ,
  STRUCTUREPROGRESS , CLUSTERSIZETOOSMALL
}
 

Functions

VOID NTAPI Chkdsk (IN PWCHAR DriveRoot, IN PWCHAR Format, IN BOOLEAN CorrectErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PVOID Unused2, IN PVOID Unused3, IN PFMIFSCALLBACK Callback)
 
VOID NTAPI ChkdskEx (IN PWCHAR DriveRoot, IN PWCHAR Format, IN BOOLEAN CorrectErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PVOID Unused2, IN PVOID Unused3, IN PFMIFSCALLBACK Callback)
 
FMIFS_MEDIA_FLAG NTAPI ComputeFmMediaType (IN ULONG MediaType)
 
VOID NTAPI DiskCopy (VOID)
 
BOOLEAN NTAPI EnableVolumeCompression (IN PWCHAR DriveRoot, IN USHORT Compression)
 
VOID NTAPI Format (IN PWCHAR DriveRoot, IN FMIFS_MEDIA_FLAG MediaFlag, IN PWCHAR Format, IN PWCHAR Label, IN BOOLEAN QuickFormat, IN PFMIFSCALLBACK Callback)
 
VOID NTAPI FormatEx (IN PWCHAR DriveRoot, IN FMIFS_MEDIA_FLAG MediaFlag, IN PWCHAR Format, IN PWCHAR Label, IN BOOLEAN QuickFormat, IN ULONG ClusterSize, IN PFMIFSCALLBACK Callback)
 
BOOLEAN NTAPI QueryAvailableFileSystemFormat (IN DWORD Index, IN OUT PWCHAR FileSystem, OUT UCHAR *Major, OUT UCHAR *Minor, OUT BOOLEAN *LatestVersion)
 
BOOL NTAPI QueryDeviceInformation (_In_ PWCHAR DriveRoot, _Out_ PVOID DeviceInformation, _In_ ULONG BufferSize)
 Retrieves disk device information.
 
BOOL NTAPI QueryFileSystemName (IN PWCHAR DriveRoot, OUT PWCHAR FileSystem OPTIONAL, OUT UCHAR *Unknown2 OPTIONAL, OUT UCHAR *Unknown3 OPTIONAL, OUT ULONG *Unknown4 OPTIONAL)
 
BOOLEAN NTAPI QueryLatestFileSystemVersion (IN PWCHAR FileSystem, OUT UCHAR *Major OPTIONAL, OUT UCHAR *Minor OPTIONAL)
 
BOOL NTAPI QuerySupportedMedia (IN PWCHAR DriveRoot, OUT FMIFS_MEDIA_FLAG *CurrentMedia OPTIONAL, IN ULONG Unknown3, OUT PULONG Unknown4)
 
BOOL NTAPI SetLabel (IN PWCHAR DriveRoot, IN PWCHAR Label)
 

Macro Definition Documentation

◆ DEVICE_HOTPLUG

#define DEVICE_HOTPLUG   0x40

Definition at line 47 of file fmifs.h.

◆ DEVICE_MEMORYSTICK

#define DEVICE_MEMORYSTICK   0x41

Definition at line 48 of file fmifs.h.

◆ MEMORYSTICK_FORMAT_CAPABLE

#define MEMORYSTICK_FORMAT_CAPABLE   0x10

Definition at line 45 of file fmifs.h.

◆ MEMORYSTICK_SUPPORTS_PROGRESS_BAR

#define MEMORYSTICK_SUPPORTS_PROGRESS_BAR   0x20

Definition at line 46 of file fmifs.h.

Typedef Documentation

◆ DEVICE_INFORMATION

◆ PDEVICE_INFORMATION

◆ PFMIFSCALLBACK

typedef BOOLEAN(NTAPI * PFMIFSCALLBACK) (IN CALLBACKCOMMAND Command, IN ULONG SubAction, IN PVOID ActionInfo)

Definition at line 102 of file fmifs.h.

◆ PTEXTOUTPUT

◆ PULIB_CHKDSK

typedef BOOLEAN(NTAPI * PULIB_CHKDSK) (IN PUNICODE_STRING DriveRoot, IN PFMIFSCALLBACK Callback, IN BOOLEAN FixErrors, IN BOOLEAN Verbose, IN BOOLEAN CheckOnlyIfDirty, IN BOOLEAN ScanDrive, IN PVOID pUnknown1, IN PVOID pUnknown2, IN PVOID pUnknown3, IN PVOID pUnknown4, IN PULONG ExitStatus)

Definition at line 215 of file fmifs.h.

◆ PULIB_FORMAT

typedef BOOLEAN(NTAPI * PULIB_FORMAT) (IN PUNICODE_STRING DriveRoot, IN PFMIFSCALLBACK Callback, IN BOOLEAN QuickFormat, IN BOOLEAN BackwardCompatible, IN MEDIA_TYPE MediaType, IN PUNICODE_STRING Label, IN ULONG ClusterSize)

Definition at line 231 of file fmifs.h.

Enumeration Type Documentation

◆ CALLBACKCOMMAND

Enumerator
PROGRESS 
DONEWITHSTRUCTURE 
UNKNOWN2 
UNKNOWN3 
UNKNOWN4 
UNKNOWN5 
INSUFFICIENTRIGHTS 
FSNOTSUPPORTED 
VOLUMEINUSE 
UNKNOWN9 
UNKNOWNA 
DONE 
UNKNOWNC 
UNKNOWND 
OUTPUT 
STRUCTUREPROGRESS 
CLUSTERSIZETOOSMALL 
PROGRESS 
DONEWITHSTRUCTURE 
UNKNOWN2 
UNKNOWN3 
UNKNOWN4 
UNKNOWN5 
INSUFFICIENTRIGHTS 
FSNOTSUPPORTED 
VOLUMEINUSE 
UNKNOWN9 
UNKNOWNA 
DONE 
UNKNOWNC 
UNKNOWND 
OUTPUT 
STRUCTUREPROGRESS 
CLUSTERSIZETOOSMALL 

Definition at line 80 of file fmifs.h.

81{
93 DONE,
96 OUTPUT,
CALLBACKCOMMAND
Definition: fmifs.h:81
@ UNKNOWN9
Definition: fmifs.h:91
@ OUTPUT
Definition: fmifs.h:96
@ FSNOTSUPPORTED
Definition: fmifs.h:89
@ UNKNOWND
Definition: fmifs.h:95
@ VOLUMEINUSE
Definition: fmifs.h:90
@ UNKNOWN4
Definition: fmifs.h:86
@ UNKNOWNA
Definition: fmifs.h:92
@ STRUCTUREPROGRESS
Definition: fmifs.h:97
@ DONE
Definition: fmifs.h:93
@ CLUSTERSIZETOOSMALL
Definition: fmifs.h:98
@ DONEWITHSTRUCTURE
Definition: fmifs.h:83
@ INSUFFICIENTRIGHTS
Definition: fmifs.h:88
@ PROGRESS
Definition: fmifs.h:82
@ UNKNOWN5
Definition: fmifs.h:87
@ UNKNOWN2
Definition: fmifs.h:84
@ UNKNOWN3
Definition: fmifs.h:85
@ UNKNOWNC
Definition: fmifs.h:94

◆ FMIFS_MEDIA_FLAG

Enumerator
FMIFS_UNKNOWN0 
FMIFS_UNKNOWN1 
FMIFS_UNKNOWN2 
FMIFS_UNKNOWN3 
FMIFS_UNKNOWN4 
FMIFS_UNKNOWN5 
FMIFS_UNKNOWN6 
FMIFS_UNKNOWN7 
FMIFS_FLOPPY 
FMIFS_UNKNOWN9 
FMIFS_UNKNOWN10 
FMIFS_REMOVABLE 
FMIFS_HARDDISK 
FMIFS_UNKNOWN13 
FMIFS_UNKNOWN14 
FMIFS_UNKNOWN15 
FMIFS_UNKNOWN16 
FMIFS_UNKNOWN17 
FMIFS_UNKNOWN18 
FMIFS_UNKNOWN19 
FMIFS_UNKNOWN20 
FMIFS_UNKNOWN21 
FMIFS_UNKNOWN22 
FMIFS_UNKNOWN23 
FMIFS_UNKNOWN0 
FMIFS_UNKNOWN1 
FMIFS_UNKNOWN2 
FMIFS_UNKNOWN3 
FMIFS_UNKNOWN4 
FMIFS_UNKNOWN5 
FMIFS_UNKNOWN6 
FMIFS_UNKNOWN7 
FMIFS_FLOPPY 
FMIFS_UNKNOWN9 
FMIFS_UNKNOWN10 
FMIFS_REMOVABLE 
FMIFS_HARDDISK 
FMIFS_UNKNOWN13 
FMIFS_UNKNOWN14 
FMIFS_UNKNOWN15 
FMIFS_UNKNOWN16 
FMIFS_UNKNOWN17 
FMIFS_UNKNOWN18 
FMIFS_UNKNOWN19 
FMIFS_UNKNOWN20 
FMIFS_UNKNOWN21 
FMIFS_UNKNOWN22 
FMIFS_UNKNOWN23 

Definition at line 51 of file fmifs.h.

52{
FMIFS_MEDIA_FLAG
Definition: fmifs.h:52
@ FMIFS_UNKNOWN14
Definition: fmifs.h:67
@ FMIFS_UNKNOWN23
Definition: fmifs.h:76
@ FMIFS_UNKNOWN13
Definition: fmifs.h:66
@ FMIFS_UNKNOWN22
Definition: fmifs.h:75
@ FMIFS_UNKNOWN17
Definition: fmifs.h:70
@ FMIFS_UNKNOWN4
Definition: fmifs.h:57
@ FMIFS_UNKNOWN1
Definition: fmifs.h:54
@ FMIFS_FLOPPY
Definition: fmifs.h:61
@ FMIFS_UNKNOWN3
Definition: fmifs.h:56
@ FMIFS_UNKNOWN10
Definition: fmifs.h:63
@ FMIFS_UNKNOWN18
Definition: fmifs.h:71
@ FMIFS_UNKNOWN0
Definition: fmifs.h:53
@ FMIFS_UNKNOWN21
Definition: fmifs.h:74
@ FMIFS_UNKNOWN15
Definition: fmifs.h:68
@ FMIFS_UNKNOWN16
Definition: fmifs.h:69
@ FMIFS_UNKNOWN7
Definition: fmifs.h:60
@ FMIFS_UNKNOWN20
Definition: fmifs.h:73
@ FMIFS_UNKNOWN19
Definition: fmifs.h:72
@ FMIFS_UNKNOWN6
Definition: fmifs.h:59
@ FMIFS_REMOVABLE
Definition: fmifs.h:64
@ FMIFS_UNKNOWN5
Definition: fmifs.h:58
@ FMIFS_UNKNOWN9
Definition: fmifs.h:62
@ FMIFS_HARDDISK
Definition: fmifs.h:65
@ FMIFS_UNKNOWN2
Definition: fmifs.h:55

Function Documentation

◆ Chkdsk()

VOID NTAPI Chkdsk ( IN PWCHAR  DriveRoot,
IN PWCHAR  Format,
IN BOOLEAN  CorrectErrors,
IN BOOLEAN  Verbose,
IN BOOLEAN  CheckOnlyIfDirty,
IN BOOLEAN  ScanDrive,
IN PVOID  Unused2,
IN PVOID  Unused3,
IN PFMIFSCALLBACK  Callback 
)

Definition at line 19 of file chkdsk.c.

29{
31 UNICODE_STRING usDriveRoot;
34 WCHAR DriveName[MAX_PATH];
36
38 if (!Provider)
39 {
40 /* Unknown file system */
41 goto Quit;
42 }
43
44 if (!NT_SUCCESS(RtlStringCchCopyW(DriveName, ARRAYSIZE(DriveName), DriveRoot)))
45 goto Quit;
46
47 if (DriveName[wcslen(DriveName) - 1] != L'\\')
48 {
49 /* Append the trailing backslash for GetVolumeNameForVolumeMountPointW */
50 if (!NT_SUCCESS(RtlStringCchCatW(DriveName, ARRAYSIZE(DriveName), L"\\")))
51 goto Quit;
52 }
53
55 {
56 /* Couldn't get a volume GUID path, try checking using a parameter provided path */
57 DPRINT1("Couldn't get a volume GUID path for drive %S\n", DriveName);
58 wcscpy(VolumeName, DriveName);
59 }
60
62 goto Quit;
63
64 /* Trim the trailing backslash since we will work with a device object */
65 usDriveRoot.Length -= sizeof(WCHAR);
66
67 DPRINT("Chkdsk() - %S\n", Format);
69 Success = Provider->Chkdsk(&usDriveRoot,
71 CorrectErrors,
72 Verbose,
73 CheckOnlyIfDirty,
74 ScanDrive,
75 NULL,
76 NULL,
77 NULL,
78 NULL,
79 (PULONG)&Status);
80 if (!Success)
81 DPRINT1("Chkdsk() failed with Status 0x%lx\n", Status);
82
83 RtlFreeUnicodeString(&usDriveRoot);
84
85Quit:
86 /* Report result */
87 Callback(DONE, 0, &Success);
88}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOL Verbose
Definition: chkdsk.c:72
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATH
Definition: compat.h:34
@ Success
Definition: eventcreate.c:712
_Must_inspect_result_ _Inout_opt_ PUNICODE_STRING VolumeName
Definition: fltkernel.h:1117
return pInstance GetProvider() -> GetHandle()
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
BOOL WINAPI GetVolumeNameForVolumeMountPointW(IN LPCWSTR VolumeMountPoint, OUT LPWSTR VolumeName, IN DWORD VolumeNameLength)
Definition: mntpoint.c:496
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSTRSAFEAPI RtlStringCchCopyW(_Out_writes_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:127
NTSTRSAFEAPI RtlStringCchCatW(_Inout_updates_(cchDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cchDest, _In_ NTSTRSAFE_PCWSTR pszSrc)
Definition: ntstrsafe.h:601
#define L(x)
Definition: ntvdm.h:50
#define DONE
Definition: rnr20lib.h:14
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:73
uint32_t * PULONG
Definition: typedefs.h:59
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:458
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ChkDskNow(), and wmain().

◆ ChkdskEx()

VOID NTAPI ChkdskEx ( IN PWCHAR  DriveRoot,
IN PWCHAR  Format,
IN BOOLEAN  CorrectErrors,
IN BOOLEAN  Verbose,
IN BOOLEAN  CheckOnlyIfDirty,
IN BOOLEAN  ScanDrive,
IN PVOID  Unused2,
IN PVOID  Unused3,
IN PFMIFSCALLBACK  Callback 
)

◆ ComputeFmMediaType()

FMIFS_MEDIA_FLAG NTAPI ComputeFmMediaType ( IN ULONG  MediaType)

◆ DiskCopy()

VOID NTAPI DiskCopy ( VOID  )

Definition at line 15 of file diskcopy.c.

16{
17}

◆ EnableVolumeCompression()

BOOLEAN NTAPI EnableVolumeCompression ( IN PWCHAR  DriveRoot,
IN USHORT  Compression 
)

Definition at line 17 of file compress.c.

20{
22 DWORD RetBytes;
23 BOOL Ret;
24
25 hFile = CreateFileW(DriveRoot,
28 NULL,
31 NULL);
33 return FALSE;
34
37 &Compression,
38 sizeof(USHORT),
39 NULL,
40 0,
41 &RetBytes,
42 NULL);
43
45
46 return (Ret != 0);
47}
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define CloseHandle
Definition: compat.h:739
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
_In_ HANDLE hFile
Definition: mswsock.h:90
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define FILE_READ_DATA
Definition: nt_native.h:628
#define FSCTL_SET_COMPRESSION
Definition: nt_native.h:842
unsigned short USHORT
Definition: pedump.c:61

Referenced by wmain().

◆ Format()

VOID NTAPI Format ( IN PWCHAR  DriveRoot,
IN FMIFS_MEDIA_FLAG  MediaFlag,
IN PWCHAR  Format,
IN PWCHAR  Label,
IN BOOLEAN  QuickFormat,
IN PFMIFSCALLBACK  Callback 
)

Definition at line 19 of file format.c.

26{
27 FormatEx(DriveRoot,
28 MediaFlag,
29 Format,
30 Label,
32 0,
33 Callback);
34}
BOOL QuickFormat
Definition: format.c:66
PWCHAR Label
Definition: format.c:70
VOID NTAPI FormatEx(IN PWCHAR DriveRoot, IN FMIFS_MEDIA_FLAG MediaFlag, IN PWCHAR Format, IN PWCHAR Label, IN BOOLEAN QuickFormat, IN ULONG ClusterSize, IN PFMIFSCALLBACK Callback)
Definition: format.c:39

◆ FormatEx()

VOID NTAPI FormatEx ( IN PWCHAR  DriveRoot,
IN FMIFS_MEDIA_FLAG  MediaFlag,
IN PWCHAR  Format,
IN PWCHAR  Label,
IN BOOLEAN  QuickFormat,
IN ULONG  ClusterSize,
IN PFMIFSCALLBACK  Callback 
)

Definition at line 39 of file format.c.

47{
49 UNICODE_STRING usDriveRoot;
50 UNICODE_STRING usLabel;
52 BOOLEAN BackwardCompatible = FALSE; // Default to latest FS versions.
53 MEDIA_TYPE MediaType;
54 WCHAR DriveName[MAX_PATH];
56
57//
58// TODO: Convert filesystem Format into ULIB format string.
59//
60
62 if (!Provider)
63 {
64 /* Unknown file system */
65 goto Quit;
66 }
67
68 if (!NT_SUCCESS(RtlStringCchCopyW(DriveName, ARRAYSIZE(DriveName), DriveRoot)))
69 goto Quit;
70
71 if (DriveName[wcslen(DriveName) - 1] != L'\\')
72 {
73 /* Append the trailing backslash for GetVolumeNameForVolumeMountPointW */
74 if (!NT_SUCCESS(RtlStringCchCatW(DriveName, ARRAYSIZE(DriveName), L"\\")))
75 goto Quit;
76 }
77
79 {
80 /* Couldn't get a volume GUID path, try formatting using a parameter provided path */
81 DPRINT1("Couldn't get a volume GUID path for drive %S\n", DriveName);
82 wcscpy(VolumeName, DriveName);
83 }
84
86 goto Quit;
87
88 /* Trim the trailing backslash since we will work with a device object */
89 usDriveRoot.Length -= sizeof(WCHAR);
90
91 RtlInitUnicodeString(&usLabel, Label);
92
93 /* Set the BackwardCompatible flag in case we format with older FAT12/16 */
94 if (wcsicmp(Format, L"FAT") == 0)
95 BackwardCompatible = TRUE;
96 // else if (wcsicmp(Format, L"FAT32") == 0)
97 // BackwardCompatible = FALSE;
98
99 /* Convert the FMIFS MediaFlag to a NT MediaType */
100 // FIXME: Actually covert all the possible flags.
101 switch (MediaFlag)
102 {
103 case FMIFS_FLOPPY:
104 MediaType = F5_320_1024; // FIXME: This is hardfixed!
105 break;
106 case FMIFS_REMOVABLE:
107 MediaType = RemovableMedia;
108 break;
109 case FMIFS_HARDDISK:
110 MediaType = FixedMedia;
111 break;
112 default:
113 DPRINT1("Unknown FMIFS MediaFlag %d, converting 1-to-1 to NT MediaType\n",
114 MediaFlag);
115 MediaType = (MEDIA_TYPE)MediaFlag;
116 break;
117 }
118
119 DPRINT("Format() - %S\n", Format);
120 Success = Provider->Format(&usDriveRoot,
121 Callback,
123 BackwardCompatible,
124 MediaType,
125 &usLabel,
127 if (!Success)
128 DPRINT1("Format() failed\n");
129
130 RtlFreeUnicodeString(&usDriveRoot);
131
132Quit:
133 /* Report result */
134 Callback(DONE, 0, &Success);
135}
DWORD ClusterSize
Definition: format.c:67
#define TRUE
Definition: types.h:120
#define wcsicmp
Definition: compat.h:15
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
enum _MEDIA_TYPE MEDIA_TYPE
@ RemovableMedia
Definition: ntdddisk.h:382
@ FixedMedia
Definition: ntdddisk.h:383
@ F5_320_1024
Definition: ntdddisk.h:379

Referenced by Format(), FormatDrive(), and wmain().

◆ QueryAvailableFileSystemFormat()

BOOLEAN NTAPI QueryAvailableFileSystemFormat ( IN DWORD  Index,
IN OUT PWCHAR  FileSystem,
OUT UCHAR Major,
OUT UCHAR Minor,
OUT BOOLEAN LatestVersion 
)

Definition at line 20 of file query.c.

26{
27 PLIST_ENTRY ListEntry;
29
30 if (!FileSystem || !Major ||!Minor ||!LatestVersion)
31 return FALSE;
32
33 ListEntry = ProviderListHead.Flink;
34 while (TRUE)
35 {
36 if (ListEntry == &ProviderListHead)
37 return FALSE;
38 if (Index == 0)
39 break;
40 ListEntry = ListEntry->Flink;
41 Index--;
42 }
43
44 Provider = CONTAINING_RECORD(ListEntry, IFS_PROVIDER, ListEntry);
46 *Major = 0; /* FIXME */
47 *Minor = 0; /* FIXME */
48 *LatestVersion = TRUE; /* FIXME */
49
50 return TRUE;
51}
PWCHAR FileSystem
Definition: format.c:72
LIST_ENTRY ProviderListHead
Definition: init.c:20
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_In_ WDFCOLLECTION _In_ ULONG Index
_Out_opt_ PULONG Minor
Definition: cmfuncs.h:44

Referenced by InitializeFormatDriveDlg(), ShowInstalledFileSystems(), and Usage().

◆ QueryDeviceInformation()

BOOL NTAPI QueryDeviceInformation ( _In_ PWCHAR  DriveRoot,
_Out_ PVOID  DeviceInformation,
_In_ ULONG  BufferSize 
)

Retrieves disk device information.

Parameters
[in]DriveRootString which contains a DOS device name,
[in,out]DeviceInformationPointer to buffer with DEVICE_INFORMATION structure which will receive data.
[in]BufferSizeSize of buffer in bytes.
Returns
TRUE if the buffer was large enough and was filled with the requested information, FALSE otherwise.
Remarks
The returned information is mostly related to Sony Memory Stick devices. On Vista+ the returned information is disk sector size and volume length in sectors, regardless of the type of disk. ReactOS implementation returns DEVICE_HOTPLUG flag if inspected device is a hotplug device as well as sector size and volume length of disk device.

Definition at line 79 of file query.c.

83{
84 PDEVICE_INFORMATION DeviceInfo = DeviceInformation;
86 DISK_GEOMETRY DiskGeometry;
87 STORAGE_HOTPLUG_INFO HotplugInfo;
88 GET_LENGTH_INFORMATION LengthInformation;
94 WCHAR DriveName[MAX_PATH];
95
96 /* Buffer should be able to at least hold DeviceFlags */
97 if (BufferSize < sizeof(ULONG) ||
98 !NT_SUCCESS(RtlStringCchCopyW(DriveName, ARRAYSIZE(DriveName), DriveRoot)))
99 {
100 return FALSE;
101 }
102
103 if (DriveName[wcslen(DriveName) - 1] != L'\\')
104 {
105 /* Append the trailing backslash for GetVolumeNameForVolumeMountPointW */
106 if (!NT_SUCCESS(RtlStringCchCatW(DriveName, ARRAYSIZE(DriveName), L"\\")))
107 return FALSE;
108 }
109
112 {
113 /* Disk has no volume GUID, fallback to QueryDosDevice */
114 DriveName[wcslen(DriveName) - 1] = UNICODE_NULL;
116 return FALSE;
118 }
119 else
120 {
121 /* Trim the trailing backslash since we will work with a device object */
122 DeviceName.Length -= sizeof(WCHAR);
123 }
124
126 &DeviceName,
128 NULL,
129 NULL);
130
134 &Iosb,
137 if (!NT_SUCCESS(Status))
138 return FALSE;
139
141 NULL,
142 NULL,
143 NULL,
144 &Iosb,
146 NULL,
147 0,
148 &HotplugInfo,
149 sizeof(HotplugInfo));
150 if (!NT_SUCCESS(Status))
151 goto Quit;
152
153 DeviceInfo->DeviceFlags = 0;
154 if (HotplugInfo.MediaHotplug || HotplugInfo.DeviceHotplug)
155 {
156 /* This is a hotplug device */
157 DeviceInfo->DeviceFlags |= DEVICE_HOTPLUG;
158 }
159
160 /* Other flags that would be set here are related to Sony "Memory Stick"
161 * type of devices which we do not have any special support for */
162
163 if (BufferSize >= sizeof(DEVICE_INFORMATION))
164 {
165 /* This is the Vista+ version of the structure.
166 * We need to also provide disk sector size and volume length in sectors. */
168 NULL,
169 NULL,
170 NULL,
171 &Iosb,
173 NULL,
174 0,
175 &DiskGeometry,
176 sizeof(DiskGeometry));
177 if (!NT_SUCCESS(Status))
178 goto Quit;
179
181 NULL,
182 NULL,
183 NULL,
184 &Iosb,
186 NULL,
187 0,
188 &LengthInformation,
189 sizeof(LengthInformation));
190 if (!NT_SUCCESS(Status))
191 goto Quit;
192
193 LengthInformation.Length.QuadPart /= DiskGeometry.BytesPerSector;
194 DeviceInfo->SectorSize = DiskGeometry.BytesPerSector;
195 DeviceInfo->SectorCount = LengthInformation.Length;
196 }
197
199
200Quit:
202 return NT_SUCCESS(Status);
203}
@ DiskDevice
Definition: bl.h:247
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
Definition: cdrw_usr.h:169
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:542
return Iosb
Definition: create.c:4402
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
#define DEVICE_HOTPLUG
Definition: fmifs.h:47
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define IOCTL_DISK_GET_LENGTH_INFO
Definition: imports.h:192
#define IOCTL_STORAGE_GET_HOTPLUG_INFO
Definition: imports.h:238
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3952
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define UNICODE_NULL
ULONG BytesPerSector
Definition: ntdddisk.h:404
LARGE_INTEGER Length
Definition: imports.h:232
BOOLEAN DeviceHotplug
Definition: imports.h:248
BOOLEAN MediaHotplug
Definition: imports.h:247
uint32_t ULONG
Definition: typedefs.h:59
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

Referenced by MountMgrCreatePointWorker(), MountMgrNextDriveLetterWorker(), MountMgrVolumeMountPointChanged(), MountMgrVolumeMountPointCreated(), QueryPointsFromMemory(), QueryPointsFromSymbolicLinkName(), USBD_GetDeviceInformationEx(), USBH_GetDeviceType(), and wmain().

◆ QueryFileSystemName()

BOOL NTAPI QueryFileSystemName ( IN PWCHAR  DriveRoot,
OUT PWCHAR FileSystem  OPTIONAL,
OUT UCHAR *Unknown2  OPTIONAL,
OUT UCHAR *Unknown3  OPTIONAL,
OUT ULONG *Unknown4  OPTIONAL 
)

◆ QueryLatestFileSystemVersion()

BOOLEAN NTAPI QueryLatestFileSystemVersion ( IN PWCHAR  FileSystem,
OUT UCHAR *Major  OPTIONAL,
OUT UCHAR *Minor  OPTIONAL 
)

◆ QuerySupportedMedia()

BOOL NTAPI QuerySupportedMedia ( IN PWCHAR  DriveRoot,
OUT FMIFS_MEDIA_FLAG *CurrentMedia  OPTIONAL,
IN ULONG  Unknown3,
OUT PULONG  Unknown4 
)

Definition at line 15 of file media.c.

20{
21 return FALSE;
22}

◆ SetLabel()

BOOL NTAPI SetLabel ( IN PWCHAR  DriveRoot,
IN PWCHAR  Label 
)