mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[ui] display ToGo radio selection according to ISO content
* Also simplify EFI detection and reporting
This commit is contained in:
parent
bca23cc676
commit
3444a48fce
5 changed files with 58 additions and 35 deletions
|
@ -1324,7 +1324,7 @@ DWORD WINAPI FormatThread(void* param)
|
|||
pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32));
|
||||
add_uefi_togo = (fs == FS_NTFS) && (dt == DT_ISO) && (IS_EFI(iso_report)) && (bt == BT_UEFI);
|
||||
add_uefi_togo = (fs == FS_NTFS) && (dt == DT_ISO) && (iso_report.has_efi) && (bt == BT_UEFI);
|
||||
|
||||
PrintInfoDebug(0, MSG_225);
|
||||
hPhysicalDrive = GetPhysicalHandle(DriveIndex, TRUE, TRUE);
|
||||
|
@ -1629,7 +1629,7 @@ DWORD WINAPI FormatThread(void* param)
|
|||
if (IsChecked(IDC_BOOT)) {
|
||||
if (bt == BT_UEFI) {
|
||||
// For once, no need to do anything - just check our sanity
|
||||
if ( (dt != DT_ISO) || (!IS_EFI(iso_report)) || (fs > FS_NTFS) ) {
|
||||
if ( (dt != DT_ISO) || (!iso_report.has_efi) || (fs > FS_NTFS) ) {
|
||||
uprintf("Spock gone crazy error!\n");
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
|
||||
goto out;
|
||||
|
@ -1706,7 +1706,7 @@ DWORD WINAPI FormatThread(void* param)
|
|||
uprintf("Warning: loader installation failed - KolibriOS will not boot!\n");
|
||||
}
|
||||
}
|
||||
if ((bt == BT_UEFI) && (!iso_report.has_efi) && (iso_report.has_win7_efi)) {
|
||||
if ((bt == BT_UEFI) && (!iso_report.has_efi)) {
|
||||
PrintInfoDebug(0, MSG_232);
|
||||
wim_image[0] = drive_name[0];
|
||||
efi_dst[0] = drive_name[0];
|
||||
|
|
18
src/iso.c
18
src/iso.c
|
@ -68,6 +68,8 @@ static const char* grldr_name = "grldr";
|
|||
static const char* ldlinux_name = "ldlinux.sys";
|
||||
static const char* ldlinux_c32 = "ldlinux.c32";
|
||||
static const char* efi_dirname = "/efi/boot";
|
||||
static const char* efi_bootname[] = { "bootia32.efi", "bootx64.efi", "bootia64.efi", "bootarm.efi" };
|
||||
static const char* install_wim_path = "/sources/install.wim";
|
||||
static const char* grub_dirname = "/boot/grub"; // NB: We don't support nonstandard config dir such as AROS' "/boot/pc/grub/"
|
||||
static const char* grub_cfg = "grub.cfg";
|
||||
static const char* syslinux_cfg[] = { "isolinux.cfg", "syslinux.cfg", "extlinux.conf"};
|
||||
|
@ -157,7 +159,6 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons
|
|||
props->is_grub_cfg = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (scan_only) {
|
||||
// Check for a syslinux v5.0+ file anywhere
|
||||
if (safe_stricmp(psz_basename, ldlinux_c32) == 0) {
|
||||
|
@ -176,7 +177,7 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons
|
|||
iso_report.has_kolibrios = TRUE;
|
||||
}
|
||||
if (safe_stricmp(psz_basename, bootmgr_efi_name) == 0) {
|
||||
iso_report.has_win7_efi = TRUE;
|
||||
iso_report.has_efi |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -184,9 +185,16 @@ static BOOL check_iso_props(const char* psz_dirname, int64_t i_file_length, cons
|
|||
if ((iso_report.reactos_path[0] == 0) && (safe_stricmp(psz_basename, reactos_name) == 0))
|
||||
safe_strcpy(iso_report.reactos_path, sizeof(iso_report.reactos_path), psz_fullpath);
|
||||
|
||||
// Check for the EFI boot directory
|
||||
if (safe_stricmp(psz_dirname, efi_dirname) == 0)
|
||||
iso_report.has_efi = TRUE;
|
||||
// Check for the EFI boot entries
|
||||
if (safe_stricmp(psz_dirname, efi_dirname) == 0) {
|
||||
for (i=0; i<ARRAYSIZE(efi_bootname); i++)
|
||||
if (safe_stricmp(psz_basename, efi_bootname[i]) == 0)
|
||||
iso_report.has_efi |= (2<<i);
|
||||
}
|
||||
|
||||
// Check for 'install.wim"
|
||||
if (safe_stricmp(psz_fullpath, install_wim_path) == 0)
|
||||
iso_report.has_install_wim = TRUE;
|
||||
|
||||
// Check for PE (XP) specific files in "/i386" or "/minint"
|
||||
for (i=0; i<ARRAYSIZE(pe_dirname); i++)
|
||||
|
|
43
src/rufus.c
43
src/rufus.c
|
@ -145,6 +145,7 @@ static HICON hIconDisc, hIconDown, hIconUp, hIconLang;
|
|||
static char szTimer[12] = "00:00:00";
|
||||
static unsigned int timer;
|
||||
static int64_t last_iso_blocking_status;
|
||||
static void ToggleToGo(void);
|
||||
|
||||
/*
|
||||
* The following is used to allocate slots within the progress bar
|
||||
|
@ -468,7 +469,7 @@ static void SetFSFromISO(void)
|
|||
|
||||
// Syslinux and EFI have precedence over bootmgr (unless the user selected BIOS as target type)
|
||||
if ((HAS_SYSLINUX(iso_report)) || (IS_REACTOS(iso_report)) || (iso_report.has_kolibrios) ||
|
||||
((IS_EFI(iso_report)) && (bt == BT_UEFI) && (!iso_report.has_4GB_file))) {
|
||||
((iso_report.has_efi) && (bt == BT_UEFI) && (!iso_report.has_4GB_file))) {
|
||||
if (fs_mask & (1<<FS_FAT32)) {
|
||||
selected_fs = FS_FAT32;
|
||||
} else if ((fs_mask & (1<<FS_FAT16)) && (!iso_report.has_kolibrios)) {
|
||||
|
@ -509,6 +510,13 @@ static void SetMBRProps(void)
|
|||
IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, needs_masquerading?1:0));
|
||||
}
|
||||
|
||||
static void SetToGo(void)
|
||||
{
|
||||
int dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
if ( ((dt != DT_ISO) && (togo_mode)) || ((dt == DT_ISO) && (HAS_TOGO(iso_report)) && (!togo_mode)) )
|
||||
ToggleToGo();
|
||||
}
|
||||
|
||||
static void EnableAdvancedBootOptions(BOOL enable, BOOL remove_checkboxes)
|
||||
{
|
||||
int bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
|
@ -546,6 +554,8 @@ static void EnableBootOptions(BOOL enable, BOOL remove_checkboxes)
|
|||
EnableWindow(hBoot, actual_enable);
|
||||
EnableWindow(hBootType, actual_enable);
|
||||
EnableWindow(hSelectISO, actual_enable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_WINDOWS_INSTALL), actual_enable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO), actual_enable);
|
||||
EnableAdvancedBootOptions(actual_enable, remove_checkboxes);
|
||||
}
|
||||
|
||||
|
@ -570,7 +580,7 @@ static void SetTargetSystem(void)
|
|||
|
||||
if (SelectedDrive.PartitionType == PARTITION_STYLE_GPT) {
|
||||
ts = 2; // GPT/UEFI
|
||||
} else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker || (IS_EFI(iso_report) &&
|
||||
} else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker || ((iso_report.has_efi) &&
|
||||
(!HAS_SYSLINUX(iso_report)) && (!iso_report.has_bootmgr) && (!IS_REACTOS(iso_report)) &&
|
||||
(!iso_report.has_kolibrios) && (!IS_GRUB(iso_report)) && (!IS_WINPE(iso_report.winpe))) ) {
|
||||
ts = 1; // MBR/UEFI
|
||||
|
@ -783,6 +793,8 @@ static void EnableControls(BOOL bEnable)
|
|||
EnableWindow(GetDlgItem(hMainDialog, IDC_LABEL), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_QUICKFORMAT), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_SET_ICON), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_WINDOWS_INSTALL), bEnable);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO), bEnable);
|
||||
}
|
||||
|
||||
/* Callback for the log window */
|
||||
|
@ -907,7 +919,8 @@ static void DisplayISOProps(void)
|
|||
uprintf(" Has Symlinks: %s", YesNo(iso_report.has_symlinks));
|
||||
uprintf(" Has a >4GB file: %s", YesNo(iso_report.has_4GB_file));
|
||||
uprintf(" Uses Bootmgr: %s", YesNo(iso_report.has_bootmgr));
|
||||
uprintf(" Uses EFI: %s%s", YesNo(iso_report.has_efi || iso_report.has_win7_efi), (iso_report.has_win7_efi && (!iso_report.has_efi)) ? " (win7_x64)" : "");
|
||||
// TODO: report x86, x64, Arm, Itanic?
|
||||
uprintf(" Uses EFI: %s%s", YesNo(iso_report.has_efi), IS_WIN7_EFI(iso_report) ? " (win7_x64)" : "");
|
||||
uprintf(" Uses Grub 2: %s", YesNo(iso_report.has_grub2));
|
||||
uprintf(" Uses Grub4DOS: %s", YesNo(iso_report.has_grub4dos));
|
||||
uprintf(" Uses isolinux: %s", isolinux_str);
|
||||
|
@ -919,6 +932,9 @@ static void DisplayISOProps(void)
|
|||
uprintf(" Uses KolibriOS: %s", YesNo(iso_report.has_kolibrios));
|
||||
uprintf(" Uses ReactOS: %s", YesNo(IS_REACTOS(iso_report)));
|
||||
uprintf(" Uses WinPE: %s%s", YesNo(IS_WINPE(iso_report.winpe)), (iso_report.uses_minint) ? " (with /minint)" : "");
|
||||
|
||||
if ( ((!togo_mode) && (HAS_TOGO(iso_report))) || ((togo_mode) && (!HAS_TOGO(iso_report))) )
|
||||
ToggleToGo();
|
||||
}
|
||||
|
||||
// The scanning process can be blocking for message processing => use a thread
|
||||
|
@ -979,6 +995,9 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
|||
SendMessage(hMainDialog, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hMainDialog, IDC_START), TRUE);
|
||||
}
|
||||
|
||||
// Need to invalidate as we may have changed the UI and may get artifacts if we don't
|
||||
InvalidateRect(hMainDialog, NULL, TRUE);
|
||||
|
||||
out:
|
||||
PrintInfo(0, MSG_210);
|
||||
ExitThread(0);
|
||||
|
@ -1053,8 +1072,6 @@ static void ToggleAdvanced(void)
|
|||
|
||||
// Toggle the up/down icon
|
||||
SendMessage(GetDlgItem(hMainDialog, IDC_ADVANCED), BCM_SETIMAGELIST, 0, (LPARAM)(advanced_mode?&bi_up:&bi_down));
|
||||
|
||||
InvalidateRect(hMainDialog, NULL, TRUE);
|
||||
}
|
||||
|
||||
// Toggle DD Image mode
|
||||
|
@ -1132,9 +1149,6 @@ static void ToggleToGo(void)
|
|||
// Reset the radio button choice
|
||||
Button_SetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_INSTALL), BST_CHECKED);
|
||||
Button_SetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO), BST_UNCHECKED);
|
||||
|
||||
// Need to invalidate, else we may get artifacts
|
||||
InvalidateRect(hMainDialog, NULL, TRUE);
|
||||
}
|
||||
|
||||
static BOOL BootCheck(void)
|
||||
|
@ -1173,12 +1187,12 @@ static BOOL BootCheck(void)
|
|||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
if (bt == BT_UEFI) {
|
||||
if (!IS_EFI(iso_report)) {
|
||||
if (!iso_report.has_efi) {
|
||||
// Unsupported ISO
|
||||
MessageBoxU(hMainDialog, lmprintf(MSG_091), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL);
|
||||
return FALSE;
|
||||
}
|
||||
if ((iso_report.has_win7_efi) && (!WimExtractCheck())) {
|
||||
if (IS_WIN7_EFI(iso_report) && (!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|MB_IS_RTL) == IDYES)
|
||||
ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL);
|
||||
|
@ -1721,6 +1735,8 @@ void SetBoot(int fs, int bt)
|
|||
EnableWindow(hBoot, TRUE);
|
||||
EnableWindow(hBootType, TRUE);
|
||||
EnableWindow(hSelectISO, TRUE);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_WINDOWS_INSTALL), TRUE);
|
||||
EnableWindow(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO), TRUE);
|
||||
CheckDlgButton(hMainDialog, IDC_BOOT, uBootChecked);
|
||||
}
|
||||
}
|
||||
|
@ -1943,9 +1959,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
ShowWindow(hLogDlg, log_displayed?SW_SHOW:SW_HIDE);
|
||||
break;
|
||||
#ifdef RUFUS_TEST
|
||||
case IDC_TEST:
|
||||
ToggleToGo();
|
||||
#if 0
|
||||
if (format_thid != NULL) {
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
|
@ -1993,7 +2006,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
}
|
||||
if (format_thid == NULL)
|
||||
format_op_in_progress = FALSE;
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
case IDC_LANG:
|
||||
|
@ -2037,6 +2049,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
ToggleImage(FALSE);
|
||||
EnableAdvancedBootOptions(FALSE, TRUE);
|
||||
SetBoot(fs, bt);
|
||||
SetToGo();
|
||||
break;
|
||||
}
|
||||
SetClusterSizes(fs);
|
||||
|
@ -2081,6 +2094,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
EnableAdvancedBootOptions(TRUE, TRUE);
|
||||
SetBoot(fs, bt);
|
||||
SetMBRProps();
|
||||
SetToGo();
|
||||
break;
|
||||
case IDC_BOOT:
|
||||
EnableAdvancedBootOptions(TRUE, TRUE);
|
||||
|
@ -2093,6 +2107,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
|||
selection_default = (int) ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
EnableAdvancedBootOptions(TRUE, TRUE);
|
||||
ToggleImage(!IsChecked(IDC_BOOT) || (selection_default != DT_IMG));
|
||||
SetToGo();
|
||||
if ((selection_default == DT_ISO) || (selection_default == DT_IMG)) {
|
||||
if ((image_path == NULL) || (iso_report.label[0] == 0)) {
|
||||
// Set focus to the Select ISO button
|
||||
|
|
|
@ -229,8 +229,9 @@ typedef struct {
|
|||
#define WINPE_MININT 0x2A
|
||||
#define WINPE_I386 0x15
|
||||
#define HAS_SYSLINUX(r) (r.sl_version != 0)
|
||||
#define HAS_TOGO(r) (r.has_bootmgr && r.has_efi && r.has_install_wim)
|
||||
#define IS_WINPE(r) (((r & WINPE_MININT) == WINPE_MININT)||(( r & WINPE_I386) == WINPE_I386))
|
||||
#define IS_EFI(r) ((r.has_efi) || (r.has_win7_efi))
|
||||
#define IS_WIN7_EFI(r) (r.has_efi & 1)
|
||||
#define IS_REACTOS(r) (r.reactos_path[0] != 0)
|
||||
#define IS_GRUB(r) ((r.has_grub2) || (r.has_grub4dos))
|
||||
|
||||
|
@ -241,14 +242,13 @@ typedef struct {
|
|||
char reactos_path[128]; /* path to the ISO's freeldr.sys or setupldr.sys */
|
||||
uint64_t projected_size;
|
||||
uint64_t src_size;
|
||||
// TODO: use a bitmask and #define tests for the following
|
||||
uint8_t winpe;
|
||||
uint8_t has_efi;
|
||||
BOOL has_4GB_file;
|
||||
BOOL has_long_filename;
|
||||
BOOL has_symlinks;
|
||||
BOOL has_bootmgr;
|
||||
BOOL has_efi;
|
||||
BOOL has_win7_efi;
|
||||
BOOL has_install_wim;
|
||||
BOOL has_autorun;
|
||||
BOOL has_old_c32[NB_OLD_C32];
|
||||
BOOL has_old_vesamenu;
|
||||
|
|
16
src/rufus.rc
16
src/rufus.rc
|
@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
|||
|
||||
IDD_DIALOG DIALOGEX 12, 12, 242, 376
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Rufus 2.0.0.571"
|
||||
CAPTION "Rufus 2.0.0.572"
|
||||
FONT 8, "Segoe UI", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
|
||||
|
@ -157,7 +157,7 @@ END
|
|||
|
||||
IDD_DIALOG_XP DIALOGEX 12, 12, 242, 376
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Rufus 2.0.0.571"
|
||||
CAPTION "Rufus 2.0.0.572"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
|
||||
|
@ -283,7 +283,7 @@ END
|
|||
IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 376
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
|
||||
CAPTION "Rufus 2.0.0.571"
|
||||
CAPTION "Rufus 2.0.0.572"
|
||||
FONT 8, "Segoe UI", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
|
||||
|
@ -415,7 +415,7 @@ END
|
|||
IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 376
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
|
||||
CAPTION "Rufus 2.0.0.571"
|
||||
CAPTION "Rufus 2.0.0.572"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Start",IDC_START,127,339,50,14
|
||||
|
@ -669,8 +669,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,0,0,571
|
||||
PRODUCTVERSION 2,0,0,571
|
||||
FILEVERSION 2,0,0,572
|
||||
PRODUCTVERSION 2,0,0,572
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -687,13 +687,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "2.0.0.571"
|
||||
VALUE "FileVersion", "2.0.0.572"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2015 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "2.0.0.571"
|
||||
VALUE "ProductVersion", "2.0.0.572"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
Loading…
Reference in a new issue