From e6ac3782feea4df9ec0ebb1bc8ca6bdbfcad5474 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 2 Oct 2020 13:58:15 +0100 Subject: [PATCH] [ext2fs] set a minimum ext partition size of 256 MB * Not gonna bother with computing the effective minimum size so 256 MB will have to do. * Closes #1576 --- src/rufus.c | 12 +++++++++++- src/rufus.h | 1 + src/rufus.rc | 10 +++++----- src/ui.c | 5 ++++- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/rufus.c b/src/rufus.c index a380ca0a..a830b742 100755 --- a/src/rufus.c +++ b/src/rufus.c @@ -500,7 +500,7 @@ static BOOL SetFileSystemAndClusterSize(char* fs_name) SelectedDrive.ClusterSize[FS_UDF].Default = 1; // ext2/ext3/ext4 - if (advanced_mode_format) { + if (advanced_mode_format && (SelectedDrive.DiskSize >= MIN_EXT_SIZE)) { SelectedDrive.ClusterSize[FS_EXT2].Allowed = SINGLE_CLUSTERSIZE_DEFAULT; SelectedDrive.ClusterSize[FS_EXT2].Default = 1; SelectedDrive.ClusterSize[FS_EXT3].Allowed = SINGLE_CLUSTERSIZE_DEFAULT; @@ -2280,6 +2280,16 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA static_sprintf(tmp, "0 (%s)", lmprintf(MSG_124)); app_changed_size = TRUE; SetWindowTextU(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp); + } else if (persistence_size < MIN_EXT_SIZE) { + persistence_size = MIN_EXT_SIZE; + uint64_t pos = persistence_size / MB; + for (i = 0; i < persistence_unit_selection; i++) + pos /= 1024; + lPos = (LONG)pos; + SendMessage(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER), TBM_SETPOS, TRUE, lPos); + static_sprintf(tmp, "%ld", lPos); + app_changed_size = TRUE; + SetWindowTextU(GetDlgItem(hMainDialog, IDC_PERSISTENCE_SIZE), tmp); } } break; diff --git a/src/rufus.h b/src/rufus.h index 43c3ca24..085fe3e2 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -62,6 +62,7 @@ #define DRIVE_INDEX_MAX 0x000000C0 #define MIN_DRIVE_SIZE 8 // Minimum size a drive must have, to be formattable (in MB) #define MIN_EXTRA_PART_SIZE (1024*1024) // Minimum size of the extra partition, in bytes +#define MIN_EXT_SIZE (256*1024*1024) // Minimum size we allow for ext formatting #define MAX_ARCHS 9 // Number of arhitectures we recognize #define MAX_DRIVES (DRIVE_INDEX_MAX - DRIVE_INDEX_MIN) #define MAX_TOOLTIPS 128 diff --git a/src/rufus.rc b/src/rufus.rc index 7de6862a..a1a63faa 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.12.1704" +CAPTION "Rufus 3.12.1706" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -395,8 +395,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,12,1704,0 - PRODUCTVERSION 3,12,1704,0 + FILEVERSION 3,12,1706,0 + PRODUCTVERSION 3,12,1706,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -414,13 +414,13 @@ BEGIN VALUE "Comments", "https://rufus.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.12.1704" + VALUE "FileVersion", "3.12.1706" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html" VALUE "OriginalFilename", "rufus-3.12.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.12.1704" + VALUE "ProductVersion", "3.12.1706" END END BLOCK "VarFileInfo" diff --git a/src/ui.c b/src/ui.c index 4b72e15a..1d31f63e 100644 --- a/src/ui.c +++ b/src/ui.c @@ -671,7 +671,7 @@ void ToggleAdvancedFormatOptions(BOOL enable) InvalidateRect(hMainDialog, NULL, TRUE); } -// Toggle the display of peristence unit dropdown and resize the size field +// Toggle the display of persistence unit dropdown and resize the size field void TogglePersistenceControls(BOOL display) { RECT rc; @@ -747,12 +747,15 @@ void SetPersistenceSize(void) persistence_unit_selection = proposed_unit_selection; IGNORE_RETVAL(ComboBox_SetCurSel(hCtrl, persistence_unit_selection)); + if ((pos != 0) && (pos < MIN_EXT_SIZE)) + pos = MIN_EXT_SIZE; pos /= MB; max /= MB; for (i = 0; i < persistence_unit_selection; i++) { pos /= 1024; max /= 1024; } + } hCtrl = GetDlgItem(hMainDialog, IDC_PERSISTENCE_SLIDER);