2
0
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-31 14:06:08 +02:00

[ui] disable drag and drop during drive creation

* Closes #1672
* Also fix Rufus MBR not being selected when switching partition scheme to MBR
* Also fix users being prompted twice for ISO → ESP
This commit is contained in:
Pete Batard 2021-04-08 17:29:13 +01:00
parent f2ca5a3121
commit c9e71de898
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
4 changed files with 28 additions and 23 deletions

View file

@ -11,7 +11,7 @@
<Identity
Name="19453.net.Rufus"
Publisher="CN=7AC86D13-3E5A-491A-ADD5-80095C212740"
Version="3.14.1767.0" />
Version="3.14.1768.0" />
<Properties>
<DisplayName>Rufus</DisplayName>

View file

@ -643,6 +643,7 @@ static void SetFSFromISO(void)
static void SetMBRProps(void)
{
BOOL needs_masquerading = HAS_WINPE(img_report) && (!img_report.uses_minint);
fs_type = (int)ComboBox_GetCurItemData(hFileSystem);
if ((!mbr_selected_by_user) && ((image_path == NULL) || (boot_type != BT_IMAGE) || (fs_type != FS_NTFS) || HAS_GRUB(img_report) ||
((image_options & IMOP_WINTOGO) && ComboBox_GetCurItemData(hImageOption)) )) {
@ -1328,7 +1329,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
FILE *fd;
DWORD len;
WPARAM ret = BOOTCHECK_CANCEL;
BOOL in_files_dir = FALSE;
BOOL in_files_dir = FALSE, esp_already_asked = FALSE;
const char* grub = "grub";
const char* core_img = "core.img";
const char* ldlinux = "ldlinux";
@ -1378,6 +1379,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
write_as_esp = TRUE;
else if (i == 3)
write_as_image = TRUE;
esp_already_asked = TRUE;
} else {
char* choices[2] = { lmprintf(MSG_276, iso_image), lmprintf(MSG_277, dd_image) };
i = SelectionDialog(lmprintf(MSG_274, "ISOHybrid"), lmprintf(MSG_275, iso_image, dd_image, iso_image, dd_image),
@ -1451,7 +1453,7 @@ static DWORD WINAPI BootCheckThread(LPVOID param)
}
if ((img_report.projected_size < MAX_ISO_TO_ESP_SIZE * MB) && HAS_REGULAR_EFI(img_report) &&
(partition_type == PARTITION_STYLE_GPT) && IS_FAT(fs_type)) {
(partition_type == PARTITION_STYLE_GPT) && IS_FAT(fs_type) && !esp_already_asked) {
// The ISO is small enough to be written as an ESP and we are using GPT
// so ask the users if they want to write it as an ESP.
char* iso_image = lmprintf(MSG_036);
@ -2379,6 +2381,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
partition_type = (int)ComboBox_GetCurItemData(hPartitionScheme);
SetPartitionSchemeAndTargetSystem(TRUE);
SetFileSystemAndClusterSize(NULL);
SetMBRProps();
EnableMBRBootOptions(TRUE, TRUE);
selected_pt = partition_type;
break;
@ -2778,21 +2781,23 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
break;
case WM_DROPFILES:
droppedFileInfo = (HDROP)wParam;
wbuffer = calloc(MAX_PATH, sizeof(wchar_t));
if (wbuffer == NULL) {
uprintf("Failed to alloc buffer for drag-n-drop");
break;
}
DragQueryFileW(droppedFileInfo, 0, wbuffer, MAX_PATH);
safe_free(image_path);
image_path = wchar_to_utf8(wbuffer);
safe_free(wbuffer);
if (format_thread == NULL) {
droppedFileInfo = (HDROP)wParam;
wbuffer = calloc(MAX_PATH, sizeof(wchar_t));
if (wbuffer == NULL) {
uprintf("Failed to alloc buffer for drag-n-drop");
break;
}
DragQueryFileW(droppedFileInfo, 0, wbuffer, MAX_PATH);
safe_free(image_path);
image_path = wchar_to_utf8(wbuffer);
safe_free(wbuffer);
if (image_path != NULL) {
img_provided = TRUE;
// Simulate image selection click
SendMessage(hDlg, WM_COMMAND, IDC_SELECT, 0);
if (image_path != NULL) {
img_provided = TRUE;
// Simulate image selection click
SendMessage(hDlg, WM_COMMAND, IDC_SELECT, 0);
}
}
break;

View file

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.14.1767"
CAPTION "Rufus 3.14.1768"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,14,1767,0
PRODUCTVERSION 3,14,1767,0
FILEVERSION 3,14,1768,0
PRODUCTVERSION 3,14,1768,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.14.1767"
VALUE "FileVersion", "3.14.1768"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.14.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.14.1767"
VALUE "ProductVersion", "3.14.1768"
END
END
BLOCK "VarFileInfo"

View file

@ -529,7 +529,7 @@ void AdjustForLowDPI(HWND hDlg)
for (i = 0; i < ARRAYSIZE(adjust_dpi_ids); i++) {
dy += ddy;
// "...and the other thing I really like about Microsoft's UI handling is how "
//."you never have to introduce weird hardcoded constants all over the place, "
// "you never have to introduce weird hardcoded constants all over the place, "
// "just to make your UI look good...", said NO ONE ever.
if (adjust_dpi_ids[i][0] == IDC_QUICK_FORMAT)
dy += 1;