From 59496e53c0ebc77ba65889f6ee27977ce1250a93 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Thu, 31 Oct 2013 22:59:53 +0000 Subject: [PATCH] [misc] warn about UDF formatting times and 64k MS-DOS * Closes #149 * Closes #180 --- res/localization/ChangeLog.txt | 8 ++++++- res/localization/new_translation.loc | 17 ++++++++++++-- res/localization/rufus.loc | 22 +++++++++++++++---- src/format.c | 11 ++++++++-- src/rufus.c | 33 ++++++++++++++++++++++++++++ src/rufus.h | 2 ++ src/rufus.rc | 10 ++++----- 7 files changed, 89 insertions(+), 14 deletions(-) diff --git a/res/localization/ChangeLog.txt b/res/localization/ChangeLog.txt index a55e4764..3367213b 100644 --- a/res/localization/ChangeLog.txt +++ b/res/localization/ChangeLog.txt @@ -6,7 +6,13 @@ the same changes. Remember to also update the version number for your translation ('v x.y.z') once you have matched all the changes that occurred for the en-US translation. - +o Version 1.0.2 (2013.10.30) + - *NEW* MSG_110 "MS-DOS cannot boot from a drive using a 64 kilobyte Cluster size..." + - *NEW* MSG_111 "Incompatible Cluster size" + - *NEW* MSG_112 "Formatting a large UDF volumes can take a lot of time..." + - *NEW* MSG_113 "Large UDF volume" + - *NEW* MSG_220 "Formatting (%s) - estimated duration %d:%02d..." + - [ANOTHER MESSAGE TO FOLLOW] o Version 1.0.1 (2013.10.28) - MSG_061 "Please insert a media in drive." -> "Please insert a removable media in drive." - MSG_071 "Unable to create formatting thread." -> "Unable to start thread." diff --git a/res/localization/new_translation.loc b/res/localization/new_translation.loc index 2e7f5b6b..2295f5d1 100644 --- a/res/localization/new_translation.loc +++ b/res/localization/new_translation.loc @@ -51,7 +51,7 @@ l "zz-ZZ" "LangName_EN (LangName_ZZ)" 0x1234, 0xabcd # See http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx or # http://download.microsoft.com/download/9/5/E/95EF66AF-9026-4BB0-A41D-A4F81802D92C/%5BMS-LCID%5D.pdf # for the LCID (0x####) codes you should use -v 1.0.1 +v 1.0.2 # Main dialog g IDD_DIALOG @@ -255,7 +255,7 @@ t MSG_096 "Only FAT/FAT32 is supported for this type of ISO. Please select FAT/F t MSG_097 "Only 'bootmgr' or 'WinPE' based ISO images can currently be used with NTFS." t MSG_098 "FAT/FAT32 can only be used for isolinux based ISO images or when the Target Type is UEFI." t MSG_099 "Filesystem limitation" -t MSG_100 "This iso image contains a file larger than 4GB file, which is more than the " +t MSG_100 "This ISO image contains a file larger than 4GB file, which is more than the " "maximum size allowed for a FAT or FAT32 file system." t MSG_101 "Missing WIM support" t MSG_102 "Your platform cannot extract files from WIM archives. WIM extraction " @@ -275,6 +275,15 @@ t MSG_106 "Please select folder" t MSG_107 "All files" t MSG_108 "Rufus log" t MSG_109 "0x%02X (Disk %d)" +# "Cluster size" below should be the same as the label for IDS_CLUSTERSIZE_TXT +# "kilobytes" should be the same as in MSG_027 +t MSG_110 "MS-DOS cannot boot from a drive using a 64 kilobytes Cluster size.\n" + "Please change the Cluster size or use FreeDOS." +t MSG_111 "Incompatible Cluster size" +# "%d:%02d" below is a duration (mins:secs) +t MSG_112 "Formatting a large UDF volumes can take a lot of time. At USB 2.0 speeds, the estimated formatting " + "duration is %d:%02d, during which the progress bar will appear frozen. Please be patient!" +t MSG_113 "Large UDF volume" # Tootips # Partition Scheme and Target Type @@ -352,6 +361,10 @@ t MSG_216 "Saved %s" t MSG_217 "Formatting: %0.1f%% completed" t MSG_218 "Creating file system: Task %d/%d completed" t MSG_219 "NTFS Fixup: %d%% completed" +# Parameter: the file system and an estimated duration in mins and secs. +# eg. "Formatting (UDF) - Estimated duration 3:21..." +# NB: if "estimated duration" is too long, just use "estimated" or an abbreviation +t MSG_220 "Formatting (%s) - estimated duration %d:%02d..." t MSG_221 "Setting Label (This may take while)..." # Parameter: the file system. eg. "Formatting (NTFS)..." t MSG_222 "Formatting (%s)..." diff --git a/res/localization/rufus.loc b/res/localization/rufus.loc index 09215bc9..46987725 100644 --- a/res/localization/rufus.loc +++ b/res/localization/rufus.loc @@ -2,7 +2,7 @@ ################################################################################ l "en-US" "English (English)" 0x0409, 0x0809, 0x0c09, 0x1009, 0x1409, 0x1809, 0x1c09, 0x2009, 0x2409, 0x2809, 0x2c09, 0x3009, 0x3409, 0x3809, 0x3c09, 0x4009, 0x4409, 0x4809 -v 1.0.1 +v 1.0.2 g IDD_MESSAGES t MSG_001 "Other instance detected" t MSG_002 "Another Rufus application is running.\n" @@ -132,7 +132,7 @@ t MSG_096 "Only FAT/FAT32 is supported for this type of ISO. Please select FAT/F t MSG_097 "Only 'bootmgr' or 'WinPE' based ISO images can currently be used with NTFS." t MSG_098 "FAT/FAT32 can only be used for isolinux based ISO images or when the Target Type is UEFI." t MSG_099 "Filesystem limitation" -t MSG_100 "This iso image contains a file larger than 4GB file, which is more than the " +t MSG_100 "This ISO image contains a file larger than 4GB file, which is more than the " "maximum size allowed for a FAT or FAT32 file system." t MSG_101 "Missing WIM support" t MSG_102 "Your platform cannot extract files from WIM archives. WIM extraction " @@ -152,6 +152,12 @@ t MSG_106 "Please select folder" t MSG_107 "All files" t MSG_108 "Rufus log" t MSG_109 "0x%02X (Disk %d)" +t MSG_110 "MS-DOS cannot boot from a drive using a 64 kilobyte Cluster size.\n" + "Please change the Cluster size or use FreeDOS." +t MSG_111 "Incompatible Cluster size" +t MSG_112 "Formatting a large UDF volumes can take a lot of time. At USB 2.0 speeds, the estimated formatting " + "duration is %d:%02d, during which the progress bar will appear frozen. Please be patient!" +t MSG_113 "Large UDF volume" # Tootips # Partition Scheme and Target Type @@ -229,8 +235,9 @@ t MSG_216 "Saved %s" t MSG_217 "Formatting: %0.1f%% completed" t MSG_218 "Creating file system: Task %d/%d completed" t MSG_219 "NTFS Fixup: %d%% completed" +# Parameter: the file system and an estimated duration in mins and secs +t MSG_220 "Formatting (%s) - estimated duration %d:%02d..." t MSG_221 "Setting Label (This may take while)..." -# Parameter: the file system. eg. "Formatting (NTFS)..." t MSG_222 "Formatting (%s)..." t MSG_223 "NTFS Fixup (Checkdisk)..." t MSG_224 "Clearing MBR/PBR/GPT structures..." @@ -358,7 +365,7 @@ t MSG_007 "撤消" ################################################################################ l "fr-FR" "French (Français)" 0x040c, 0x080c, 0x0c0c, 0x100c, 0x140c, 0x180c, 0x1c0c, 0x200c, 0x240c, 0x280c, 0x2c0c, 0x300c, 0x340c, 0x380c, 0xe40c -v 1.0.1 +v 1.0.2 b "en-US" g IDD_DIALOG @@ -584,6 +591,12 @@ t MSG_106 "Sélection de répertoire" t MSG_107 "Tous les fichiers" t MSG_108 "Log Rufus" t MSG_109 "0x%02X (disque %d)" +t MSG_110 "MS-DOS ne peut pas être utilisé sur un disque avec une Taille de clusters de 64 kilo-octets.\n" + "Veuillez changer la Taille de clusters ou utilisez FreeDOS." +t MSG_111 "Taille de clusters incompatible" +t MSG_112 "Le formattage d'un volume UDF de grande taille peut prendre beaucoup de temps. Aux vitesses USB 2.0, " + "la durée de formattage estimée est %d:%02d, pendant laquelle la barre de progrès semblera gelée. Veuillez être patient !" +t MSG_113 "Volume UDF de grand taille" # Tootips t MSG_150 "Ce choix est le plus sûr. Mais si vous possédez un ordinateur à base de UEFI et voulez installer " @@ -656,6 +669,7 @@ t MSG_216 "%s sauvegardé" t MSG_217 "Formatage: %0.1f%% complet" t MSG_218 "Création du système de fichiers: Tâche %d/%d complète" t MSG_219 "Finalisation NTFS: %d%% complète" +t MSG_220 "Formatage (%s) - durée estimée %d:%02d..." t MSG_221 "Ecriture du label (peut prendre du temps)..." t MSG_222 "Formatage (%s)..." t MSG_223 "Finalisation NTFS (Checkdisk)..." diff --git a/src/format.c b/src/format.c index 8210d260..20312cd0 100644 --- a/src/format.c +++ b/src/format.c @@ -53,6 +53,7 @@ badblocks_report report; static float format_percent = 0.0f; static int task_number = 0; extern const int nb_steps[FS_MAX]; +extern uint32_t dur_mins, dur_secs; static int fs_index = 0; BOOL force_large_fat32 = FALSE; static BOOL WritePBR(HANDLE hLogicalDrive); @@ -626,9 +627,15 @@ static BOOL FormatDrive(DWORD DriveIndex) WCHAR wLabel[64]; ULONG ulClusterSize; size_t i; + int fs; GetWindowTextU(hFileSystem, FSType, ARRAYSIZE(FSType)); - PrintStatus(0, TRUE, lmprintf(MSG_222, FSType)); + fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); + if ((fs == FS_UDF) && !((dur_mins == 0) && (dur_secs == 0))) { + PrintStatus(0, TRUE, lmprintf(MSG_220, FSType, dur_mins, dur_secs)); + } else { + PrintStatus(0, TRUE, lmprintf(MSG_222, FSType)); + } VolumeName = GetLogicalName(DriveIndex, FALSE, TRUE); wVolumeName = utf8_to_wchar(VolumeName); if (wVolumeName == NULL) { @@ -1298,7 +1305,7 @@ DWORD WINAPI FormatThread(LPVOID param) } hLogicalVolume = INVALID_HANDLE_VALUE; - // TODO: (v1.4) Our start button should become cancel instead of close + // TODO: (v1.5) Our start button should become cancel instead of close // Especially after destructive badblocks test, you must zero the MBR/GPT completely // before repartitioning. Else, all kind of bad things happen. diff --git a/src/rufus.c b/src/rufus.c index b3bef654..1577bbc9 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -112,6 +112,7 @@ char szFolderPath[MAX_PATH], app_dir[MAX_PATH]; char* iso_path = NULL; float fScale = 1.0f; int default_fs; +uint32_t dur_mins, dur_secs; HWND hDeviceList, hPartitionScheme, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL; HWND hISOProgressDlg = NULL, hLogDlg = NULL, hISOProgressBar, hISOFileName, hDiskID; BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, detect_fakes = TRUE, mbr_selected_by_user = FALSE; @@ -1184,10 +1185,12 @@ static BOOL BootCheck(void) dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); if (dt == DT_ISO) { if (iso_path == NULL) { + // Please click on the disc button to select a bootable ISO MessageBoxU(hMainDialog, lmprintf(MSG_087), lmprintf(MSG_086), MB_OK|MB_ICONERROR); return FALSE; } if ((size_check) && (iso_report.projected_size > (uint64_t)SelectedDrive.DiskSize)) { + // This ISO image is too big for the selected target MessageBoxU(hMainDialog, lmprintf(MSG_089), lmprintf(MSG_088), MB_OK|MB_ICONERROR); return FALSE; } @@ -1195,31 +1198,39 @@ static BOOL BootCheck(void) bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme))); if (bt == BT_UEFI) { if (!IS_EFI(iso_report)) { + // Unsupported ISO MessageBoxU(hMainDialog, lmprintf(MSG_091), lmprintf(MSG_090), MB_OK|MB_ICONERROR); return FALSE; } else if (fs > FS_FAT32) { + // When using UEFI Target Type, only FAT/FAT32 is supported. MessageBoxU(hMainDialog, lmprintf(MSG_093), lmprintf(MSG_092), MB_OK|MB_ICONERROR); return FALSE; } else if (iso_report.has_4GB_file) { + // This ISO image contains a file larger than 4 GB and cannot be used to create an EFI bootable USB // Who the heck decided that using FAT32 for UEFI boot was a great idea?!? MessageBoxU(hMainDialog, lmprintf(MSG_095), lmprintf(MSG_094), MB_OK|MB_ICONINFORMATION); return FALSE; } } else if ((fs == FS_NTFS) && (!iso_report.has_bootmgr) && (!IS_WINPE(iso_report.winpe))) { if (iso_report.has_isolinux) { + // Only FAT/FAT32 is supported for this type of ISO MessageBoxU(hMainDialog, lmprintf(MSG_096), lmprintf(MSG_092), MB_OK|MB_ICONERROR); } else { + // Only 'bootmgr' or 'WinPE' based ISO images can currently be used with NTFS MessageBoxU(hMainDialog, lmprintf(MSG_097), lmprintf(MSG_090), MB_OK|MB_ICONERROR); } return FALSE; } else if (((fs == FS_FAT16)||(fs == FS_FAT32)) && (!iso_report.has_isolinux)) { + // FAT/FAT32 can only be used for isolinux based ISO images or when the Target Type is UEFI MessageBoxU(hMainDialog, lmprintf(MSG_098), lmprintf(MSG_090), MB_OK|MB_ICONERROR); return FALSE; } else if (((fs == FS_FAT16)||(fs == FS_FAT32)) && (iso_report.has_4GB_file)) { + // This ISO image contains a file larger than 4GB file (FAT32) MessageBoxU(hMainDialog, lmprintf(MSG_100), lmprintf(MSG_099), MB_OK|MB_ICONERROR); return FALSE; } if ((bt == BT_UEFI) && (iso_report.has_win7_efi) && (!WimExtractCheck())) { + // Your platform cannot extract files from WIM archives => download 7-zip? if (MessageBoxU(hMainDialog, lmprintf(MSG_102), lmprintf(MSG_101), MB_YESNO|MB_ICONERROR) == IDYES) ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL); return FALSE; @@ -1232,6 +1243,7 @@ static BOOL BootCheck(void) fclose(fd); } else { PrintStatus(0, FALSE, lmprintf(MSG_206, ldlinux_name)); + // Syslinux v5.0 or later requires a '%s' file to be installed r = MessageBoxU(hMainDialog, lmprintf(MSG_104, ldlinux_name, ldlinux_name), lmprintf(MSG_103, ldlinux_name), MB_YESNOCANCEL|MB_ICONWARNING); if (r == IDCANCEL) @@ -1242,6 +1254,12 @@ static BOOL BootCheck(void) DownloadFile(LDLINUX_C32_URL, ldlinux_name, hISOProgressDlg); } } + } else if (dt == DT_WINME) { + if ((size_check) && (ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)) >= 65536)) { + // MS-DOS cannot boot from a drive using a 64 kilobytes Cluster size + MessageBoxU(hMainDialog, lmprintf(MSG_110), lmprintf(MSG_111), MB_OK|MB_ICONERROR); + return FALSE; + } } return TRUE; } @@ -1789,6 +1807,21 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA format_op_in_progress = FALSE; break; } + + // Display a warning about UDF formatting times + fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); + if (fs == FS_UDF) { + dur_secs = (uint32_t)(((double)SelectedDrive.DiskSize)/1073741824.0f/UDF_FORMAT_SPEED); + if (dur_secs > UDF_FORMAT_WARN) { + dur_mins = dur_secs/60; + dur_secs -= dur_mins*60; + MessageBoxU(hMainDialog, lmprintf(MSG_112, dur_mins, dur_secs), lmprintf(MSG_113), MB_OK|MB_ICONASTERISK); + } else { + dur_secs = 0; + dur_mins = 0; + } + } + GetWindowTextU(hDeviceList, tmp, ARRAYSIZE(tmp)); if (MessageBoxU(hMainDialog, lmprintf(MSG_003, tmp), APPLICATION_NAME, MB_OKCANCEL|MB_ICONWARNING) == IDCANCEL) { diff --git a/src/rufus.h b/src/rufus.h index ffaa7f71..1c283a15 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -53,6 +53,8 @@ #define FS_DEFAULT FS_FAT32 #define BADBLOCK_PATTERNS {0xaa, 0x55, 0xff, 0x00} #define LARGE_FAT32_SIZE (32*1073741824LL) // Size at which we need to use fat32format +#define UDF_FORMAT_SPEED 3.1f // Speed estimate at which we expect UDF drives to be formatted (GB/s) +#define UDF_FORMAT_WARN 20 // Duration (in seconds) above which we warn about long UDF formatting times #define MAX_FAT32_SIZE 2.0f // Threshold above which we disable FAT32 formatting (in TB) #define WHITE RGB(255,255,255) #define SEPARATOR_GREY RGB(223,223,223) diff --git a/src/rufus.rc b/src/rufus.rc index b5c0f913..16d8939a 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 206, 329 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Rufus v1.4.0.301" +CAPTION "Rufus v1.4.0.302" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "Start",IDC_START,94,291,50,14 @@ -285,8 +285,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,4,0,301 - PRODUCTVERSION 1,4,0,301 + FILEVERSION 1,4,0,302 + PRODUCTVERSION 1,4,0,302 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -303,13 +303,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "1.4.0.301" + VALUE "FileVersion", "1.4.0.302" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2013 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "1.4.0.301" + VALUE "ProductVersion", "1.4.0.302" END END BLOCK "VarFileInfo"