From 002a9a29a715a06bac91fb2b4f08295b33c2518c Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Thu, 2 Jul 2020 02:17:58 +0200 Subject: Windows: Use native Windows format program first to perform formatting since it is more reliable and only fallback to FormatEx function from fmifs.dll in case of issue. --- src/Common/Format.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Common/Format.c b/src/Common/Format.c index d1aa653c..f691c78d 100644 --- a/src/Common/Format.c +++ b/src/Common/Format.c @@ -778,16 +778,15 @@ error: nStatus = ERR_VOL_MOUNT_FAILED; goto fv_end; } - - if (!Silent && !IsAdmin () && IsUacSupported ()) - retCode = UacFormatFs (volParams->hwndDlg, driveNo, volParams->clusterSize, fsType); - else - retCode = FormatFs (driveNo, volParams->clusterSize, fsType); + retCode = ExternalFormatFs (driveNo, volParams->clusterSize, fsType); if (retCode != TRUE) { - /* fallback to calling Windows native formatting tool */ - retCode = ExternalFormatFs (driveNo, volParams->clusterSize, fsType); + /* fallback to using FormatEx function from fmifs.dll */ + if (!Silent && !IsAdmin () && IsUacSupported ()) + retCode = UacFormatFs (volParams->hwndDlg, driveNo, volParams->clusterSize, fsType); + else + retCode = FormatFs (driveNo, volParams->clusterSize, fsType); } if (retCode != TRUE) -- cgit v1.2.3