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

disable MS-DOS creation for Windows 10 or later

* Microsoft removed the diskcopy.dll that contained the MS-DOS floppy image
  Not a big loss, since we have FreeDOS... ;)
* Closes #545
* Also apply a long overdue refactoring for boot and target types
* Also update the README to add an icon
This commit is contained in:
Pete Batard 2015-07-01 21:26:15 +01:00
parent 14b8ab6a43
commit 3ccae1d2e2
7 changed files with 179 additions and 166 deletions

View file

@ -1,19 +1,27 @@
# Rufus: The Reliable USB Formatting Utility
Rufus: The Reliable USB Formatting Utility
==========================================
![Rufus logo](https://raw.githubusercontent.com/pbatard/rufus/master/res/icon-set/rufus-256.png)
Features
--------
## Features
* Formats USB and Virtual HD drives to FAT/FAT32/NTFS/UDF/exFAT/ReFS
* Creates DOS bootable USB drives, using [FreeDOS](http://www.freedos.org/) or MS-DOS
* Creates BIOS or UEFI bootable drives, including UEFI bootable NTFS
* Creates bootable drives from bootable ISOs (Windows, Linux, etc.)
* Creates bootbale drives from bootable disk images, including compressed ones
* Creates [Windows To Go](https://en.wikipedia.org/wiki/Windows_To_Go) drives
* Twice as fast as Microsoft's USB/DVD tool or UNetbootin, on ISO -> USB (1)
* Performs bad blocks checks, including fake drives detection
* Twice as fast as Microsoft's USB/DVD tool or UNetbootin, on ISO -> USB creation (1)
* Performs bad blocks checks, including detection of "fake" flash drives
* Modern and familiar UI, with more than [30 languages natively supported](http://rufus.akeo.ie/translations)
* Small footprint with no installation required
* 100% Free Software (GPL v3)
* Small footprint. No installation required.
* Portable
* 100% [Free Software](http://www.gnu.org/philosophy/free-sw.en.html) (GPL v3)
Compilation
-----------
## Compilation
Use either Visual Studio 2013, WDK 7.1 (Windows Driver Kit) or MinGW and then
invoke the `.sln`, `wdk_build.cmd` or `configure`/`make` respectively.
@ -25,15 +33,18 @@ build, run or develop for Rufus. As per the Visual Studio Community Edition lice
this applies regardless of whether you are an individual or a corporate user.
For details, see [this](http://pete.akeo.ie/2014/11/visual-studio-2013-has-now-become.html).
## Additional information
Additional information
----------------------
Rufus provides extensive information about what it is doing, either through
its easily accessible log, or through the Windows debug facility.
For more info, please consult:
* The Official Website - http://rufus.akeo.ie
* The Official FAQ - http://rufus.akeo.ie/FAQ
* Website: http://rufus.akeo.ie
* FAQ: http://rufus.akeo.ie/FAQ
Enhancements/Bugs
-----------------
## Enhancements/Bugs
Please use the [GitHub issue tracker](https://github.com/pbatard/rufus/issues)
for reporting problems or suggesting new features.

View file

@ -413,9 +413,9 @@ BOOL ExtractFreeDOS(const char* path)
BOOL ExtractDOS(const char* path)
{
switch(ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType))) {
case DT_WINME:
case BT_MSDOS:
return ExtractMSDOS(path);
case DT_FREEDOS:
case BT_FREEDOS:
return ExtractFreeDOS(path);
}
return FALSE;

View file

@ -860,8 +860,8 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
FILE fake_fd = { 0 };
const char* using_msg = "Using %s MBR\n";
int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
int dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
int bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
AnalyzeMBR(hPhysicalDrive, "Drive");
@ -898,7 +898,7 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
buf[0x1c2] = 0x0c;
break;
}
if ((IsChecked(IDC_BOOT)) && (bt == BT_BIOS)) {
if ((IsChecked(IDC_BOOT)) && (tt == TT_BIOS)) {
// Set first partition bootable - masquerade as per the DiskID selected
buf[0x1be] = IsChecked(IDC_RUFUS_MBR) ?
(BYTE)ComboBox_GetItemData(hDiskID, ComboBox_GetCurSel(hDiskID)):0x80;
@ -920,43 +920,43 @@ static BOOL WriteMBR(HANDLE hPhysicalDrive)
goto windows_mbr;
// Forced UEFI (by zeroing the MBR)
if (bt == BT_UEFI) {
if (tt == TT_UEFI) {
uprintf(using_msg, "zeroed");
r = write_zero_mbr(&fake_fd);
goto notify;
}
// Syslinux
if ( (dt == DT_SYSLINUX_V4) || (dt == DT_SYSLINUX_V6) ||
((dt == DT_ISO) && (HAS_SYSLINUX(iso_report)) && (IS_FAT(fs))) ) {
if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) ||
((bt == BT_ISO) && (HAS_SYSLINUX(iso_report)) && (IS_FAT(fs))) ) {
uprintf(using_msg, "Syslinux");
r = write_syslinux_mbr(&fake_fd);
goto notify;
}
// Grub 2.0
if ( ((dt == DT_ISO) && (iso_report.has_grub2)) || (dt == DT_GRUB2) ) {
if ( ((bt == BT_ISO) && (iso_report.has_grub2)) || (bt == BT_GRUB2) ) {
uprintf(using_msg, "Grub 2.0");
r = write_grub2_mbr(&fake_fd);
goto notify;
}
// Grub4DOS
if ( ((dt == DT_ISO) && (iso_report.has_grub4dos)) || (dt == DT_GRUB4DOS) ) {
if ( ((bt == BT_ISO) && (iso_report.has_grub4dos)) || (bt == BT_GRUB4DOS) ) {
uprintf(using_msg, "Grub4DOS");
r = write_grub_mbr(&fake_fd);
goto notify;
}
// ReactOS
if (dt == DT_REACTOS) {
if (bt == BT_REACTOS) {
uprintf(using_msg, "ReactOS");
r = write_reactos_mbr(&fake_fd);
goto notify;
}
// KolibriOS
if ( (dt == DT_ISO) && (iso_report.has_kolibrios) && (IS_FAT(fs))) {
if ( (bt == BT_ISO) && (iso_report.has_kolibrios) && (IS_FAT(fs))) {
uprintf(using_msg, "KolibriOS");
r = write_kolibri_mbr(&fake_fd);
goto notify;
@ -989,7 +989,7 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
{
// TODO: Do we need anything special for 4K sectors?
DWORD size, max_size, mbr_size = 0x200;
int r, dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
int r, bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
unsigned char* buf = NULL;
FILE fake_fd = { 0 };
@ -1000,15 +1000,15 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
(DWORD)(SelectedDrive.Geometry.BytesPerSector * SelectedDrive.Geometry.SectorsPerTrack) : 1024 * 1024;
max_size -= mbr_size;
// Syslinux has precedence over Grub
if ((dt == DT_ISO) && (!HAS_SYSLINUX(iso_report))) {
if ((bt == BT_ISO) && (!HAS_SYSLINUX(iso_report))) {
if (iso_report.has_grub4dos)
dt = DT_GRUB4DOS;
bt = BT_GRUB4DOS;
if (iso_report.has_grub2)
dt = DT_GRUB2;
bt = BT_GRUB2;
}
switch (dt) {
case DT_GRUB4DOS:
switch (bt) {
case BT_GRUB4DOS:
uprintf("Writing Grub4Dos SBR...");
buf = GetResource(hMainInstance, MAKEINTRESOURCEA(IDR_GR_GRUB_GRLDR_MBR), _RT_RCDATA, "grldr.mbr", &size, FALSE);
if ((buf == NULL) || (size <= mbr_size)) {
@ -1018,7 +1018,7 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
buf = &buf[mbr_size];
size -= mbr_size;
break;
case DT_GRUB2:
case BT_GRUB2:
if (grub2_buf != NULL) {
uprintf("Writing Grub 2.0 SBR (from download)...");
buf = grub2_buf;
@ -1049,19 +1049,19 @@ static BOOL WriteSBR(HANDLE hPhysicalDrive)
/*
* Process the Partition Boot Record
*/
static __inline const char* dt_to_name(int dt) {
switch (dt) {
case DT_FREEDOS: return "FreeDOS";
case DT_REACTOS: return "ReactOS";
static __inline const char* bt_to_name(int bt) {
switch (bt) {
case BT_FREEDOS: return "FreeDOS";
case BT_REACTOS: return "ReactOS";
default:
return ((dt==DT_ISO)&&(iso_report.has_kolibrios))?"KolibriOS":"Standard";
return ((bt==BT_ISO)&&(iso_report.has_kolibrios))?"KolibriOS":"Standard";
}
}
static BOOL WritePBR(HANDLE hLogicalVolume)
{
int i;
FILE fake_fd = { 0 };
int dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
const char* using_msg = "Using %s %s partition boot record\n";
fake_fd._ptr = (char*)hLogicalVolume;
@ -1069,17 +1069,17 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
switch (ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem))) {
case FS_FAT16:
uprintf(using_msg, dt_to_name(dt), "FAT16");
uprintf(using_msg, bt_to_name(bt), "FAT16");
if (!is_fat_16_fs(&fake_fd)) {
uprintf("New volume does not have a FAT16 boot sector - aborting\n");
break;
}
uprintf("Confirmed new volume has a FAT16 boot sector\n");
if (dt == DT_FREEDOS) {
if (bt == BT_FREEDOS) {
if (!write_fat_16_fd_br(&fake_fd, 0)) break;
} else if (dt == DT_REACTOS) {
} else if (bt == BT_REACTOS) {
if (!write_fat_16_ros_br(&fake_fd, 0)) break;
} else if ((dt == DT_ISO) && (iso_report.has_kolibrios)) {
} else if ((bt == BT_ISO) && (iso_report.has_kolibrios)) {
uprintf("FAT16 is not supported for KolibriOS\n"); break;
} else {
if (!write_fat_16_br(&fake_fd, 0)) break;
@ -1089,7 +1089,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
break;
return TRUE;
case FS_FAT32:
uprintf(using_msg, dt_to_name(dt), "FAT32");
uprintf(using_msg, bt_to_name(bt), "FAT32");
for (i=0; i<2; i++) {
if (!is_fat_32_fs(&fake_fd)) {
uprintf("New volume does not have a %s FAT32 boot sector - aborting\n", i?"secondary":"primary");
@ -1097,11 +1097,11 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
}
uprintf("Confirmed new volume has a %s FAT32 boot sector\n", i?"secondary":"primary");
uprintf("Setting %s FAT32 boot sector for boot...\n", i?"secondary":"primary");
if (dt == DT_FREEDOS) {
if (bt == BT_FREEDOS) {
if (!write_fat_32_fd_br(&fake_fd, 0)) break;
} else if (dt == DT_REACTOS) {
} else if (bt == BT_REACTOS) {
if (!write_fat_32_ros_br(&fake_fd, 0)) break;
} else if ((dt == DT_ISO) && (iso_report.has_kolibrios)) {
} else if ((bt == BT_ISO) && (iso_report.has_kolibrios)) {
if (!write_fat_32_kos_br(&fake_fd, 0)) break;
} else {
if (!write_fat_32_br(&fake_fd, 0)) break;
@ -1113,7 +1113,7 @@ static BOOL WritePBR(HANDLE hLogicalVolume)
}
return TRUE;
case FS_NTFS:
uprintf(using_msg, dt_to_name(dt), "NTFS");
uprintf(using_msg, bt_to_name(bt), "NTFS");
if (!is_ntfs_fs(&fake_fd)) {
uprintf("New volume does not have an NTFS boot sector - aborting\n");
break;
@ -1483,7 +1483,7 @@ void update_progress(const uint64_t processed_bytes)
*/
DWORD WINAPI FormatThread(void* param)
{
int i, r, pt, bt, fs, dt;
int i, r, pt, tt, fs, bt;
BOOL s, ret, use_large_fat32, windows_to_go;
const DWORD SectorSize = SelectedDrive.Geometry.BytesPerSector;
DWORD rSize, wSize, BufSize, DriveIndex = (DWORD)(uintptr_t)param;
@ -1509,18 +1509,18 @@ DWORD WINAPI FormatThread(void* param)
PF_INIT(SetThreadUILanguage, Kernel32);
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
bt = GETBIOSTYPE((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(iso_report) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED);
// Find out if we need to add any extra partitions
if ((windows_to_go) && (bt == BT_UEFI) && (pt == PARTITION_STYLE_GPT))
if ((windows_to_go) && (tt == TT_UEFI) && (pt == PARTITION_STYLE_GPT))
// According to Microsoft, every GPT disk (we RUN Windows from) must have an MSR due to not having hidden sectors
// 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) && ((dt == DT_UEFI_NTFS) ||
((dt == DT_ISO) && (iso_report.has_efi) && ((bt == BT_UEFI) || (windows_to_go) || (allow_dual_uefi_bios)))) )
else if ( (fs == FS_NTFS) && ((bt == BT_UEFI_NTFS) ||
((bt == BT_ISO) && (iso_report.has_efi) && ((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;
@ -1551,7 +1551,7 @@ DWORD WINAPI FormatThread(void* param)
// Do it in reverse so that we always end on the first volume letter
for (i=(int)safe_strlen(drive_letters); i>0; i--) {
drive_name[0] = drive_letters[i-1];
if (IsChecked(IDC_BOOT) && ((dt == DT_ISO) || (dt == DT_IMG))) {
if (IsChecked(IDC_BOOT) && ((bt == BT_ISO) || (bt == BT_IMG))) {
// If we are using an image, check that it isn't located on the drive we are trying to format
if ((PathGetDriveNumberU(image_path) + 'A') == drive_letters[i-1]) {
uprintf("ABORTED: Cannot use an image that is located on the target drive!\n");
@ -1663,7 +1663,7 @@ DWORD WINAPI FormatThread(void* param)
}
// Write an image file
if (IsChecked(IDC_BOOT) && (dt == DT_IMG)) {
if (IsChecked(IDC_BOOT) && (bt == BT_IMG)) {
char fs_type[32];
// We poked the MBR and other stuff, so we need to rewind
li.QuadPart = 0;
@ -1762,7 +1762,7 @@ DWORD WINAPI FormatThread(void* param)
UpdateProgress(OP_ZERO_MBR, -1.0f);
CHECK_FOR_USER_CANCEL;
if (!CreatePartition(hPhysicalDrive, pt, fs, (pt==PARTITION_STYLE_MBR) && (bt==BT_UEFI), extra_partitions)) {
if (!CreatePartition(hPhysicalDrive, pt, fs, (pt==PARTITION_STYLE_MBR) && (tt==TT_UEFI), extra_partitions)) {
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_PARTITION_FAILURE;
goto out;
}
@ -1826,17 +1826,17 @@ DWORD WINAPI FormatThread(void* param)
CHECK_FOR_USER_CANCEL;
if (IsChecked(IDC_BOOT)) {
if (dt == DT_UEFI_NTFS) {
if (bt == BT_UEFI_NTFS) {
// All good
} else if (bt == BT_UEFI) {
} else if (tt == TT_UEFI) {
// For once, no need to do anything - just check our sanity
if ( (dt != DT_ISO) || (!iso_report.has_efi) || (fs > FS_NTFS) ) {
if ( (bt != BT_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;
}
} else if ( (dt == DT_SYSLINUX_V4) || (dt == DT_SYSLINUX_V6) ||
((dt == DT_ISO) && (HAS_SYSLINUX(iso_report) || IS_REACTOS(iso_report)) &&
} else if ( (bt == BT_SYSLINUX_V4) || (bt == BT_SYSLINUX_V6) ||
((bt == BT_ISO) && (HAS_SYSLINUX(iso_report) || IS_REACTOS(iso_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;
@ -1875,7 +1875,7 @@ DWORD WINAPI FormatThread(void* param)
CHECK_FOR_USER_CANCEL;
if (IsChecked(IDC_BOOT)) {
if ((dt == DT_WINME) || (dt == DT_FREEDOS)) {
if ((bt == BT_MSDOS) || (bt == BT_FREEDOS)) {
UpdateProgress(OP_DOS, -1.0f);
PrintInfoDebug(0, MSG_230);
if (!ExtractDOS(drive_name)) {
@ -1883,13 +1883,13 @@ DWORD WINAPI FormatThread(void* param)
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|ERROR_CANNOT_COPY;
goto out;
}
} else if (dt == DT_GRUB4DOS) {
} else if (bt == BT_GRUB4DOS) {
grub4dos_dst[0] = drive_name[0];
uprintf("Installing: %s (Grub4DOS loader)\n", grub4dos_dst);
IGNORE_RETVAL(_chdirU(app_dir));
if (!CopyFileU(FILES_DIR "\\grub4dos-" GRUB4DOS_VERSION "\\grldr", grub4dos_dst, FALSE))
uprintf("Failed to copy file: %s", WindowsErrorString());
} else if ((dt == DT_ISO) && (image_path != NULL)) {
} else if ((bt == BT_ISO) && (image_path != NULL)) {
UpdateProgress(OP_DOS, 0.0f);
drive_name[2] = 0; // Ensure our drive is something like 'D:'
if (windows_to_go) {
@ -1915,7 +1915,7 @@ DWORD WINAPI FormatThread(void* param)
}
}
// EFI mode selected, with no 'boot###.efi' but Windows 7 x64's 'bootmgr.efi' (bit #0)
if ((bt == BT_UEFI) && IS_WIN7_EFI(iso_report)) {
if ((tt == TT_UEFI) && IS_WIN7_EFI(iso_report)) {
PrintInfoDebug(0, MSG_232);
iso_report.install_wim_path[0] = drive_name[0];
efi_dst[0] = drive_name[0];
@ -1931,7 +1931,7 @@ DWORD WINAPI FormatThread(void* param)
}
}
}
if ( (bt == BT_BIOS) && (IS_WINPE(iso_report.winpe)) ) {
if ( (tt == TT_BIOS) && (IS_WINPE(iso_report.winpe)) ) {
// Apply WinPe fixup
if (!SetupWinPE(drive_name[0]))
FormatStatus = ERROR_SEVERITY_ERROR|FAC(FACILITY_STORAGE)|APPERR(ERROR_CANT_PATCH);
@ -1945,7 +1945,7 @@ DWORD WINAPI FormatThread(void* param)
// Issue another complete remount before we exit, to ensure we're clean
RemountVolume(drive_name);
// NTFS fixup (WinPE/AIK images don't seem to boot without an extra checkdisk)
if ((dt == DT_ISO) && (fs == FS_NTFS)) {
if ((bt == BT_ISO) && (fs == FS_NTFS)) {
// Try to ensure that all messages from Checkdisk will be in English
if ((pfGetThreadUILanguage != NULL) && (PRIMARYLANGID(pfGetThreadUILanguage()) != LANG_ENGLISH)) {
pfSetThreadUILanguage(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));

View file

@ -410,7 +410,7 @@ static void SetMBRForUEFI(BOOL replace)
if (replace)
ComboBox_DeleteString(hPartitionScheme, 0);
IGNORE_RETVAL(ComboBox_SetItemData(hPartitionScheme, ComboBox_InsertStringU(hPartitionScheme, 0,
lmprintf(MSG_031, PartitionTypeLabel[PARTITION_STYLE_MBR], useCSM?"UEFI-CSM":"UEFI")), (BT_BIOS<<16)|PARTITION_STYLE_MBR));
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)));
}
@ -473,7 +473,7 @@ static BOOL SetDriveInfo(int ComboIndex)
SetMBRForUEFI(FALSE);
} else {
IGNORE_RETVAL(ComboBox_SetItemData(hPartitionScheme, ComboBox_AddStringU(hPartitionScheme,
lmprintf(MSG_033, PartitionTypeLabel[pt])), (BT_UEFI<<16)|pt));
lmprintf(MSG_033, PartitionTypeLabel[pt])), (TT_UEFI<<16)|pt));
}
}
@ -487,7 +487,7 @@ static void SetFSFromISO(void)
{
int i, fs, selected_fs = FS_UNKNOWN;
uint32_t fs_mask = 0;
int bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
BOOL windows_to_go = (togo_mode) && HAS_TOGO(iso_report) &&
(Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED);
@ -502,7 +502,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) ||
((iso_report.has_efi) && (bt == BT_UEFI) && (!iso_report.has_4GB_file) && (!windows_to_go))) {
((iso_report.has_efi) && (tt == TT_UEFI) && (!iso_report.has_4GB_file) && (!windows_to_go))) {
if (fs_mask & (1<<FS_FAT32)) {
selected_fs = FS_FAT32;
} else if ((fs_mask & (1<<FS_FAT16)) && (!iso_report.has_kolibrios)) {
@ -528,10 +528,10 @@ static void SetFSFromISO(void)
static void SetMBRProps(void)
{
int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
int dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
BOOL needs_masquerading = (IS_WINPE(iso_report.winpe) && (!iso_report.uses_minint));
if ((!mbr_selected_by_user) && ((image_path == NULL) || (dt != DT_ISO) || (fs != FS_NTFS) || IS_GRUB(iso_report) ||
if ((!mbr_selected_by_user) && ((image_path == NULL) || (bt != BT_ISO) || (fs != FS_NTFS) || IS_GRUB(iso_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));
@ -546,19 +546,19 @@ static void SetMBRProps(void)
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)) )
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
if ( ((bt != BT_ISO) && (togo_mode)) || ((bt == BT_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)));
BOOL actual_enable_mbr = ((bt==BT_UEFI)||(selection_default>=DT_IMG)||!IsChecked(IDC_BOOT))?FALSE:enable;
BOOL actual_enable_fix = ((bt==BT_UEFI)||(selection_default==DT_IMG)||!IsChecked(IDC_BOOT))?FALSE:enable;
int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
BOOL actual_enable_mbr = ((tt==TT_UEFI)||(selection_default>=BT_IMG)||!IsChecked(IDC_BOOT))?FALSE:enable;
BOOL actual_enable_fix = ((tt==TT_UEFI)||(selection_default==BT_IMG)||!IsChecked(IDC_BOOT))?FALSE:enable;
static UINT uXPartChecked = BST_UNCHECKED;
if ((selection_default == DT_ISO) && (iso_report.has_kolibrios || IS_GRUB(iso_report) || IS_REACTOS(iso_report) || HAS_SYSLINUX(iso_report))) {
if ((selection_default == BT_ISO) && (iso_report.has_kolibrios || IS_GRUB(iso_report) || IS_REACTOS(iso_report) || HAS_SYSLINUX(iso_report))) {
actual_enable_mbr = FALSE;
mbr_selected_by_user = FALSE;
}
@ -583,7 +583,7 @@ static void EnableAdvancedBootOptions(BOOL enable, BOOL remove_checkboxes)
static void EnableBootOptions(BOOL enable, BOOL remove_checkboxes)
{
int fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
BOOL actual_enable = ((!IS_FAT(fs)) && (fs != FS_NTFS) && (selection_default == DT_IMG))?FALSE:enable;
BOOL actual_enable = ((!IS_FAT(fs)) && (fs != FS_NTFS) && (selection_default == BT_IMG))?FALSE:enable;
EnableWindow(hBoot, actual_enable);
EnableWindow(hBootType, actual_enable);
@ -595,9 +595,9 @@ static void EnableBootOptions(BOOL enable, BOOL remove_checkboxes)
static void SetPartitionSchemeTooltip(void)
{
int bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
int tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
int pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
if (bt == BT_BIOS) {
if (tt == TT_BIOS) {
CreateTooltip(hPartitionScheme, lmprintf(MSG_150), 15000);
} else {
if (pt == PARTITION_STYLE_MBR) {
@ -702,16 +702,16 @@ static void InitProgress(BOOL bOnlyFormat)
if (IsChecked(IDC_BOOT)) {
// 1 extra slot for PBR writing
switch (selection_default) {
case DT_WINME:
case BT_MSDOS:
nb_slots[OP_DOS] = 3+1;
break;
case DT_FREEDOS:
case BT_FREEDOS:
nb_slots[OP_DOS] = 5+1;
break;
case DT_IMG:
case BT_IMG:
nb_slots[OP_DOS] = 0;
break;
case DT_ISO:
case BT_ISO:
nb_slots[OP_DOS] = -1;
break;
default:
@ -719,7 +719,7 @@ static void InitProgress(BOOL bOnlyFormat)
break;
}
}
if (selection_default == DT_IMG) {
if (selection_default == BT_IMG) {
nb_slots[OP_FORMAT] = -1;
} else {
nb_slots[OP_ZERO_MBR] = 1;
@ -731,7 +731,7 @@ static void InitProgress(BOOL bOnlyFormat)
|| ((fs == FS_FAT32) && ((SelectedDrive.DiskSize >= LARGE_FAT32_SIZE) || (force_large_fat32))) ) {
nb_slots[OP_FORMAT] = -1;
}
nb_slots[OP_FINALIZE] = ((selection_default == DT_ISO) && (fs == FS_NTFS))?3:2;
nb_slots[OP_FINALIZE] = ((selection_default == BT_ISO) && (fs == FS_NTFS))?3:2;
}
}
@ -820,7 +820,7 @@ static void EnableControls(BOOL bEnable)
EnableWindow(hLangToolbar, bEnable);
EnableWindow(GetDlgItem(hMainDialog, IDC_ENABLE_FIXED_DISKS), bEnable);
SetDlgItemTextU(hMainDialog, IDCANCEL, lmprintf(bEnable?MSG_006:MSG_007));
if (selection_default == DT_IMG)
if (selection_default == BT_IMG)
return;
EnableWindow(GetDlgItem(hMainDialog, IDC_PARTITION_TYPE), bEnable);
EnableWindow(GetDlgItem(hMainDialog, IDC_FILESYSTEM), bEnable);
@ -1020,9 +1020,9 @@ DWORD WINAPI ISOScanThread(LPVOID param)
if (iso_report.is_bootable_img) {
uprintf("'%s' is a %sbootable %s image", image_path,
(iso_report.compression_type != BLED_COMPRESSION_NONE)?"compressed ":"", iso_report.is_vhd?"VHD":"disk");
selection_default = DT_IMG;
selection_default = BT_IMG;
} else {
selection_default = DT_ISO;
selection_default = BT_ISO;
DisplayISOProps();
}
if ( (!iso_report.has_bootmgr) && (!HAS_SYSLINUX(iso_report)) && (!IS_WINPE(iso_report.winpe)) && (!IS_GRUB(iso_report))
@ -1234,7 +1234,7 @@ static void ToggleToGo(void)
static BOOL BootCheck(void)
{
int i, fs, bt, dt, pt, r;
int i, fs, tt, bt, pt, r;
FILE *fd;
DWORD len;
BOOL in_files_dir = FALSE;
@ -1247,9 +1247,9 @@ static BOOL BootCheck(void)
syslinux_ldlinux_len[0] = 0; syslinux_ldlinux_len[1] = 0;
safe_free(grub2_buf);
dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
pt = GETPARTTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
if ((dt == DT_ISO) || (dt == DT_IMG)) {
if ((bt == BT_ISO) || (bt == BT_IMG)) {
if (image_path == NULL) {
// Please click on the disc button to select a bootable ISO
MessageBoxU(hMainDialog, lmprintf(MSG_087), lmprintf(MSG_086), MB_OK|MB_ICONERROR|MB_IS_RTL);
@ -1260,21 +1260,21 @@ static BOOL BootCheck(void)
MessageBoxU(hMainDialog, lmprintf(MSG_089), lmprintf(MSG_088), MB_OK|MB_ICONERROR|MB_IS_RTL);
return FALSE;
}
if (dt == DT_IMG) {
if (bt == BT_IMG) {
if (!iso_report.is_bootable_img)
// The selected image doesn't match the boot option selected.
MessageBoxU(hMainDialog, lmprintf(MSG_188), lmprintf(MSG_187), MB_OK|MB_ICONERROR|MB_IS_RTL);
return (iso_report.is_bootable_img);
}
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
if ((togo_mode) && (Button_GetCheck(GetDlgItem(hMainDialog, IDC_WINDOWS_TO_GO)) == BST_CHECKED)) {
if (fs != FS_NTFS) {
// Windows To Go only works for NTFS
MessageBoxU(hMainDialog, lmprintf(MSG_097, "Windows To Go"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL);
return FALSE;
} else if (SelectedDrive.Geometry.MediaType != FixedMedia) {
if ((bt == BT_UEFI) && (pt == PARTITION_STYLE_GPT)) {
if ((tt == TT_UEFI) && (pt == PARTITION_STYLE_GPT)) {
// We're screwed since we need access to 2 partitions at the same time to set this, which
// Windows can't do. Cue in Arthur's Theme: "♫ I know it's stupid... but it's true. ♫"
MessageBoxU(hMainDialog, lmprintf(MSG_198), lmprintf(MSG_190), MB_OK|MB_ICONERROR|MB_IS_RTL);
@ -1285,7 +1285,7 @@ static BOOL BootCheck(void)
if (MessageBoxU(hMainDialog, lmprintf(MSG_098), lmprintf(MSG_190), MB_YESNO|MB_ICONWARNING|MB_IS_RTL) != IDYES)
return FALSE;
}
} else if (bt == BT_UEFI) {
} else if (tt == TT_UEFI) {
if (!iso_report.has_efi) {
// Unsupported ISO
MessageBoxU(hMainDialog, lmprintf(MSG_091), lmprintf(MSG_090), MB_OK|MB_ICONERROR|MB_IS_RTL);
@ -1468,7 +1468,7 @@ static BOOL BootCheck(void)
}
}
}
} else if (dt == DT_SYSLINUX_V6) {
} else if (bt == BT_SYSLINUX_V6) {
IGNORE_RETVAL(_chdirU(app_dir));
IGNORE_RETVAL(_mkdir(FILES_DIR));
IGNORE_RETVAL(_chdir(FILES_DIR));
@ -1494,13 +1494,13 @@ static BOOL BootCheck(void)
return FALSE;
}
}
} else if (dt == DT_WINME) {
} else if (bt == BT_MSDOS) {
if ((size_check) && (ComboBox_GetItemData(hClusterSize, ComboBox_GetCurSel(hClusterSize)) >= 65536)) {
// MS-DOS cannot boot from a drive using a 64 kilobytes Cluster size
MessageBoxU(hMainDialog, lmprintf(MSG_110), lmprintf(MSG_111), MB_OK|MB_ICONERROR|MB_IS_RTL);
return FALSE;
}
} else if (dt == DT_GRUB4DOS) {
} else if (bt == BT_GRUB4DOS) {
IGNORE_RETVAL(_chdirU(app_dir));
IGNORE_RETVAL(_mkdir(FILES_DIR));
IGNORE_RETVAL(_chdir(FILES_DIR));
@ -1526,7 +1526,7 @@ static BOOL BootCheck(void)
return FALSE;
}
}
} else if (dt == DT_UEFI_NTFS) {
} else if (bt == BT_UEFI_NTFS) {
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
if (fs != FS_NTFS) {
MessageBoxU(hMainDialog, lmprintf(MSG_097, "UEFI:NTFS"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL);
@ -1689,7 +1689,7 @@ void InitDialog(HWND hDlg)
SetClusterSizeLabels();
// Prefer FreeDOS to MS-DOS
selection_default = DT_FREEDOS;
selection_default = BT_FREEDOS;
// Create the status line and initialize the taskbar icon for progress overlay
CreateStatusBar();
CreateTaskbarList();
@ -1704,10 +1704,11 @@ void InitDialog(HWND hDlg)
IGNORE_RETVAL(ComboBox_SetCurSel(hNBPasses, 0));
SetPassesTooltip();
// Fill up the boot type dropdown
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS"), DT_WINME));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS"), DT_FREEDOS));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_036)), DT_ISO));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_095)), DT_IMG));
if (nWindowsVersion < WINDOWS_10) // The diskcopy.dll with the MS-DOS floppy image was removed in Windows 10
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS"), BT_MSDOS));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS"), BT_FREEDOS));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_036)), BT_ISO));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_095)), BT_IMG));
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, selection_default));
// Fill up the MBR masqueraded disk IDs ("8 disks should be enough for anybody")
IGNORE_RETVAL(ComboBox_SetItemData(hDiskID, ComboBox_AddStringU(hDiskID, lmprintf(MSG_030, LEFT_TO_RIGHT_MARK "0x80")), 0x80));
@ -1903,34 +1904,35 @@ void ShowLanguageMenu(RECT rcExclude)
DestroyMenu(menu);
}
void SetBoot(int fs, int bt)
void SetBoot(int fs, int tt)
{
int i;
char tmp[32];
IGNORE_RETVAL(ComboBox_ResetContent(hBootType));
if ((bt == BT_BIOS) && (IS_FAT(fs))) {
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS"), DT_WINME));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS"), DT_FREEDOS));
if ((tt == TT_BIOS) && (IS_FAT(fs))) {
if (nWindowsVersion < WINDOWS_10) // The diskcopy.dll with the MS-DOS floppy image was removed in Windows 10
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "MS-DOS"), BT_MSDOS));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "FreeDOS"), BT_FREEDOS));
}
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_036)), DT_ISO));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_095)), DT_IMG));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_036)), BT_ISO));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, lmprintf(MSG_095)), BT_IMG));
// If needed (advanced mode) also append "bare" Syslinux and other options
if ( (bt == BT_BIOS) && ((IS_FAT(fs) || (fs == FS_NTFS)) && (advanced_mode)) ) {
if ( (tt == TT_BIOS) && ((IS_FAT(fs) || (fs == FS_NTFS)) && (advanced_mode)) ) {
static_sprintf(tmp, "Syslinux %s", embedded_sl_version_str[0]);
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, tmp), DT_SYSLINUX_V4));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, tmp), BT_SYSLINUX_V4));
static_sprintf(tmp, "Syslinux %s", embedded_sl_version_str[1]);
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, tmp), DT_SYSLINUX_V6));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "ReactOS"), DT_REACTOS));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, tmp), BT_SYSLINUX_V6));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "ReactOS"), BT_REACTOS));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType,
"Grub " GRUB2_PACKAGE_VERSION), DT_GRUB2));
"Grub " GRUB2_PACKAGE_VERSION), BT_GRUB2));
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType,
"Grub4DOS " GRUB4DOS_VERSION), DT_GRUB4DOS));
"Grub4DOS " GRUB4DOS_VERSION), BT_GRUB4DOS));
}
if (advanced_mode)
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "UEFI:NTFS"), DT_UEFI_NTFS));
if ((!advanced_mode) && (selection_default >= DT_SYSLINUX_V4)) {
selection_default = DT_FREEDOS;
IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "UEFI:NTFS"), BT_UEFI_NTFS));
if ((!advanced_mode) && (selection_default >= BT_SYSLINUX_V4)) {
selection_default = BT_FREEDOS;
CheckDlgButton(hMainDialog, IDC_DISK_ID, BST_UNCHECKED);
}
for (i=0; i<ComboBox_GetCount(hBootType); i++) {
@ -1966,7 +1968,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
POINT Point;
RECT DialogRect, DesktopRect, LangToolbarRect;
LONG progress_style;
int nDeviceIndex, fs, bt, i, nWidth, nHeight, nb_devices, selected_language, offset;
int nDeviceIndex, fs, tt, i, nWidth, nHeight, nb_devices, selected_language, offset;
char tmp[128];
loc_cmd* lcmd = NULL;
EXT_DECL(img_ext, NULL, __VA_GROUP__("*.img;*.vhd;*.gz;*.bzip2;*.xz;*.lzma;*.Z;*.zip"), __VA_GROUP__(lmprintf(MSG_095)));
@ -2246,11 +2248,11 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
if (HIWORD(wParam) != CBN_SELCHANGE)
break;
fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem));
bt = GETBIOSTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
if ((selection_default == DT_IMG) && IsChecked(IDC_BOOT)) {
tt = GETTARGETTYPE((int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)));
if ((selection_default == BT_IMG) && IsChecked(IDC_BOOT)) {
ToggleImage(FALSE);
EnableAdvancedBootOptions(FALSE, TRUE);
SetBoot(fs, bt);
SetBoot(fs, tt);
SetToGo();
break;
}
@ -2272,8 +2274,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
EnableBootOptions(TRUE, TRUE);
SetMBRProps();
// Remove the SysLinux and ReactOS options if they exists
if (ComboBox_GetItemData(hBootType, ComboBox_GetCount(hBootType)-1) == (DT_MAX-1)) {
for (i=DT_SYSLINUX_V4; i<DT_MAX; i++)
if (ComboBox_GetItemData(hBootType, ComboBox_GetCount(hBootType)-1) == (BT_MAX-1)) {
for (i=BT_SYSLINUX_V4; i<BT_MAX; i++)
IGNORE_RETVAL(ComboBox_DeleteString(hBootType, ComboBox_GetCount(hBootType)-1));
IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 1));
}
@ -2294,13 +2296,13 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break;
}
EnableAdvancedBootOptions(TRUE, TRUE);
SetBoot(fs, bt);
SetBoot(fs, tt);
SetMBRProps();
SetToGo();
break;
case IDC_BOOT:
EnableAdvancedBootOptions(TRUE, TRUE);
if (selection_default == DT_IMG)
if (selection_default == BT_IMG)
ToggleImage(!IsChecked(IDC_BOOT));
break;
case IDC_BOOTTYPE:
@ -2308,15 +2310,15 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break;
selection_default = (int) ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
EnableAdvancedBootOptions(TRUE, TRUE);
ToggleImage(!IsChecked(IDC_BOOT) || (selection_default != DT_IMG));
ToggleImage(!IsChecked(IDC_BOOT) || (selection_default != BT_IMG));
SetToGo();
if ((selection_default == DT_ISO) || (selection_default == DT_IMG)) {
if ((selection_default == BT_ISO) || (selection_default == BT_IMG)) {
if ((image_path != NULL) && (iso_report.label[0] != 0)) {
// Some distros (eg. Arch Linux) want to see a specific label => ignore user one
SetWindowTextU(hLabel, iso_report.label);
}
} else {
if (selection_default == DT_UEFI_NTFS) {
if (selection_default == BT_UEFI_NTFS) {
// Try to select NTFS as default
for (i=0; i<ComboBox_GetCount(hFileSystem); i++) {
fs = (int)ComboBox_GetItemData(hFileSystem, i);
@ -2339,7 +2341,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
iso_provided = FALSE; // One off thing...
} else {
safe_free(image_path);
image_path = FileDialog(FALSE, NULL, (selection_default == DT_IMG)?&img_ext:&iso_ext, 0);
image_path = FileDialog(FALSE, NULL, (selection_default == BT_IMG)?&img_ext:&iso_ext, 0);
if (image_path == NULL) {
CreateTooltip(hSelectISO, lmprintf(MSG_173), -1);
PrintStatus(0, MSG_086);

View file

@ -197,28 +197,28 @@ enum {
FS_MAX
};
enum dos_type {
DT_WINME = 0,
DT_FREEDOS,
DT_ISO,
DT_IMG,
DT_SYSLINUX_V4, // Start of indexes that only display in advanced mode
DT_SYSLINUX_V6,
DT_REACTOS,
DT_GRUB4DOS,
DT_GRUB2,
DT_UEFI_NTFS,
DT_MAX
};
enum bios_type {
BT_BIOS = 0,
BT_UEFI,
enum boot_type {
BT_MSDOS = 0,
BT_FREEDOS,
BT_ISO,
BT_IMG,
BT_SYSLINUX_V4, // Start of indexes that only display in advanced mode
BT_SYSLINUX_V6,
BT_REACTOS,
BT_GRUB4DOS,
BT_GRUB2,
BT_UEFI_NTFS,
BT_MAX
};
enum target_type {
TT_BIOS = 0,
TT_UEFI,
TT_MAX
};
// For the partition types we'll use Microsoft's PARTITION_STYLE_### constants
#define GETBIOSTYPE(x) (((x)>0)?(((x) >> 16) & 0xFFFF):0)
#define GETPARTTYPE(x) (((x)>0)?((x) & 0xFFFF):0);
#define GETTARGETTYPE(x) (((x)>0)?(((x) >> 16) & 0xFFFF):0)
#define GETPARTTYPE(x) (((x)>0)?((x) & 0xFFFF):0);
/* Current drive info */
typedef struct {

View file

@ -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.3.687"
CAPTION "Rufus 2.3.688"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -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.3.687"
CAPTION "Rufus 2.3.688"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -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.3.687"
CAPTION "Rufus 2.3.688"
FONT 8, "Segoe UI", 400, 0, 0x1
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -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.3.687"
CAPTION "Rufus 2.3.688"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Device",IDS_DEVICE_TXT,9,6,200,8
@ -671,8 +671,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,3,687,0
PRODUCTVERSION 2,3,687,0
FILEVERSION 2,3,688,0
PRODUCTVERSION 2,3,688,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -689,13 +689,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "2.3.687"
VALUE "FileVersion", "2.3.688"
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.3.687"
VALUE "ProductVersion", "2.3.688"
END
END
BLOCK "VarFileInfo"

View file

@ -104,10 +104,10 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
int ldlinux_sectors;
uint32_t ldlinux_cluster;
int i, nsectors;
int dt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
BOOL use_v5 = (dt == DT_SYSLINUX_V6) || ((dt == DT_ISO) && (SL_MAJOR(iso_report.sl_version) >= 5));
int bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType));
BOOL use_v5 = (bt == BT_SYSLINUX_V6) || ((bt == BT_ISO) && (SL_MAJOR(iso_report.sl_version) >= 5));
PrintInfoDebug(0, MSG_234, (dt == DT_ISO)?iso_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]);
PrintInfoDebug(0, MSG_234, (bt == BT_ISO)?iso_report.sl_version_str:embedded_sl_version_str[use_v5?1:0]);
// 4K sector size workaround
SECTOR_SHIFT = 0;
@ -186,7 +186,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
}
uprintf("Successfully wrote '%s'\n", &path[3]);
if (dt != DT_ISO)
if (bt != BT_ISO)
UpdateProgress(OP_DOS, -1.0f);
/* Now flush the media */
@ -299,7 +299,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
uprintf("Successfully wrote Syslinux boot record\n");
if (dt == DT_SYSLINUX_V6) {
if (bt == BT_SYSLINUX_V6) {
IGNORE_RETVAL(_chdirU(app_dir));
static_sprintf(path, "%s/%s-%s", FILES_DIR, syslinux, embedded_sl_version_str[1]);
IGNORE_RETVAL(_chdir(path));
@ -350,7 +350,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int fs_type)
fclose(fd);
}
if (dt != DT_ISO)
if (bt != BT_ISO)
UpdateProgress(OP_DOS, -1.0f);
r = TRUE;