diff --git a/src/format.c b/src/format.c index c27610ca..21457367 100644 --- a/src/format.c +++ b/src/format.c @@ -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]; diff --git a/src/iso.c b/src/iso.c index 8a651814..f9e6c5d0 100644 --- a/src/iso.c +++ b/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; i4GB 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 @@ -978,6 +994,9 @@ DWORD WINAPI ISOScanThread(LPVOID param) // Lose the focus from Close and set it back to Start 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); @@ -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 diff --git a/src/rufus.h b/src/rufus.h index 562c014c..962d4a64 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -229,8 +229,9 @@ typedef struct { #define WINPE_MININT 0x2A #define WINPE_I386 0x15 #define HAS_SYSLINUX(r) (r.sl_version != 0) -#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 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_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; diff --git a/src/rufus.rc b/src/rufus.rc index 30ab74e9..8be43350 100644 --- a/src/rufus.rc +++ b/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"