mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[ui] initial work for the display of a persistence option
* This doesn't mean we'll get persistence support any time soon, but any UI work on this needs to be carried out *MONTHS* in advance because of the translators.
This commit is contained in:
parent
5602494690
commit
a34cb1194e
7 changed files with 127 additions and 88 deletions
|
@ -1683,7 +1683,7 @@ DWORD WINAPI FormatThread(void* param)
|
||||||
char grub4dos_dst[] = "?:\\grldr";
|
char grub4dos_dst[] = "?:\\grldr";
|
||||||
|
|
||||||
use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32));
|
use_large_fat32 = (fs == FS_FAT32) && ((SelectedDrive.DiskSize > LARGE_FAT32_SIZE) || (force_large_fat32));
|
||||||
windows_to_go = display_togo_option && (bt == BT_IMAGE) && HAS_WINTOGO(img_report) &&
|
windows_to_go = (image_options & IMOP_WINTOGO) && (bt == BT_IMAGE) && HAS_WINTOGO(img_report) &&
|
||||||
(ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1);
|
(ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1);
|
||||||
large_drive = (SelectedDrive.DiskSize > (1*TB));
|
large_drive = (SelectedDrive.DiskSize > (1*TB));
|
||||||
if (large_drive)
|
if (large_drive)
|
||||||
|
|
|
@ -54,6 +54,8 @@ const loc_control_id control_id[] = {
|
||||||
LOC_CTRL(IDC_EXTENDED_LABEL),
|
LOC_CTRL(IDC_EXTENDED_LABEL),
|
||||||
LOC_CTRL(IDC_RUFUS_MBR),
|
LOC_CTRL(IDC_RUFUS_MBR),
|
||||||
LOC_CTRL(IDC_TARGET_SYSTEM),
|
LOC_CTRL(IDC_TARGET_SYSTEM),
|
||||||
|
LOC_CTRL(IDC_PERSISTENCE_SIZE),
|
||||||
|
LOC_CTRL(IDC_PERSISTENCE_UNITS),
|
||||||
LOC_CTRL(IDC_DISK_ID),
|
LOC_CTRL(IDC_DISK_ID),
|
||||||
LOC_CTRL(IDC_OLD_BIOS_FIXES),
|
LOC_CTRL(IDC_OLD_BIOS_FIXES),
|
||||||
LOC_CTRL(IDC_LIST_USB_HDD),
|
LOC_CTRL(IDC_LIST_USB_HDD),
|
||||||
|
@ -61,6 +63,9 @@ const loc_control_id control_id[] = {
|
||||||
LOC_CTRL(IDC_SAVE),
|
LOC_CTRL(IDC_SAVE),
|
||||||
LOC_CTRL(IDC_HASH),
|
LOC_CTRL(IDC_HASH),
|
||||||
LOC_CTRL(IDC_IMAGE_OPTION),
|
LOC_CTRL(IDC_IMAGE_OPTION),
|
||||||
|
LOC_CTRL(IDC_PERSISTENCE_SLIDER),
|
||||||
|
LOC_CTRL(IDC_ADVANCED_DRIVE_PROPERTIES),
|
||||||
|
LOC_CTRL(IDC_ADVANCED_FORMAT_OPTIONS),
|
||||||
LOC_CTRL(IDC_ABOUT_LICENSE),
|
LOC_CTRL(IDC_ABOUT_LICENSE),
|
||||||
LOC_CTRL(IDC_ABOUT_ICON),
|
LOC_CTRL(IDC_ABOUT_ICON),
|
||||||
LOC_CTRL(IDC_ABOUT_COPYRIGHTS),
|
LOC_CTRL(IDC_ABOUT_COPYRIGHTS),
|
||||||
|
@ -133,8 +138,6 @@ const loc_control_id control_id[] = {
|
||||||
LOC_CTRL(IDC_LIST_ITEM14),
|
LOC_CTRL(IDC_LIST_ITEM14),
|
||||||
LOC_CTRL(IDC_LIST_ITEM15),
|
LOC_CTRL(IDC_LIST_ITEM15),
|
||||||
LOC_CTRL(IDC_LIST_ITEMMAX),
|
LOC_CTRL(IDC_LIST_ITEMMAX),
|
||||||
LOC_CTRL(IDC_ADVANCED_DRIVE_PROPERTIES),
|
|
||||||
LOC_CTRL(IDC_ADVANCED_FORMAT_OPTIONS),
|
|
||||||
LOC_CTRL(IDS_DEVICE_TXT),
|
LOC_CTRL(IDS_DEVICE_TXT),
|
||||||
LOC_CTRL(IDS_PARTITION_TYPE_TXT),
|
LOC_CTRL(IDS_PARTITION_TYPE_TXT),
|
||||||
LOC_CTRL(IDS_FILE_SYSTEM_TXT),
|
LOC_CTRL(IDS_FILE_SYSTEM_TXT),
|
||||||
|
|
|
@ -108,6 +108,8 @@
|
||||||
#define IDC_EXTENDED_LABEL 1015
|
#define IDC_EXTENDED_LABEL 1015
|
||||||
#define IDC_RUFUS_MBR 1016
|
#define IDC_RUFUS_MBR 1016
|
||||||
#define IDC_TARGET_SYSTEM 1017
|
#define IDC_TARGET_SYSTEM 1017
|
||||||
|
#define IDC_PERSISTENCE_SIZE 1118
|
||||||
|
#define IDC_PERSISTENCE_UNITS 1019
|
||||||
#define IDC_DISK_ID 1020
|
#define IDC_DISK_ID 1020
|
||||||
#define IDC_OLD_BIOS_FIXES 1021
|
#define IDC_OLD_BIOS_FIXES 1021
|
||||||
#define IDC_LIST_USB_HDD 1022
|
#define IDC_LIST_USB_HDD 1022
|
||||||
|
@ -115,6 +117,9 @@
|
||||||
#define IDC_SAVE 1024
|
#define IDC_SAVE 1024
|
||||||
#define IDC_HASH 1025
|
#define IDC_HASH 1025
|
||||||
#define IDC_IMAGE_OPTION 1026
|
#define IDC_IMAGE_OPTION 1026
|
||||||
|
#define IDC_PERSISTENCE_SLIDER 1027
|
||||||
|
#define IDC_ADVANCED_DRIVE_PROPERTIES 1028
|
||||||
|
#define IDC_ADVANCED_FORMAT_OPTIONS 1029
|
||||||
#define IDC_ABOUT_LICENSE 1030
|
#define IDC_ABOUT_LICENSE 1030
|
||||||
#define IDC_ABOUT_ICON 1031
|
#define IDC_ABOUT_ICON 1031
|
||||||
#define IDC_ABOUT_COPYRIGHTS 1032
|
#define IDC_ABOUT_COPYRIGHTS 1032
|
||||||
|
@ -187,8 +192,6 @@
|
||||||
#define IDC_LIST_ITEM14 1109
|
#define IDC_LIST_ITEM14 1109
|
||||||
#define IDC_LIST_ITEM15 1110
|
#define IDC_LIST_ITEM15 1110
|
||||||
#define IDC_LIST_ITEMMAX 1111
|
#define IDC_LIST_ITEMMAX 1111
|
||||||
#define IDC_ADVANCED_DRIVE_PROPERTIES 1112
|
|
||||||
#define IDC_ADVANCED_FORMAT_OPTIONS 1113
|
|
||||||
#define IDS_DEVICE_TXT 2000
|
#define IDS_DEVICE_TXT 2000
|
||||||
#define IDS_PARTITION_TYPE_TXT 2001
|
#define IDS_PARTITION_TYPE_TXT 2001
|
||||||
#define IDS_FILE_SYSTEM_TXT 2002
|
#define IDS_FILE_SYSTEM_TXT 2002
|
||||||
|
@ -538,7 +541,7 @@
|
||||||
#define _APS_NO_MFC 1
|
#define _APS_NO_MFC 1
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 505
|
#define _APS_NEXT_RESOURCE_VALUE 505
|
||||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
#define _APS_NEXT_CONTROL_VALUE 1114
|
#define _APS_NEXT_CONTROL_VALUE 1112
|
||||||
#define _APS_NEXT_SYMED_VALUE 4000
|
#define _APS_NEXT_SYMED_VALUE 4000
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
111
src/rufus.c
111
src/rufus.c
|
@ -36,6 +36,7 @@
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
#include "rufus.h"
|
#include "rufus.h"
|
||||||
#include "missing.h"
|
#include "missing.h"
|
||||||
|
@ -96,37 +97,36 @@ extern const char* sfd_name;
|
||||||
* Globals
|
* Globals
|
||||||
*/
|
*/
|
||||||
OPENED_LIBRARIES_VARS;
|
OPENED_LIBRARIES_VARS;
|
||||||
|
RUFUS_UPDATE update = { { 0,0,0 },{ 0,0 }, NULL, NULL };
|
||||||
HINSTANCE hMainInstance;
|
HINSTANCE hMainInstance;
|
||||||
HWND hMainDialog, hMultiToolbar, hSaveToolbar, hHashToolbar, hAdvancedDeviceToolbar, hAdvancedFormatToolbar, hUpdatesDlg = NULL;
|
HWND hMainDialog, hMultiToolbar, hSaveToolbar, hHashToolbar, hAdvancedDeviceToolbar, hAdvancedFormatToolbar, hUpdatesDlg = NULL;
|
||||||
HIMAGELIST hUpImageList, hDownImageList;
|
HIMAGELIST hUpImageList, hDownImageList;
|
||||||
char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH];
|
uint8_t image_options = 0x00;
|
||||||
char *image_path = NULL, *short_image_path;
|
uint16_t rufus_version[3], embedded_sl_version[2];
|
||||||
float fScale = 1.0f;
|
uint32_t dur_mins, dur_secs, DrivePort[MAX_DRIVES];;
|
||||||
int default_fs, fs, bt, pt, tt; // file system, boot type, partition type, target type
|
|
||||||
int cbw, ddw, ddbh = 0, bh = 0; // (empty) check box width, (empty) drop down width, button height (for and without dropdown match)
|
|
||||||
uint32_t dur_mins, dur_secs;
|
|
||||||
loc_cmd* selected_locale = NULL;
|
loc_cmd* selected_locale = NULL;
|
||||||
WORD selected_langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
|
WORD selected_langid = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT);
|
||||||
DWORD MainThreadId;
|
DWORD MainThreadId;
|
||||||
HWND hDeviceList, hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL;
|
HWND hDeviceList, hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog = NULL;
|
||||||
HWND hLogDialog = NULL, hProgress = NULL, hDiskID;
|
HWND hLogDialog = NULL, hProgress = NULL, hDiskID;
|
||||||
BOOL use_own_c32[NB_OLD_C32] = {FALSE, FALSE}, mbr_selected_by_user = FALSE, display_togo_option = FALSE;
|
BOOL use_own_c32[NB_OLD_C32] = { FALSE, FALSE }, mbr_selected_by_user = FALSE;
|
||||||
BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE, has_uefi_csm;
|
BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mode = FALSE, has_uefi_csm;
|
||||||
BOOL enable_HDDs = FALSE, force_update = FALSE, enable_ntfs_compression = FALSE, no_confirmation_on_cancel = FALSE, lock_drive = TRUE;
|
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;
|
BOOL advanced_mode_device, advanced_mode_format, allow_dual_uefi_bios, detect_fakes, enable_vmdk, force_large_fat32, usb_debug;
|
||||||
BOOL use_fake_units, preserve_timestamps = FALSE;
|
BOOL use_fake_units, preserve_timestamps = FALSE;
|
||||||
BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, enable_file_indexing, large_drive = FALSE, write_as_image = FALSE;
|
BOOL zero_drive = FALSE, list_non_usb_removable_drives = FALSE, enable_file_indexing, large_drive = FALSE, write_as_image = FALSE;
|
||||||
|
float fScale = 1.0f;
|
||||||
int dialog_showing = 0;
|
int dialog_showing = 0;
|
||||||
uint16_t rufus_version[3], embedded_sl_version[2];
|
int default_fs, fs, bt, pt, tt; // file system, boot type, partition type, target type
|
||||||
|
int cbw, ddw, ddbh = 0, bh = 0; // (empty) check box width, (empty) drop down width, button height (for and without dropdown match)
|
||||||
|
char szFolderPath[MAX_PATH], app_dir[MAX_PATH], system_dir[MAX_PATH], temp_dir[MAX_PATH], sysnative_dir[MAX_PATH];
|
||||||
char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
|
char embedded_sl_version_str[2][12] = { "?.??", "?.??" };
|
||||||
char embedded_sl_version_ext[2][32];
|
char embedded_sl_version_ext[2][32];
|
||||||
char ClusterSizeLabel[MAX_CLUSTER_SIZES][64];
|
char ClusterSizeLabel[MAX_CLUSTER_SIZES][64];
|
||||||
char msgbox[1024], msgbox_title[32], *ini_file = NULL;
|
char msgbox[1024], msgbox_title[32], *ini_file = NULL, *image_path = NULL, *short_image_path;
|
||||||
RUFUS_UPDATE update = { {0,0,0}, {0,0}, NULL, NULL};
|
|
||||||
StrArray DriveID, DriveLabel, DriveHub, BlockingProcess, ImageList;
|
StrArray DriveID, DriveLabel, DriveHub, BlockingProcess, ImageList;
|
||||||
uint32_t DrivePort[MAX_DRIVES];
|
|
||||||
|
|
||||||
static void ToggleImageOption(void);
|
static void ToggleImageOption(uint8_t mask);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following is used to allocate slots within the progress bar
|
* The following is used to allocate slots within the progress bar
|
||||||
|
@ -577,7 +577,7 @@ static void SetFSFromISO(void)
|
||||||
{
|
{
|
||||||
int i, fs_tmp, preferred_fs = FS_UNKNOWN;
|
int i, fs_tmp, preferred_fs = FS_UNKNOWN;
|
||||||
uint32_t fs_mask = 0;
|
uint32_t fs_mask = 0;
|
||||||
BOOL windows_to_go = display_togo_option && (bt == BT_IMAGE) && HAS_WINTOGO(img_report) &&
|
BOOL windows_to_go = (image_options & IMOP_WINTOGO) && (bt == BT_IMAGE) && HAS_WINTOGO(img_report) &&
|
||||||
(ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1);
|
(ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1);
|
||||||
|
|
||||||
if (image_path == NULL)
|
if (image_path == NULL)
|
||||||
|
@ -624,7 +624,7 @@ static void SetMBRProps(void)
|
||||||
BOOL needs_masquerading = HAS_WINPE(img_report) && (!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_IMAGE) || (fs != FS_NTFS) || HAS_GRUB(img_report) ||
|
if ((!mbr_selected_by_user) && ((image_path == NULL) || (bt != BT_IMAGE) || (fs != FS_NTFS) || HAS_GRUB(img_report) ||
|
||||||
((display_togo_option) && (ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1)) )) {
|
((image_options & IMOP_WINTOGO) && (ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1)) )) {
|
||||||
CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, BST_UNCHECKED);
|
CheckDlgButton(hMainDialog, IDC_RUFUS_MBR, BST_UNCHECKED);
|
||||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, 0));
|
IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, 0));
|
||||||
return;
|
return;
|
||||||
|
@ -636,19 +636,23 @@ static void SetMBRProps(void)
|
||||||
IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, needs_masquerading?1:0));
|
IGNORE_RETVAL(ComboBox_SetCurSel(hDiskID, needs_masquerading?1:0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetToGo(void)
|
static void SetImageOptions(void)
|
||||||
{
|
{
|
||||||
HWND hCtrl = GetDlgItem(hMainDialog, IDC_IMAGE_OPTION);
|
if ((bt != BT_IMAGE) || (image_path == NULL)) {
|
||||||
|
if (image_options & IMOP_WINTOGO)
|
||||||
|
ToggleImageOption(IMOP_WINTOGO);
|
||||||
|
if (image_options & IMOP_PERSISTENCE)
|
||||||
|
ToggleImageOption(IMOP_PERSISTENCE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Populate the dropdown
|
if ( (!HAS_WINTOGO(img_report) && ( (image_options & IMOP_WINTOGO))) ||
|
||||||
IGNORE_RETVAL(ComboBox_ResetContent(hCtrl));
|
( HAS_WINTOGO(img_report) && (!(image_options & IMOP_WINTOGO))) ) {
|
||||||
IGNORE_RETVAL(ComboBox_SetItemData(hCtrl, ComboBox_AddStringU(hCtrl, lmprintf(MSG_117)), FALSE));
|
ToggleImageOption(IMOP_WINTOGO);
|
||||||
IGNORE_RETVAL(ComboBox_SetItemData(hCtrl, ComboBox_AddStringU(hCtrl, lmprintf(MSG_118)), TRUE));
|
}
|
||||||
IGNORE_RETVAL(ComboBox_SetCurSel(hCtrl, windows_to_go_selection));
|
if ( (!HAS_PERSISTENCE(img_report) && ( (image_options & IMOP_PERSISTENCE))) ||
|
||||||
|
( HAS_PERSISTENCE(img_report) && (!(image_options & IMOP_PERSISTENCE))) ) {
|
||||||
if ((((bt != BT_IMAGE) || (image_path == NULL) || (!HAS_WINTOGO(img_report))) && (display_togo_option)) ||
|
ToggleImageOption(IMOP_PERSISTENCE);
|
||||||
((bt == BT_IMAGE) && (HAS_WINTOGO(img_report)) && (!display_togo_option))) {
|
|
||||||
ToggleImageOption();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1153,10 +1157,7 @@ static void DisplayISOProps(void)
|
||||||
PRINT_ISO_PROP(img_report.has_symlinks, " Note: This ISO uses symbolic links, which will not be replicated due to file system limitations.");
|
PRINT_ISO_PROP(img_report.has_symlinks, " Note: This ISO uses symbolic links, which will not be replicated due to file system limitations.");
|
||||||
PRINT_ISO_PROP(img_report.has_symlinks, " Because of this, some features from this image may not work...");
|
PRINT_ISO_PROP(img_report.has_symlinks, " Because of this, some features from this image may not work...");
|
||||||
|
|
||||||
// We don't support ToGo on Windows 7 or earlier, for lack of native ISO mounting capabilities
|
SetImageOptions();
|
||||||
if (nWindowsVersion >= WINDOWS_8)
|
|
||||||
if ( ((!display_togo_option) && (HAS_WINTOGO(img_report))) || ((display_togo_option) && (!HAS_WINTOGO(img_report))) )
|
|
||||||
ToggleImageOption();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move a control along the Y axis
|
// Move a control along the Y axis
|
||||||
|
@ -1283,32 +1284,47 @@ static void ToggleAdvancedFormatOptions(BOOL enable)
|
||||||
InvalidateRect(hMainDialog, NULL, TRUE);
|
InvalidateRect(hMainDialog, NULL, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle the Image Option dropdown (Windows To Go or Casper settings)
|
// Toggle the Image Option dropdown (Windows To Go or persistence settings)
|
||||||
static void ToggleImageOption(void)
|
static void ToggleImageOption(uint8_t mask)
|
||||||
{
|
{
|
||||||
int i, shift = row_height;
|
int i, shift = (__popcnt16(image_options) >= 2) ? 0 : row_height;
|
||||||
// Windows To Go mode is only available for Windows 8 or later due to the lack
|
|
||||||
// of an ISO mounting API on previous versions.
|
|
||||||
// But we still need to be able to hide the Windows To Go option on startup.
|
|
||||||
if ((nWindowsVersion < WINDOWS_8) && (!display_togo_option))
|
|
||||||
return;
|
|
||||||
|
|
||||||
display_togo_option = !display_togo_option;
|
assert(__popcnt16(mask) <= 1);
|
||||||
if (!display_togo_option)
|
|
||||||
|
if (mask & IMOP_WINTOGO) {
|
||||||
|
if (nWindowsVersion < WINDOWS_8)
|
||||||
|
return;
|
||||||
|
image_options ^= IMOP_WINTOGO;
|
||||||
|
// Set the Windows To Go selection in the dropdown
|
||||||
|
IGNORE_RETVAL(ComboBox_SetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION), windows_to_go_selection));
|
||||||
|
} else if (mask & IMOP_PERSISTENCE) {
|
||||||
|
image_options ^= IMOP_PERSISTENCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__popcnt16(image_options) >= 2)
|
||||||
|
shift = 0;
|
||||||
|
|
||||||
|
if (shift != 0) {
|
||||||
|
if ((mask == 0) || (image_options == 0))
|
||||||
shift = -shift;
|
shift = -shift;
|
||||||
section_vpos[1] += shift;
|
section_vpos[1] += shift;
|
||||||
section_vpos[2] += shift;
|
section_vpos[2] += shift;
|
||||||
|
|
||||||
|
if (__popcnt16(image_options) <= 1) {
|
||||||
// Move the controls up or down
|
// Move the controls up or down
|
||||||
for (i = 0; i < ARRAYSIZE(image_option_move_ids); i++)
|
for (i = 0; i < ARRAYSIZE(image_option_move_ids); i++)
|
||||||
MoveCtrlY(hMainDialog, image_option_move_ids[i], shift);
|
MoveCtrlY(hMainDialog, image_option_move_ids[i], shift);
|
||||||
|
|
||||||
// Resize the main dialog and log window
|
// Resize the main dialog and log window
|
||||||
ResizeDialogs(shift);
|
ResizeDialogs(shift);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Hide or show the boot options
|
// Hide or show the boot options
|
||||||
for (i = 0; i < ARRAYSIZE(image_option_toggle_ids); i++)
|
for (i = 0; i < ARRAYSIZE(image_option_toggle_ids); i++) {
|
||||||
ShowWindow(GetDlgItem(hMainDialog, image_option_toggle_ids[i]), display_togo_option ? SW_SHOW : SW_HIDE);
|
ShowWindow(GetDlgItem(hMainDialog, image_option_toggle_ids[i][0]),
|
||||||
|
(image_options & image_option_toggle_ids[i][1]) ? SW_SHOW : SW_HIDE);
|
||||||
|
}
|
||||||
|
|
||||||
// If you don't force a redraw here, all kind of bad UI artifacts happen...
|
// If you don't force a redraw here, all kind of bad UI artifacts happen...
|
||||||
InvalidateRect(hMainDialog, NULL, TRUE);
|
InvalidateRect(hMainDialog, NULL, TRUE);
|
||||||
|
@ -1486,7 +1502,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if ((display_togo_option) && (ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1)) {
|
if ((image_options & IMOP_WINTOGO) && (ComboBox_GetCurSel(GetDlgItem(hMainDialog, IDC_IMAGE_OPTION)) == 1)) {
|
||||||
if (fs != FS_NTFS) {
|
if (fs != FS_NTFS) {
|
||||||
// Windows To Go only works for NTFS
|
// Windows To Go only works for NTFS
|
||||||
MessageBoxExU(hMainDialog, lmprintf(MSG_097, "Windows To Go"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
|
MessageBoxExU(hMainDialog, lmprintf(MSG_097, "Windows To Go"), lmprintf(MSG_092), MB_OK|MB_ICONERROR|MB_IS_RTL, selected_langid);
|
||||||
|
@ -2544,6 +2560,7 @@ void OnPaint(HDC hdc)
|
||||||
static void InitDialog(HWND hDlg)
|
static void InitDialog(HWND hDlg)
|
||||||
{
|
{
|
||||||
DWORD len;
|
DWORD len;
|
||||||
|
HWND hCtrl;
|
||||||
HDC hDC;
|
HDC hDC;
|
||||||
int i, lfHeight;
|
int i, lfHeight;
|
||||||
char tmp[128], *token, *buf, *ext, *msg;
|
char tmp[128], *token, *buf, *ext, *msg;
|
||||||
|
@ -2662,6 +2679,11 @@ static void InitDialog(HWND hDlg)
|
||||||
// Fill up the boot options dropdown
|
// Fill up the boot options dropdown
|
||||||
SetBootOptions();
|
SetBootOptions();
|
||||||
|
|
||||||
|
// Fill up the Image Options Windows To Go dropdown
|
||||||
|
hCtrl = GetDlgItem(hMainDialog, IDC_IMAGE_OPTION);
|
||||||
|
IGNORE_RETVAL(ComboBox_SetItemData(hCtrl, ComboBox_AddStringU(hCtrl, lmprintf(MSG_117)), FALSE));
|
||||||
|
IGNORE_RETVAL(ComboBox_SetItemData(hCtrl, ComboBox_AddStringU(hCtrl, lmprintf(MSG_118)), TRUE));
|
||||||
|
|
||||||
// Fill up the MBR masqueraded disk IDs ("8 disks should be enough for anybody")
|
// 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_EMBEDDING "0x80" POP_DIRECTIONAL_FORMATTING)), 0x80));
|
IGNORE_RETVAL(ComboBox_SetItemData(hDiskID, ComboBox_AddStringU(hDiskID, lmprintf(MSG_030, LEFT_TO_RIGHT_EMBEDDING "0x80" POP_DIRECTIONAL_FORMATTING)), 0x80));
|
||||||
for (i=1; i<=7; i++) {
|
for (i=1; i<=7; i++) {
|
||||||
|
@ -2718,7 +2740,7 @@ static void InitDialog(HWND hDlg)
|
||||||
ToggleAdvancedDeviceOptions(FALSE);
|
ToggleAdvancedDeviceOptions(FALSE);
|
||||||
if (!advanced_mode_format)
|
if (!advanced_mode_format)
|
||||||
ToggleAdvancedFormatOptions(FALSE);
|
ToggleAdvancedFormatOptions(FALSE);
|
||||||
SetToGo();
|
ToggleImageOption(0);
|
||||||
|
|
||||||
// Process commandline parameters
|
// Process commandline parameters
|
||||||
if (iso_provided) {
|
if (iso_provided) {
|
||||||
|
@ -3206,7 +3228,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
||||||
if ((selected_fs == -1) && (SelectedDrive.DeviceNumber != 0))
|
if ((selected_fs == -1) && (SelectedDrive.DeviceNumber != 0))
|
||||||
GetDrivePartitionData(SelectedDrive.DeviceNumber, tmp, sizeof(tmp), TRUE);
|
GetDrivePartitionData(SelectedDrive.DeviceNumber, tmp, sizeof(tmp), TRUE);
|
||||||
SetFileSystemAndClusterSize(tmp);
|
SetFileSystemAndClusterSize(tmp);
|
||||||
SetToGo();
|
SetImageOptions();
|
||||||
SetProposedLabel(ComboBox_GetCurSel(hDeviceList));
|
SetProposedLabel(ComboBox_GetCurSel(hDeviceList));
|
||||||
EnableControls(TRUE);
|
EnableControls(TRUE);
|
||||||
tt = (int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme));
|
tt = (int)ComboBox_GetItemData(hPartitionScheme, ComboBox_GetCurSel(hPartitionScheme));
|
||||||
|
@ -3388,7 +3410,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
||||||
safe_release_dc(hDlg, hDC);
|
safe_release_dc(hDlg, hDC);
|
||||||
apply_localization(IDD_DIALOG, hDlg);
|
apply_localization(IDD_DIALOG, hDlg);
|
||||||
SetUpdateCheck();
|
SetUpdateCheck();
|
||||||
display_togo_option = TRUE; // We display the ToGo controls by default and need to hide them
|
|
||||||
first_log_display = TRUE;
|
first_log_display = TRUE;
|
||||||
log_displayed = FALSE;
|
log_displayed = FALSE;
|
||||||
hLogDialog = MyCreateDialog(hMainInstance, IDD_LOG, hDlg, (DLGPROC)LogCallback);
|
hLogDialog = MyCreateDialog(hMainInstance, IDD_LOG, hDlg, (DLGPROC)LogCallback);
|
||||||
|
|
42
src/rufus.h
42
src/rufus.h
|
@ -97,6 +97,9 @@
|
||||||
#define IsChecked(CheckBox_ID) (IsDlgButtonChecked(hMainDialog, CheckBox_ID) == BST_CHECKED)
|
#define IsChecked(CheckBox_ID) (IsDlgButtonChecked(hMainDialog, CheckBox_ID) == BST_CHECKED)
|
||||||
#define MB_IS_RTL (right_to_left_mode?MB_RTLREADING|MB_RIGHT:0)
|
#define MB_IS_RTL (right_to_left_mode?MB_RTLREADING|MB_RIGHT:0)
|
||||||
#define CHECK_FOR_USER_CANCEL if (IS_ERROR(FormatStatus)) goto out
|
#define CHECK_FOR_USER_CANCEL if (IS_ERROR(FormatStatus)) goto out
|
||||||
|
// Bit masks used for the display of additional image options in the UI
|
||||||
|
#define IMOP_WINTOGO 0x01
|
||||||
|
#define IMOP_PERSISTENCE 0x02
|
||||||
|
|
||||||
#define safe_free(p) do {free((void*)p); p = NULL;} while(0)
|
#define safe_free(p) do {free((void*)p); p = NULL;} while(0)
|
||||||
#define safe_mm_free(p) do {_mm_free((void*)p); p = NULL;} while(0)
|
#define safe_mm_free(p) do {_mm_free((void*)p); p = NULL;} while(0)
|
||||||
|
@ -279,6 +282,12 @@ enum checksum_type {
|
||||||
#define IS_EFI_BOOTABLE(r) (r.has_efi != 0)
|
#define IS_EFI_BOOTABLE(r) (r.has_efi != 0)
|
||||||
#define IS_BIOS_BOOTABLE(r) (HAS_BOOTMGR(r) || HAS_SYSLINUX(r) || HAS_WINPE(r) || HAS_GRUB(r) || HAS_REACTOS(r) || HAS_KOLIBRIOS(r))
|
#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 HAS_WINTOGO(r) (HAS_BOOTMGR(r) && IS_EFI_BOOTABLE(r) && HAS_INSTALL_WIM(r) && (r.install_wim_version < MAX_WIM_VERSION))
|
||||||
|
#ifdef RUFUS_TEST
|
||||||
|
// TODO: have a better test for persistence/Linux
|
||||||
|
#define HAS_PERSISTENCE(r) HAS_SYSLINUX(r)
|
||||||
|
#else
|
||||||
|
#define HAS_PERSISTENCE(r) FALSE
|
||||||
|
#endif
|
||||||
#define IS_FAT(fs) ((fs == FS_FAT16) || (fs == FS_FAT32))
|
#define IS_FAT(fs) ((fs == FS_FAT16) || (fs == FS_FAT32))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -393,31 +402,28 @@ enum WindowsVersion {
|
||||||
/*
|
/*
|
||||||
* Globals
|
* Globals
|
||||||
*/
|
*/
|
||||||
|
extern RUFUS_UPDATE update;
|
||||||
|
extern RUFUS_IMG_REPORT img_report;
|
||||||
extern HINSTANCE hMainInstance;
|
extern HINSTANCE hMainInstance;
|
||||||
extern HWND hMainDialog, hLogDialog, hStatus, hDeviceList, hCapacity;
|
extern HWND hMainDialog, hLogDialog, hStatus, hDeviceList, hCapacity;
|
||||||
extern HWND hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog;
|
extern HWND hPartitionScheme, hTargetSystem, hFileSystem, hClusterSize, hLabel, hBootType, hNBPasses, hLog;
|
||||||
extern HWND hInfo, hProgress, hDiskID;
|
extern HWND hInfo, hProgress, hDiskID;
|
||||||
|
extern WORD selected_langid;
|
||||||
|
extern DWORD FormatStatus, DownloadStatus, MainThreadId;
|
||||||
|
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, large_drive, usb_debug;
|
||||||
|
extern int64_t iso_blocking_status;
|
||||||
|
extern uint8_t image_options;
|
||||||
|
extern uint16_t rufus_version[3], embedded_sl_version[2];
|
||||||
|
extern size_t ubuffer_pos;
|
||||||
|
extern const int nb_steps[FS_MAX];
|
||||||
extern float fScale;
|
extern float fScale;
|
||||||
|
extern int nWindowsVersion, nWindowsBuildNumber, dialog_showing;
|
||||||
|
extern int fs, bt, pt, tt;
|
||||||
|
extern unsigned long syslinux_ldlinux_len[2];
|
||||||
|
extern char WindowsVersionStr[128], ubuffer[UBUFFER_SIZE], embedded_sl_version_str[2][12];
|
||||||
extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], temp_dir[MAX_PATH], system_dir[MAX_PATH], sysnative_dir[MAX_PATH];
|
extern char szFolderPath[MAX_PATH], app_dir[MAX_PATH], temp_dir[MAX_PATH], system_dir[MAX_PATH], sysnative_dir[MAX_PATH];
|
||||||
extern char* image_path;
|
extern char* image_path;
|
||||||
extern DWORD FormatStatus, DownloadStatus, MainThreadId;
|
|
||||||
extern unsigned long syslinux_ldlinux_len[2];
|
|
||||||
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 allow_dual_uefi_bios, display_togo_option, large_drive, usb_debug;
|
|
||||||
extern RUFUS_IMG_REPORT img_report;
|
|
||||||
extern int64_t iso_blocking_status;
|
|
||||||
extern uint16_t rufus_version[3], embedded_sl_version[2];
|
|
||||||
extern int nWindowsVersion;
|
|
||||||
extern int nWindowsBuildNumber;
|
|
||||||
extern int fs, bt, pt, tt;
|
|
||||||
extern char WindowsVersionStr[128];
|
|
||||||
extern size_t ubuffer_pos;
|
|
||||||
extern char ubuffer[UBUFFER_SIZE];
|
|
||||||
extern char embedded_sl_version_str[2][12];
|
|
||||||
extern RUFUS_UPDATE update;
|
|
||||||
extern int dialog_showing;
|
|
||||||
extern WORD selected_langid;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Shared prototypes
|
* Shared prototypes
|
||||||
|
|
17
src/rufus.rc
17
src/rufus.rc
|
@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||||
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
IDD_DIALOG DIALOGEX 12, 12, 232, 326
|
||||||
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_ACCEPTFILES
|
EXSTYLE WS_EX_ACCEPTFILES
|
||||||
CAPTION "Rufus 3.2.1328"
|
CAPTION "Rufus 3.2.1329"
|
||||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||||
|
@ -45,7 +45,10 @@ BEGIN
|
||||||
PUSHBUTTON "#",IDC_HASH,162,52,10,12,BS_FLAT | NOT WS_VISIBLE
|
PUSHBUTTON "#",IDC_HASH,162,52,10,12,BS_FLAT | NOT WS_VISIBLE
|
||||||
PUSHBUTTON "SELECT",IDC_SELECT,180,52,45,10
|
PUSHBUTTON "SELECT",IDC_SELECT,180,52,45,10
|
||||||
LTEXT "Image option",IDS_IMAGE_OPTION_TXT,8,65,216,8
|
LTEXT "Image option",IDS_IMAGE_OPTION_TXT,8,65,216,8
|
||||||
COMBOBOX IDC_IMAGE_OPTION,8,74,216,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_IMAGE_OPTION,8,74,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
|
CONTROL "",IDC_PERSISTENCE_SLIDER,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,125,76,34,8
|
||||||
|
EDITTEXT IDC_PERSISTENCE_SIZE,160,74,36,12,ES_AUTOHSCROLL
|
||||||
|
COMBOBOX IDC_PERSISTENCE_UNITS,200,74,24,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,87,96,8
|
LTEXT "Partition scheme",IDS_PARTITION_TYPE_TXT,8,87,96,8
|
||||||
COMBOBOX IDC_PARTITION_TYPE,8,96,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_PARTITION_TYPE,8,96,96,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
LTEXT "Target system",IDS_TARGET_SYSTEM_TXT,128,87,96,8
|
LTEXT "Target system",IDS_TARGET_SYSTEM_TXT,128,87,96,8
|
||||||
|
@ -389,8 +392,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 3,2,1328,0
|
FILEVERSION 3,2,1329,0
|
||||||
PRODUCTVERSION 3,2,1328,0
|
PRODUCTVERSION 3,2,1329,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -407,13 +410,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", "3.2.1328"
|
VALUE "FileVersion", "3.2.1329"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2018 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", "3.2.1328"
|
VALUE "ProductVersion", "3.2.1329"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
11
src/ui.h
11
src/ui.h
|
@ -85,9 +85,12 @@ static int image_option_move_ids[] = {
|
||||||
IDC_STATUS_TOOLBAR,
|
IDC_STATUS_TOOLBAR,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int image_option_toggle_ids[] = {
|
static int image_option_toggle_ids[][2] = {
|
||||||
IDS_IMAGE_OPTION_TXT,
|
{ IDS_IMAGE_OPTION_TXT, 0x03 },
|
||||||
IDC_IMAGE_OPTION,
|
{ IDC_IMAGE_OPTION, 0x01 },
|
||||||
|
{ IDC_PERSISTENCE_SLIDER, 0x02 },
|
||||||
|
{ IDC_PERSISTENCE_SIZE, 0x02 },
|
||||||
|
{ IDC_PERSISTENCE_UNITS, 0x02 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int advanced_device_move_ids[] = {
|
static int advanced_device_move_ids[] = {
|
||||||
|
@ -192,7 +195,7 @@ static int half_width_ids[] = {
|
||||||
static int adjust_dpi_ids[][5] = {
|
static int adjust_dpi_ids[][5] = {
|
||||||
{IDS_DEVICE_TXT, IDC_DEVICE, IDC_SAVE_TOOLBAR, 0, 0},
|
{IDS_DEVICE_TXT, IDC_DEVICE, IDC_SAVE_TOOLBAR, 0, 0},
|
||||||
{IDS_BOOT_SELECTION_TXT, IDC_BOOT_SELECTION, IDC_HASH_TOOLBAR, IDC_SELECT, 0},
|
{IDS_BOOT_SELECTION_TXT, IDC_BOOT_SELECTION, IDC_HASH_TOOLBAR, IDC_SELECT, 0},
|
||||||
{IDS_IMAGE_OPTION_TXT, IDC_IMAGE_OPTION, 0, 0, 0},
|
{IDS_IMAGE_OPTION_TXT, IDC_IMAGE_OPTION, IDC_PERSISTENCE_SLIDER, IDC_PERSISTENCE_SIZE, IDC_PERSISTENCE_UNITS},
|
||||||
{IDS_PARTITION_TYPE_TXT, IDC_PARTITION_TYPE, IDS_TARGET_SYSTEM_TXT, IDC_TARGET_SYSTEM, IDS_CSM_HELP_TXT},
|
{IDS_PARTITION_TYPE_TXT, IDC_PARTITION_TYPE, IDS_TARGET_SYSTEM_TXT, IDC_TARGET_SYSTEM, IDS_CSM_HELP_TXT},
|
||||||
{IDC_ADVANCED_DEVICE_TOOLBAR, 0, 0, 0, 0},
|
{IDC_ADVANCED_DEVICE_TOOLBAR, 0, 0, 0, 0},
|
||||||
{IDC_LIST_USB_HDD, 0, 0, 0, 0 },
|
{IDC_LIST_USB_HDD, 0, 0, 0, 0 },
|
||||||
|
|
Loading…
Reference in a new issue