mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[misc] warn about UDF formatting times and 64k MS-DOS
* Closes #149 * Closes #180
This commit is contained in:
parent
7d2519675c
commit
59496e53c0
7 changed files with 89 additions and 14 deletions
11
src/format.c
11
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.
|
||||
|
|
33
src/rufus.c
33
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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
10
src/rufus.rc
10
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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue