disable update related elements and enable Fido always

* The check for update is not necessary or even desirable for the AppStore
  version, since the Windows Store takes care of updating the app.
This commit is contained in:
Pete Batard 2021-02-08 12:15:49 +00:00
parent f86cd69944
commit 85cd19eb76
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
6 changed files with 69 additions and 56 deletions

View File

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

View File

@ -1759,7 +1759,7 @@ static void InitDialog(HWND hDlg)
// Now that we have a title, we can find the handle of our Dialog
dialog_handle = FindWindowA(NULL, tmp);
uprintf(APPLICATION_NAME " " APPLICATION_ARCH " v%d.%d.%d%s%s", rufus_version[0], rufus_version[1], rufus_version[2],
IsAlphaOrBeta(), (ini_file != NULL)?"(Portable)":"");
IsAlphaOrBeta(), (ini_file != NULL)?"(Portable)": (appstore_version ? "(AppStore version)" : ""));
for (i = 0; i < ARRAYSIZE(resource); i++) {
len = 0;
buf = (char*)GetResource(hMainInstance, resource[i], _RT_RCDATA, "ldlinux_sys", &len, TRUE);
@ -2588,14 +2588,20 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f;
safe_release_dc(hDlg, hDC);
apply_localization(IDD_DIALOG, hDlg);
SetUpdateCheck();
// The AppStore version always enables Fido
if (appstore_version)
SetFidoCheck();
else
SetUpdateCheck();
first_log_display = TRUE;
log_displayed = FALSE;
hLogDialog = MyCreateDialog(hMainInstance, IDD_LOG, hDlg, (DLGPROC)LogCallback);
InitDialog(hDlg);
GetDevices(0);
EnableControls(TRUE, FALSE);
CheckForUpdates(FALSE);
// The AppStore version does not need the internal check for updates
if (!appstore_version)
CheckForUpdates(FALSE);
// Register MEDIA_INSERTED/MEDIA_REMOVED notifications for card readers
if (SUCCEEDED(SHGetSpecialFolderLocation(0, CSIDL_DESKTOP, &pidlDesktop))) {
NotifyEntry.pidl = pidlDesktop;

View File

@ -545,6 +545,7 @@ extern uint64_t DownloadToFileOrBuffer(const char* url, const char* file, BYTE**
extern DWORD DownloadSignedFile(const char* url, const char* file, HWND hProgressDialog, BOOL PromptOnError);
extern HANDLE DownloadSignedFileThreaded(const char* url, const char* file, HWND hProgressDialog, BOOL bPromptOnError);
extern INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
extern void SetFidoCheck(void);
extern BOOL SetUpdateCheck(void);
extern BOOL CheckForUpdates(BOOL force);
extern void DownloadNewVersion(void);

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.1734"
CAPTION "Rufus 3.14.1735"
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,1734,0
PRODUCTVERSION 3,14,1734,0
FILEVERSION 3,14,1735,0
PRODUCTVERSION 3,14,1735,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.1734"
VALUE "FileVersion", "3.14.1735"
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.13.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.14.1734"
VALUE "ProductVersion", "3.14.1735"
END
END
BLOCK "VarFileInfo"

View File

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Standard Dialog Routines (Browse for folder, About, etc)
* Copyright © 2011-2020 Pete Batard <pete@akeo.ie>
* Copyright © 2011-2021 Pete Batard <pete@akeo.ie>
*
* 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
@ -45,7 +45,7 @@
#include "license.h"
/* Globals */
extern BOOL is_x86_32;
extern BOOL is_x86_32, appstore_version;
static HICON hMessageIcon = (HICON)INVALID_HANDLE_VALUE;
static char* szMessageText = NULL;
static char* szMessageTitle = NULL;
@ -589,7 +589,7 @@ INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lP
ResizeButtonHeight(hDlg, IDOK);
static_sprintf(about_blurb, about_blurb_format, lmprintf(MSG_174|MSG_RTF),
lmprintf(MSG_175|MSG_RTF, rufus_version[0], rufus_version[1], rufus_version[2]),
"Copyright © 2011-2020 Pete Batard / Akeo",
"Copyright © 2011-2021 Pete Batard / Akeo",
lmprintf(MSG_176|MSG_RTF), lmprintf(MSG_177|MSG_RTF), lmprintf(MSG_178|MSG_RTF));
for (i=0; i<ARRAYSIZE(hEdit); i++) {
hEdit[i] = GetDlgItem(hDlg, edit_id[i]);
@ -1550,6 +1550,28 @@ out:
return 0;
}
void SetFidoCheck(void)
{
// Detect if we can use Fido, which depends on:
// - Powershell being installed
// - Update check being enabled
// - URL for the script being reachable
if ((ReadRegistryKey32(REGKEY_HKLM, "Microsoft\\PowerShell\\1\\Install") <= 0) &&
(ReadRegistryKey32(REGKEY_HKLM, "Microsoft\\PowerShell\\3\\Install") <= 0)) {
ubprintf("Notice: The ISO download feature has been deactivated because "
"a compatible PowerShell version was not detected on this system.");
return;
}
if (!appstore_version && (ReadSetting32(SETTING_UPDATE_INTERVAL) <= 0)) {
ubprintf("Notice: The ISO download feature has been deactivated because "
"'Check for updates' is disabled in your settings.");
return;
}
CreateThread(NULL, 0, CheckForFidoThread, NULL, 0, NULL);
}
/*
* Initial update check setup
*/
@ -1595,18 +1617,7 @@ BOOL SetUpdateCheck(void)
((ReadSetting32(SETTING_UPDATE_INTERVAL) == -1) && enable_updates) )
WriteSetting32(SETTING_UPDATE_INTERVAL, 86400);
}
// Also detect if we can use Fido, which depends on:
// - Powershell being installed
// - Update check being enabled
// - URL for the script being reachable
if (((ReadRegistryKey32(REGKEY_HKLM, "Microsoft\\PowerShell\\1\\Install") > 0) ||
(ReadRegistryKey32(REGKEY_HKLM, "Microsoft\\PowerShell\\3\\Install") > 0)) &&
(ReadSetting32(SETTING_UPDATE_INTERVAL) > 0)) {
CreateThread(NULL, 0, CheckForFidoThread, NULL, 0, NULL);
} else {
ubprintf("Notice: The ISO download feature has been deactivated because "
"'Check for updates' is disabled in your settings.");
}
SetFidoCheck();
return TRUE;
}

View File

@ -44,7 +44,7 @@
UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
HIMAGELIST hUpImageList, hDownImageList;
extern BOOL use_vds;
extern BOOL use_vds, appstore_version;
int update_progress_type = UPT_PERCENT;
int advanced_device_section_height, advanced_format_section_height;
// (empty) check box width, (empty) drop down width, button height (for and without dropdown match)
@ -1018,13 +1018,16 @@ static INT_PTR CALLBACK ProgressCallback(HWND hCtrl, UINT message, WPARAM wParam
void CreateAdditionalControls(HWND hDlg)
{
int buttons_list[] = { IDC_LANG, IDC_ABOUT, IDC_SETTINGS, IDC_LOG };
int bitmaps_list[] = { 0, 1, 2, 3 };
HINSTANCE hDll;
HIMAGELIST hToolbarImageList;
HICON hIcon, hIconUp, hIconDown;
RECT rc;
SIZE sz;
int icon_offset = 0, i, i16, s16, toolbar_dx = -4 - ((fScale > 1.49f) ? 1 : 0) - ((fScale > 1.99f) ? 1 : 0);
TBBUTTON tbToolbarButtons[7];
int icon_offset = 0, i, i16, s16, size;
int toolbar_dx = -4 - ((fScale > 1.49f) ? 1 : 0) - ((fScale > 1.99f) ? 1 : 0);
TBBUTTON tbToolbarButtons[ARRAYSIZE(buttons_list) * 2 - 1];
unsigned char* buffer;
DWORD bufsize;
@ -1119,35 +1122,27 @@ void CreateAdditionalControls(HWND hDlg)
SendMessage(hMultiToolbar, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)hToolbarImageList);
SendMessage(hMultiToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
memset(tbToolbarButtons, 0, sizeof(TBBUTTON) * ARRAYSIZE(tbToolbarButtons));
tbToolbarButtons[0].idCommand = IDC_LANG;
tbToolbarButtons[0].fsStyle = BTNS_BUTTON;
tbToolbarButtons[0].fsState = TBSTATE_ENABLED;
tbToolbarButtons[0].iBitmap = 0;
tbToolbarButtons[1].fsStyle = BTNS_AUTOSIZE;
tbToolbarButtons[1].fsState = TBSTATE_INDETERMINATE;
tbToolbarButtons[1].iBitmap = I_IMAGENONE;
tbToolbarButtons[1].iString = (fScale < 1.5f) ? (INT_PTR)L"" : (INT_PTR)L" ";
tbToolbarButtons[2].idCommand = IDC_ABOUT;
tbToolbarButtons[2].fsStyle = BTNS_BUTTON;
tbToolbarButtons[2].fsState = TBSTATE_ENABLED;
tbToolbarButtons[2].iBitmap = 1;
tbToolbarButtons[3].fsStyle = BTNS_AUTOSIZE;
tbToolbarButtons[3].fsState = TBSTATE_INDETERMINATE;
tbToolbarButtons[3].iBitmap = I_IMAGENONE;
tbToolbarButtons[3].iString = (fScale < 1.5f) ? (INT_PTR)L"" : (INT_PTR)L" ";
tbToolbarButtons[4].idCommand = IDC_SETTINGS;
tbToolbarButtons[4].fsStyle = BTNS_BUTTON;
tbToolbarButtons[4].fsState = TBSTATE_ENABLED;
tbToolbarButtons[4].iBitmap = 2;
tbToolbarButtons[5].fsStyle = BTNS_AUTOSIZE;
tbToolbarButtons[5].fsState = TBSTATE_INDETERMINATE;
tbToolbarButtons[5].iBitmap = I_IMAGENONE;
tbToolbarButtons[5].iString = (fScale < 1.5f) ? (INT_PTR)L"" : (INT_PTR)L" ";
tbToolbarButtons[6].idCommand = IDC_LOG;
tbToolbarButtons[6].fsStyle = BTNS_BUTTON;
tbToolbarButtons[6].fsState = TBSTATE_ENABLED;
tbToolbarButtons[6].iBitmap = 3;
SendMessage(hMultiToolbar, TB_ADDBUTTONS, (WPARAM)7, (LPARAM)&tbToolbarButtons);
size = 2 * ARRAYSIZE(buttons_list) - 1;
if (appstore_version) {
// Remove the Update Settings button for the AppStore version
buttons_list[2] = buttons_list[3];
bitmaps_list[2] = bitmaps_list[3];
size -= 2;
}
for (i = 0; i < size; i++) {
if (i % 2 == 0) {
tbToolbarButtons[i].idCommand = buttons_list[i / 2];
tbToolbarButtons[i].fsStyle = BTNS_BUTTON;
tbToolbarButtons[i].fsState = TBSTATE_ENABLED;
tbToolbarButtons[i].iBitmap = bitmaps_list[i / 2];
} else {
tbToolbarButtons[i].fsStyle = BTNS_AUTOSIZE;
tbToolbarButtons[i].fsState = TBSTATE_INDETERMINATE;
tbToolbarButtons[i].iBitmap = I_IMAGENONE;
tbToolbarButtons[i].iString = (fScale < 1.5f) ? (INT_PTR)L"" : (INT_PTR)L" ";
}
}
SendMessage(hMultiToolbar, TB_ADDBUTTONS, (WPARAM)i, (LPARAM)&tbToolbarButtons);
SendMessage(hMultiToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(i16, ddbh));
SetAccessibleName(hMultiToolbar, lmprintf(MSG_315));