[misc] fix FAT32 cluster boundaries and add cheat mode to force DD

* Closes #310
* Alt-I can now be used to disable ISO support. This is meant to be
  used for dual ISO/DD images so that DD (disk image) mode will be used
* Also issue a message in the log to indicate whether slow or quick format is used
* Also change the cheat mode keys for force update and proper unit to C and U
This commit is contained in:
Pete Batard 2014-04-13 15:20:20 +01:00
parent 1c8f57a4e7
commit f78eb4de99
6 changed files with 40 additions and 25 deletions

View File

@ -80,5 +80,6 @@ o Version 1.0.0 (2013.10.20)
[TODO] (NOTE: THIS PART IS ONLY FOR THE RUFUS DEVELOPER, NOT TRANSLATORS)
- MSG_165 should be altered to say image
- NEW message for wrong MSG_044 in _StrError()
- NEW message for Alt-Q toggle
- NEW message for Alt-I toggle
- NEW message for Alt-U toggle
- NEW message for ERROR_NOT_READY

View File

@ -743,6 +743,7 @@ static BOOL FormatDrive(DWORD DriveIndex)
task_number = 0;
fs_index = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
uprintf("%s format was selected\n", IsChecked(IDC_QUICKFORMAT)?"Quick":"Slow");
pfFormatEx(wVolumeName, SelectedDrive.Geometry.MediaType, wFSType, wLabel,
IsChecked(IDC_QUICKFORMAT), ulClusterSize, FormatExCallback);

View File

@ -54,7 +54,7 @@ void cdio_destroy (CdIo_t* p_cdio) {}
RUFUS_ISO_REPORT iso_report;
int64_t iso_blocking_status = -1;
BOOL enable_joliet = TRUE, enable_rockridge = TRUE, has_ldlinux_c32;
BOOL enable_iso = TRUE, enable_joliet = TRUE, enable_rockridge = TRUE, has_ldlinux_c32;
#define ISO_BLOCKING(x) do {x; iso_blocking_status++; } while(0)
static const char* psz_extract_dir;
static const char* bootmgr_efi_name = "bootmgr.efi";
@ -483,7 +483,7 @@ BOOL ExtractISO(const char* src_iso, const char* dest_dir, BOOL scan)
const char ISOLINUX[] = { 'I', 'S', 'O', 'L', 'I', 'N', 'U', 'X', ' ' };
iso_extension_mask_t iso_extension_mask = ISO_EXTENSION_ALL;
if ((src_iso == NULL) || (dest_dir == NULL))
if ((!enable_iso) || (src_iso == NULL) || (dest_dir == NULL))
return FALSE;
scan_only = scan;

View File

@ -117,7 +117,7 @@ static BOOL log_displayed = FALSE;
static BOOL iso_provided = FALSE;
static BOOL user_notified = FALSE;
static BOOL relaunch = FALSE;
extern BOOL force_large_fat32, enable_joliet, enable_rockridge, enable_ntfs_compression;
extern BOOL force_large_fat32, enable_iso, enable_joliet, enable_rockridge, enable_ntfs_compression;
extern const char* old_c32_name[NB_OLD_C32];
static int selection_default;
static loc_cmd* selected_locale = NULL;
@ -261,7 +261,7 @@ static BOOL DefineClusterSizes(void)
if ((SelectedDrive.DiskSize >= 32*MB) && (1.0f*SelectedDrive.DiskSize < 1.0f*MAX_FAT32_SIZE*TB)) {
SelectedDrive.ClusterSize[FS_FAT32].Allowed = 0x000001F8;
for (i=32; i<=(32*1024); i<<=1) { // 32 MB -> 32 GB
if (SelectedDrive.DiskSize < i*MB) {
if (SelectedDrive.DiskSize*1.0f < i*MB*FAT32_CLUSTER_THRESHOLD) { // MS
SelectedDrive.ClusterSize[FS_FAT32].Default = 8*(ULONG)i;
break;
}
@ -272,7 +272,7 @@ static BOOL DefineClusterSizes(void)
// Default cluster sizes in the 256MB to 32 GB range do not follow the rule above
if ((SelectedDrive.DiskSize >= 256*MB) && (SelectedDrive.DiskSize < 32*GB)) {
for (i=8; i<=32; i<<=1) { // 256 MB -> 32 GB
if (SelectedDrive.DiskSize < i*GB) {
if (SelectedDrive.DiskSize*1.0f < i*GB*FAT32_CLUSTER_THRESHOLD) {
SelectedDrive.ClusterSize[FS_FAT32].Default = ((ULONG)i/2)*1024;
break;
}
@ -2105,7 +2105,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
return (INT_PTR)TRUE;
case IDC_SELECT_ISO:
if (iso_provided) {
uprintf("Commandline Image provided: '%s'\n", iso_path);
uprintf("Image provided: '%s'\n", iso_path);
iso_provided = FALSE; // One off thing...
} else {
safe_free(iso_path);
@ -2526,6 +2526,14 @@ relaunch:
PrintStatus2000(lmprintf(MSG_256), detect_fakes);
continue;
}
// Alt C => Force the update check to be successful
// This will set the reported current version of Rufus to 0.0.0.0 when performing an update
// check, so that it always succeeds. This is useful for translators.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'C')) {
force_update = !force_update;
PrintStatus2000(lmprintf(MSG_259), force_update);
continue;
}
// Alt-D => Delete the NoDriveTypeAutorun key on exit (useful if the app crashed)
// This key is used to disable Windows popup messages when an USB drive is plugged in.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'D')) {
@ -2544,6 +2552,18 @@ relaunch:
CheckDlgButton(hMainDialog, IDC_ENABLE_FIXED_DISKS, enable_HDDs?BST_CHECKED:BST_UNCHECKED);
continue;
}
// Alt-I => Toggle ISO support
// This is useful if you have a dual ISO/DD image and you want to force Rufus to use
// DD-mode when writing the data.
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'I')) {
enable_iso = !enable_iso;
PrintStatus2000("ISO support:", enable_iso);
if (iso_path != NULL) {
iso_provided = TRUE;
PostMessage(hDlg, WM_COMMAND, IDC_SELECT_ISO, 0);
}
continue;
}
// Alt J => Toggle Joliet support for ISO9660 images
// Some ISOs (Ubuntu) have Joliet extensions but expect applications not to use them,
// due to their reliance on filenames that are > 64 chars (the Joliet max length for
@ -2572,13 +2592,6 @@ relaunch:
PrintStatus2000(lmprintf(MSG_260), enable_ntfs_compression);
continue;
}
// Alt-Q => Use PROPER size units, instead of this whole Kibi/Gibi nonsense
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'Q')) {
use_fake_units = !use_fake_units;
PrintStatus2000("Use PROPER size units:", !use_fake_units);
GetUSBDevices(0);
continue;
}
// Alt-R => Remove all the registry keys created by Rufus
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'R')) {
PrintStatus(2000, FALSE, DeleteRegistryKey(REGKEY_HKCU, COMPANY_NAME "\\" APPLICATION_NAME)?MSG_248:MSG_249);
@ -2595,12 +2608,11 @@ relaunch:
GetUSBDevices(0);
continue;
}
// Alt U => Force the update check to be successful
// This will set the reported current version of Rufus to 0.0.0.0 when performing an update
// check, so that it always succeeds. This is useful for translators.
// Alt-U => Use PROPER size units, instead of this whole Kibi/Gibi nonsense
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'U')) {
force_update = !force_update;
PrintStatus2000(lmprintf(MSG_259), force_update);
use_fake_units = !use_fake_units;
PrintStatus2000("Use PROPER size units:", !use_fake_units);
GetUSBDevices(0);
continue;
}
TranslateMessage(&msg);

View File

@ -58,6 +58,7 @@
#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 FAT32_CLUSTER_THRESHOLD 1.011f // For FAT32, cluster size changes don't occur at power of 2 boundaries but sligthly above
#define DD_BUFFER_SIZE 65536 // Size of the buffer we use for DD operations
#define WHITE RGB(255,255,255)
#define SEPARATOR_GREY RGB(223,223,223)

View File

@ -32,7 +32,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
CAPTION "Rufus 1.4.7.452"
CAPTION "Rufus 1.4.7.453"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -165,7 +165,7 @@ END
RTL_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_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
CAPTION "Rufus 1.4.7.452"
CAPTION "Rufus 1.4.7.453"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "Start",IDC_START,94,291,50,14
@ -427,8 +427,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,7,452
PRODUCTVERSION 1,4,7,452
FILEVERSION 1,4,7,453
PRODUCTVERSION 1,4,7,453
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -445,13 +445,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "1.4.7.452"
VALUE "FileVersion", "1.4.7.453"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "1.4.7.452"
VALUE "ProductVersion", "1.4.7.453"
END
END
BLOCK "VarFileInfo"