mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] improve/fix file system selection according to current ISO
* Closes #2074. * Also harmonize whitespaces.
This commit is contained in:
parent
a6769e4fb2
commit
9727fd4342
2 changed files with 21 additions and 30 deletions
37
src/rufus.c
37
src/rufus.c
|
@ -483,7 +483,7 @@ static BOOL SetFileSystemAndClusterSize(char* fs_name)
|
|||
// FAT 16
|
||||
if (SelectedDrive.DiskSize < 4*GB) {
|
||||
SelectedDrive.ClusterSize[FS_FAT16].Allowed = 0x00001E00;
|
||||
for (i=32; i<=4096; i<<=1) { // 8 MB -> 4 GB
|
||||
for (i = 32; i <= 4096; i <<= 1) { // 8 MB -> 4 GB
|
||||
if (SelectedDrive.DiskSize < i*MB) {
|
||||
SelectedDrive.ClusterSize[FS_FAT16].Default = 16*(ULONG)i;
|
||||
break;
|
||||
|
@ -613,7 +613,7 @@ static BOOL SetFileSystemAndClusterSize(char* fs_name)
|
|||
SelectedDrive.FSType = selected_fs;
|
||||
}
|
||||
|
||||
for (i = 0; i<ComboBox_GetCount(hFileSystem); i++) {
|
||||
for (i = 0; i < ComboBox_GetCount(hFileSystem); i++) {
|
||||
if (ComboBox_GetItemData(hFileSystem, i) == SelectedDrive.FSType) {
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hFileSystem, i));
|
||||
break;
|
||||
|
@ -631,7 +631,7 @@ static BOOL SetFileSystemAndClusterSize(char* fs_name)
|
|||
static void SetFSFromISO(void)
|
||||
{
|
||||
int i, fs_tmp, preferred_fs = FS_UNKNOWN;
|
||||
uint32_t fs_mask = FS_FAT32 | FS_NTFS;
|
||||
uint32_t fs_mask = FS_NTFS | (img_report.has_4GB_file ? 0 : FS_FAT32);
|
||||
BOOL windows_to_go = (image_options & IMOP_WINTOGO) && (boot_type == BT_IMAGE) &&
|
||||
HAS_WINTOGO(img_report) && (ComboBox_GetCurItemData(hImageOption) == IMOP_WIN_TO_GO);
|
||||
|
||||
|
@ -639,38 +639,29 @@ static void SetFSFromISO(void)
|
|||
return;
|
||||
|
||||
// Create a mask of all the FS's available
|
||||
for (i=0; i<ComboBox_GetCount(hFileSystem); i++) {
|
||||
for (i = 0; i < ComboBox_GetCount(hFileSystem); i++) {
|
||||
fs_tmp = (int)ComboBox_GetItemData(hFileSystem, i);
|
||||
fs_mask |= 1<<fs_tmp;
|
||||
fs_mask |= 1 << fs_tmp;
|
||||
}
|
||||
|
||||
if ((preferred_fs == FS_UNKNOWN) && (preselected_fs != FS_UNKNOWN)) {
|
||||
// If the FS requested from the command line is valid use it
|
||||
if (fs_mask & (1 << preselected_fs)) {
|
||||
if ((preselected_fs != FS_UNKNOWN) && (fs_mask & (1 << preselected_fs))) {
|
||||
preferred_fs = preselected_fs;
|
||||
}
|
||||
}
|
||||
|
||||
if (preferred_fs == FS_UNKNOWN) {
|
||||
} else {
|
||||
// Syslinux and EFI have precedence over bootmgr (unless the user selected BIOS as target type)
|
||||
if ((HAS_SYSLINUX(img_report)) || (HAS_REACTOS(img_report)) || HAS_KOLIBRIOS(img_report) ||
|
||||
(IS_EFI_BOOTABLE(img_report) && (target_type == TT_UEFI) && (!windows_to_go))) {
|
||||
if (fs_mask & (1 << FS_FAT32)) {
|
||||
(IS_EFI_BOOTABLE(img_report) && (target_type == TT_UEFI) && (!windows_to_go) && (!img_report.has_4GB_file))) {
|
||||
if (fs_mask & (1 << FS_FAT32))
|
||||
preferred_fs = FS_FAT32;
|
||||
} else if ((fs_mask & (1 << FS_FAT16)) && !HAS_KOLIBRIOS(img_report)) {
|
||||
else if ((fs_mask & (1 << FS_FAT16)) && !HAS_KOLIBRIOS(img_report))
|
||||
preferred_fs = FS_FAT16;
|
||||
}
|
||||
} else if ((windows_to_go) || HAS_BOOTMGR(img_report) || HAS_WINPE(img_report)) {
|
||||
if (fs_mask & (1 << FS_NTFS)) {
|
||||
if ((fs_mask & (1 << FS_FAT32)) && (!img_report.has_4GB_file) && (allow_dual_uefi_bios))
|
||||
preferred_fs = FS_FAT32;
|
||||
else if (fs_mask & (1 << FS_NTFS))
|
||||
preferred_fs = FS_NTFS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The presence of a 4GB file forces the use of NTFS as default FS if available
|
||||
if (img_report.has_4GB_file && (fs_mask & (1 << FS_NTFS))) {
|
||||
preferred_fs = FS_NTFS;
|
||||
}
|
||||
|
||||
// Try to select the FS
|
||||
for (i = 0; i < ComboBox_GetCount(hFileSystem); i++) {
|
||||
|
@ -683,7 +674,7 @@ static void SetFSFromISO(void)
|
|||
if (selected_fs == FS_UNKNOWN)
|
||||
selected_fs = preferred_fs;
|
||||
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE_INTERNAL<<16) | IDC_FILE_SYSTEM,
|
||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE_INTERNAL << 16) | IDC_FILE_SYSTEM,
|
||||
ComboBox_GetCurSel(hFileSystem));
|
||||
}
|
||||
|
||||
|
|
10
src/rufus.rc
10
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.21.1945"
|
||||
CAPTION "Rufus 3.21.1946"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -396,8 +396,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,21,1945,0
|
||||
PRODUCTVERSION 3,21,1945,0
|
||||
FILEVERSION 3,21,1946,0
|
||||
PRODUCTVERSION 3,21,1946,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -415,13 +415,13 @@ BEGIN
|
|||
VALUE "Comments", "https://rufus.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "3.21.1945"
|
||||
VALUE "FileVersion", "3.21.1946"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2022 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
VALUE "OriginalFilename", "rufus-3.21.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "3.21.1945"
|
||||
VALUE "ProductVersion", "3.21.1946"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue