mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[core] remove 'MBR for BIOS' option for pure UEFI images
* Closes #832 * Also refactor image property macros
This commit is contained in:
parent
7d302d340f
commit
104b33a7ba
6 changed files with 80 additions and 69 deletions
28
src/format.c
28
src/format.c
|
@ -916,7 +916,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
|
||||
// What follows is really a case statement with complex conditions listed
|
||||
// by order of preference
|
||||
if (IS_WINDOWS(img_report) && (allow_dual_uefi_bios) && (tt == TT_BIOS))
|
||||
if (HAS_WINDOWS(img_report) && (allow_dual_uefi_bios) && (tt == TT_BIOS))
|
||||
goto windows_mbr;
|
||||
|
||||
// Forced UEFI (by zeroing the MBR)
|
||||
|
@ -956,7 +956,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
}
|
||||
|
||||
// KolibriOS
|
||||
if ( (bt == BT_ISO) && (img_report.has_kolibrios) && (IS_FAT(fs))) {
|
||||
if ( (bt == BT_ISO) && HAS_KOLIBRIOS(img_report) && (IS_FAT(fs))) {
|
||||
uprintf(using_msg, "KolibriOS");
|
||||
r = write_kolibrios_mbr(fp);
|
||||
goto notify;
|
||||
|
@ -964,7 +964,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
|||
|
||||
// If everything else failed, fall back to a conventional Windows/Rufus MBR
|
||||
windows_mbr:
|
||||
if ((IS_WINPE(img_report.winpe) && !img_report.uses_minint) || (IsChecked(IDC_RUFUS_MBR))) {
|
||||
if ((HAS_WINPE(img_report) && !img_report.uses_minint) || (IsChecked(IDC_RUFUS_MBR))) {
|
||||
uprintf(using_msg, APPLICATION_NAME);
|
||||
r = write_rufus_mbr(fp);
|
||||
} else {
|
||||
|
@ -1056,7 +1056,7 @@ static __inline const char* bt_to_name(int bt) {
|
|||
case BT_FREEDOS: return "FreeDOS";
|
||||
case BT_REACTOS: return "ReactOS";
|
||||
default:
|
||||
return ((bt==BT_ISO)&&(img_report.has_kolibrios))?"KolibriOS":"Standard";
|
||||
return ((bt==BT_ISO) && HAS_KOLIBRIOS(img_report)) ? "KolibriOS" : "Standard";
|
||||
}
|
||||
}
|
||||
static BOOL WritePBR(HANDLE hLogicalVolume)
|
||||
|
@ -1082,7 +1082,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
|
|||
if (!write_fat_16_fd_br(fp, 0)) break;
|
||||
} else if (bt == BT_REACTOS) {
|
||||
if (!write_fat_16_ros_br(fp, 0)) break;
|
||||
} else if ((bt == BT_ISO) && (img_report.has_kolibrios)) {
|
||||
} else if ((bt == BT_ISO) && HAS_KOLIBRIOS(img_report)) {
|
||||
uprintf("FAT16 is not supported for KolibriOS\n"); break;
|
||||
} else {
|
||||
if (!write_fat_16_br(fp, 0)) break;
|
||||
|
@ -1104,7 +1104,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
|
|||
if (!write_fat_32_fd_br(fp, 0)) break;
|
||||
} else if (bt == BT_REACTOS) {
|
||||
if (!write_fat_32_ros_br(fp, 0)) break;
|
||||
} else if ((bt == BT_ISO) && (img_report.has_kolibrios)) {
|
||||
} else if ((bt == BT_ISO) && HAS_KOLIBRIOS(img_report)) {
|
||||
if (!write_fat_32_kos_br(fp, 0)) break;
|
||||
} else {
|
||||
if (!write_fat_32_br(fp, 0)) break;
|
||||
|
@ -1598,7 +1598,7 @@ DWORD WINAPI FormatThread(void* param)
|
|||
pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32));
|
||||
windows_to_go = (togo_mode) && HAS_TOGO(img_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED);
|
||||
windows_to_go = (togo_mode) && HAS_WINTOGO(img_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED);
|
||||
large_drive = (SelectedDrive.DiskSize > (1*TB));
|
||||
if (large_drive)
|
||||
uprintf("Notice: Large drive detected (may produce short writes)");
|
||||
|
@ -1608,7 +1608,7 @@ DWORD WINAPI FormatThread(void* param)
|
|||
// http://msdn.microsoft.com/en-us/library/windows/hardware/dn640535.aspx#gpt_faq_what_disk_require_msr
|
||||
extra_partitions = XP_MSR | XP_EFI;
|
||||
else if ( (fs == FS_NTFS) && ((bt == BT_UEFI_NTFS) ||
|
||||
((bt == BT_ISO) && (img_report.has_efi) && ((tt == TT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) )
|
||||
((bt == BT_ISO) && IS_EFI_BOOTABLE(img_report) && ((tt == TT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) )
|
||||
extra_partitions = XP_UEFI_NTFS;
|
||||
else if (IsChecked(IDC_EXTRA_PARTITION))
|
||||
extra_partitions = XP_COMPAT;
|
||||
|
@ -1883,14 +1883,14 @@ DWORD WINAPI FormatThread(void* param)
|
|||
// All good
|
||||
} else if (tt == TT_UEFI) {
|
||||
// For once, no need to do anything - just check our sanity
|
||||
if ( (bt != BT_ISO) || (!img_report.has_efi) || (fs > FS_NTFS) ) {
|
||||
if ( (bt != BT_ISO) || !IS_EFI_BOOTABLE(img_report) || (fs > FS_NTFS) ) {
|
||||
uprintf("Spock gone crazy error in %s:%d", __FILE__, __LINE__);
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
} else if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) ||
|
||||
((bt == BT_ISO) && (HAS_SYSLINUX(img_report) || IS_REACTOS(img_report)) &&
|
||||
(!IS_WINDOWS(img_report) || !allow_dual_uefi_bios) && (IS_FAT(fs))) ) {
|
||||
((bt == BT_ISO) && (HAS_SYSLINUX(img_report) || HAS_REACTOS(img_report)) &&
|
||||
(!HAS_WINDOWS(img_report) || !allow_dual_uefi_bios) && (IS_FAT(fs))) ) {
|
||||
if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) {
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
|
||||
}
|
||||
|
@ -1960,7 +1960,7 @@ DWORD WINAPI FormatThread(void* param)
|
|||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_ISO_EXTRACT);
|
||||
goto out;
|
||||
}
|
||||
if (img_report.has_kolibrios) {
|
||||
if (HAS_KOLIBRIOS(img_report)) {
|
||||
kolibri_dst[0] = drive_name[0];
|
||||
uprintf("Installing: %s (KolibriOS loader)\n", kolibri_dst);
|
||||
if (ExtractISOFile(image_path, "HD_Load/USB_Boot/MTLD_F32", kolibri_dst,
|
||||
|
@ -1969,7 +1969,7 @@ DWORD WINAPI FormatThread(void* param)
|
|||
}
|
||||
}
|
||||
// EFI mode selected, with no 'boot###.efi' but Windows 7 x64's 'bootmgr.efi' (bit #0)
|
||||
if ((tt == TT_UEFI) && IS_WIN7_EFI(img_report)) {
|
||||
if ((tt == TT_UEFI) && HAS_WIN7_EFI(img_report)) {
|
||||
PrintInfoDebug(0, MSG_232);
|
||||
img_report.install_wim_path[0] = drive_name[0];
|
||||
efi_dst[0] = drive_name[0];
|
||||
|
@ -1985,7 +1985,7 @@ DWORD WINAPI FormatThread(void* param)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( (tt == TT_BIOS) && (IS_WINPE(img_report.winpe)) ) {
|
||||
if ( (tt == TT_BIOS) && HAS_WINPE(img_report) ) {
|
||||
// Apply WinPe fixup
|
||||
if (!SetupWinPE(drive_name[0]))
|
||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH);
|
||||
|
|
|
@ -835,7 +835,7 @@ out:
|
|||
img_report.sl_version_str);
|
||||
}
|
||||
}
|
||||
if (IS_WINPE(img_report.winpe)) {
|
||||
if (HAS_WINPE(img_report)) {
|
||||
// In case we have a WinPE 1.x based iso, we extract and parse txtsetup.sif
|
||||
// during scan, to see if /minint was provided for OsLoadOptions, as it decides
|
||||
// whether we should use 0x80 or 0x81 as the disk ID in the MBR
|
||||
|
|
90
src/rufus.c
90
src/rufus.c
|
@ -363,25 +363,36 @@ static BOOL SetClusterSizes(int FSType)
|
|||
|
||||
// This call sets the first option for the "partition type and target system" field
|
||||
// according to whether we will be running in UEFI/CSM mode or standard UEFI
|
||||
static void SetMBRForUEFI(BOOL replace)
|
||||
// Return value is -1 if the image is pure EFI (non BIOS bootable), 0 otherwise.
|
||||
static int SetMBRForUEFI(BOOL replace)
|
||||
{
|
||||
static BOOL pure_efi = FALSE;
|
||||
BOOL useCSM = FALSE;
|
||||
|
||||
if (ComboBox_GetCurSel(hDeviceList) < 0)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
if (image_path != NULL) {
|
||||
if ( (!img_report.has_efi) || ((img_report.has_bootmgr) && (!allow_dual_uefi_bios) &&
|
||||
if ( !IS_EFI_BOOTABLE(img_report) || (HAS_BOOTMGR(img_report) && (!allow_dual_uefi_bios) &&
|
||||
(Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) != BST_CHECKED)) )
|
||||
useCSM = TRUE;
|
||||
}
|
||||
|
||||
if (replace)
|
||||
if (replace && !pure_efi)
|
||||
ComboBox_DeleteString(hPartitionScheme, 0);
|
||||
|
||||
if ((image_path != NULL) && IS_EFI_BOOTABLE(img_report) && !IS_BIOS_BOOTABLE(img_report)) {
|
||||
pure_efi = TRUE;
|
||||
return -1;
|
||||
} else {
|
||||
pure_efi = FALSE;
|
||||
}
|
||||
|
||||
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));
|
||||
if (replace)
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hPartitionScheme, max(ComboBox_GetCurSel(hPartitionScheme), 0)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -457,7 +468,7 @@ static void SetFSFromISO(void)
|
|||
int i, fs, selected_fs = FS_UNKNOWN;
|
||||
uint32_t fs_mask = 0;
|
||||
int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
BOOL windows_to_go = (togo_mode) && HAS_TOGO(img_report) &&
|
||||
BOOL windows_to_go = (togo_mode) && HAS_WINTOGO(img_report) &&
|
||||
(Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED);
|
||||
|
||||
if (image_path == NULL)
|
||||
|
@ -470,14 +481,14 @@ static void SetFSFromISO(void)
|
|||
}
|
||||
|
||||
// Syslinux and EFI have precedence over bootmgr (unless the user selected BIOS as target type)
|
||||
if ((HAS_SYSLINUX(img_report)) || (IS_REACTOS(img_report)) || (img_report.has_kolibrios) ||
|
||||
((img_report.has_efi) && (tt == TT_UEFI) && (!img_report.has_4GB_file) && (!windows_to_go))) {
|
||||
if ((HAS_SYSLINUX(img_report)) || (HAS_REACTOS(img_report)) || HAS_KOLIBRIOS(img_report) ||
|
||||
(IS_EFI_BOOTABLE(img_report) && (tt == TT_UEFI) && (!img_report.has_4GB_file) && (!windows_to_go))) {
|
||||
if (fs_mask & (1<<FS_FAT32)) {
|
||||
selected_fs = FS_FAT32;
|
||||
} else if ((fs_mask & (1<<FS_FAT16)) && (!img_report.has_kolibrios)) {
|
||||
} else if ((fs_mask & (1<<FS_FAT16)) && !HAS_KOLIBRIOS(img_report)) {
|
||||
selected_fs = FS_FAT16;
|
||||
}
|
||||
} else if ((windows_to_go) || (img_report.has_bootmgr) || (IS_WINPE(img_report.winpe))) {
|
||||
} else if ((windows_to_go) || HAS_BOOTMGR(img_report) || HAS_WINPE(img_report)) {
|
||||
if (fs_mask & (1<<FS_NTFS)) {
|
||||
selected_fs = FS_NTFS;
|
||||
}
|
||||
|
@ -498,16 +509,16 @@ static void SetMBRProps(void)
|
|||
{
|
||||
int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
BOOL needs_masquerading = (IS_WINPE(img_report.winpe) && (!img_report.uses_minint));
|
||||
BOOL needs_masquerading = HAS_WINPE(img_report) && (!img_report.uses_minint);
|
||||
|
||||
if ((!mbr_selected_by_user) && ((image_path == NULL) || (bt != BT_ISO) || (fs != FS_NTFS) || IS_GRUB(img_report) ||
|
||||
if ((!mbr_selected_by_user) && ((image_path == NULL) || (bt != BT_ISO) || (fs != FS_NTFS) || HAS_GRUB(img_report) ||
|
||||
((togo_mode) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED)) )) {
|
||||
CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, BST_UNCHECKED);
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
uMBRChecked = (needs_masquerading || img_report.has_bootmgr || mbr_selected_by_user)?BST_CHECKED:BST_UNCHECKED;
|
||||
uMBRChecked = (needs_masquerading || HAS_BOOTMGR(img_report) || mbr_selected_by_user)?BST_CHECKED:BST_UNCHECKED;
|
||||
if (IsWindowEnabled(GetDlgItem(hMainDialog, IDC_RUFUS_MBR)))
|
||||
CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, uMBRChecked);
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, needs_masquerading?1:0));
|
||||
|
@ -516,7 +527,7 @@ static void SetMBRProps(void)
|
|||
static void SetToGo(void)
|
||||
{
|
||||
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||
if ( ((bt != BT_ISO) && (togo_mode)) || ((bt == BT_ISO) && (HAS_TOGO(img_report)) && (!togo_mode)) )
|
||||
if ( ((bt != BT_ISO) && (togo_mode)) || ((bt == BT_ISO) && (HAS_WINTOGO(img_report)) && (!togo_mode)) )
|
||||
ToggleToGo();
|
||||
}
|
||||
|
||||
|
@ -527,7 +538,7 @@ static void EnableAdvancedBootOptions(BOOL enable, BOOL remove_checkboxes)
|
|||
BOOL actual_enable_fix = ((tt==TT_UEFI)||(selection_default==BT_IMG)||!IsChecked(IDC_BOOT))?FALSE:enable;
|
||||
static UINT uXPartChecked = BST_UNCHECKED;
|
||||
|
||||
if ((selection_default == BT_ISO) && (img_report.has_kolibrios || IS_GRUB(img_report) || IS_REACTOS(img_report) || HAS_SYSLINUX(img_report))) {
|
||||
if ((selection_default == BT_ISO) && IS_BIOS_BOOTABLE(img_report) && !HAS_WINPE(img_report) && !HAS_BOOTMGR(img_report)) {
|
||||
actual_enable_mbr = FALSE;
|
||||
mbr_selected_by_user = FALSE;
|
||||
}
|
||||
|
@ -579,17 +590,14 @@ static void SetPartitionSchemeTooltip(void)
|
|||
|
||||
static void SetTargetSystem(void)
|
||||
{
|
||||
int ts;
|
||||
|
||||
SetMBRForUEFI(TRUE);
|
||||
int ts = SetMBRForUEFI(TRUE); // Will be set to -1 for pure UEFI, 0 otherwise
|
||||
if (SelectedDrive.PartitionType == PARTITION_STYLE_GPT) {
|
||||
ts = 2; // GPT/UEFI
|
||||
} else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker || ((img_report.has_efi) &&
|
||||
(!HAS_SYSLINUX(img_report)) && (!img_report.has_bootmgr) && (!IS_REACTOS(img_report)) &&
|
||||
(!img_report.has_kolibrios) && (!IS_GRUB(img_report)) && (!IS_WINPE(img_report.winpe))) ) {
|
||||
ts = 1; // MBR/UEFI
|
||||
ts += 2; // GPT/UEFI
|
||||
} else if (SelectedDrive.has_protective_mbr || SelectedDrive.has_mbr_uefi_marker ||
|
||||
(IS_EFI_BOOTABLE(img_report) && !IS_BIOS_BOOTABLE(img_report)) ) {
|
||||
ts += 1; // MBR/UEFI
|
||||
} else {
|
||||
ts = 0; // MBR/BIOS|UEFI
|
||||
ts += 0; // MBR/BIOS|UEFI
|
||||
}
|
||||
IGNORE_RETVAL(ComboBox_SetCurSel(hPartitionScheme, ts));
|
||||
// Can't call SetPartitionSchemeTooltip() directly, as we may be on a different thread
|
||||
|
@ -969,13 +977,13 @@ static void DisplayISOProps(void)
|
|||
PRINT_ISO_PROP(img_report.has_old_c32[i], " With an old %s", old_c32_name[i]);
|
||||
}
|
||||
}
|
||||
PRINT_ISO_PROP(img_report.has_kolibrios, " Uses: KolibriOS");
|
||||
PRINT_ISO_PROP(IS_REACTOS(img_report), " Uses: ReactOS");
|
||||
PRINT_ISO_PROP(HAS_KOLIBRIOS(img_report), " Uses: KolibriOS");
|
||||
PRINT_ISO_PROP(HAS_REACTOS(img_report), " Uses: ReactOS");
|
||||
PRINT_ISO_PROP(img_report.has_grub4dos, " Uses: Grub4DOS");
|
||||
PRINT_ISO_PROP(img_report.has_grub2, " Uses: GRUB2");
|
||||
PRINT_ISO_PROP(img_report.has_efi, " Uses: EFI %s", IS_WIN7_EFI(img_report) ? "(win7_x64)" : "");
|
||||
PRINT_ISO_PROP(img_report.has_bootmgr, " Uses: Bootmgr");
|
||||
PRINT_ISO_PROP(IS_WINPE(img_report.winpe), " Uses: WinPE %s", (img_report.uses_minint) ? "(with /minint)" : "");
|
||||
PRINT_ISO_PROP(img_report.has_efi, " Uses: EFI %s", HAS_WIN7_EFI(img_report) ? "(win7_x64)" : "");
|
||||
PRINT_ISO_PROP(HAS_BOOTMGR(img_report), " Uses: Bootmgr");
|
||||
PRINT_ISO_PROP(HAS_WINPE(img_report), " Uses: WinPE %s", (img_report.uses_minint) ? "(with /minint)" : "");
|
||||
if (HAS_INSTALL_WIM(img_report)) {
|
||||
uprintf(" Uses: Install.wim (version %d.%d.%d)", (img_report.install_wim_version >> 24) & 0xff,
|
||||
(img_report.install_wim_version >> 16) & 0xff, (img_report.install_wim_version >> 8) & 0xff);
|
||||
|
@ -989,7 +997,7 @@ static void DisplayISOProps(void)
|
|||
|
||||
// We don't support ToGo on Windows 7 or earlier, for lack of native ISO mounting capabilities
|
||||
if (nWindowsVersion >= WINDOWS_8)
|
||||
if ( ((!togo_mode) && (HAS_TOGO(img_report))) || ((togo_mode) && (!HAS_TOGO(img_report))) )
|
||||
if ( ((!togo_mode) && (HAS_WINTOGO(img_report))) || ((togo_mode) && (!HAS_WINTOGO(img_report))) )
|
||||
ToggleToGo();
|
||||
}
|
||||
|
||||
|
@ -1026,8 +1034,7 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
|||
if (img_report.is_iso) {
|
||||
DisplayISOProps();
|
||||
// If we have an ISOHybrid, but without an ISO method we support, disable ISO support altogether
|
||||
if ((img_report.is_bootable_img) && (!img_report.has_bootmgr) && (!HAS_SYSLINUX(img_report)) && (!IS_WINPE(img_report.winpe))
|
||||
&& (!IS_GRUB(img_report)) && (!img_report.has_efi) && (!IS_REACTOS(img_report)) && (!img_report.has_kolibrios)) {
|
||||
if (IS_DD_BOOTABLE(img_report) && !IS_BIOS_BOOTABLE(img_report) && !IS_EFI_BOOTABLE(img_report)) {
|
||||
uprintf("This ISOHybrid is not compatible with any of the ISO boot methods we support");
|
||||
img_report.is_iso = FALSE;
|
||||
} else {
|
||||
|
@ -1037,8 +1044,7 @@ DWORD WINAPI ISOScanThread(LPVOID param)
|
|||
}
|
||||
// Only enable AFTER we have determined the image type
|
||||
EnableControls(TRUE);
|
||||
if ( (!img_report.has_bootmgr) && (!HAS_SYSLINUX(img_report)) && (!IS_WINPE(img_report.winpe)) && (!IS_GRUB(img_report))
|
||||
&& (!img_report.has_efi) && (!IS_REACTOS(img_report)) && (!img_report.has_kolibrios) && (!img_report.is_bootable_img) ) {
|
||||
if (!IS_DD_BOOTABLE(img_report) && !IS_BIOS_BOOTABLE(img_report) && !IS_EFI_BOOTABLE(img_report)) {
|
||||
// No boot method that we support
|
||||
PrintInfo(0, MSG_081);
|
||||
safe_free(image_path);
|
||||
|
@ -1274,10 +1280,10 @@ static BOOL BootCheck(void)
|
|||
return FALSE;
|
||||
}
|
||||
if (bt == BT_IMG) {
|
||||
if (!img_report.is_bootable_img)
|
||||
if (!IS_DD_BOOTABLE(img_report))
|
||||
// The selected image doesn't match the boot option selected.
|
||||
MessageBoxExU(hMainDialog, lmprintf(MSG_188), lmprintf(MSG_187), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
|
||||
return (img_report.is_bootable_img);
|
||||
return IS_DD_BOOTABLE(img_report);
|
||||
}
|
||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||
tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||
|
@ -1299,25 +1305,25 @@ static BOOL BootCheck(void)
|
|||
return FALSE;
|
||||
}
|
||||
} else if (tt == TT_UEFI) {
|
||||
if (!img_report.has_efi) {
|
||||
if (!IS_EFI_BOOTABLE(img_report)) {
|
||||
// Unsupported ISO
|
||||
MessageBoxExU(hMainDialog, lmprintf(MSG_091), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
|
||||
return FALSE;
|
||||
}
|
||||
if (IS_WIN7_EFI(img_report) && (!WimExtractCheck())) {
|
||||
if (HAS_WIN7_EFI(img_report) && (!WimExtractCheck())) {
|
||||
// Your platform cannot extract files from WIM archives => download 7-zip?
|
||||
if (MessageBoxExU(hMainDialog, lmprintf(MSG_102), lmprintf(MSG_101), MB_YESNO|MB_ICONERROR|MB_IS_RTL, selected_langid) == IDYES)
|
||||
ShellExecuteA(hMainDialog, "open", SEVENZIP_URL, NULL, NULL, SW_SHOWNORMAL);
|
||||
return FALSE;
|
||||
}
|
||||
} else if ( ((fs == FS_NTFS) && (!IS_WINDOWS(img_report)) && (!IS_GRUB(img_report)))
|
||||
|| ((IS_FAT(fs)) && (!HAS_SYSLINUX(img_report)) && (!allow_dual_uefi_bios) && (!img_report.has_efi) &&
|
||||
(!IS_REACTOS(img_report)) && (!img_report.has_kolibrios) && (!IS_GRUB(img_report)))
|
||||
|| ((IS_FAT(fs)) && (IS_WINDOWS(img_report) || HAS_INSTALL_WIM(img_report))) ) {
|
||||
} else if ( ((fs == FS_NTFS) && (!HAS_WINDOWS(img_report)) && (!HAS_GRUB(img_report)))
|
||||
|| ((IS_FAT(fs)) && (!HAS_SYSLINUX(img_report)) && (!allow_dual_uefi_bios) && !IS_EFI_BOOTABLE(img_report) &&
|
||||
(!HAS_REACTOS(img_report)) && !HAS_KOLIBRIOS(img_report) && (!HAS_GRUB(img_report)))
|
||||
|| ((IS_FAT(fs)) && (HAS_WINDOWS(img_report) || HAS_INSTALL_WIM(img_report))) ) {
|
||||
// Incompatible FS and ISO
|
||||
MessageBoxExU(hMainDialog, lmprintf(MSG_096), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
|
||||
return FALSE;
|
||||
} else if ((fs == FS_FAT16) && (img_report.has_kolibrios)) {
|
||||
} else if ((fs == FS_FAT16) && HAS_KOLIBRIOS(img_report)) {
|
||||
// KolibriOS doesn't support FAT16
|
||||
MessageBoxExU(hMainDialog, lmprintf(MSG_189), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
|
||||
return FALSE;
|
||||
|
|
17
src/rufus.h
17
src/rufus.h
|
@ -249,14 +249,19 @@ enum checksum_type {
|
|||
#define WINPE_MININT 0x2A
|
||||
#define WINPE_I386 0x15
|
||||
#define MAX_WIM_VERSION 0x000E0000
|
||||
#define HAS_KOLIBRIOS(r) (r.has_kolibrios)
|
||||
#define HAS_REACTOS(r) (r.reactos_path[0] != 0)
|
||||
#define HAS_GRUB(r) ((r.has_grub2) || (r.has_grub4dos))
|
||||
#define HAS_SYSLINUX(r) (r.sl_version != 0)
|
||||
#define HAS_BOOTMGR(r) (r.has_bootmgr)
|
||||
#define HAS_INSTALL_WIM(r) (r.install_wim_path[0] != 0)
|
||||
#define HAS_TOGO(r) (r.has_bootmgr && r.has_efi && HAS_INSTALL_WIM(r) && (r.install_wim_version < MAX_WIM_VERSION))
|
||||
#define IS_WINPE(r) (((r & WINPE_MININT) == WINPE_MININT)||(( r & WINPE_I386) == WINPE_I386))
|
||||
#define IS_WINDOWS(r) ((r.has_bootmgr) || (r.uses_minint) || IS_WINPE(r.winpe))
|
||||
#define IS_WIN7_EFI(r) ((r.has_efi == 1) && HAS_INSTALL_WIM(r))
|
||||
#define IS_REACTOS(r) (r.reactos_path[0] != 0)
|
||||
#define IS_GRUB(r) ((r.has_grub2) || (r.has_grub4dos))
|
||||
#define HAS_WINPE(r) (((r.winpe & WINPE_MININT) == WINPE_MININT)||((r.winpe & WINPE_I386) == WINPE_I386))
|
||||
#define HAS_WINDOWS(r) (HAS_BOOTMGR(r) || (r.uses_minint) || HAS_WINPE(r))
|
||||
#define HAS_WIN7_EFI(r) ((r.has_efi == 1) && HAS_INSTALL_WIM(r))
|
||||
#define IS_DD_BOOTABLE(r) (r.is_bootable_img)
|
||||
#define IS_EFI_BOOTABLE(r) (r.has_efi)
|
||||
#define IS_BIOS_BOOTABLE(r) (HAS_BOOTMGR(r) || HAS_SYSLINUX(r) || HAS_WINPE(r) || HAS_GRUB(r) || HAS_REACTOS(r) || HAS_KOLIBRIOS(r))
|
||||
#define HAS_WINTOGO(r) (HAS_BOOTMGR(r) && IS_EFI_BOOTABLE(r) && HAS_INSTALL_WIM(r) && (r.install_wim_version < MAX_WIM_VERSION))
|
||||
#define IS_FAT(fs) ((fs == FS_FAT16) || (fs == FS_FAT32))
|
||||
|
||||
typedef struct {
|
||||
|
|
10
src/rufus.rc
10
src/rufus.rc
|
@ -33,7 +33,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
|
||||
EXSTYLE WS_EX_ACCEPTFILES
|
||||
CAPTION "Rufus 2.12.1008"
|
||||
CAPTION "Rufus 2.12.1009"
|
||||
FONT 8, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
|
||||
|
@ -334,8 +334,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,12,1008,0
|
||||
PRODUCTVERSION 2,12,1008,0
|
||||
FILEVERSION 2,12,1009,0
|
||||
PRODUCTVERSION 2,12,1009,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -352,13 +352,13 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "2.12.1008"
|
||||
VALUE "FileVersion", "2.12.1009"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2016 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html"
|
||||
VALUE "OriginalFilename", "rufus.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "2.12.1008"
|
||||
VALUE "ProductVersion", "2.12.1009"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -342,7 +342,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
|
|||
uprintf("Failed to create '%s': %s", path, WindowsErrorString());
|
||||
}
|
||||
}
|
||||
} else if (IS_REACTOS(img_report)) {
|
||||
} else if (HAS_REACTOS(img_report)) {
|
||||
uprintf("Setting up ReactOS...");
|
||||
syslinux_mboot = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_SL_MBOOT_C32),
|
||||
_RT_RCDATA, "mboot.c32", &syslinux_mboot_len, FALSE);
|
||||
|
|
Loading…
Reference in a new issue