mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-24 03:36:56 -04:00
[misc] add dual UEFI/BIOS cheat mode for Windows
* Suggested by Jacob Boyce
This commit is contained in:
parent
08e7757e84
commit
420db67ce1
4 changed files with 22 additions and 12 deletions
|
@ -906,7 +906,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
||||||
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
|
||||||
dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
|
||||||
bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
|
||||||
if (bt == BT_UEFI) {
|
if ((bt == BT_UEFI) && (!allow_dual_uefi_bios)) {
|
||||||
uprintf(using_msg, "zeroed");
|
uprintf(using_msg, "zeroed");
|
||||||
r = write_zero_mbr(&fake_fd); // Force UEFI boot only by zeroing the MBR
|
r = write_zero_mbr(&fake_fd); // Force UEFI boot only by zeroing the MBR
|
||||||
} else if ( (dt == DT_ISO) && (iso_report.has_kolibrios) && (fs == FS_FAT32)) {
|
} else if ( (dt == DT_ISO) && (iso_report.has_kolibrios) && (fs == FS_FAT32)) {
|
||||||
|
@ -921,7 +921,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
|
||||||
} else if (dt == DT_REACTOS) {
|
} else if (dt == DT_REACTOS) {
|
||||||
uprintf(using_msg, "ReactOS");
|
uprintf(using_msg, "ReactOS");
|
||||||
r = write_reactos_mbr(&fake_fd);
|
r = write_reactos_mbr(&fake_fd);
|
||||||
} else if ( (dt == DT_SYSLINUX_V4) || (dt == DT_SYSLINUX_V6) || ((dt == DT_ISO) && ((fs == FS_FAT16) || (fs == FS_FAT32))) ) {
|
} else if ( (dt == DT_SYSLINUX_V4) || (dt == DT_SYSLINUX_V6) || ((dt == DT_ISO) && (!allow_dual_uefi_bios) && ((fs == FS_FAT16) || (fs == FS_FAT32))) ) {
|
||||||
uprintf(using_msg, "Syslinux");
|
uprintf(using_msg, "Syslinux");
|
||||||
r = write_syslinux_mbr(&fake_fd);
|
r = write_syslinux_mbr(&fake_fd);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1621,7 +1621,8 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
}
|
}
|
||||||
// We must close and unlock the volume to write files to it
|
// We must close and unlock the volume to write files to it
|
||||||
safe_unlockclose(hLogicalVolume);
|
safe_unlockclose(hLogicalVolume);
|
||||||
} else if ( (dt == DT_SYSLINUX_V4) || (dt == DT_SYSLINUX_V6) || ((dt == DT_ISO) && ((fs == FS_FAT16) || (fs == FS_FAT32))) ) {
|
} else if ( (dt == DT_SYSLINUX_V4) || (dt == DT_SYSLINUX_V6) || ((dt == DT_ISO) && (!allow_dual_uefi_bios) &&
|
||||||
|
((fs == FS_FAT16) || (fs == FS_FAT32))) ) {
|
||||||
if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) {
|
if (!InstallSyslinux(DriveIndex, drive_name[0], fs)) {
|
||||||
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
|
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_INSTALL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
10
src/rufus.c
10
src/rufus.c
|
@ -123,6 +123,7 @@ HWND hISOProgressDlg = NULL, hLogDlg = NULL, hISOProgressBar, hISOFileName, hDis
|
||||||
BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, detect_fakes = TRUE, mbr_selected_by_user = FALSE;
|
BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, detect_fakes = TRUE, mbr_selected_by_user = FALSE;
|
||||||
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, advanced_mode = TRUE, force_update = FALSE, use_fake_units = TRUE;
|
BOOL enable_HDDs = FALSE, advanced_mode = TRUE, force_update = FALSE, use_fake_units = TRUE;
|
||||||
|
BOOL allow_dual_uefi_bios = FALSE;
|
||||||
int dialog_showing = 0;
|
int dialog_showing = 0;
|
||||||
uint16_t rufus_version[4], embedded_sl_version[2];
|
uint16_t rufus_version[4], embedded_sl_version[2];
|
||||||
char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
|
char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
|
||||||
|
@ -1170,7 +1171,7 @@ static BOOL BootCheck(void)
|
||||||
// KolibriOS doesn't support FAT16
|
// KolibriOS doesn't support FAT16
|
||||||
MessageBoxU(hMainDialog, lmprintf(MSG_189), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL);
|
MessageBoxU(hMainDialog, lmprintf(MSG_189), lmprintf(MSG_099), MB_OK|MB_ICONERROR|MB_IS_RTL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (((fs == FS_FAT16)||(fs == FS_FAT32)) && (!HAS_SYSLINUX(iso_report)) &&
|
} else if (((fs == FS_FAT16)||(fs == FS_FAT32)) && (!HAS_SYSLINUX(iso_report)) && (!allow_dual_uefi_bios) &&
|
||||||
(!IS_REACTOS(iso_report)) && (!iso_report.has_kolibrios) && (!IS_GRUB(iso_report))) {
|
(!IS_REACTOS(iso_report)) && (!iso_report.has_kolibrios) && (!IS_GRUB(iso_report))) {
|
||||||
// FAT/FAT32 can only be used for isolinux based ISO images or when the Target Type is UEFI
|
// FAT/FAT32 can only be used for isolinux based ISO images or when the Target Type is UEFI
|
||||||
MessageBoxU(hMainDialog, lmprintf(MSG_098), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL);
|
MessageBoxU(hMainDialog, lmprintf(MSG_098), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL);
|
||||||
|
@ -2471,6 +2472,13 @@ relaunch:
|
||||||
existing_key = FALSE;
|
existing_key = FALSE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Alt-E => Enhanced installation mode (allow dual UEFI/BIOS mode and FAT32 for Windows)
|
||||||
|
if ((msg.message == WM_SYSKEYDOWN) && (msg.wParam == 'E')) {
|
||||||
|
allow_dual_uefi_bios = !allow_dual_uefi_bios;
|
||||||
|
// TODO: add a localized message
|
||||||
|
PrintStatus2000("Allow dual UEFI/BIOS mode", allow_dual_uefi_bios);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Alt-F => Toggle detection of USB HDDs
|
// Alt-F => Toggle detection of USB HDDs
|
||||||
// By default Rufus does not list USB HDDs. This is a safety feature aimed at avoiding
|
// By default Rufus does not list USB HDDs. This is a safety feature aimed at avoiding
|
||||||
// unintentional formatting of backup drives instead of USB keys.
|
// unintentional formatting of backup drives instead of USB keys.
|
||||||
|
|
|
@ -337,6 +337,7 @@ extern DWORD syslinux_ldlinux_len[2];
|
||||||
extern RUFUS_DRIVE_INFO SelectedDrive;
|
extern RUFUS_DRIVE_INFO SelectedDrive;
|
||||||
extern const int nb_steps[FS_MAX];
|
extern const int nb_steps[FS_MAX];
|
||||||
extern BOOL use_own_c32[NB_OLD_C32], detect_fakes, iso_op_in_progress, format_op_in_progress, right_to_left_mode;
|
extern BOOL use_own_c32[NB_OLD_C32], detect_fakes, iso_op_in_progress, format_op_in_progress, right_to_left_mode;
|
||||||
|
extern BOOL allow_dual_uefi_bios;
|
||||||
extern RUFUS_ISO_REPORT iso_report;
|
extern RUFUS_ISO_REPORT iso_report;
|
||||||
extern int64_t iso_blocking_status;
|
extern int64_t iso_blocking_status;
|
||||||
extern uint16_t rufus_version[4], embedded_sl_version[2];
|
extern uint16_t rufus_version[4], embedded_sl_version[2];
|
||||||
|
|
16
src/rufus.rc
16
src/rufus.rc
|
@ -32,7 +32,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
|
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 242, 329
|
IDD_DIALOG DIALOGEX 12, 12, 242, 329
|
||||||
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
|
||||||
CAPTION "Rufus 1.5.0.558"
|
CAPTION "Rufus 1.5.0.559"
|
||||||
FONT 8, "Segoe UI", 400, 0, 0x1
|
FONT 8, "Segoe UI", 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Start",IDC_START,127,291,50,14
|
DEFPUSHBUTTON "Start",IDC_START,127,291,50,14
|
||||||
|
@ -164,7 +164,7 @@ END
|
||||||
|
|
||||||
IDD_DIALOG_XP DIALOGEX 12, 12, 242, 329
|
IDD_DIALOG_XP DIALOGEX 12, 12, 242, 329
|
||||||
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
|
||||||
CAPTION "Rufus 1.5.0.558"
|
CAPTION "Rufus 1.5.0.559"
|
||||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Start",IDC_START,127,291,50,14
|
DEFPUSHBUTTON "Start",IDC_START,127,291,50,14
|
||||||
|
@ -297,7 +297,7 @@ END
|
||||||
IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 329
|
IDD_DIALOG_RTL DIALOGEX 12, 12, 242, 329
|
||||||
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_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
|
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
|
||||||
CAPTION "Rufus 1.5.0.558"
|
CAPTION "Rufus 1.5.0.559"
|
||||||
FONT 8, "Segoe UI", 400, 0, 0x1
|
FONT 8, "Segoe UI", 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Start",IDC_START,127,291,50,14
|
DEFPUSHBUTTON "Start",IDC_START,127,291,50,14
|
||||||
|
@ -437,7 +437,7 @@ END
|
||||||
IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 329
|
IDD_DIALOG_RTL_XP DIALOGEX 12, 12, 242, 329
|
||||||
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_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
|
EXSTYLE WS_EX_RTLREADING | WS_EX_APPWINDOW | WS_EX_LAYOUTRTL
|
||||||
CAPTION "Rufus 1.5.0.558"
|
CAPTION "Rufus 1.5.0.559"
|
||||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||||
BEGIN
|
BEGIN
|
||||||
DEFPUSHBUTTON "Start",IDC_START,127,291,50,14
|
DEFPUSHBUTTON "Start",IDC_START,127,291,50,14
|
||||||
|
@ -702,8 +702,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,5,0,558
|
FILEVERSION 1,5,0,559
|
||||||
PRODUCTVERSION 1,5,0,558
|
PRODUCTVERSION 1,5,0,559
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -720,13 +720,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", "1.5.0.558"
|
VALUE "FileVersion", "1.5.0.559"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2014 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2014 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", "1.5.0.558"
|
VALUE "ProductVersion", "1.5.0.559"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue