From dddd4b38f62d312e68e9ff45324ef41777544b2e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Tue, 16 May 2017 20:16:43 +0000 Subject: [PATCH] [SHELL32]: Fix a FIXME: Recognize the media type for formatting, by calling GetDriveTypeW(). Based on what format.com does too. svn path=/trunk/; revision=74565 --- reactos/dll/win32/shell32/dialogs/drive.cpp | 30 +++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/reactos/dll/win32/shell32/dialogs/drive.cpp b/reactos/dll/win32/shell32/dialogs/drive.cpp index 8ea0cb54be5..a5919f027f0 100644 --- a/reactos/dll/win32/shell32/dialogs/drive.cpp +++ b/reactos/dll/win32/shell32/dialogs/drive.cpp @@ -473,6 +473,8 @@ FormatDrive(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) HWND hDlgCtrl; BOOL QuickFormat; DWORD ClusterSize; + DWORD DriveType; + FMIFS_MEDIA_FLAG MediaFlag = FMIFS_HARDDISK; /* set volume path */ szDrive[0] = pContext->Drive + L'A'; @@ -539,8 +541,32 @@ FormatDrive(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) */ FormatDrvDialog = hwndDlg; + /* See if the drive is removable or not */ + DriveType = GetDriveTypeW(szDrive); + switch (DriveType) + { + case DRIVE_UNKNOWN: + case DRIVE_REMOTE: + case DRIVE_CDROM: + case DRIVE_NO_ROOT_DIR: + { + FIXME("\n"); + return; + } + + case DRIVE_REMOVABLE: + MediaFlag = FMIFS_FLOPPY; + break; + + case DRIVE_FIXED: + case DRIVE_RAMDISK: + MediaFlag = FMIFS_HARDDISK; + break; + } + + /* Format the drive */ FormatEx(szDrive, - FMIFS_HARDDISK, /* FIXME */ + MediaFlag, szFileSys, szLabel, QuickFormat, @@ -559,7 +585,7 @@ FormatDrive(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext) } else { - pContext->Result = FALSE; + pContext->Result = FALSE; } } -- 2.17.1