ReactOS  0.4.14-dev-293-g2b39b42
format.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: File Management IFS Utility functions
4  * FILE: reactos/dll/win32/fmifs/format.c
5  * PURPOSE: Volume format
6  *
7  * PROGRAMMERS: Emanuele Aliberti
8  * Hervé Poussineau (hpoussin@reactos.org)
9  */
10 
11 #include "precomp.h"
12 
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* FMIFS.6 */
17 VOID NTAPI
19  IN PWCHAR DriveRoot,
20  IN FMIFS_MEDIA_FLAG MediaFlag,
22  IN PWCHAR Label,
25 {
26  FormatEx(DriveRoot,
27  MediaFlag,
28  Format,
29  Label,
31  0,
32  Callback);
33 }
34 
35 /* FMIFS.7 */
36 VOID
37 NTAPI
39  IN PWCHAR DriveRoot,
40  IN FMIFS_MEDIA_FLAG MediaFlag,
42  IN PWCHAR Label,
46 {
48  UNICODE_STRING usDriveRoot;
49  UNICODE_STRING usLabel;
50  BOOLEAN Argument = FALSE;
52  //CURDIR CurDir;
53 
55  if (!Provider)
56  {
57  /* Unknown file system */
58  Callback(DONE, 0, &Argument);
59  return;
60  }
61 
62 #if 1
63  DPRINT1("Warning: use GetVolumeNameForVolumeMountPointW() instead!\n");
64  swprintf(VolumeName, L"\\??\\%c:", towupper(DriveRoot[0]));
65  RtlCreateUnicodeString(&usDriveRoot, VolumeName);
66  /* Code disabled as long as our storage stack doesn't understand IOCTL_MOUNTDEV_QUERY_DEVICE_NAME */
67 #else
69  !RtlDosPathNameToNtPathName_U(VolumeName, &usDriveRoot, NULL, &CurDir))
70  {
71  /* Report an error. */
72  Callback(DONE, 0, &Argument);
73  return;
74  }
75 #endif
76 
77  RtlInitUnicodeString(&usLabel, Label);
78 
79  DPRINT("FormatEx - %S\n", Format);
80  Provider->FormatEx(&usDriveRoot,
81  MediaFlag,
82  &usLabel,
85  Callback);
86 
87  RtlFreeUnicodeString(&usDriveRoot);
88 }
89 
90 /* EOF */
#define IN
Definition: typedefs.h:38
uint16_t * PWCHAR
Definition: typedefs.h:54
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
BOOL QuickFormat
Definition: format.c:66
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:38
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
DWORD ClusterSize
Definition: format.c:67
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static const WCHAR L[]
Definition: oid.c:1250
BOOLEAN(NTAPI * PFMIFSCALLBACK)(IN CALLBACKCOMMAND Command, IN ULONG SubAction, IN PVOID ActionInfo)
Definition: fmifs.h:89
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _Inout_opt_ PUNICODE_STRING VolumeName
Definition: fltkernel.h:1117
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
PWCHAR Label
Definition: format.c:70
#define DONE
Definition: rnr20lib.h:14
#define towupper(c)
Definition: wctype.h:99
BOOL WINAPI GetVolumeNameForVolumeMountPointW(IN LPCWSTR VolumeMountPoint, OUT LPWSTR VolumeName, IN DWORD VolumeNameLength)
Definition: mntpoint.c:496
LPFNPSPCALLBACK Callback
Definition: desk.c:111
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)
VOID NTAPI Format(IN PWCHAR DriveRoot, IN FMIFS_MEDIA_FLAG MediaFlag, IN PWCHAR Format, IN PWCHAR Label, IN BOOLEAN QuickFormat, IN PFMIFSCALLBACK Callback)
Definition: format.c:18
FMIFS_MEDIA_FLAG
Definition: fmifs.h:37
PIFS_PROVIDER GetProvider(IN PWCHAR FileSystem)
Definition: init.c:23