ReactOS 0.4.16-dev-715-ga1a169f
drive.cpp
Go to the documentation of this file.
1/*
2 * Shell Library Functions
3 *
4 * Copyright 2005 Johannes Anderwald
5 * Copyright 2017 Katayama Hirofumi MZ
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#include "precomp.h"
23#include <process.h>
24
26
27typedef struct
28{
34
35/*
36 * TODO: In Windows the Shell doesn't know by itself if a drive is
37 * a system one or not but rather a packet message is being sent by
38 * FMIFS library code and further translated into specific packet
39 * status codes in the Shell, the packet being _FMIFS_PACKET_TYPE.
40 *
41 * With that being said, most of this code as well as FMIFS library code
42 * have to be refactored in order to comply with the way Windows works.
43 *
44 * See the enum definition for more details:
45 * https://github.com/microsoft/winfile/blob/master/src/fmifs.h#L23
46 */
47static BOOL
49{
50 WCHAR wszDriveLetter[6], wszSystemDrv[6];
51
52 wszDriveLetter[0] = pContext->Drive + L'A';
53 StringCchCatW(wszDriveLetter, _countof(wszDriveLetter), L":");
54
55 if (!GetEnvironmentVariableW(L"SystemDrive", wszSystemDrv, _countof(wszSystemDrv)))
56 return FALSE;
57
58 if (!_wcsicmp(wszDriveLetter, wszSystemDrv))
59 return TRUE;
60
61 return FALSE;
62}
63
64static BOOL
65GetDefaultClusterSize(LPWSTR szFs, PDWORD pClusterSize, PULARGE_INTEGER TotalNumberOfBytes)
66{
68
69 if (!_wcsicmp(szFs, L"FAT16") ||
70 !_wcsicmp(szFs, L"FAT")) // REACTOS HACK
71 {
72 if (TotalNumberOfBytes->QuadPart <= (16 * 1024 * 1024))
73 ClusterSize = 2048;
74 else if (TotalNumberOfBytes->QuadPart <= (32 * 1024 * 1024))
75 ClusterSize = 512;
76 else if (TotalNumberOfBytes->QuadPart <= (64 * 1024 * 1024))
77 ClusterSize = 1024;
78 else if (TotalNumberOfBytes->QuadPart <= (128 * 1024 * 1024))
79 ClusterSize = 2048;
80 else if (TotalNumberOfBytes->QuadPart <= (256 * 1024 * 1024))
81 ClusterSize = 4096;
82 else if (TotalNumberOfBytes->QuadPart <= (512 * 1024 * 1024))
83 ClusterSize = 8192;
84 else if (TotalNumberOfBytes->QuadPart <= (1024 * 1024 * 1024))
85 ClusterSize = 16384;
86 else if (TotalNumberOfBytes->QuadPart <= (2048LL * 1024LL * 1024LL))
87 ClusterSize = 32768;
88 else if (TotalNumberOfBytes->QuadPart <= (4096LL * 1024LL * 1024LL))
89 ClusterSize = 8192;
90 else
91 return FALSE;
92 }
93 else if (!_wcsicmp(szFs, L"FAT32"))
94 {
95 if (TotalNumberOfBytes->QuadPart <= (64 * 1024 * 1024))
96 ClusterSize = 512;
97 else if (TotalNumberOfBytes->QuadPart <= (128 * 1024 * 1024))
98 ClusterSize = 1024;
99 else if (TotalNumberOfBytes->QuadPart <= (256 * 1024 * 1024))
100 ClusterSize = 2048;
101 else if (TotalNumberOfBytes->QuadPart <= (8192LL * 1024LL * 1024LL))
102 ClusterSize = 2048;
103 else if (TotalNumberOfBytes->QuadPart <= (16384LL * 1024LL * 1024LL))
104 ClusterSize = 8192;
105 else if (TotalNumberOfBytes->QuadPart <= (32768LL * 1024LL * 1024LL))
106 ClusterSize = 16384;
107 else
108 return FALSE;
109 }
110 else if (!_wcsicmp(szFs, L"FATX"))
111 {
112 if (TotalNumberOfBytes->QuadPart <= (16 * 1024 * 1024))
113 ClusterSize = 2048;
114 else if (TotalNumberOfBytes->QuadPart <= (32 * 1024 * 1024))
115 ClusterSize = 512;
116 else if (TotalNumberOfBytes->QuadPart <= (64 * 1024 * 1024))
117 ClusterSize = 1024;
118 else if (TotalNumberOfBytes->QuadPart <= (128 * 1024 * 1024))
119 ClusterSize = 2048;
120 else if (TotalNumberOfBytes->QuadPart <= (256 * 1024 * 1024))
121 ClusterSize = 4096;
122 else if (TotalNumberOfBytes->QuadPart <= (8192LL * 1024LL * 1024LL))
123 ClusterSize = 2048;
124 else if (TotalNumberOfBytes->QuadPart <= (16384LL * 1024LL * 1024LL))
125 ClusterSize = 8192;
126 else if (TotalNumberOfBytes->QuadPart <= (32768LL * 1024LL * 1024LL))
127 ClusterSize = 16384;
128 else
129 return FALSE;
130 }
131 else if (!_wcsicmp(szFs, L"NTFS"))
132 {
133 if (TotalNumberOfBytes->QuadPart <= (512 * 1024 * 1024))
134 ClusterSize = 512;
135 else if (TotalNumberOfBytes->QuadPart <= (1024 * 1024 * 1024))
136 ClusterSize = 1024;
137 else if (TotalNumberOfBytes->QuadPart <= (2048LL * 1024LL * 1024LL))
138 ClusterSize = 2048;
139 else
140 ClusterSize = 2048;
141 }
142 else if (!_wcsicmp(szFs, L"EXT2"))
143 {
144 // auto block size calculation
145 ClusterSize = 0;
146 }
147 else if (!_wcsicmp(szFs, L"BtrFS"))
148 {
149 // auto block size calculation
150 ClusterSize = 0;
151 }
152 else
153 return FALSE;
154
155 *pClusterSize = ClusterSize;
156 return TRUE;
157}
158
159static VOID
161{
162 WCHAR wszBuf[100] = {0};
163 WCHAR wszDefaultSize[100] = {0};
164 PCWSTR pwszFsSizeLimit;
165 WCHAR szDrive[] = L"C:\\";
166 INT iSelIndex;
167 ULARGE_INTEGER FreeBytesAvailableUser, TotalNumberOfBytes;
169 LRESULT lIndex;
170 HWND hDlgCtrl;
171
172 hDlgCtrl = GetDlgItem(hwndDlg, 28677);
173 iSelIndex = SendMessage(hDlgCtrl, CB_GETCURSEL, 0, 0);
174 if (iSelIndex == CB_ERR)
175 return;
176
177 if (SendMessageW(hDlgCtrl, CB_GETLBTEXT, iSelIndex, (LPARAM)wszBuf) == CB_ERR)
178 return;
179
180 szDrive[0] = pContext->Drive + L'A';
181
182 if (!GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailableUser, &TotalNumberOfBytes, NULL))
183 return;
184
185 if (!_wcsicmp(wszBuf, L"FAT16") ||
186 !_wcsicmp(wszBuf, L"FAT")) // REACTOS HACK
187 {
188 pwszFsSizeLimit = L"4GB";
189 }
190 else if (!_wcsicmp(wszBuf, L"FAT32"))
191 {
192 pwszFsSizeLimit = L"32GB";
193 }
194 else if (!_wcsicmp(wszBuf, L"FATX"))
195 {
196 pwszFsSizeLimit = L"1GB/32GB";
197 }
198 else if (!_wcsicmp(wszBuf, L"NTFS"))
199 {
200 pwszFsSizeLimit = L"256TB";
201 }
202 else if (!_wcsicmp(wszBuf, L"EXT2"))
203 {
204 pwszFsSizeLimit = L"32TB";
205 }
206 else
207 {
208 pwszFsSizeLimit = L"16EB";
209 }
210
211 if (!_wcsicmp(wszBuf, L"FAT16") ||
212 !_wcsicmp(wszBuf, L"FAT") || // REACTOS HACK
213 !_wcsicmp(wszBuf, L"FAT32") ||
214 !_wcsicmp(wszBuf, L"FATX") ||
215 !_wcsicmp(wszBuf, L"NTFS") ||
216 !_wcsicmp(wszBuf, L"EXT2") ||
217 !_wcsicmp(wszBuf, L"BtrFS"))
218 {
219 if (!GetDefaultClusterSize(wszBuf, &ClusterSize, &TotalNumberOfBytes))
220 {
221 TRACE("%S is not supported on drive larger than %S, current size: %lu\n", wszBuf, pwszFsSizeLimit, TotalNumberOfBytes.QuadPart);
222 SendMessageW(hDlgCtrl, CB_DELETESTRING, iSelIndex, 0);
223 return;
224 }
225
226 if (LoadStringW(shell32_hInstance, IDS_DEFAULT_CLUSTER_SIZE, wszDefaultSize, _countof(wszDefaultSize)))
227 {
228 hDlgCtrl = GetDlgItem(hwndDlg, 28680); // Get the window handle of "allocation unit size" combobox
229 SendMessageW(hDlgCtrl, CB_RESETCONTENT, 0, 0);
230 lIndex = SendMessageW(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)wszDefaultSize);
231 if (lIndex != CB_ERR)
232 SendMessageW(hDlgCtrl, CB_SETITEMDATA, lIndex, (LPARAM)ClusterSize);
233 SendMessageW(hDlgCtrl, CB_SETCURSEL, 0, 0);
234 }
235
236 if (!_wcsicmp(wszBuf, L"NTFS"))
237 {
238 ClusterSize = 512;
239 for (lIndex = 0; lIndex < 4; lIndex++)
240 {
241 TotalNumberOfBytes.QuadPart = ClusterSize;
242 if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, wszDefaultSize, _countof(wszDefaultSize)))
243 {
244 lIndex = SendMessageW(hDlgCtrl, CB_ADDSTRING, 0, (LPARAM)wszDefaultSize);
245 if (lIndex != CB_ERR)
246 SendMessageW(hDlgCtrl, CB_SETITEMDATA, lIndex, (LPARAM)ClusterSize);
247 }
248 ClusterSize *= 2;
249 }
250 }
251
252 SendMessageW(GetDlgItem(hwndDlg, 28675), BM_SETCHECK, BST_UNCHECKED, 0);
253 if (!_wcsicmp(wszBuf, L"EXT2") ||
254 !_wcsicmp(wszBuf, L"BtrFS") ||
255 !_wcsicmp(wszBuf, L"NTFS"))
256 {
257 /* Enable the "Enable Compression" button */
258 EnableWindow(GetDlgItem(hwndDlg, 28675), TRUE);
259 }
260 else
261 {
262 /* Disable the "Enable Compression" button */
263 EnableWindow(GetDlgItem(hwndDlg, 28675), FALSE);
264 }
265 }
266 else
267 {
268 FIXME("Unknown filesystem: %ls\n", wszBuf);
269 SendDlgItemMessageW(hwndDlg, 28680, CB_RESETCONTENT, iSelIndex, 0);
270 return;
271 }
272}
273
274static VOID
276{
277 WCHAR szText[120];
278 WCHAR szDrive[] = L"C:\\";
279 WCHAR szFs[30] = L"";
280 INT cchText;
281 ULARGE_INTEGER FreeBytesAvailableUser, TotalNumberOfBytes;
282 DWORD dwIndex, dwDefault;
283 UCHAR uMinor, uMajor;
284 BOOLEAN Latest;
285 HWND hwndFileSystems;
286
287 cchText = GetWindowTextW(hwndDlg, szText, _countof(szText) - 1);
288 if (cchText < 0)
289 cchText = 0;
290 szText[cchText++] = L' ';
291 szDrive[0] = pContext->Drive + L'A';
292 if (GetVolumeInformationW(szDrive, &szText[cchText], _countof(szText) - cchText, NULL, NULL, NULL, szFs, _countof(szFs)))
293 {
294 if (szText[cchText] == UNICODE_NULL)
295 {
296 /* load default volume label */
298 }
299 else
300 {
301 /* set volume label */
302 SetDlgItemTextW(hwndDlg, 28679, &szText[cchText]);
303 cchText += wcslen(&szText[cchText]);
304 }
305 }
306
307 StringCchPrintfW(szText + cchText, _countof(szText) - cchText, L" (%c:)", szDrive[0]);
308
309 /* set window text */
310 SetWindowTextW(hwndDlg, szText);
311
312 if (GetDiskFreeSpaceExW(szDrive, &FreeBytesAvailableUser, &TotalNumberOfBytes, NULL))
313 {
314 if (StrFormatByteSizeW(TotalNumberOfBytes.QuadPart, szText, _countof(szText)))
315 {
316 /* add drive capacity */
317 SendDlgItemMessageW(hwndDlg, 28673, CB_ADDSTRING, 0, (LPARAM)szText);
318 SendDlgItemMessageW(hwndDlg, 28673, CB_SETCURSEL, 0, (LPARAM)0);
319 }
320 }
321
322 if (pContext->Options & SHFMT_OPT_FULL)
323 {
324 /* check quick format button */
325 SendDlgItemMessageW(hwndDlg, 28674, BM_SETCHECK, BST_CHECKED, 0);
326 }
327
328 /* enumerate all available filesystems */
329 dwIndex = 0;
330 dwDefault = 0;
331 hwndFileSystems = GetDlgItem(hwndDlg, 28677);
332
333 while(QueryAvailableFileSystemFormat(dwIndex, szText, &uMajor, &uMinor, &Latest))
334 {
335 if (!_wcsicmp(szText, szFs))
336 dwDefault = dwIndex;
337
338 SendMessageW(hwndFileSystems, CB_ADDSTRING, 0, (LPARAM)szText);
339 dwIndex++;
340 }
341
342 if (!dwIndex)
343 {
344 ERR("no filesystem providers\n");
345 return;
346 }
347
348 /* select default filesys */
349 SendMessageW(hwndFileSystems, CB_SETCURSEL, dwDefault, 0);
350 /* setup cluster combo */
351 InsertDefaultClusterSizeForFs(hwndDlg, pContext);
352}
353
356
357static BOOLEAN NTAPI
360 IN ULONG SubAction,
361 IN PVOID ActionInfo)
362{
363 PDWORD Progress;
364 PBOOLEAN pSuccess;
365 switch(Command)
366 {
367 case PROGRESS:
368 Progress = (PDWORD)ActionInfo;
370 break;
371 case DONE:
372 pSuccess = (PBOOLEAN)ActionInfo;
373 bSuccess = (*pSuccess);
376 break;
377
378 case VOLUMEINUSE:
380 case FSNOTSUPPORTED:
382 bSuccess = FALSE;
383 FIXME("Unsupported command in FormatExCB\n");
384 break;
385
386 default:
387 break;
388 }
389
390 return TRUE;
391}
392
393VOID
395{
396 WCHAR szDrive[4] = { L'C', ':', '\\', 0 };
397 WCHAR szFileSys[40] = {0};
398 WCHAR szLabel[40] = {0};
399 INT iSelIndex;
400 UINT Length;
401 HWND hDlgCtrl;
406
407 /* set volume path */
408 szDrive[0] = pContext->Drive + L'A';
409
410 /* get filesystem */
411 hDlgCtrl = GetDlgItem(hwndDlg, 28677);
412 iSelIndex = SendMessageW(hDlgCtrl, CB_GETCURSEL, 0, 0);
413 if (iSelIndex == CB_ERR)
414 {
415 ERR("Unable to get file system selection\n");
416 return;
417 }
418 Length = SendMessageW(hDlgCtrl, CB_GETLBTEXTLEN, iSelIndex, 0);
419 if ((int)Length == CB_ERR || Length + 1 > _countof(szFileSys))
420 {
421 ERR("Unable to get file system selection\n");
422 return;
423 }
424
425 /* retrieve the file system */
426 SendMessageW(hDlgCtrl, CB_GETLBTEXT, iSelIndex, (LPARAM)szFileSys);
427 szFileSys[_countof(szFileSys)-1] = L'\0';
428
429 /* retrieve the volume label */
430 hDlgCtrl = GetWindow(hwndDlg, 28679);
431 Length = SendMessageW(hDlgCtrl, WM_GETTEXTLENGTH, 0, 0);
432 if (Length + 1 > _countof(szLabel))
433 {
434 ERR("Unable to get volume label\n");
435 return;
436 }
437 SendMessageW(hDlgCtrl, WM_GETTEXT, _countof(szLabel), (LPARAM)szLabel);
438 szLabel[(sizeof(szLabel)/sizeof(WCHAR))-1] = L'\0';
439
440 /* check for quickformat */
441 if (SendDlgItemMessageW(hwndDlg, 28674, BM_GETCHECK, 0, 0) == BST_CHECKED)
443 else
445
446 /* get the cluster size */
447 hDlgCtrl = GetDlgItem(hwndDlg, 28680);
448 iSelIndex = SendMessageW(hDlgCtrl, CB_GETCURSEL, 0, 0);
449 if (iSelIndex == CB_ERR)
450 {
451 FIXME("\n");
452 return;
453 }
454 ClusterSize = SendMessageW(hDlgCtrl, CB_GETITEMDATA, iSelIndex, 0);
455 if ((int)ClusterSize == CB_ERR)
456 {
457 FIXME("\n");
458 return;
459 }
460
461 hDlgCtrl = GetDlgItem(hwndDlg, 28680);
462 SendMessageW(hDlgCtrl, PBM_SETRANGE, 0, MAKELPARAM(0, 100));
463 bSuccess = FALSE;
464
465 /* FIXME
466 * will cause display problems
467 * when performing more than one format
468 */
469 FormatDrvDialog = hwndDlg;
470
471 /* See if the drive is removable or not */
472 DriveType = GetDriveTypeW(szDrive);
473 switch (DriveType)
474 {
475 case DRIVE_UNKNOWN:
476 case DRIVE_REMOTE:
477 case DRIVE_CDROM:
479 {
480 FIXME("\n");
481 return;
482 }
483
484 case DRIVE_REMOVABLE:
485 MediaFlag = FMIFS_FLOPPY;
486 break;
487
488 case DRIVE_FIXED:
489 case DRIVE_RAMDISK:
490 MediaFlag = FMIFS_HARDDISK;
491 break;
492 }
493
494 /* Format the drive */
495 FormatEx(szDrive,
496 MediaFlag,
497 szFileSys,
498 szLabel,
501 FormatExCB);
502
504 if (!bSuccess)
505 {
506 pContext->Result = SHFMT_ERROR;
507 }
508 else if (QuickFormat)
509 {
510 pContext->Result = SHFMT_OPT_FULL;
511 }
512 else
513 {
514 pContext->Result = FALSE;
515 }
516}
517
519{
522};
523
524static unsigned __stdcall DoFormatDrive(void *args)
525{
526 FORMAT_DRIVE_PARAMS *pParams = reinterpret_cast<FORMAT_DRIVE_PARAMS *>(args);
527 HWND hwndDlg = pParams->hwndDlg;
528 PFORMAT_DRIVE_CONTEXT pContext = pParams->pContext;
529
530 /* Disable controls during format */
531 HMENU hSysMenu = GetSystemMenu(hwndDlg, FALSE);
533 EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
535 EnableWindow(GetDlgItem(hwndDlg, 28673), FALSE);
536 EnableWindow(GetDlgItem(hwndDlg, 28677), FALSE);
537 EnableWindow(GetDlgItem(hwndDlg, 28680), FALSE);
538 EnableWindow(GetDlgItem(hwndDlg, 28679), FALSE);
539 EnableWindow(GetDlgItem(hwndDlg, 28674), FALSE);
540
541 FormatDrive(hwndDlg, pContext);
542
543 /* Re-enable controls after format */
544 EnableWindow(GetDlgItem(hwndDlg, IDOK), TRUE);
546 EnableWindow(GetDlgItem(hwndDlg, 28673), TRUE);
547 EnableWindow(GetDlgItem(hwndDlg, 28677), TRUE);
548 EnableWindow(GetDlgItem(hwndDlg, 28680), TRUE);
549 EnableWindow(GetDlgItem(hwndDlg, 28679), TRUE);
550 EnableWindow(GetDlgItem(hwndDlg, 28674), TRUE);
552 pContext->bFormattingNow = FALSE;
553
554 delete pParams;
555 return 0;
556}
557
558static INT_PTR CALLBACK
560{
561 PFORMAT_DRIVE_CONTEXT pContext;
562
563 switch(uMsg)
564 {
565 case WM_INITDIALOG:
568 return TRUE;
569 case WM_COMMAND:
570 switch(LOWORD(wParam))
571 {
572 case IDOK:
574 if (pContext->bFormattingNow)
575 break;
576
581 {
582 pContext->bFormattingNow = TRUE;
583
585 pParams->hwndDlg = hwndDlg;
586 pParams->pContext = pContext;
587
588 unsigned tid;
591 }
592 break;
593 case IDCANCEL:
595 if (pContext->bFormattingNow)
596 break;
597
598 EndDialog(hwndDlg, pContext->Result);
599 break;
600 case 28677: // filesystem combo
601 if (HIWORD(wParam) == CBN_SELENDOK)
602 {
604 if (pContext->bFormattingNow)
605 break;
606
607 InsertDefaultClusterSizeForFs(hwndDlg, pContext);
608 }
609 break;
610 }
611 }
612 return FALSE;
613}
614
615/*************************************************************************
616 * SHFormatDrive (SHELL32.@)
617 */
618
619DWORD
620WINAPI
622{
624 int result;
625
626 TRACE("%p, 0x%08x, 0x%08x, 0x%08x - stub\n", hwnd, drive, fmtID, options);
627
628 Context.Drive = drive;
629 Context.Options = options;
630 Context.Result = FALSE;
631 Context.bFormattingNow = FALSE;
632
633 if (!IsSystemDrive(&Context))
634 {
636 }
637 else
638 {
641 TRACE("SHFormatDrive(): The provided drive for format is a system volume! Aborting...\n");
642 }
643
644 return result;
645}
UINT DriveType
unsigned char BOOLEAN
#define shell32_hInstance
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
void shell(int argc, const char *argv[])
Definition: cmds.c:1231
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
BOOL QuickFormat
Definition: format.c:66
DWORD ClusterSize
Definition: format.c:67
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define CALLBACK
Definition: compat.h:35
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
BOOLEAN NTAPI QueryAvailableFileSystemFormat(IN DWORD Index, IN OUT PWCHAR FileSystem, OUT UCHAR *Major, OUT UCHAR *Minor, OUT BOOLEAN *LatestVersion)
Definition: query.c:20
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
static HWND FormatDrvDialog
Definition: drive.cpp:354
static BOOLEAN bSuccess
Definition: drive.cpp:355
struct FORMAT_DRIVE_CONTEXT * PFORMAT_DRIVE_CONTEXT
static BOOLEAN NTAPI FormatExCB(IN CALLBACKCOMMAND Command, IN ULONG SubAction, IN PVOID ActionInfo)
Definition: drive.cpp:358
static INT_PTR CALLBACK FormatDriveDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: drive.cpp:559
static BOOL GetDefaultClusterSize(LPWSTR szFs, PDWORD pClusterSize, PULARGE_INTEGER TotalNumberOfBytes)
Definition: drive.cpp:65
VOID FormatDrive(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext)
Definition: drive.cpp:394
static BOOL IsSystemDrive(PFORMAT_DRIVE_CONTEXT pContext)
Definition: drive.cpp:48
static VOID InitializeFormatDriveDlg(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext)
Definition: drive.cpp:275
DWORD WINAPI SHFormatDrive(HWND hwnd, UINT drive, UINT fmtID, UINT options)
Definition: drive.cpp:621
static unsigned __stdcall DoFormatDrive(void *args)
Definition: drive.cpp:524
static VOID InsertDefaultClusterSizeForFs(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext)
Definition: drive.cpp:160
#define ShellMessageBoxW
Definition: precomp.h:62
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2394
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FMIFS_MEDIA_FLAG
Definition: fmifs.h:52
@ FMIFS_FLOPPY
Definition: fmifs.h:61
@ FMIFS_HARDDISK
Definition: fmifs.h:65
CALLBACKCOMMAND
Definition: fmifs.h:81
@ FSNOTSUPPORTED
Definition: fmifs.h:89
@ VOLUMEINUSE
Definition: fmifs.h:90
@ CLUSTERSIZETOOSMALL
Definition: fmifs.h:98
@ INSUFFICIENTRIGHTS
Definition: fmifs.h:88
@ PROGRESS
Definition: fmifs.h:82
GLuint64EXT * result
Definition: glext.h:11304
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define DRIVE_CDROM
Definition: machpc98.h:119
static TfClientId tid
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
HANDLE hThread
Definition: wizard.c:28
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
DWORD * PDWORD
Definition: pedump.c:68
#define PBM_SETPOS
Definition: commctrl.h:2189
#define PBM_SETRANGE
Definition: commctrl.h:2188
#define DONE
Definition: rnr20lib.h:14
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define args
Definition: format.c:66
#define SHFMT_ERROR
Definition: shlobj.h:327
#define SHFMT_OPT_FULL
Definition: shlobj.h:333
#define IDS_FORMAT_COMPLETE
Definition: shresdef.h:203
#define IDS_NO_FORMAT_TITLE
Definition: shresdef.h:206
#define IDS_FORMAT_TITLE
Definition: shresdef.h:201
#define IDS_DRIVE_FIXED
Definition: shresdef.h:111
#define IDS_NO_FORMAT
Definition: shresdef.h:207
#define IDS_FORMAT_WARNING
Definition: shresdef.h:202
#define IDD_FORMAT_DRIVE
Definition: shresdef.h:519
#define IDS_DEFAULT_CLUSTER_SIZE
Definition: shresdef.h:228
#define _countof(array)
Definition: sndvol32.h:70
#define TRACE(s)
Definition: solgame.cpp:4
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
Definition: shell.h:41
PFORMAT_DRIVE_CONTEXT pContext
Definition: drive.cpp:521
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
Definition: match.c:390
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
const uint16_t * PCWSTR
Definition: typedefs.h:57
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
PVOID HANDLE
Definition: typedefs.h:73
int32_t INT
Definition: typedefs.h:58
#define __stdcall
Definition: typedefs.h:25
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1384
#define DRIVE_UNKNOWN
Definition: winbase.h:282
#define DRIVE_NO_ROOT_DIR
Definition: winbase.h:283
#define DRIVE_REMOTE
Definition: winbase.h:279
#define DRIVE_RAMDISK
Definition: winbase.h:281
#define DRIVE_FIXED
Definition: winbase.h:278
#define DRIVE_REMOVABLE
Definition: winbase.h:277
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define WINAPI
Definition: msvc.h:6
#define CB_SETITEMDATA
Definition: winuser.h:1969
#define WM_GETTEXTLENGTH
Definition: winuser.h:1622
#define CB_GETLBTEXTLEN
Definition: winuser.h:1956
#define MF_BYCOMMAND
Definition: winuser.h:202
#define DWLP_USER
Definition: winuser.h:875
#define CB_GETLBTEXT
Definition: winuser.h:1955
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
#define IDCANCEL
Definition: winuser.h:834
#define BST_UNCHECKED
Definition: winuser.h:199
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define WM_COMMAND
Definition: winuser.h:1743
#define CB_ERR
Definition: winuser.h:2438
#define CB_SETCURSEL
Definition: winuser.h:1964
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define WM_GETTEXT
Definition: winuser.h:1621
#define CB_RESETCONTENT
Definition: winuser.h:1962
#define WM_INITDIALOG
Definition: winuser.h:1742
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:833
#define BM_SETCHECK
Definition: winuser.h:1924
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_OKCANCEL
Definition: winuser.h:807
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define MF_ENABLED
Definition: winuser.h:128
#define CB_ADDSTRING
Definition: winuser.h:1939
_In_ int cchText
Definition: winuser.h:4468
#define CB_GETITEMDATA
Definition: winuser.h:1953
#define SendMessage
Definition: winuser.h:5855
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SC_CLOSE
Definition: winuser.h:2595
#define MB_OK
Definition: winuser.h:793
#define MB_ICONWARNING
Definition: winuser.h:789
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define MB_ICONINFORMATION
Definition: winuser.h:805
#define CBN_SELENDOK
Definition: winuser.h:1984
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define CB_GETCURSEL
Definition: winuser.h:1946
#define CB_DELETESTRING
Definition: winuser.h:1940
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define BM_GETCHECK
Definition: winuser.h:1921
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define MF_GRAYED
Definition: winuser.h:129
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184