From 15806de646cd51da7bf72fd20d4aac335a3f157c Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Tue, 20 Nov 2018 12:28:20 +0000 Subject: [PATCH] [ui] display a notice about Secure Boot when UEFI:NTFS is applied --- res/loc/ChangeLog.txt | 5 ++++ res/loc/rufus.loc | 6 ++++ src/drive.c | 2 ++ src/resource.h | 3 +- src/rufus.c | 23 +++++++++++---- src/rufus.h | 9 ++++-- src/rufus.rc | 20 +++++++------ src/settings.h | 1 + src/stdlg.c | 66 ++++++++++++++++++++++++++++++------------- 9 files changed, 98 insertions(+), 37 deletions(-) diff --git a/res/loc/ChangeLog.txt b/res/loc/ChangeLog.txt index 4a7d6d37..3b6464f5 100644 --- a/res/loc/ChangeLog.txt +++ b/res/loc/ChangeLog.txt @@ -6,6 +6,11 @@ https://github.com/pbatard/rufus/wiki/Localization#Editing_a_translation Or simply download the latest pollock.exe from https://rufus.ie/locale/ and follow its directions. +o v3.x + - *NEW* MSG_127 "Do not show this message again" + - *NEW* MSG_128 "Important notice about Secure Boot" + - *NEW* MSG_129 "You have just created a media that includes the UEFI:NTFS bootloader (...)" + o v3.2 (2018.07.20) The following appears in Advanced format options → Check device for bad blocks → dropdown menu with %s being replaced with SLC, MLC or TLC, which is a type of NAND (or flash memory. In other words, diff --git a/res/loc/rufus.loc b/res/loc/rufus.loc index fd613664..318dd4f0 100644 --- a/res/loc/rufus.loc +++ b/res/loc/rufus.loc @@ -327,6 +327,9 @@ t MSG_124 "No persistence" # Tooltips used for the peristence size slider and edit control t MSG_125 "Set the size of the persistent partition for live USB media. Setting the size to 0 disables the persistent partition." t MSG_126 "Set the partition size units." +t MSG_127 "Do not show this message again" +t MSG_128 "Important notice about Secure Boot" +t MSG_129 "You have just created a media that includes the UEFI:NTFS bootloader. Please remember that, to be able to boot this media, YOU WILL NEED TO DISABLE SECURE BOOT.\nFor more details on the reasons behind this, you may click the button below." t MSG_150 "Type of computer you plan to use this bootable drive with. It is your responsibility to determine whether " "your target is of BIOS or UEFI type before you start creating the drive, as it may fail to boot otherwise." # You shouldn't translate 'Legacy Mode' as this is an option that usually appears in English in the UEFI settings. @@ -4253,6 +4256,9 @@ t MSG_123 "Taille de partition persistente" t MSG_124 "Désactivée" t MSG_125 "Etablit la taille de la partition persistente pour media USB de type \"live\". Une taille de 0 désactive l’utilisation d’une partition persistente." t MSG_126 "Unité de taille utilisée pour la partition persistente." +t MSG_127 "Ne plus montrer ce message" +t MSG_128 "Note importante a propos de Secure Boot" +t MSG_129 "Vous venez juste de créer un média qui utilise UEFI:NTFS. Veuillez prendre note que, pour pouvoir démarrer ce média, VOUS DEVREZ DESACTIVER SECURE BOOT.\nPour plus de détails (en Anglais) sur les raisons nécessitant ce changement, vous pouvez cliquer sur le bouton ci dessous." t MSG_150 "Type d'ordinateur avec lequel vous comptez utiliser ce disque démarrable. Il est de votre responsabilité de déterminer s'il s'agit d'un type BIOS ou UEFI avant de commencer a créer votre périphérique, car il risque de ne pas démarrer sinon." t MSG_151 "'UEFI-CSM' signifie que le périphérique démarrera seulement en mode émulation BIOS (i.e. 'Legacy Mode') sous UEFI, et non pas en mode UEFI natif." t MSG_152 "'non CSM' signifie que le périphérique démarrera seulement en mode UEFI natif, et non pas en mode émulation BIOS (i.e. 'Legacy Mode')." diff --git a/src/drive.c b/src/drive.c index 5821b02d..d72c173c 100644 --- a/src/drive.c +++ b/src/drive.c @@ -61,6 +61,7 @@ PF_TYPE_DECL(NTAPI, NTSTATUS, NtQueryVolumeInformationFile, (HANDLE, PIO_STATUS_ * Globals */ RUFUS_DRIVE_INFO SelectedDrive; +BOOL installed_uefi_ntfs; const char* sfd_name = "Super Floppy Disk"; /* @@ -1250,6 +1251,7 @@ BOOL CreatePartition(HANDLE hDrive, int partition_style, int file_system, BOOL m uprintf("Write error: %s", WindowsErrorString()); return FALSE; } + installed_uefi_ntfs = TRUE; } pn++; } diff --git a/src/resource.h b/src/resource.h index 7f71d7d8..bfbb7e33 100644 --- a/src/resource.h +++ b/src/resource.h @@ -108,7 +108,7 @@ #define IDC_EXTENDED_LABEL 1015 #define IDC_RUFUS_MBR 1016 #define IDC_TARGET_SYSTEM 1017 -#define IDC_PERSISTENCE_SIZE 1118 +#define IDC_PERSISTENCE_SIZE 1018 #define IDC_PERSISTENCE_UNITS 1019 #define IDC_DISK_ID 1020 #define IDC_OLD_BIOS_FIXES 1021 @@ -140,6 +140,7 @@ #define IDC_LOG_EDIT 1055 #define IDC_LOG_SAVE 1056 #define IDC_LOG_CLEAR 1057 +#define IDC_DONT_DISPLAY_AGAIN 1059 #define IDC_MORE_INFO 1060 #define IDC_POLICY 1061 #define IDC_UPDATE_FREQUENCY 1062 diff --git a/src/rufus.c b/src/rufus.c index f4a42e1b..ce0fc4a9 100755 --- a/src/rufus.c +++ b/src/rufus.c @@ -104,7 +104,8 @@ BOOL iso_op_in_progress = FALSE, format_op_in_progress = FALSE, right_to_left_mo 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 use_fake_units, preserve_timestamps = FALSE, fast_zeroing = FALSE, app_changed_size = 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; +BOOL write_as_image = FALSE, installed_uefi_ntfs; uint64_t persistence_size = 0; float fScale = 1.0f; int dialog_showing = 0, selection_default = BT_IMAGE, windows_to_go_selection = 0, persistence_unit_selection = -1; @@ -1839,7 +1840,7 @@ static BOOL CheckDriveAccess(DWORD dwTimeOut) message = GetMuiString("shell32.dll", 28701); // "This drive is in use (...) Do you want to format it anyway?" if (message != NULL) { ComboBox_GetTextU(hDeviceList, title, sizeof(title)); - proceed = Notification(MSG_WARNING_QUESTION, NULL, title, message); + proceed = Notification(MSG_WARNING_QUESTION, NULL, NULL, title, message); free(message); } } @@ -1884,7 +1885,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA case WM_COMMAND: #ifdef RUFUS_TEST if (LOWORD(wParam) == IDC_TEST) { - uprintf("CPU ARCH: %d", GetCpuArch()); + notification_info more_info; + more_info.id = MORE_INFO_URL; + more_info.url = SECURE_BOOT_MORE_INFO_URL; + Notification(MSG_INFO, SETTING_DISABLE_SECURE_BOOT_NOTICE, &more_info, lmprintf(MSG_128), lmprintf(MSG_129)); break; } #endif @@ -2206,6 +2210,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA tt = (int)ComboBox_GetItemData(hTargetSystem, ComboBox_GetCurSel(hTargetSystem)); fs = (int)ComboBox_GetItemData(hFileSystem, ComboBox_GetCurSel(hFileSystem)); write_as_image = FALSE; + installed_uefi_ntfs = FALSE; // Disable all controls except Cancel EnableControls(FALSE); FormatStatus = 0; @@ -2512,7 +2517,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA break; case UM_NO_UPDATE: - Notification(MSG_INFO, NULL, lmprintf(MSG_243), lmprintf(MSG_247)); + Notification(MSG_INFO, NULL, NULL, lmprintf(MSG_243), lmprintf(MSG_247)); // Need to manually set focus back to "Check Now" for tabbing to work SendMessage(hUpdatesDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hUpdatesDlg, IDC_CHECK_NOW), TRUE); break; @@ -2617,11 +2622,17 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA PrintInfo(0, MSG_210); MessageBeep(MB_OK); FlashTaskbar(dialog_handle); + if (installed_uefi_ntfs && (!ReadSettingBool(SETTING_DISABLE_SECURE_BOOT_NOTICE))) { + notification_info more_info; + more_info.id = MORE_INFO_URL; + more_info.url = SECURE_BOOT_MORE_INFO_URL; + Notification(MSG_INFO, SETTING_DISABLE_SECURE_BOOT_NOTICE, &more_info, lmprintf(MSG_128), lmprintf(MSG_129)); + } } else if (SCODE_CODE(FormatStatus) == ERROR_CANCELLED) { SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_PAUSED, 0); SetTaskbarProgressState(TASKBAR_PAUSED); PrintInfo(0, MSG_211); - Notification(MSG_INFO, NULL, lmprintf(MSG_211), lmprintf(MSG_041)); + Notification(MSG_INFO, NULL, NULL, lmprintf(MSG_211), lmprintf(MSG_041)); } else { SendMessage(hProgress, PBM_SETSTATE, (WPARAM)PBST_ERROR, 0); SetTaskbarProgressState(TASKBAR_ERROR); @@ -2660,7 +2671,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA break; } } - Notification(MSG_ERROR, NULL, lmprintf(MSG_042), lmprintf(MSG_043, StrError(FormatStatus, FALSE))); + Notification(MSG_ERROR, NULL, NULL, lmprintf(MSG_042), lmprintf(MSG_043, StrError(FormatStatus, FALSE))); } } FormatStatus = 0; diff --git a/src/rufus.h b/src/rufus.h index d1e50983..2246e6ff 100644 --- a/src/rufus.h +++ b/src/rufus.h @@ -72,6 +72,7 @@ #define MAX_GPT_PARTITIONS 128 #define MAX_SECTORS_TO_CLEAR 128 // nb sectors to zap when clearing the MBR/GPT (must be >34) #define MBR_UEFI_MARKER 0x49464555 // 'U', 'E', 'F', 'I', as a 32 bit little endian longword +#define MORE_INFO_URL 0xFFFF #define STATUS_MSG_TIMEOUT 3500 // How long should cheat mode messages appear for on the status bar #define WRITE_RETRIES 4 #define WRITE_TIMEOUT 5000 // How long we should wait between write retries @@ -100,6 +101,7 @@ #endif #define DOWNLOAD_URL RUFUS_URL "/downloads" #define FILES_URL RUFUS_URL "/files" +#define SECURE_BOOT_MORE_INFO_URL "https://github.com/pbatard/rufus/wiki/FAQ#Why_do_I_need_to_disable_Secure_Boot_to_use_UEFINTFS" #define SEVENZIP_URL "https://www.7-zip.org" #define FILES_DIR "rufus_files" #define IGNORE_RETVAL(expr) do { (void)(expr); } while(0) @@ -197,7 +199,10 @@ enum notification_type { typedef INT_PTR (CALLBACK *Callback_t)(HWND, UINT, WPARAM, LPARAM); typedef struct { WORD id; - Callback_t callback; + union { + Callback_t callback; + char* url; + }; } notification_info; // To provide a "More info..." on notifications /* Status Bar sections */ @@ -481,7 +486,7 @@ extern INT_PTR CreateAboutBox(void); extern BOOL CreateTooltip(HWND hControl, const char* message, int duration); extern void DestroyTooltip(HWND hWnd); extern void DestroyAllTooltips(void); -extern BOOL Notification(int type, const notification_info* more_info, char* title, char* format, ...); +extern BOOL Notification(int type, const char* dont_display_setting, const notification_info* more_info, char* title, char* format, ...); extern int SelectionDialog(char* title, char* message, char** choices, int size); extern void ListDialog(char* title, char* message, char** items, int size); extern SIZE GetTextSize(HWND hCtrl, char* txt); diff --git a/src/rufus.rc b/src/rufus.rc index e85c82cf..55850e6c 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -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.4.1423" +CAPTION "Rufus 3.4.1424" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -129,7 +129,7 @@ BEGIN DEFPUSHBUTTON "Close",IDCANCEL,306,305,50,12 END -IDD_NOTIFICATION DIALOGEX 0, 0, 263, 59 +IDD_NOTIFICATION DIALOGEX 0, 0, 263, 73 STYLE DS_SETFONT | DS_NOFAILCREATE | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_THICKFRAME CAPTION "Rufus" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 @@ -138,9 +138,11 @@ BEGIN LTEXT "",IDC_STATIC,0,0,263,34 ICON OCR_UP,IDC_NOTIFICATION_ICON,6,6,20,20 LTEXT "Message",IDC_NOTIFICATION_TEXT,35,6,219,20 - DEFPUSHBUTTON "No",IDNO,206,40,50,14 - PUSHBUTTON "More information",IDC_MORE_INFO,8,40,76,14,NOT WS_VISIBLE - PUSHBUTTON "Yes",IDYES,149,40,50,14,NOT WS_VISIBLE + DEFPUSHBUTTON "No",IDNO,205,53,50,14 + PUSHBUTTON "More information",IDC_MORE_INFO,8,53,76,14,NOT WS_VISIBLE + PUSHBUTTON "Yes",IDYES,148,53,50,14,NOT WS_VISIBLE + CONTROL "Do not show this message again",IDC_DONT_DISPLAY_AGAIN, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,39,248,10,WS_EX_TRANSPARENT END IDD_SELECTION DIALOGEX 0, 0, 312, 71 @@ -392,8 +394,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,4,1423,0 - PRODUCTVERSION 3,4,1423,0 + FILEVERSION 3,4,1424,0 + PRODUCTVERSION 3,4,1424,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -411,13 +413,13 @@ BEGIN VALUE "Comments", "https://akeo.ie" VALUE "CompanyName", "Akeo Consulting" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.4.1423" + VALUE "FileVersion", "3.4.1424" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "https://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus-3.4.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.4.1423" + VALUE "ProductVersion", "3.4.1424" END END BLOCK "VarFileInfo" diff --git a/src/settings.h b/src/settings.h index 2e1bddc9..b45b5fe5 100644 --- a/src/settings.h +++ b/src/settings.h @@ -34,6 +34,7 @@ extern char* ini_file; #define SETTING_COMM_CHECK "CommCheck64" #define SETTING_LOCALE "Locale" #define SETTING_DISABLE_LGP "DisableLGP" +#define SETTING_DISABLE_SECURE_BOOT_NOTICE "DisableSecureBootNotice" #define SETTING_ADVANCED_MODE "AdvancedMode" #define SETTING_ADVANCED_MODE_DEVICE "ShowAdvancedDriveProperties" diff --git a/src/stdlg.c b/src/stdlg.c index 3da931d8..e1b343e8 100644 --- a/src/stdlg.c +++ b/src/stdlg.c @@ -31,6 +31,8 @@ #include #include #include +#undef NDEBUG +#include #include "rufus.h" #include "missing.h" @@ -55,6 +57,7 @@ static WNDPROC pOrgBrowseWndproc; static const SETTEXTEX friggin_microsoft_unicode_amateurs = {ST_DEFAULT, CP_UTF8}; static BOOL notification_is_question; static const notification_info* notification_more_info; +static const char* notification_dont_display_setting; static WNDPROC update_original_proc = NULL; static HWINEVENTHOOK fp_weh = NULL; static char *fp_title_str = "Microsoft Windows", *fp_button_str = "Format disk"; @@ -659,11 +662,11 @@ INT_PTR CreateAboutBox(void) INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT loc; - int i, dh; + int i, dh, cbh = 0; // Prevent resizing static LRESULT disabled[9] = { HTLEFT, HTRIGHT, HTTOP, HTBOTTOM, HTSIZE, HTTOPLEFT, HTTOPRIGHT, HTBOTTOMLEFT, HTBOTTOMRIGHT }; - static HBRUSH background_brush, separator_brush; + static HBRUSH background_brush, separator_brush, buttonface_brush; // To use the system message font NONCLIENTMETRICS ncm; HFONT hDlgFont; @@ -677,9 +680,9 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP ncm.cbSize = sizeof(ncm); // If we're compiling with the Vista SDK or later, the NONCLIENTMETRICS struct // will be the wrong size for previous versions, so we need to adjust it. - #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) +#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (_WIN32_WINNT >= _WIN32_WINNT_VISTA) ncm.cbSize -= sizeof(ncm.iPaddedBorderWidth); - #endif +#endif SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0); hDlgFont = CreateFontIndirect(&(ncm.lfMessageFont)); // Set the dialog to use the system message box font @@ -697,6 +700,7 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP apply_localization(IDD_NOTIFICATION, hDlg); background_brush = CreateSolidBrush(GetSysColor(COLOR_WINDOW)); separator_brush = CreateSolidBrush(GetSysColor(COLOR_3DLIGHT)); + buttonface_brush = CreateSolidBrush(GetSysColor(COLOR_BTNFACE)); SetTitleBarIcon(hDlg); CenterDialog(hDlg); // Change the default icon @@ -713,6 +717,16 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP } else { ShowWindow(GetDlgItem(hDlg, IDYES), SW_SHOW); } + hCtrl = GetDlgItem(hDlg, IDC_DONT_DISPLAY_AGAIN); + if (notification_dont_display_setting != NULL) { + SetWindowTextU(hCtrl, lmprintf(MSG_127)); + } else { + // Remove the "Don't display again" checkbox + ShowWindow(hCtrl, SW_HIDE); + GetWindowRect(hCtrl, &rc); + MapWindowPoints(NULL, hDlg, (POINT*)&rc, 2); + cbh = rc.bottom - rc.top; + } if ((notification_more_info != NULL) && (notification_more_info->callback != NULL)) { hCtrl = GetDlgItem(hDlg, IDC_MORE_INFO); // Resize the 'More information' button @@ -731,17 +745,16 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP GetWindowRect(hCtrl, &rc); dh = rc.bottom - rc.top; DrawTextU(hDC, szMessageText, -1, &rc, DT_CALCRECT | DT_WORDBREAK); - dh = rc.bottom - rc.top - dh + (int)(8.0f * fScale); + dh = max(rc.bottom - rc.top - dh + (int)(8.0f * fScale), 0); safe_release_dc(hCtrl, hDC); - if (dh > 0) { - ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f); - ResizeMoveCtrl(hDlg, hDlg, 0, 0, 0, dh, 1.0f); - ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, -1), 0, 0, 0, dh, 1.0f); // IDC_STATIC = -1 - ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SELECTION_LINE), 0, dh, 0, 0, 1.0f); - ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_MORE_INFO), 0, dh, 0, 0, 1.0f); - ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDYES), 0, dh, 0, 0, 1.0f); - ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDNO), 0, dh, 0, 0, 1.0f); - } + ResizeMoveCtrl(hDlg, hCtrl, 0, 0, 0, dh, 1.0f); + ResizeMoveCtrl(hDlg, hDlg, 0, 0, 0, dh - cbh, 1.0f); + ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, -1), 0, 0, 0, dh, 1.0f); // IDC_STATIC = -1 + ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_SELECTION_LINE), 0, dh, 0, 0, 1.0f); + ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_DONT_DISPLAY_AGAIN), 0, dh, 0, 0, 1.0f); + ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDC_MORE_INFO), 0, dh - cbh, 0, 0, 1.0f); + ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDYES), 0, dh -cbh, 0, 0, 1.0f); + ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, IDNO), 0, dh -cbh, 0, 0, 1.0f); } return (INT_PTR)TRUE; case WM_CTLCOLORSTATIC: @@ -750,6 +763,9 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP if ((HWND)lParam == GetDlgItem(hDlg, IDC_NOTIFICATION_LINE)) { return (INT_PTR)separator_brush; } + if ((HWND)lParam == GetDlgItem(hDlg, IDC_DONT_DISPLAY_AGAIN)) { + return (INT_PTR)buttonface_brush; + } return (INT_PTR)background_brush; case WM_NCHITTEST: // Check coordinates to prevent resize actions @@ -766,11 +782,20 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP case IDCANCEL: case IDYES: case IDNO: + if (IsDlgButtonChecked(hDlg, IDC_DONT_DISPLAY_AGAIN) == BST_CHECKED) { + WriteSettingBool(SETTING_DISABLE_SECURE_BOOT_NOTICE, TRUE); + } EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; case IDC_MORE_INFO: - if (notification_more_info != NULL) - MyDialogBox(hMainInstance, notification_more_info->id, hDlg, notification_more_info->callback); + assert(notification_more_info->callback != NULL); + if (notification_more_info != NULL) { + if (notification_more_info->id == MORE_INFO_URL) { + ShellExecuteA(hDlg, "open", notification_more_info->url, NULL, NULL, SW_SHOWNORMAL); + } else { + MyDialogBox(hMainInstance, notification_more_info->id, hDlg, notification_more_info->callback); + } + } break; } break; @@ -781,7 +806,7 @@ INT_PTR CALLBACK NotificationCallback(HWND hDlg, UINT message, WPARAM wParam, LP /* * Display a custom notification */ -BOOL Notification(int type, const notification_info* more_info, char* title, char* format, ...) +BOOL Notification(int type, const char* dont_display_setting, const notification_info* more_info, char* title, char* format, ...) { BOOL ret; va_list args; @@ -800,6 +825,7 @@ BOOL Notification(int type, const notification_info* more_info, char* title, cha szMessageText[max_msg_size -1] = 0; notification_more_info = more_info; notification_is_question = FALSE; + notification_dont_display_setting = dont_display_setting; switch(type) { case MSG_WARNING_QUESTION: @@ -1478,7 +1504,6 @@ BOOL SetUpdateCheck(void) { BOOL enable_updates; uint64_t commcheck = GetTickCount64(); - notification_info more_info = { IDD_UPDATE_POLICY, UpdateCallback }; char filename[MAX_PATH] = "", exename[] = APPLICATION_NAME ".exe"; size_t fn_len, exe_len; @@ -1489,6 +1514,7 @@ BOOL SetUpdateCheck(void) // If the update interval is not set, this is the first time we run so prompt the user if (ReadSetting32(SETTING_UPDATE_INTERVAL) == 0) { + notification_info more_info; // Add a hack for people who'd prefer the app not to prompt about update settings on first run. // If the executable is called "rufus.exe", without version, we disable the prompt @@ -1501,7 +1527,9 @@ BOOL SetUpdateCheck(void) enable_updates = TRUE; } else { #endif - enable_updates = Notification(MSG_QUESTION, &more_info, lmprintf(MSG_004), lmprintf(MSG_005)); + more_info.id = IDD_UPDATE_POLICY; + more_info.callback = UpdateCallback; + enable_updates = Notification(MSG_QUESTION, NULL, &more_info, lmprintf(MSG_004), lmprintf(MSG_005)); #if !defined(_DEBUG) } #endif