mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[ui] preserve user-specified label on error/cancel or drive insertion
* Also produce warnings in the log if we detect Windows write-protection policies.
This commit is contained in:
parent
892996aafd
commit
247dbe2f7b
2 changed files with 17 additions and 16 deletions
23
src/rufus.c
23
src/rufus.c
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Rufus: The Reliable USB Formatting Utility
|
* Rufus: The Reliable USB Formatting Utility
|
||||||
* Copyright © 2011-2022 Pete Batard <pete@akeo.ie>
|
* Copyright © 2011-2023 Pete Batard <pete@akeo.ie>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -702,19 +702,15 @@ static void SetProposedLabel(int ComboIndex)
|
||||||
{
|
{
|
||||||
const char no_label[] = STR_NO_LABEL, empty[] = "";
|
const char no_label[] = STR_NO_LABEL, empty[] = "";
|
||||||
|
|
||||||
|
// If the user manually changed the label, try to preserve it
|
||||||
|
if (user_changed_label)
|
||||||
|
return;
|
||||||
|
|
||||||
app_changed_label = TRUE;
|
app_changed_label = TRUE;
|
||||||
// If bootable ISO creation is selected, and we have an ISO selected with a valid name, use that
|
// If bootable ISO creation is selected, and we have an ISO selected with a valid name, use that
|
||||||
// Also some distros (eg. Arch) require the USB to have the same label as the ISO
|
// Also some distros (eg. Arch) require the USB to have the same label as the ISO
|
||||||
if ((boot_type == BT_IMAGE) && (image_path != NULL) && (img_report.label[0] != 0)) {
|
if ((boot_type == BT_IMAGE) && (image_path != NULL) && (img_report.label[0] != 0)) {
|
||||||
SetWindowTextU(hLabel, img_report.label);
|
SetWindowTextU(hLabel, img_report.label);
|
||||||
// If we force the ISO label, we need to reset the user_changed_label flag
|
|
||||||
user_changed_label = FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the user manually changed the label, try to preserve it
|
|
||||||
if (user_changed_label) {
|
|
||||||
app_changed_label = FALSE;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1393,9 +1389,10 @@ DWORD WINAPI ImageScanThread(LPVOID param)
|
||||||
SetFileSystemAndClusterSize(NULL);
|
SetFileSystemAndClusterSize(NULL);
|
||||||
SetFSFromISO();
|
SetFSFromISO();
|
||||||
SetMBRProps();
|
SetMBRProps();
|
||||||
|
user_changed_label = FALSE;
|
||||||
SetProposedLabel(ComboBox_GetCurSel(hDeviceList));
|
SetProposedLabel(ComboBox_GetCurSel(hDeviceList));
|
||||||
} else {
|
} else {
|
||||||
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE_INTERNAL<<16) | IDC_FILE_SYSTEM,
|
SendMessage(hMainDialog, WM_COMMAND, (CBN_SELCHANGE_INTERNAL << 16) | IDC_FILE_SYSTEM,
|
||||||
ComboBox_GetCurSel(hFileSystem));
|
ComboBox_GetCurSel(hFileSystem));
|
||||||
}
|
}
|
||||||
// Lose the focus on the select ISO (but place it on Close)
|
// Lose the focus on the select ISO (but place it on Close)
|
||||||
|
@ -2055,6 +2052,11 @@ static void InitDialog(HWND hDlg)
|
||||||
"one. Because of this, some messages will only be displayed in English.", selected_locale->txt[1]);
|
"one. Because of this, some messages will only be displayed in English.", selected_locale->txt[1]);
|
||||||
uprintf("If you think you can help update this translation, please e-mail the author of this application");
|
uprintf("If you think you can help update this translation, please e-mail the author of this application");
|
||||||
}
|
}
|
||||||
|
// Detect and report system limitations
|
||||||
|
if (ReadRegistryKeyBool(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Policies\\Microsoft\\FVE"))
|
||||||
|
uprintf("WARNING: This system has a policy set to prevent write access to FIXED drives not using BitLocker");
|
||||||
|
if (ReadRegistryKeyBool(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\StorageDevicePolicies\\WriteProtect"))
|
||||||
|
uprintf("WARNING: This system has a policy set to prevent write access to storage devices");
|
||||||
if (!is_vds_available)
|
if (!is_vds_available)
|
||||||
uprintf("Notice: Windows VDS is unavailable");
|
uprintf("Notice: Windows VDS is unavailable");
|
||||||
|
|
||||||
|
@ -2839,7 +2841,6 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
|
||||||
if (!op_in_progress) {
|
if (!op_in_progress) {
|
||||||
queued_hotplug_event = FALSE;
|
queued_hotplug_event = FALSE;
|
||||||
GetDevices((DWORD)ComboBox_GetCurItemData(hDeviceList));
|
GetDevices((DWORD)ComboBox_GetCurItemData(hDeviceList));
|
||||||
user_changed_label = FALSE;
|
|
||||||
EnableControls(TRUE, FALSE);
|
EnableControls(TRUE, FALSE);
|
||||||
if (ComboBox_GetCurSel(hDeviceList) < 0) {
|
if (ComboBox_GetCurSel(hDeviceList) < 0) {
|
||||||
SetPartitionSchemeAndTargetSystem(FALSE);
|
SetPartitionSchemeAndTargetSystem(FALSE);
|
||||||
|
|
10
src/rufus.rc
10
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.22.1997"
|
CAPTION "Rufus 3.22.1998"
|
||||||
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
|
||||||
|
@ -392,8 +392,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 3,22,1997,0
|
FILEVERSION 3,22,1998,0
|
||||||
PRODUCTVERSION 3,22,1997,0
|
PRODUCTVERSION 3,22,1998,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -411,13 +411,13 @@ BEGIN
|
||||||
VALUE "Comments", "https://rufus.ie"
|
VALUE "Comments", "https://rufus.ie"
|
||||||
VALUE "CompanyName", "Akeo Consulting"
|
VALUE "CompanyName", "Akeo Consulting"
|
||||||
VALUE "FileDescription", "Rufus"
|
VALUE "FileDescription", "Rufus"
|
||||||
VALUE "FileVersion", "3.22.1997"
|
VALUE "FileVersion", "3.22.1998"
|
||||||
VALUE "InternalName", "Rufus"
|
VALUE "InternalName", "Rufus"
|
||||||
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
|
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
|
||||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||||
VALUE "OriginalFilename", "rufus-3.22.exe"
|
VALUE "OriginalFilename", "rufus-3.22.exe"
|
||||||
VALUE "ProductName", "Rufus"
|
VALUE "ProductName", "Rufus"
|
||||||
VALUE "ProductVersion", "3.22.1997"
|
VALUE "ProductVersion", "3.22.1998"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
Loading…
Reference in a new issue