ReactOS 0.4.16-dev-2613-g9533ad7
format.c File Reference
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <conutils.h>
#include <ndk/rtlfuncs.h>
#include <fmifs/fmifs.h>
#include "resource.h"
Include dependency graph for format.c:

Go to the source code of this file.

Classes

struct  SIZEDEFINITION
 

Macros

#define WIN32_NO_STATUS
 
#define NTOS_MODE_USER
 
#define FMIFS_IMPORT_DLL
 

Typedefs

typedef struct SIZEDEFINITIONPSIZEDEFINITION
 

Functions

static VOID PrintWin32Error (UINT Message, DWORD ErrorCode)
 
static int ParseCommandLine (int argc, WCHAR *argv[])
 
BOOLEAN WINAPI FormatExCallback (CALLBACKCOMMAND Command, ULONG Modifier, PVOID Argument)
 
static VOID Usage (LPWSTR ProgramName)
 
int wmain (int argc, WCHAR *argv[])
 

Variables

BOOL Error = FALSE
 
BOOL QuickFormat = FALSE
 
DWORD ClusterSize = 0
 
BOOL CompressDrive = FALSE
 
BOOL GotALabel = FALSE
 
PWCHAR Label = L""
 
PWCHAR Drive = NULL
 
PWCHAR FileSystem = L"FAT"
 
WCHAR RootDirectory [MAX_PATH]
 
WCHAR LabelString [12]
 
SIZEDEFINITION LegalSizes []
 

Macro Definition Documentation

◆ FMIFS_IMPORT_DLL

#define FMIFS_IMPORT_DLL

Definition at line 59 of file format.c.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 51 of file format.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 45 of file format.c.

Typedef Documentation

◆ PSIZEDEFINITION

Function Documentation

◆ FormatExCallback()

BOOLEAN WINAPI FormatExCallback ( CALLBACKCOMMAND  Command,
ULONG  Modifier,
PVOID  Argument 
)

Definition at line 220 of file format.c.

224{
226 PTEXTOUTPUT output;
228
229 //
230 // We get other types of commands, but we don't have to pay attention to them
231 //
232 switch (Command)
233 {
234 case PROGRESS:
235 percent = (PDWORD)Argument;
237 break;
238
239 case OUTPUT:
240 output = (PTEXTOUTPUT)Argument;
241 ConPrintf(StdOut, L"%S\n", output->Output);
242 break;
243
244 case DONE:
245 status = (PBOOLEAN)Argument;
246 if (*status == FALSE)
247 {
249 Error = TRUE;
250 }
251 break;
252
254 case UNKNOWN2:
255 case UNKNOWN3:
256 case UNKNOWN4:
257 case UNKNOWN5:
259 case FSNOTSUPPORTED:
260 case VOLUMEINUSE:
261 case UNKNOWN9:
262 case UNKNOWNA:
263 case UNKNOWNC:
264 case UNKNOWND:
268 return FALSE;
269 }
270 return TRUE;
271}
BOOL Error
Definition: format.c:62
#define STRING_COMPLETE
Definition: resource.h:6
#define STRING_FORMAT_FAIL
Definition: resource.h:7
#define STRING_NO_SUPPORT
Definition: resource.h:8
void ConPrintf(FILE *fp, LPCWSTR psz,...)
#define StdOut
Definition: conutils_noros.h:6
void ConResPrintf(FILE *fp, UINT nID,...)
void ConResPuts(FILE *fp, UINT nID)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define OUTPUT(ch)
#define L(x)
Definition: resources.c:13
struct TEXTOUTPUT * PTEXTOUTPUT
@ UNKNOWN9
Definition: fmifs.h:92
@ FSNOTSUPPORTED
Definition: fmifs.h:90
@ UNKNOWND
Definition: fmifs.h:96
@ VOLUMEINUSE
Definition: fmifs.h:91
@ UNKNOWN4
Definition: fmifs.h:87
@ UNKNOWNA
Definition: fmifs.h:93
@ STRUCTUREPROGRESS
Definition: fmifs.h:98
@ CLUSTERSIZETOOSMALL
Definition: fmifs.h:99
@ DONEWITHSTRUCTURE
Definition: fmifs.h:84
@ INSUFFICIENTRIGHTS
Definition: fmifs.h:89
@ PROGRESS
Definition: fmifs.h:83
@ UNKNOWN5
Definition: fmifs.h:88
@ UNKNOWN2
Definition: fmifs.h:85
@ UNKNOWN3
Definition: fmifs.h:86
@ UNKNOWNC
Definition: fmifs.h:95
DWORD * PDWORD
Definition: pedump.c:68
#define DONE
Definition: rnr20lib.h:14
Definition: shell.h:41
PCHAR Output
Definition: fmifs.h:33
Definition: ps.c:97
unsigned char * PBOOLEAN
Definition: typedefs.h:53

Referenced by wmain().

◆ ParseCommandLine()

static int ParseCommandLine ( int  argc,
WCHAR argv[] 
)
static

Definition at line 138 of file format.c.

139{
140 int i, j;
141 BOOLEAN gotFormat = FALSE;
142 BOOLEAN gotQuick = FALSE;
143 BOOLEAN gotSize = FALSE;
144 BOOLEAN gotLabel = FALSE;
145 BOOLEAN gotCompressed = FALSE;
146
147 for (i = 1; i < argc; i++)
148 {
149 switch (argv[i][0])
150 {
151 case L'-': case L'/':
152
153 if (!_wcsnicmp(&argv[i][1], L"FS:", 3))
154 {
155 if (gotFormat) return -1;
156 FileSystem = &argv[i][4];
157 gotFormat = TRUE;
158 }
159 else if (!_wcsnicmp(&argv[i][1], L"A:", 2))
160 {
161 if (gotSize) return -1;
162 j = 0;
163 while (LegalSizes[j].ClusterSize &&
164 _wcsicmp(LegalSizes[j].SizeString, &argv[i][3]))
165 {
166 j++;
167 }
168
169 if (!LegalSizes[j].ClusterSize) return i;
171 gotSize = TRUE;
172 }
173 else if (!_wcsnicmp(&argv[i][1], L"V:", 2))
174 {
175 if (gotLabel) return -1;
176 Label = &argv[i][3];
177 gotLabel = TRUE;
178 GotALabel = TRUE;
179 }
180 else if (!_wcsicmp(&argv[i][1], L"Q"))
181 {
182 if (gotQuick) return -1;
184 gotQuick = TRUE;
185 }
186 else if (!_wcsicmp(&argv[i][1], L"C"))
187 {
188 if (gotCompressed) return -1;
190 gotCompressed = TRUE;
191 }
192 else
193 {
194 return i;
195 }
196 break;
197
198 default:
199 {
200 if (Drive) return i;
201 if (argv[i][1] != L':') return i;
202
203 Drive = argv[i];
204 break;
205 }
206 }
207 }
208 return 0;
209}
unsigned char BOOLEAN
Definition: actypes.h:127
BOOL CompressDrive
Definition: format.c:67
SIZEDEFINITION LegalSizes[]
Definition: format.c:94
PWCHAR Drive
Definition: format.c:70
BOOL QuickFormat
Definition: format.c:65
PWCHAR Label
Definition: format.c:69
BOOL GotALabel
Definition: format.c:68
DWORD ClusterSize
Definition: format.c:66
PWCHAR FileSystem
Definition: format.c:71
MonoAssembly int argc
Definition: metahost.c:107
_ACRTIMP int __cdecl _wcsicmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:159
_ACRTIMP int __cdecl _wcsnicmp(const wchar_t *, const wchar_t *, size_t)
Definition: wcs.c:195
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define argv
Definition: mplay32.c:18
DWORD ClusterSize
Definition: format.c:91

Referenced by wmain().

◆ PrintWin32Error()

static VOID PrintWin32Error ( UINT  Message,
DWORD  ErrorCode 
)
static

Definition at line 116 of file format.c.

117{
118 PCWSTR pszMsg;
119 INT Len;
120
121 Len = LoadStringW(NULL, Message, (PWSTR)&pszMsg, 0);
122 if (Len > 0)
123 ConPrintf(StdErr, L"%.*s: ", Len, pszMsg);
124
127 ConPuts(StdErr, L"\n");
128}
void ConPuts(FILE *fp, LPCWSTR psz)
Definition: conutils_noros.h:8
#define StdErr
Definition: conutils_noros.h:7
#define Len
Definition: deflate.h:82
#define NULL
Definition: types.h:112
static const WCHAR Message[]
Definition: register.c:74
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
INT ConMsgPuts(IN PCON_STREAM Stream, IN DWORD dwFlags, IN LPCVOID lpSource OPTIONAL, IN DWORD dwMessageId, IN DWORD dwLanguageId)
Definition: outstream.c:835
#define LoadStringW
Definition: utils.h:64
#define LANG_USER_DEFAULT
Definition: tnerror.cpp:50
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
int32_t INT
Definition: typedefs.h:58
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:400

Referenced by wmain().

◆ Usage()

static VOID Usage ( LPWSTR  ProgramName)
static

Definition at line 320 of file format.c.

321{
322 WCHAR szFormats[MAX_PATH];
323 WCHAR szFormatW[MAX_PATH];
324 DWORD Index = 0;
325 BYTE dummy;
326 BOOLEAN latestVersion;
327
328 szFormats[0] = UNICODE_NULL;
329 while (QueryAvailableFileSystemFormat(Index++, szFormatW, &dummy, &dummy, &latestVersion))
330 {
331 if (!latestVersion)
332 continue;
333 if (szFormats[0])
334 wcscat(szFormats, L", ");
335
336 wcscat(szFormats, szFormatW);
337 }
338 ConResPrintf(StdOut, STRING_HELP, ProgramName, szFormats);
339}
#define MAX_PATH
Definition: compat.h:34
BOOLEAN NTAPI QueryAvailableFileSystemFormat(IN DWORD Index, IN OUT PWCHAR FileSystem, OUT UCHAR *Major, OUT UCHAR *Minor, OUT BOOLEAN *LatestVersion)
Definition: query.c:20
unsigned long DWORD
Definition: ntddk_ex.h:95
#define UNICODE_NULL
short WCHAR
Definition: pedump.c:58
wcscat
_In_ WDFCOLLECTION _In_ ULONG Index
#define STRING_HELP
Definition: xcopy.h:74
unsigned char BYTE
Definition: xxhash.c:193

◆ wmain()

int wmain ( int  argc,
WCHAR argv[] 
)

Definition at line 354 of file format.c.

355{
356 int badArg;
357 DEVICE_INFORMATION DeviceInformation;
359 DWORD driveType;
360 WCHAR fileSystem[1024];
361 WCHAR volumeName[1024];
362 WCHAR input[1024];
364 ULARGE_INTEGER totalNumberOfBytes, totalNumberOfFreeBytes;
365 DWORD dwError;
366 PCWSTR pszMsg;
367 INT Len;
368
369 /* Initialize the Console Standard Streams */
371
373 L"\n"
374 L"Formatx v1.0 by Mark Russinovich\n"
375 L"Systems Internals - http://www.sysinternals.com\n"
376 L"ReactOS adaptation 1999 by Emanuele Aliberti\n\n");
377
378#ifndef FMIFS_IMPORT_DLL
379 //
380 // Get function pointers
381 //
382 if (!LoadFMIFSEntryPoints())
383 {
385 return -1;
386 }
387#endif
388
389 //
390 // Parse command line
391 //
392 badArg = ParseCommandLine(argc, argv);
393 if (badArg)
394 {
396 Usage(argv[0]);
397 return -1;
398 }
399
400 //
401 // Get the drive's format
402 //
403 if (!Drive)
404 {
406 Usage(argv[0]);
407 return -1;
408 }
409 else
410 {
412 }
413 RootDirectory[2] = L'\\';
414 RootDirectory[3] = L'\0';
415
416 //
417 // See if the drive is removable or not
418 //
419 driveType = GetDriveTypeW(RootDirectory);
420 switch (driveType)
421 {
422 case DRIVE_UNKNOWN:
423 case DRIVE_NO_ROOT_DIR: // This case used to report STRING_NO_VOLUME, which has no ".\n".
425 return -1;
426
427 case DRIVE_REMOTE:
428 case DRIVE_CDROM:
430 return -1;
431
432 case DRIVE_REMOVABLE:
436 break;
437
438 case DRIVE_FIXED:
439 case DRIVE_RAMDISK:
441 break;
442 }
443
444 // Reject attempts to format the system drive
445 {
446 WCHAR path[MAX_PATH + 1];
447 UINT rc;
449 if (rc == 0 || rc > MAX_PATH)
450 // todo: Report "Unable to query system directory"
451 return -1;
452 if (towlower(path[0]) == towlower(Drive[0]))
453 {
454 // todo: report "Cannot format system drive"
456 return -1;
457 }
458 }
459
460 //
461 // Get the existing name and file system, and print out the latter
462 //
464 volumeName, ARRAYSIZE(volumeName),
465 NULL, NULL, NULL,
466 fileSystem, ARRAYSIZE(fileSystem)))
467 {
468 dwError = GetLastError();
469 if (dwError == ERROR_UNRECOGNIZED_VOLUME)
470 {
471 // Unformatted volume
472 volumeName[0] = UNICODE_NULL;
473 wcscpy(fileSystem, L"RAW");
474 }
475 else
476 {
478 return -1;
479 }
480 }
481
483
484 if (!QueryDeviceInformation(RootDirectory, &DeviceInformation, sizeof(DeviceInformation)))
485 {
486 totalNumberOfBytes.QuadPart = 0;
487 }
488 else
489 {
490 totalNumberOfBytes.QuadPart = DeviceInformation.SectorSize *
491 DeviceInformation.SectorCount.QuadPart;
492 }
493
494 /* QueryDeviceInformation returns more accurate volume length and works with
495 * unformatted volumes, however it will NOT return volume length on XP/2003.
496 * Fallback to GetFreeDiskSpaceExW if we did not get any volume length. */
497 if (totalNumberOfBytes.QuadPart == 0 &&
499 NULL,
500 &totalNumberOfBytes,
501 NULL))
502 {
503 dwError = GetLastError();
505 return -1;
506 }
507
508 //
509 // Make sure they want to do this
510 //
511 if (driveType == DRIVE_FIXED)
512 {
513 if (volumeName[0])
514 {
515 while (TRUE)
516 {
520
521 if (!_wcsicmp(input, volumeName))
522 break;
523
525 }
526 }
527
529
530 Len = LoadStringW(NULL, STRING_YES_NO_FAQ, (PWSTR)&pszMsg, 0);
531 if (Len < 2) pszMsg = L"YN";
532 while (TRUE)
533 {
535 if (towupper(input[0]) == pszMsg[0])
536 break;
537 if (towupper(input[0]) == pszMsg[1])
538 {
539 ConPuts(StdOut, L"\n");
540 return 0;
541 }
542 }
543 }
544
545 //
546 // Tell the user we're doing a long format if appropriate
547 //
548 if (!QuickFormat)
549 {
550 Len = LoadStringW(NULL, STRING_VERIFYING, (PWSTR)&pszMsg, 0);
551 if (totalNumberOfBytes.QuadPart > 1024*1024*10)
552 {
553 ConPrintf(StdOut, L"%.*s %luM\n", Len, pszMsg,
554 (DWORD)(totalNumberOfBytes.QuadPart/(1024*1024)));
555 }
556 else
557 {
558 ConPrintf(StdOut, L"%.*s %.1fM\n", Len, pszMsg,
559 ((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
560 }
561 }
562 else
563 {
564 Len = LoadStringW(NULL, STRING_FAST_FMT, (PWSTR)&pszMsg, 0);
565 if (totalNumberOfBytes.QuadPart > 1024*1024*10)
566 {
567 ConPrintf(StdOut, L"%.*s %luM\n", Len, pszMsg,
568 (DWORD)(totalNumberOfBytes.QuadPart/(1024*1024)));
569 }
570 else
571 {
572 ConPrintf(StdOut, L"%.*s %.2fM\n", Len, pszMsg,
573 ((float)(LONGLONG)totalNumberOfBytes.QuadPart)/(float)(1024.0*1024.0));
574 }
576 }
577
578 //
579 // Format away!
580 //
583 if (Error) return -1;
584 ConPuts(StdOut, L"\n");
586
587 //
588 // Enable compression if desired
589 //
590 if (CompressDrive)
591 {
594 }
595
596 //
597 // Get the label if we don't have it
598 //
599 if (!GotALabel)
600 {
604
606 {
607 dwError = GetLastError();
609 return -1;
610 }
611 }
612
613 //
614 // Get and print out some stuff including the formatted size
615 //
617 NULL,
618 &totalNumberOfBytes,
619 &totalNumberOfFreeBytes))
620 {
621 dwError = GetLastError();
623 return -1;
624 }
625
626 ConResPrintf(StdOut, STRING_FREE_SPACE, totalNumberOfBytes.QuadPart,
627 totalNumberOfFreeBytes.QuadPart);
628
629 //
630 // Get and print out the new serial number
631 //
633 NULL, 0,
635 NULL, 0))
636 {
637 dwError = GetLastError();
639 return -1;
640 }
641
643 (unsigned int)(serialNumber >> 16),
644 (unsigned int)(serialNumber & 0xFFFF));
645
646 return 0;
647}
WCHAR LabelString[12]
Definition: format.c:74
static VOID PrintWin32Error(UINT Message, DWORD ErrorCode)
Definition: format.c:116
static int ParseCommandLine(int argc, WCHAR *argv[])
Definition: format.c:138
BOOLEAN WINAPI FormatExCallback(CALLBACKCOMMAND Command, ULONG Modifier, PVOID Argument)
Definition: format.c:220
WCHAR RootDirectory[MAX_PATH]
Definition: format.c:73
#define STRING_DRIVE_PARM
Definition: resource.h:11
#define STRING_YN_FORMAT
Definition: resource.h:19
#define STRING_CREATE_FSYS
Definition: resource.h:23
#define STRING_ENTER_LABEL
Definition: resource.h:26
#define STRING_FILESYSTEM
Definition: resource.h:16
#define STRING_LABEL_NAME_EDIT
Definition: resource.h:17
#define STRING_YES_NO_FAQ
Definition: resource.h:20
#define STRING_INSERT_DISK
Definition: resource.h:13
#define STRING_FMT_COMPLETE
Definition: resource.h:24
#define STRING_NO_VOLUME_SIZE
Definition: resource.h:15
#define STRING_UNKNOW_ARG
Definition: resource.h:10
#define STRING_ERROR_LABEL
Definition: resource.h:18
#define STRING_VERIFYING
Definition: resource.h:21
#define STRING_NO_LABEL
Definition: resource.h:27
#define STRING_FREE_SPACE
Definition: resource.h:28
#define STRING_VOL_COMPRESS
Definition: resource.h:25
#define STRING_NO_VOLUME
Definition: resource.h:14
#define STRING_FMIFS_FAIL
Definition: resource.h:9
#define STRING_SERIAL_NUMBER
Definition: resource.h:29
#define STRING_ERROR_DRIVE_TYPE
Definition: resource.h:12
#define STRING_FAST_FMT
Definition: resource.h:22
#define ConInitStdStreams()
Definition: conutils_noros.h:5
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
BOOLEAN NTAPI EnableVolumeCompression(IN PWCHAR DriveRoot, IN USHORT Compression)
Definition: compress.c:17
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
BOOL NTAPI QueryDeviceInformation(_In_ PCWSTR DriveRoot, _Out_ PVOID DeviceInformation, _In_ ULONG BufferSize)
Retrieves disk device information.
Definition: query.c:79
BOOL WINAPI GetDiskFreeSpaceExW(IN LPCWSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
Definition: disk.c:342
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
Definition: volume.c:226
BOOL WINAPI SetVolumeLabelW(IN LPCWSTR lpRootPathName, IN LPCWSTR lpVolumeName OPTIONAL)
Definition: volume.c:503
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2271
wchar_t *CDECL fgetws(wchar_t *s, int size, FILE *file)
Definition: file.c:4043
#define stdin
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
FMIFS_MEDIA_FLAG
Definition: fmifs.h:53
@ FMIFS_FLOPPY
Definition: fmifs.h:62
@ FMIFS_HARDDISK
Definition: fmifs.h:66
GLenum GLenum GLenum input
Definition: glext.h:9031
_Must_inspect_result_ _In_ USAGE _In_ USHORT _In_ USAGE Usage
Definition: hidpi.h:384
__u8 media
Definition: mkdosfs.c:9
static const BYTE serialNumber[]
Definition: msg.c:2714
unsigned int UINT
Definition: ndis.h:50
wcscpy
#define towlower(c)
Definition: wctype.h:97
#define towupper(c)
Definition: wctype.h:99
ULONG SectorSize
Definition: fmifs.h:41
LARGE_INTEGER SectorCount
Definition: fmifs.h:42
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
int64_t LONGLONG
Definition: typedefs.h:68
LONGLONG QuadPart
Definition: typedefs.h:114
#define DRIVE_UNKNOWN
Definition: winbase.h:280
#define DRIVE_NO_ROOT_DIR
Definition: winbase.h:281
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define DRIVE_REMOTE
Definition: winbase.h:277
#define DRIVE_RAMDISK
Definition: winbase.h:279
#define DRIVE_CDROM
Definition: winbase.h:278
#define DRIVE_FIXED
Definition: winbase.h:276
#define DRIVE_REMOVABLE
Definition: winbase.h:275
#define ERROR_UNRECOGNIZED_VOLUME
Definition: winerror.h:908

Variable Documentation

◆ ClusterSize

◆ CompressDrive

BOOL CompressDrive = FALSE

Definition at line 67 of file format.c.

Referenced by ParseCommandLine(), and wmain().

◆ Drive

PWCHAR Drive = NULL

Definition at line 70 of file format.c.

Referenced by ParseCommandLine(), and wmain().

◆ Error

BOOL Error = FALSE

Definition at line 62 of file format.c.

Referenced by FormatExCallback(), and wmain().

◆ FileSystem

◆ GotALabel

BOOL GotALabel = FALSE

Definition at line 68 of file format.c.

Referenced by ParseCommandLine(), and wmain().

◆ Label

◆ LabelString

WCHAR LabelString[12]

Definition at line 74 of file format.c.

Referenced by format_main(), and wmain().

◆ LegalSizes

SIZEDEFINITION LegalSizes[]
Initial value:
= {
{ L"512", 512 },
{ L"1024", 1024 },
{ L"2048", 2048 },
{ L"4096", 4096 },
{ L"8192", 8192 },
{ L"16K", 16384 },
{ L"32K", 32768 },
{ L"64K", 65536 },
{ L"128K", 65536 * 2 },
{ L"256K", 65536 * 4 },
{ L"", 0 },
}

Definition at line 94 of file format.c.

Referenced by ParseCommandLine().

◆ QuickFormat

◆ RootDirectory