2 * Shell Library Functions
4 * Copyright 2005 Johannes Anderwald
5 * Copyright 2017 Katayama Hirofumi MZ
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.
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.
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
25 WINE_DEFAULT_DEBUG_CHANNEL(shell
);
33 } FORMAT_DRIVE_CONTEXT
, *PFORMAT_DRIVE_CONTEXT
;
35 EXTERN_C HPSXA WINAPI
SHCreatePropSheetExtArrayEx(HKEY hKey
, LPCWSTR pszSubKey
, UINT max_iface
, IDataObject
*pDataObj
);
36 HPROPSHEETPAGE
SH_CreatePropertySheetPage(LPCSTR resname
, DLGPROC dlgproc
, LPARAM lParam
, LPWSTR szTitle
);
39 * TODO: In Windows the Shell doesn't know by itself if a drive is
40 * a system one or not but rather a packet message is being sent by
41 * FMIFS library code and further translated into specific packet
42 * status codes in the Shell, the packet being _FMIFS_PACKET_TYPE.
44 * With that being said, most of this code as well as FMIFS library code
45 * have to be refactored in order to comply with the way Windows works.
47 * See the enum definition for more details:
48 * https://github.com/microsoft/winfile/blob/master/src/fmifs.h#L23
51 IsSystemDrive(PFORMAT_DRIVE_CONTEXT pContext
)
53 WCHAR wszDriveLetter
[6], wszSystemDrv
[6];
55 wszDriveLetter
[0] = pContext
->Drive
+ L
'A';
56 StringCchCatW(wszDriveLetter
, _countof(wszDriveLetter
), L
":");
58 if (!GetEnvironmentVariableW(L
"SystemDrive", wszSystemDrv
, _countof(wszSystemDrv
)))
61 if (!wcsicmp(wszDriveLetter
, wszSystemDrv
))
68 GetDefaultClusterSize(LPWSTR szFs
, PDWORD pClusterSize
, PULARGE_INTEGER TotalNumberOfBytes
)
72 if (!wcsicmp(szFs
, L
"FAT16") ||
73 !wcsicmp(szFs
, L
"FAT")) // REACTOS HACK
75 if (TotalNumberOfBytes
->QuadPart
<= (16 * 1024 * 1024))
77 else if (TotalNumberOfBytes
->QuadPart
<= (32 * 1024 * 1024))
79 else if (TotalNumberOfBytes
->QuadPart
<= (64 * 1024 * 1024))
81 else if (TotalNumberOfBytes
->QuadPart
<= (128 * 1024 * 1024))
83 else if (TotalNumberOfBytes
->QuadPart
<= (256 * 1024 * 1024))
85 else if (TotalNumberOfBytes
->QuadPart
<= (512 * 1024 * 1024))
87 else if (TotalNumberOfBytes
->QuadPart
<= (1024 * 1024 * 1024))
89 else if (TotalNumberOfBytes
->QuadPart
<= (2048LL * 1024LL * 1024LL))
91 else if (TotalNumberOfBytes
->QuadPart
<= (4096LL * 1024LL * 1024LL))
96 else if (!wcsicmp(szFs
, L
"FAT32"))
98 if (TotalNumberOfBytes
->QuadPart
<= (64 * 1024 * 1024))
100 else if (TotalNumberOfBytes
->QuadPart
<= (128 * 1024 * 1024))
102 else if (TotalNumberOfBytes
->QuadPart
<= (256 * 1024 * 1024))
104 else if (TotalNumberOfBytes
->QuadPart
<= (8192LL * 1024LL * 1024LL))
106 else if (TotalNumberOfBytes
->QuadPart
<= (16384LL * 1024LL * 1024LL))
108 else if (TotalNumberOfBytes
->QuadPart
<= (32768LL * 1024LL * 1024LL))
113 else if (!wcsicmp(szFs
, L
"FATX"))
115 if (TotalNumberOfBytes
->QuadPart
<= (16 * 1024 * 1024))
117 else if (TotalNumberOfBytes
->QuadPart
<= (32 * 1024 * 1024))
119 else if (TotalNumberOfBytes
->QuadPart
<= (64 * 1024 * 1024))
121 else if (TotalNumberOfBytes
->QuadPart
<= (128 * 1024 * 1024))
123 else if (TotalNumberOfBytes
->QuadPart
<= (256 * 1024 * 1024))
125 else if (TotalNumberOfBytes
->QuadPart
<= (8192LL * 1024LL * 1024LL))
127 else if (TotalNumberOfBytes
->QuadPart
<= (16384LL * 1024LL * 1024LL))
129 else if (TotalNumberOfBytes
->QuadPart
<= (32768LL * 1024LL * 1024LL))
134 else if (!wcsicmp(szFs
, L
"NTFS"))
136 if (TotalNumberOfBytes
->QuadPart
<= (512 * 1024 * 1024))
138 else if (TotalNumberOfBytes
->QuadPart
<= (1024 * 1024 * 1024))
140 else if (TotalNumberOfBytes
->QuadPart
<= (2048LL * 1024LL * 1024LL))
145 else if (!wcsicmp(szFs
, L
"EXT2"))
147 // auto block size calculation
150 else if (!wcsicmp(szFs
, L
"BtrFS"))
152 // auto block size calculation
158 *pClusterSize
= ClusterSize
;
162 typedef struct _DRIVE_PROP_PAGE
170 SH_ShowDriveProperties(WCHAR
*pwszDrive
, LPCITEMIDLIST pidlFolder
, PCUITEMID_CHILD_ARRAY apidl
)
173 HPROPSHEETPAGE hpsp
[MAX_PROPERTY_SHEET_PAGE
];
174 PROPSHEETHEADERW psh
;
175 CComObject
<CDrvDefExt
> *pDrvDefExt
= NULL
;
178 ZeroMemory(&psh
, sizeof(PROPSHEETHEADERW
));
179 psh
.dwSize
= sizeof(PROPSHEETHEADERW
);
180 psh
.dwFlags
= 0; // FIXME: make it modeless
181 psh
.hwndParent
= NULL
;
185 LPITEMIDLIST completePidl
= ILCombine(pidlFolder
, apidl
[0]);
187 return E_OUTOFMEMORY
;
189 if (ILGetDisplayNameExW(NULL
, completePidl
, wszName
, ILGDN_NORMAL
))
191 psh
.pszCaption
= wszName
;
192 psh
.dwFlags
|= PSH_PROPTITLE
;
195 ILFree(completePidl
);
197 CComPtr
<IDataObject
> pDataObj
;
198 HRESULT hr
= SHCreateDataObject(pidlFolder
, 1, apidl
, NULL
, IID_PPV_ARG(IDataObject
, &pDataObj
));
202 hr
= CComObject
<CDrvDefExt
>::CreateInstance(&pDrvDefExt
);
205 pDrvDefExt
->AddRef(); // CreateInstance returns object with 0 ref count
206 hr
= pDrvDefExt
->Initialize(pidlFolder
, pDataObj
, NULL
);
209 hr
= pDrvDefExt
->AddPages(AddPropSheetPageCallback
, (LPARAM
)&psh
);
211 ERR("AddPages failed\n");
213 ERR("Initialize failed\n");
216 hpsx
= SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT
, L
"Drive", MAX_PROPERTY_SHEET_PAGE
, pDataObj
);
218 SHAddFromPropSheetExtArray(hpsx
, (LPFNADDPROPSHEETPAGE
)AddPropSheetPageCallback
, (LPARAM
)&psh
);
221 // NOTE: Currently property sheet is modal. If we make it modeless, then it returns HWND.
222 INT_PTR ret
= PropertySheetW(&psh
);
225 SHDestroyPropSheetExtArray(hpsx
);
227 pDrvDefExt
->Release();
237 InsertDefaultClusterSizeForFs(HWND hwndDlg
, PFORMAT_DRIVE_CONTEXT pContext
)
239 WCHAR wszBuf
[100] = {0};
240 WCHAR wszDefaultSize
[100] = {0};
241 PCWSTR pwszFsSizeLimit
;
242 WCHAR szDrive
[] = L
"C:\\";
244 ULARGE_INTEGER FreeBytesAvailableUser
, TotalNumberOfBytes
;
249 hDlgCtrl
= GetDlgItem(hwndDlg
, 28677);
250 iSelIndex
= SendMessage(hDlgCtrl
, CB_GETCURSEL
, 0, 0);
251 if (iSelIndex
== CB_ERR
)
254 if (SendMessageW(hDlgCtrl
, CB_GETLBTEXT
, iSelIndex
, (LPARAM
)wszBuf
) == CB_ERR
)
257 szDrive
[0] = pContext
->Drive
+ L
'A';
259 if (!GetDiskFreeSpaceExW(szDrive
, &FreeBytesAvailableUser
, &TotalNumberOfBytes
, NULL
))
262 if (!wcsicmp(wszBuf
, L
"FAT16") ||
263 !wcsicmp(wszBuf
, L
"FAT")) // REACTOS HACK
265 pwszFsSizeLimit
= L
"4GB";
267 else if (!wcsicmp(wszBuf
, L
"FAT32"))
269 pwszFsSizeLimit
= L
"32GB";
271 else if (!wcsicmp(wszBuf
, L
"FATX"))
273 pwszFsSizeLimit
= L
"1GB/32GB";
275 else if (!wcsicmp(wszBuf
, L
"NTFS"))
277 pwszFsSizeLimit
= L
"256TB";
279 else if (!wcsicmp(wszBuf
, L
"EXT2"))
281 pwszFsSizeLimit
= L
"32TB";
285 pwszFsSizeLimit
= L
"16EB";
288 if (!wcsicmp(wszBuf
, L
"FAT16") ||
289 !wcsicmp(wszBuf
, L
"FAT") || // REACTOS HACK
290 !wcsicmp(wszBuf
, L
"FAT32") ||
291 !wcsicmp(wszBuf
, L
"FATX") ||
292 !wcsicmp(wszBuf
, L
"NTFS") ||
293 !wcsicmp(wszBuf
, L
"EXT2") ||
294 !wcsicmp(wszBuf
, L
"BtrFS"))
296 if (!GetDefaultClusterSize(wszBuf
, &ClusterSize
, &TotalNumberOfBytes
))
298 TRACE("%S is not supported on drive larger than %S, current size: %lu\n", wszBuf
, pwszFsSizeLimit
, TotalNumberOfBytes
.QuadPart
);
299 SendMessageW(hDlgCtrl
, CB_DELETESTRING
, iSelIndex
, 0);
303 if (LoadStringW(shell32_hInstance
, IDS_DEFAULT_CLUSTER_SIZE
, wszDefaultSize
, _countof(wszDefaultSize
)))
305 hDlgCtrl
= GetDlgItem(hwndDlg
, 28680); // Get the window handle of "allocation unit size" combobox
306 SendMessageW(hDlgCtrl
, CB_RESETCONTENT
, 0, 0);
307 lIndex
= SendMessageW(hDlgCtrl
, CB_ADDSTRING
, 0, (LPARAM
)wszDefaultSize
);
308 if (lIndex
!= CB_ERR
)
309 SendMessageW(hDlgCtrl
, CB_SETITEMDATA
, lIndex
, (LPARAM
)ClusterSize
);
310 SendMessageW(hDlgCtrl
, CB_SETCURSEL
, 0, 0);
313 if (!wcsicmp(wszBuf
, L
"NTFS"))
316 for (lIndex
= 0; lIndex
< 4; lIndex
++)
318 TotalNumberOfBytes
.QuadPart
= ClusterSize
;
319 if (StrFormatByteSizeW(TotalNumberOfBytes
.QuadPart
, wszDefaultSize
, _countof(wszDefaultSize
)))
321 lIndex
= SendMessageW(hDlgCtrl
, CB_ADDSTRING
, 0, (LPARAM
)wszDefaultSize
);
322 if (lIndex
!= CB_ERR
)
323 SendMessageW(hDlgCtrl
, CB_SETITEMDATA
, lIndex
, (LPARAM
)ClusterSize
);
329 SendMessageW(GetDlgItem(hwndDlg
, 28675), BM_SETCHECK
, BST_UNCHECKED
, 0);
330 if (!wcsicmp(wszBuf
, L
"EXT2") ||
331 !wcsicmp(wszBuf
, L
"BtrFS") ||
332 !wcsicmp(wszBuf
, L
"NTFS"))
334 /* Enable the "Enable Compression" button */
335 EnableWindow(GetDlgItem(hwndDlg
, 28675), TRUE
);
339 /* Disable the "Enable Compression" button */
340 EnableWindow(GetDlgItem(hwndDlg
, 28675), FALSE
);
345 FIXME("Unknown filesystem: %ls\n", wszBuf
);
346 SendDlgItemMessageW(hwndDlg
, 28680, CB_RESETCONTENT
, iSelIndex
, 0);
352 InitializeFormatDriveDlg(HWND hwndDlg
, PFORMAT_DRIVE_CONTEXT pContext
)
355 WCHAR szDrive
[] = L
"C:\\";
356 WCHAR szFs
[30] = L
"";
358 ULARGE_INTEGER FreeBytesAvailableUser
, TotalNumberOfBytes
;
359 DWORD dwIndex
, dwDefault
;
360 UCHAR uMinor
, uMajor
;
362 HWND hwndFileSystems
;
364 cchText
= GetWindowTextW(hwndDlg
, szText
, _countof(szText
) - 1);
367 szText
[cchText
++] = L
' ';
368 szDrive
[0] = pContext
->Drive
+ L
'A';
369 if (GetVolumeInformationW(szDrive
, &szText
[cchText
], _countof(szText
) - cchText
, NULL
, NULL
, NULL
, szFs
, _countof(szFs
)))
371 if (szText
[cchText
] == UNICODE_NULL
)
373 /* load default volume label */
374 cchText
+= LoadStringW(shell32_hInstance
, IDS_DRIVE_FIXED
, &szText
[cchText
], _countof(szText
) - cchText
);
378 /* set volume label */
379 SetDlgItemTextW(hwndDlg
, 28679, &szText
[cchText
]);
380 cchText
+= wcslen(&szText
[cchText
]);
384 StringCchPrintfW(szText
+ cchText
, _countof(szText
) - cchText
, L
" (%c:)", szDrive
[0]);
386 /* set window text */
387 SetWindowTextW(hwndDlg
, szText
);
389 if (GetDiskFreeSpaceExW(szDrive
, &FreeBytesAvailableUser
, &TotalNumberOfBytes
, NULL
))
391 if (StrFormatByteSizeW(TotalNumberOfBytes
.QuadPart
, szText
, _countof(szText
)))
393 /* add drive capacity */
394 SendDlgItemMessageW(hwndDlg
, 28673, CB_ADDSTRING
, 0, (LPARAM
)szText
);
395 SendDlgItemMessageW(hwndDlg
, 28673, CB_SETCURSEL
, 0, (LPARAM
)0);
399 if (pContext
->Options
& SHFMT_OPT_FULL
)
401 /* check quick format button */
402 SendDlgItemMessageW(hwndDlg
, 28674, BM_SETCHECK
, BST_CHECKED
, 0);
405 /* enumerate all available filesystems */
408 hwndFileSystems
= GetDlgItem(hwndDlg
, 28677);
410 while(QueryAvailableFileSystemFormat(dwIndex
, szText
, &uMajor
, &uMinor
, &Latest
))
412 if (!wcsicmp(szText
, szFs
))
415 SendMessageW(hwndFileSystems
, CB_ADDSTRING
, 0, (LPARAM
)szText
);
421 ERR("no filesystem providers\n");
425 /* select default filesys */
426 SendMessageW(hwndFileSystems
, CB_SETCURSEL
, dwDefault
, 0);
427 /* setup cluster combo */
428 InsertDefaultClusterSizeForFs(hwndDlg
, pContext
);
431 static HWND FormatDrvDialog
= NULL
;
432 static BOOLEAN bSuccess
= FALSE
;
436 IN CALLBACKCOMMAND Command
,
445 Progress
= (PDWORD
)ActionInfo
;
446 SendDlgItemMessageW(FormatDrvDialog
, 28678, PBM_SETPOS
, (WPARAM
)*Progress
, 0);
449 pSuccess
= (PBOOLEAN
)ActionInfo
;
450 bSuccess
= (*pSuccess
);
451 ShellMessageBoxW(shell32_hInstance
, FormatDrvDialog
, MAKEINTRESOURCEW(IDS_FORMAT_COMPLETE
), MAKEINTRESOURCEW(IDS_FORMAT_TITLE
), MB_OK
| MB_ICONINFORMATION
);
452 SendDlgItemMessageW(FormatDrvDialog
, 28678, PBM_SETPOS
, 0, 0);
456 case INSUFFICIENTRIGHTS
:
458 case CLUSTERSIZETOOSMALL
:
460 FIXME("Unsupported command in FormatExCB\n");
471 FormatDrive(HWND hwndDlg
, PFORMAT_DRIVE_CONTEXT pContext
)
473 WCHAR szDrive
[4] = { L
'C', ':', '\\', 0 };
474 WCHAR szFileSys
[40] = {0};
475 WCHAR szLabel
[40] = {0};
482 FMIFS_MEDIA_FLAG MediaFlag
= FMIFS_HARDDISK
;
484 /* set volume path */
485 szDrive
[0] = pContext
->Drive
+ L
'A';
488 hDlgCtrl
= GetDlgItem(hwndDlg
, 28677);
489 iSelIndex
= SendMessageW(hDlgCtrl
, CB_GETCURSEL
, 0, 0);
490 if (iSelIndex
== CB_ERR
)
492 ERR("Unable to get file system selection\n");
495 Length
= SendMessageW(hDlgCtrl
, CB_GETLBTEXTLEN
, iSelIndex
, 0);
496 if ((int)Length
== CB_ERR
|| Length
+ 1 > _countof(szFileSys
))
498 ERR("Unable to get file system selection\n");
502 /* retrieve the file system */
503 SendMessageW(hDlgCtrl
, CB_GETLBTEXT
, iSelIndex
, (LPARAM
)szFileSys
);
504 szFileSys
[_countof(szFileSys
)-1] = L
'\0';
506 /* retrieve the volume label */
507 hDlgCtrl
= GetWindow(hwndDlg
, 28679);
508 Length
= SendMessageW(hDlgCtrl
, WM_GETTEXTLENGTH
, 0, 0);
509 if (Length
+ 1 > _countof(szLabel
))
511 ERR("Unable to get volume label\n");
514 SendMessageW(hDlgCtrl
, WM_GETTEXT
, _countof(szLabel
), (LPARAM
)szLabel
);
515 szLabel
[(sizeof(szLabel
)/sizeof(WCHAR
))-1] = L
'\0';
517 /* check for quickformat */
518 if (SendDlgItemMessageW(hwndDlg
, 28674, BM_GETCHECK
, 0, 0) == BST_CHECKED
)
523 /* get the cluster size */
524 hDlgCtrl
= GetDlgItem(hwndDlg
, 28680);
525 iSelIndex
= SendMessageW(hDlgCtrl
, CB_GETCURSEL
, 0, 0);
526 if (iSelIndex
== CB_ERR
)
531 ClusterSize
= SendMessageW(hDlgCtrl
, CB_GETITEMDATA
, iSelIndex
, 0);
532 if ((int)ClusterSize
== CB_ERR
)
538 hDlgCtrl
= GetDlgItem(hwndDlg
, 28680);
539 SendMessageW(hDlgCtrl
, PBM_SETRANGE
, 0, MAKELPARAM(0, 100));
543 * will cause display problems
544 * when performing more than one format
546 FormatDrvDialog
= hwndDlg
;
548 /* See if the drive is removable or not */
549 DriveType
= GetDriveTypeW(szDrive
);
555 case DRIVE_NO_ROOT_DIR
:
561 case DRIVE_REMOVABLE
:
562 MediaFlag
= FMIFS_FLOPPY
;
567 MediaFlag
= FMIFS_HARDDISK
;
571 /* Format the drive */
580 FormatDrvDialog
= NULL
;
583 pContext
->Result
= SHFMT_ERROR
;
585 else if (QuickFormat
)
587 pContext
->Result
= SHFMT_OPT_FULL
;
591 pContext
->Result
= FALSE
;
595 struct FORMAT_DRIVE_PARAMS
598 PFORMAT_DRIVE_CONTEXT pContext
;
601 static unsigned __stdcall
DoFormatDrive(void *args
)
603 FORMAT_DRIVE_PARAMS
*pParams
= reinterpret_cast<FORMAT_DRIVE_PARAMS
*>(args
);
604 HWND hwndDlg
= pParams
->hwndDlg
;
605 PFORMAT_DRIVE_CONTEXT pContext
= pParams
->pContext
;
607 /* Disable controls during format */
608 HMENU hSysMenu
= GetSystemMenu(hwndDlg
, FALSE
);
609 EnableMenuItem(hSysMenu
, SC_CLOSE
, MF_BYCOMMAND
| MF_GRAYED
);
610 EnableWindow(GetDlgItem(hwndDlg
, IDOK
), FALSE
);
611 EnableWindow(GetDlgItem(hwndDlg
, IDCANCEL
), FALSE
);
612 EnableWindow(GetDlgItem(hwndDlg
, 28673), FALSE
);
613 EnableWindow(GetDlgItem(hwndDlg
, 28677), FALSE
);
614 EnableWindow(GetDlgItem(hwndDlg
, 28680), FALSE
);
615 EnableWindow(GetDlgItem(hwndDlg
, 28679), FALSE
);
616 EnableWindow(GetDlgItem(hwndDlg
, 28674), FALSE
);
618 FormatDrive(hwndDlg
, pContext
);
620 /* Re-enable controls after format */
621 EnableWindow(GetDlgItem(hwndDlg
, IDOK
), TRUE
);
622 EnableWindow(GetDlgItem(hwndDlg
, IDCANCEL
), TRUE
);
623 EnableWindow(GetDlgItem(hwndDlg
, 28673), TRUE
);
624 EnableWindow(GetDlgItem(hwndDlg
, 28677), TRUE
);
625 EnableWindow(GetDlgItem(hwndDlg
, 28680), TRUE
);
626 EnableWindow(GetDlgItem(hwndDlg
, 28679), TRUE
);
627 EnableWindow(GetDlgItem(hwndDlg
, 28674), TRUE
);
628 EnableMenuItem(hSysMenu
, SC_CLOSE
, MF_BYCOMMAND
| MF_ENABLED
);
629 pContext
->bFormattingNow
= FALSE
;
635 static INT_PTR CALLBACK
636 FormatDriveDlg(HWND hwndDlg
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
638 PFORMAT_DRIVE_CONTEXT pContext
;
643 InitializeFormatDriveDlg(hwndDlg
, (PFORMAT_DRIVE_CONTEXT
)lParam
);
644 SetWindowLongPtr(hwndDlg
, DWLP_USER
, (LONG_PTR
)lParam
);
647 switch(LOWORD(wParam
))
650 pContext
= (PFORMAT_DRIVE_CONTEXT
)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
651 if (pContext
->bFormattingNow
)
654 if (ShellMessageBoxW(shell32_hInstance
, hwndDlg
,
655 MAKEINTRESOURCEW(IDS_FORMAT_WARNING
),
656 MAKEINTRESOURCEW(IDS_FORMAT_TITLE
),
657 MB_OKCANCEL
| MB_ICONWARNING
) == IDOK
)
659 pContext
->bFormattingNow
= TRUE
;
661 FORMAT_DRIVE_PARAMS
*pParams
= new FORMAT_DRIVE_PARAMS
;
662 pParams
->hwndDlg
= hwndDlg
;
663 pParams
->pContext
= pContext
;
666 HANDLE hThread
= (HANDLE
)_beginthreadex(NULL
, 0, DoFormatDrive
, pParams
, 0, &tid
);
667 CloseHandle(hThread
);
671 pContext
= (PFORMAT_DRIVE_CONTEXT
)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
672 if (pContext
->bFormattingNow
)
675 EndDialog(hwndDlg
, pContext
->Result
);
677 case 28677: // filesystem combo
678 if (HIWORD(wParam
) == CBN_SELENDOK
)
680 pContext
= (PFORMAT_DRIVE_CONTEXT
)GetWindowLongPtr(hwndDlg
, DWLP_USER
);
681 if (pContext
->bFormattingNow
)
684 InsertDefaultClusterSizeForFs(hwndDlg
, pContext
);
692 /*************************************************************************
693 * SHFormatDrive (SHELL32.@)
698 SHFormatDrive(HWND hwnd
, UINT drive
, UINT fmtID
, UINT options
)
700 FORMAT_DRIVE_CONTEXT Context
;
703 TRACE("%p, 0x%08x, 0x%08x, 0x%08x - stub\n", hwnd
, drive
, fmtID
, options
);
705 Context
.Drive
= drive
;
706 Context
.Options
= options
;
707 Context
.Result
= FALSE
;
708 Context
.bFormattingNow
= FALSE
;
710 if (!IsSystemDrive(&Context
))
712 result
= DialogBoxParamW(shell32_hInstance
, MAKEINTRESOURCEW(IDD_FORMAT_DRIVE
), hwnd
, FormatDriveDlg
, (LPARAM
)&Context
);
716 result
= SHFMT_ERROR
;
717 ShellMessageBoxW(shell32_hInstance
, hwnd
, MAKEINTRESOURCEW(IDS_NO_FORMAT
), MAKEINTRESOURCEW(IDS_NO_FORMAT_TITLE
), MB_OK
| MB_ICONWARNING
);
718 TRACE("SHFormatDrive(): The provided drive for format is a system volume! Aborting...\n");