diff --git a/res/localization/rufus.loc b/res/localization/rufus.loc index 747c62e3..f17c7456 100644 --- a/res/localization/rufus.loc +++ b/res/localization/rufus.loc @@ -5609,8 +5609,8 @@ t MSG_276 "Ecrire en mode %s (Recommandé)" t MSG_277 "Ecrire en mode %s" t MSG_278 "Type de démarrage" t MSG_279 "Non démarrable" -t MSG_280 "Sélection d'image" -t MSG_281 "(Veuillez sélectioner une image)" +t MSG_280 "Image disque ou ISO" +t MSG_281 "%s (Veuillez sélectioner)" t MSG_282 "Verrouillage exclusif de périphérique USB" t MSG_283 "Signature invalide" t MSG_284 "L'exécutable téléchargé ne possède pas de signature digitale." diff --git a/src/localization_data.h b/src/localization_data.h index 7011dcbc..cf146afd 100644 --- a/src/localization_data.h +++ b/src/localization_data.h @@ -45,7 +45,6 @@ const loc_control_id control_id[] = { LOC_CTRL(IDC_STATUS), LOC_CTRL(IDC_LABEL), LOC_CTRL(IDC_QUICKFORMAT), - LOC_CTRL(IDC_SHOW_ADVANCED_TOOLBAR), LOC_CTRL(IDC_BADBLOCKS), LOC_CTRL(IDC_PROGRESS), LOC_CTRL(IDC_BOOT_TYPE), @@ -78,7 +77,6 @@ const loc_control_id control_id[] = { LOC_CTRL(IDC_LOG), LOC_CTRL(IDC_WINDOWS_INSTALL), LOC_CTRL(IDC_WINDOWS_TO_GO), - LOC_CTRL(IDC_SHOW_ADVANCED_OPTIONS), LOC_CTRL(IDC_MULTI_TOOLBAR), LOC_CTRL(IDC_SETTINGS), LOC_CTRL(IDC_LOG_EDIT), diff --git a/src/resource.h b/src/resource.h index 55c5d55e..7405cefa 100644 --- a/src/resource.h +++ b/src/resource.h @@ -79,27 +79,25 @@ #define IDC_PARTITION_TYPE 1004 #define IDC_CLUSTERSIZE 1005 #define IDC_STATUS 1006 -#define IDC_LABEL 1008 -#define IDC_QUICKFORMAT 1009 -#define IDC_SHOW_ADVANCED_TOOLBAR 1010 -#define IDC_BADBLOCKS 1011 -#define IDC_PROGRESS 1012 -#define IDC_BOOT_TYPE 1013 -#define IDC_NBPASSES 1014 -#define IDC_TEST 1015 -#define IDC_SELECT 1016 -#define IDC_EXTENDED_LABEL 1017 -#define IDC_RUFUS_MBR 1018 -#define IDC_TARGET_SYSTEM 1019 -#define IDC_INFO 1020 -#define IDC_LANG 1021 -#define IDC_DISK_ID 1022 -#define IDC_OLD_BIOS_FIXES 1023 -#define IDC_LIST_USB_HDD 1024 -#define IDC_STATUS_TOOLBAR 1025 -#define IDC_HASH 1026 -#define IDC_SAVE 1027 -#define IDC_IMAGE_OPTION 1029 +#define IDC_LABEL 1007 +#define IDC_QUICKFORMAT 1008 +#define IDC_BADBLOCKS 1009 +#define IDC_PROGRESS 1010 +#define IDC_BOOT_TYPE 1011 +#define IDC_NBPASSES 1012 +#define IDC_TEST 1013 +#define IDC_SELECT 1014 +#define IDC_EXTENDED_LABEL 1015 +#define IDC_RUFUS_MBR 1016 +#define IDC_TARGET_SYSTEM 1017 +#define IDC_INFO 1018 +#define IDC_DISK_ID 1020 +#define IDC_OLD_BIOS_FIXES 1021 +#define IDC_LIST_USB_HDD 1022 +#define IDC_STATUS_TOOLBAR 1023 +#define IDC_HASH 1024 +#define IDC_SAVE 1025 +#define IDC_IMAGE_OPTION 1026 #define IDC_ABOUT_LICENSE 1030 #define IDC_ABOUT_ICON 1031 #define IDC_ABOUT_COPYRIGHTS 1032 @@ -110,13 +108,14 @@ #define IDC_NOTIFICATION_LINE 1042 #define IDC_ADVANCED_DEVICE_TOOLBAR 1043 #define IDC_ADVANCED_FORMAT_TOOLBAR 1044 -#define IDC_ABOUT 1045 -#define IDC_LOG 1046 #define IDC_WINDOWS_INSTALL 1047 #define IDC_WINDOWS_TO_GO 1048 -#define IDC_SHOW_ADVANCED_OPTIONS 1049 +#define IDC_CHECKSUM_TOOLBAR 1049 #define IDC_MULTI_TOOLBAR 1050 -#define IDC_SETTINGS 1051 +#define IDC_LANG 1051 +#define IDC_ABOUT 1052 +#define IDC_SETTINGS 1053 +#define IDC_LOG 1054 #define IDC_LOG_EDIT 1055 #define IDC_LOG_SAVE 1056 #define IDC_LOG_CLEAR 1057 diff --git a/src/rufus.c b/src/rufus.c index 35c6ae90..3646ee02 100644 --- a/src/rufus.c +++ b/src/rufus.c @@ -166,7 +166,7 @@ static int64_t last_iso_blocking_status; // TODO: rename 'selection_default' to something more explicit static int selection_default, row_height, advanced_device_section_height, advanced_format_section_height, image_index; static int device_vpos, format_vpos, status_vpos; -static int cb_width, dd_width, sep_width, margin_width, half_width, full_width, hash_button_width, small_button_width, small_sep_width; +static int cb_width, sep_width, margin_width, half_width, full_width, hash_button_width, small_button_width, small_sep_width; static UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU; static RECT relaunch_rc = { -65536, -65536, 0, 0}; static UINT uQFChecked = BST_CHECKED, uMBRChecked = BST_UNCHECKED; @@ -193,7 +193,7 @@ extern const char* sfd_name; */ OPENED_LIBRARIES_VARS; HINSTANCE hMainInstance; -HWND hMainDialog, hMultiToolbar = NULL, hAdvancedDeviceToolBar, hAdvancedFormatToolBar, hUpdatesDlg = NULL; +HWND hMainDialog, hMultiToolbar, hAdvancedDeviceToolbar, hAdvancedFormatToolbar, hUpdatesDlg = NULL; HIMAGELIST hUpImageList, hDownImageList; BUTTON_IMAGELIST bi_iso = { 0 }, bi_up = { 0 }, bi_down = { 0 }, bi_save = { 0 }; char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH]; @@ -210,7 +210,7 @@ BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, tog BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE, progress_in_use = FALSE; BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE; BOOL advanced_mode_device, advanced_mode_format, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug, use_fake_units, preserve_timestamps; -BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, disable_file_indexing, large_drive = FALSE, prefer_gpt = FALSE; +BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, disable_file_indexing, large_drive = FALSE; int dialog_showing = 0; uint16_t rufus_version[3], embedded_sl_version[2]; char embedded_sl_version_str[2][12] = { "?.??", "?.??" }; @@ -281,9 +281,10 @@ static void SetAllowedFileSystems(void) allowed_filesystem[FS_FAT32] = TRUE; break; case BT_IMAGE: - // TODO: only do this if ISO we can service - allowed_filesystem[FS_FAT16] = TRUE; - allowed_filesystem[FS_FAT32] = TRUE; + if (!HAS_WINDOWS(img_report) || (tt != TT_BIOS) || allow_dual_uefi_bios) { + allowed_filesystem[FS_FAT16] = TRUE; + allowed_filesystem[FS_FAT32] = TRUE; + } allowed_filesystem[FS_NTFS] = TRUE; break; case BT_SYSLINUX_V6: @@ -333,9 +334,8 @@ static void SetBootOptions(void) "Grub4DOS " GRUB4DOS_VERSION), BT_GRUB4DOS)); IGNORE_RETVAL(ComboBox_SetItemData(hBootType, ComboBox_AddStringU(hBootType, "UEFI:NTFS"), BT_UEFI_NTFS)); } - // TODO: re-select last image instead of FreeDOS if ((!advanced_mode_device) && (selection_default >= BT_SYSLINUX_V4)) { - selection_default = BT_FREEDOS; + selection_default = BT_IMAGE; CheckDlgButton(hMainDialog, IDC_DISK_ID, BST_UNCHECKED); } SetComboEntry(hBootType, selection_default); @@ -346,7 +346,6 @@ static void SetPartitionSchemeAndTargetSystem(BOOL only_target) BOOL allowed_partition_scheme[3] = { TRUE, TRUE, FALSE }; BOOL allowed_target_system[3] = { TRUE, TRUE, FALSE }; BOOL dual_boot = FALSE; -// BOOL prefer_gpt = FALSE; // TODO: Windows To Go selected BOOL is_windows_to_go_selected = FALSE; @@ -363,12 +362,8 @@ static void SetPartitionSchemeAndTargetSystem(BOOL only_target) allowed_target_system[2] = TRUE; break; case BT_IMAGE: - if (pt == PARTITION_STYLE_GPT) - allowed_target_system[0] = FALSE; if (image_path == NULL) break; -// if HAS_BOOTMGR(img_report) -// prefer_gpt = TRUE; // Check if image is EFI bootable if (!IS_EFI_BOOTABLE(img_report)) { allowed_partition_scheme[PARTITION_STYLE_GPT] = FALSE; @@ -379,12 +374,8 @@ static void SetPartitionSchemeAndTargetSystem(BOOL only_target) if (IS_BIOS_BOOTABLE(img_report)) { if (!HAS_WINDOWS(img_report) || allow_dual_uefi_bios || is_windows_to_go_selected) { allowed_target_system[0] = FALSE; - allowed_target_system[1] = FALSE; + allowed_target_system[1] = TRUE; allowed_target_system[2] = TRUE; - } else { - // If GPT is selected, only enable UEFI as target - if (prefer_gpt) - allowed_target_system[0] = FALSE; } } else { allowed_target_system[0] = FALSE; @@ -415,19 +406,21 @@ static void SetPartitionSchemeAndTargetSystem(BOOL only_target) if (allowed_partition_scheme[PARTITION_STYLE_SFD]) IGNORE_RETVAL(ComboBox_SetItemData(hPartitionScheme, ComboBox_AddStringU(hPartitionScheme, sfd_name), PARTITION_STYLE_SFD)); - SetComboEntry(hPartitionScheme, prefer_gpt ? PARTITION_STYLE_GPT : PARTITION_STYLE_MBR); + SetComboEntry(hPartitionScheme, PARTITION_STYLE_GPT); + pt = (int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme)); } - if (allowed_target_system[0]) + if (allowed_target_system[0] && (pt != PARTITION_STYLE_GPT)) IGNORE_RETVAL(ComboBox_SetItemData(hTargetSystem, ComboBox_AddStringU(hTargetSystem, lmprintf(MSG_031)), TT_BIOS)); - if (allowed_target_system[1]) + if (allowed_target_system[1] && !((pt == PARTITION_STYLE_MBR) && IS_BIOS_BOOTABLE(img_report) && IS_EFI_BOOTABLE(img_report)) ) IGNORE_RETVAL(ComboBox_SetItemData(hTargetSystem, ComboBox_AddStringU(hTargetSystem, lmprintf(MSG_032)), TT_UEFI)); - if (allowed_target_system[2]) + if (allowed_target_system[2] && (pt != PARTITION_STYLE_GPT)) IGNORE_RETVAL(ComboBox_SetItemData(hTargetSystem, ComboBox_AddStringU(hTargetSystem, lmprintf(MSG_033)), TT_BIOS)); IGNORE_RETVAL(ComboBox_SetCurSel(hTargetSystem, 0)); + tt = (int)ComboBox_GetItemData(hTargetSystem, ComboBox_GetCurSel(hTargetSystem)); } // Populate the Allocation unit size field @@ -906,10 +899,7 @@ static BOOL PopulateProperties(int device_index) free(device_tooltip); } - - // TODO: should only be enabled when we are in a position to start - // i.e. not if Image is selected and no image - EnableWindow(hStart, TRUE); + EnableWindow(hStart, (bt != BT_IMAGE) || (image_path != NULL)); out: SetProposedLabel(device_index); @@ -1048,19 +1038,17 @@ static void EnableControls(BOOL bEnable) EnableBootOptions(bEnable, FALSE); EnableWindow(hSelectImage, bEnable); EnableWindow(hNBPasses, bEnable); - EnableWindow(hAdvancedDeviceToolBar, bEnable); - EnableWindow(hAdvancedFormatToolBar, bEnable); + EnableWindow(hAdvancedDeviceToolbar, bEnable); + EnableWindow(hAdvancedFormatToolbar, bEnable); + SendMessage(hMultiToolbar, TB_ENABLEBUTTON, (WPARAM)IDC_LANG, (LPARAM)bEnable); SendMessage(hMultiToolbar, TB_ENABLEBUTTON, (WPARAM)IDC_ABOUT, (LPARAM)bEnable); SendMessage(hMultiToolbar, TB_ENABLEBUTTON, (WPARAM)IDC_SETTINGS, (LPARAM)bEnable); - SendMessage(hMultiToolbar, TB_ENABLEBUTTON, (WPARAM)IDC_LANG, (LPARAM)bEnable); EnableWindow(hStatusToolbar, bEnable); EnableWindow(GetDlgItem(hMainDialog, IDC_LIST_USB_HDD), bEnable); SetDlgItemTextU(hMainDialog, IDCANCEL, lmprintf(bEnable?MSG_006:MSG_007)); - if ((selection_default == BT_IMAGE) && (!img_report.is_iso)) - return; EnableWindow(GetDlgItem(hMainDialog, IDC_PARTITION_TYPE), bEnable); EnableWindow(GetDlgItem(hMainDialog, IDC_TARGET_SYSTEM), bEnable); - EnableWindow(GetDlgItem(hMainDialog, IDC_HASH), bEnable); + EnableWindow(GetDlgItem(hMainDialog, IDC_HASH), bEnable && (image_path != NULL)); EnableWindow(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), bEnable); EnableWindow(GetDlgItem(hMainDialog, IDC_FILESYSTEM), bEnable); EnableWindow(GetDlgItem(hMainDialog, IDC_CLUSTERSIZE), bEnable); @@ -1293,12 +1281,12 @@ static void ToggleAdvancedDeviceOptions(BOOL enable) button_info.cbSize = sizeof(button_info); button_info.dwMask = TBIF_TEXT; button_info.pszText = wtbtext[0]; - SendMessage(hAdvancedDeviceToolBar, TB_SETBUTTONINFO, (WPARAM)IDC_ADVANCED_DRIVE_PROPERTIES, (LPARAM)&button_info); - SendMessage(hAdvancedDeviceToolBar, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)((enable) ? hUpImageList : hDownImageList)); - GetWindowRect(hAdvancedDeviceToolBar, &rc); + SendMessage(hAdvancedDeviceToolbar, TB_SETBUTTONINFO, (WPARAM)IDC_ADVANCED_DRIVE_PROPERTIES, (LPARAM)&button_info); + SendMessage(hAdvancedDeviceToolbar, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)((enable) ? hUpImageList : hDownImageList)); + GetWindowRect(hAdvancedDeviceToolbar, &rc); MapWindowPoints(NULL, hMainDialog, (POINT*)&rc, 2); - SendMessage(hAdvancedDeviceToolBar, TB_GETIDEALSIZE, (WPARAM)FALSE, (LPARAM)&sz); - SetWindowPos(hAdvancedDeviceToolBar, HWND_TOP, rc.left, rc.top, sz.cx, rc.bottom - rc.top, 0); + SendMessage(hAdvancedDeviceToolbar, TB_GETIDEALSIZE, (WPARAM)FALSE, (LPARAM)&sz); + SetWindowPos(hAdvancedDeviceToolbar, HWND_TOP, rc.left, rc.top, sz.cx, rc.bottom - rc.top, 0); // Move the controls up or down for (i = 0; i don't bother - // IGNORE_RETVAL(ComboBox_SetCurSel(hBootType, 0)); - // uBootChecked = IsChecked(IDC_BOOT); - // CheckDlgButton(hDlg, IDC_BOOT, BST_UNCHECKED); - // EnableBootOptions(FALSE, TRUE); - // } else if (IsChecked(IDC_BOOT)) { - // uBootChecked = TRUE; - // CheckDlgButton(hDlg, IDC_BOOT, BST_UNCHECKED); - // } - // SetMBRProps(); - // break; - //} EnableAdvancedBootOptions(TRUE, TRUE); -// SetAllowedFileSystems(fs, tt, pt); SetMBRProps(); -// SetToGo(); break; case IDC_BOOT_TYPE: bt = (int)ComboBox_GetItemData(hBootType, ComboBox_GetCurSel(hBootType)); @@ -3256,11 +3198,9 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA break; case IDC_LANG: // Show the language menu such that it doesn't overlap the button - // by using the the next button (LOG) as our starting point. - SendMessage(hMultiToolbar, TB_GETRECT, (WPARAM)IDC_LOG, (LPARAM)&rc); + SendMessage(hMultiToolbar, TB_GETRECT, (WPARAM)IDC_ABOUT, (LPARAM)&rc); MapWindowPoints(hDlg, NULL, (POINT*)&rc, 2); - // TODO: add a proper fudge - rc.left += 10; + rc.left += cb_width / 2; ShowLanguageMenu(rc); break; case IDC_SETTINGS: @@ -3416,16 +3356,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA EndPaint(hDlg, &ps); break; - case WM_CTLCOLORSTATIC: - if ((HWND)lParam == GetDlgItem(hDlg, IDC_SHOW_ADVANCED_OPTIONS)) { - SetBkMode((HDC)wParam, TRANSPARENT); - CreateStaticFont((HDC)wParam, &hLinkFont, FALSE); - SelectObject((HDC)wParam, hLinkFont); - SetTextColor((HDC)wParam, RGB(0, 0, 125)); - return (INT_PTR)GetStockObject(NULL_BRUSH); - } - break; - case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case TTN_GETDISPINFO: