1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[ui] prefer GPT if the user switched to it before ISO selection

* This should help with the myriad of people not noticing that
  this setting was reset after selecting an ISO.
This commit is contained in:
Pete Batard 2017-03-30 12:07:49 +01:00
parent 893a2e63d7
commit abce1a2aa0
2 changed files with 14 additions and 10 deletions

View file

@ -109,7 +109,7 @@ BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, tog
BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE; BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE;
BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE; BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE;
BOOL advanced_mode, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug, use_fake_units, preserve_timestamps; BOOL advanced_mode, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug, use_fake_units, preserve_timestamps;
BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, disable_file_indexing, large_drive = FALSE; BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, disable_file_indexing, large_drive = FALSE, prefer_gpt = FALSE;
int dialog_showing = 0, lang_button_id = 0; int dialog_showing = 0, lang_button_id = 0;
uint16_t rufus_version[3], embedded_sl_version[2]; uint16_t rufus_version[3], embedded_sl_version[2];
char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
@ -378,16 +378,17 @@ static int SetMBRForUEFI(BOOL replace)
useCSM = TRUE; useCSM = TRUE;
} }
// If we weren't already dealing with pure EFI, we need to remove the first option
if (replace && !pure_efi) if (replace && !pure_efi)
ComboBox_DeleteString(hPartitionScheme, 0); ComboBox_DeleteString(hPartitionScheme, 0);
if ((image_path != NULL) && IS_EFI_BOOTABLE(img_report) && !IS_BIOS_BOOTABLE(img_report)) { if ((image_path != NULL) && IS_EFI_BOOTABLE(img_report) && !IS_BIOS_BOOTABLE(img_report)) {
pure_efi = TRUE; pure_efi = TRUE;
// Pure EFI -> no need to add the BIOS option
return -1; return -1;
} else {
pure_efi = FALSE;
} }
pure_efi = FALSE;
IGNORE_RETVAL(ComboBox_SetItemData(hPartitionScheme, ComboBox_InsertStringU(hPartitionScheme, 0, IGNORE_RETVAL(ComboBox_SetItemData(hPartitionScheme, ComboBox_InsertStringU(hPartitionScheme, 0,
lmprintf(MSG_031, PartitionTypeLabel[PARTITION_STYLE_MBR], useCSM?"UEFI-CSM":"UEFI")), (TT_BIOS<<16)|PARTITION_STYLE_MBR)); lmprintf(MSG_031, PartitionTypeLabel[PARTITION_STYLE_MBR], useCSM?"UEFI-CSM":"UEFI")), (TT_BIOS<<16)|PARTITION_STYLE_MBR));
if (replace) if (replace)
@ -591,7 +592,7 @@ static void SetPartitionSchemeTooltip(void)
static void SetTargetSystem(void) static void SetTargetSystem(void)
{ {
int ts = SetMBRForUEFI(TRUE); // Will be set to -1 for pure UEFI, 0 otherwise int ts = SetMBRForUEFI(TRUE); // Will be set to -1 for pure UEFI, 0 otherwise
if (SelectedDrive.PartitionType == PARTITION_STYLE_GPT) { if ((prefer_gpt && IS_EFI_BOOTABLE(img_report)) || SelectedDrive.PartitionType == PARTITION_STYLE_GPT) {
ts += 2; // GPT/UEFI ts += 2; // GPT/UEFI
} else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker || } else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker ||
(IS_EFI_BOOTABLE(img_report) && !IS_BIOS_BOOTABLE(img_report)) ) { (IS_EFI_BOOTABLE(img_report) && !IS_BIOS_BOOTABLE(img_report)) ) {
@ -2156,7 +2157,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
RECT DialogRect, DesktopRect, LangToolbarRect; RECT DialogRect, DesktopRect, LangToolbarRect;
LONG progress_style; LONG progress_style;
HDC hDC; HDC hDC;
int nDeviceIndex, fs, tt, i, nWidth, nHeight, nb_devices, selected_language, offset; int nDeviceIndex, fs, tt, pt, i, nWidth, nHeight, nb_devices, selected_language, offset;
char tmp[128]; char tmp[128];
wchar_t* wbuffer = NULL; wchar_t* wbuffer = NULL;
loc_cmd* lcmd = NULL; loc_cmd* lcmd = NULL;
@ -2301,6 +2302,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break; break;
SetPartitionSchemeTooltip(); SetPartitionSchemeTooltip();
SetFSFromISO(); SetFSFromISO();
pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
// If a user switches to GPT before an image is selected, it is reasonable to assume that they prefer GPT
prefer_gpt = (pt == PARTITION_STYLE_GPT) && (image_path == NULL);
// fall-through // fall-through
case IDC_FILESYSTEM: case IDC_FILESYSTEM:
if (HIWORD(wParam) != CBN_SELCHANGE) if (HIWORD(wParam) != CBN_SELCHANGE)

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 242, 376 IDD_DIALOG DIALOGEX 12, 12, 242, 376
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 2.13.1075" CAPTION "Rufus 2.13.1076"
FONT 8, "Segoe UI Symbol", 400, 0, 0x0 FONT 8, "Segoe UI Symbol", 400, 0, 0x0
BEGIN BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8 LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -334,8 +334,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,13,1075,0 FILEVERSION 2,13,1076,0
PRODUCTVERSION 2,13,1075,0 PRODUCTVERSION 2,13,1076,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -352,13 +352,13 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus" VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.13.1075" VALUE "FileVersion", "2.13.1076"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2017 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
VALUE "OriginalFilename", "rufus.exe" VALUE "OriginalFilename", "rufus.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "2.13.1075" VALUE "ProductVersion", "2.13.1076"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"