1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[appstore] 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 21:02:01 +00:00
parent 1062dde076
commit bb291df342
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
6 changed files with 70 additions and 57 deletions

View file

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

View file

@ -1,6 +1,6 @@
/* /*
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* 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 * 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
@ -1759,7 +1759,7 @@ static void InitDialog(HWND hDlg)
// Now that we have a title, we can find the handle of our Dialog // Now that we have a title, we can find the handle of our Dialog
dialog_handle = FindWindowA(NULL, tmp); 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], 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++) { for (i = 0; i < ARRAYSIZE(resource); i++) {
len = 0; len = 0;
buf = (char*)GetResource(hMainInstance, resource[i], _RT_RCDATA, "ldlinux_sys", &len, TRUE); buf = (char*)GetResource(hMainInstance, resource[i], _RT_RCDATA, "ldlinux_sys", &len, TRUE);
@ -2588,6 +2588,10 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f; fScale = GetDeviceCaps(hDC, LOGPIXELSX) / 96.0f;
safe_release_dc(hDlg, hDC); safe_release_dc(hDlg, hDC);
apply_localization(IDD_DIALOG, hDlg); apply_localization(IDD_DIALOG, hDlg);
// The AppStore version always enables Fido
if (appstore_version)
SetFidoCheck();
else
SetUpdateCheck(); SetUpdateCheck();
first_log_display = TRUE; first_log_display = TRUE;
log_displayed = FALSE; log_displayed = FALSE;
@ -2595,6 +2599,8 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
InitDialog(hDlg); InitDialog(hDlg);
GetDevices(0); GetDevices(0);
EnableControls(TRUE, FALSE); EnableControls(TRUE, FALSE);
// The AppStore version does not need the internal check for updates
if (!appstore_version)
CheckForUpdates(FALSE); CheckForUpdates(FALSE);
// Register MEDIA_INSERTED/MEDIA_REMOVED notifications for card readers // Register MEDIA_INSERTED/MEDIA_REMOVED notifications for card readers
if (SUCCEEDED(SHGetSpecialFolderLocation(0, CSIDL_DESKTOP, &pidlDesktop))) { if (SUCCEEDED(SHGetSpecialFolderLocation(0, CSIDL_DESKTOP, &pidlDesktop))) {

View file

@ -1,6 +1,6 @@
/* /*
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* 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 * 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
@ -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 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 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 INT_PTR CALLBACK UpdateCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
extern void SetFidoCheck(void);
extern BOOL SetUpdateCheck(void); extern BOOL SetUpdateCheck(void);
extern BOOL CheckForUpdates(BOOL force); extern BOOL CheckForUpdates(BOOL force);
extern void DownloadNewVersion(void); extern void DownloadNewVersion(void);

View file

@ -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.14.1741" CAPTION "Rufus 3.14.1742"
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
@ -395,8 +395,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,14,1741,0 FILEVERSION 3,14,1742,0
PRODUCTVERSION 3,14,1741,0 PRODUCTVERSION 3,14,1742,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -414,13 +414,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.14.1741" VALUE "FileVersion", "3.14.1742"
VALUE "InternalName", "Rufus" VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2021 Pete Batard (GPL v3)" VALUE "LegalCopyright", "© 2011-2021 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.14.exe" VALUE "OriginalFilename", "rufus-3.14.exe"
VALUE "ProductName", "Rufus" VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.14.1741" VALUE "ProductVersion", "3.14.1742"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -45,7 +45,7 @@
#include "license.h" #include "license.h"
/* Globals */ /* Globals */
extern BOOL is_x86_32; extern BOOL is_x86_32, appstore_version;
static HICON hMessageIcon = (HICON)INVALID_HANDLE_VALUE; static HICON hMessageIcon = (HICON)INVALID_HANDLE_VALUE;
static char* szMessageText = NULL; static char* szMessageText = NULL;
static char* szMessageTitle = NULL; static char* szMessageTitle = NULL;
@ -1550,6 +1550,28 @@ out:
return 0; return 0;
} }
void SetFidoCheck(void)
{
// Detect if we can use Fido, which depends on:
// - Powershell being installed
// - Rufus running in AppStore mode or 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 * Initial update check setup
*/ */
@ -1595,18 +1617,7 @@ BOOL SetUpdateCheck(void)
((ReadSetting32(SETTING_UPDATE_INTERVAL) == -1) && enable_updates) ) ((ReadSetting32(SETTING_UPDATE_INTERVAL) == -1) && enable_updates) )
WriteSetting32(SETTING_UPDATE_INTERVAL, 86400); WriteSetting32(SETTING_UPDATE_INTERVAL, 86400);
} }
// Also detect if we can use Fido, which depends on: SetFidoCheck();
// - 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.");
}
return TRUE; return TRUE;
} }

View file

@ -1,7 +1,7 @@
/* /*
* Rufus: The Reliable USB Formatting Utility * Rufus: The Reliable USB Formatting Utility
* UI-related function calls * UI-related function calls
* Copyright © 2018-2020 Pete Batard <pete@akeo.ie> * Copyright © 2018-2021 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
@ -44,7 +44,7 @@
UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU; UINT_PTR UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
HIMAGELIST hUpImageList, hDownImageList; HIMAGELIST hUpImageList, hDownImageList;
extern BOOL use_vds; extern BOOL use_vds, appstore_version;
int update_progress_type = UPT_PERCENT; int update_progress_type = UPT_PERCENT;
int advanced_device_section_height, advanced_format_section_height; int advanced_device_section_height, advanced_format_section_height;
// (empty) check box width, (empty) drop down width, button height (for and without dropdown match) // (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) void CreateAdditionalControls(HWND hDlg)
{ {
int buttons_list[] = { IDC_LANG, IDC_ABOUT, IDC_SETTINGS, IDC_LOG };
int bitmaps_list[] = { 0, 1, 2, 3 };
HINSTANCE hDll; HINSTANCE hDll;
HIMAGELIST hToolbarImageList; HIMAGELIST hToolbarImageList;
HICON hIcon, hIconUp, hIconDown; HICON hIcon, hIconUp, hIconDown;
RECT rc; RECT rc;
SIZE sz; SIZE sz;
int icon_offset = 0, i, i16, s16, toolbar_dx = -4 - ((fScale > 1.49f) ? 1 : 0) - ((fScale > 1.99f) ? 1 : 0); int icon_offset = 0, i, i16, s16, size;
TBBUTTON tbToolbarButtons[7]; int toolbar_dx = -4 - ((fScale > 1.49f) ? 1 : 0) - ((fScale > 1.99f) ? 1 : 0);
TBBUTTON tbToolbarButtons[ARRAYSIZE(buttons_list) * 2 - 1];
unsigned char* buffer; unsigned char* buffer;
DWORD bufsize; DWORD bufsize;
@ -1119,35 +1122,27 @@ void CreateAdditionalControls(HWND hDlg)
SendMessage(hMultiToolbar, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)hToolbarImageList); SendMessage(hMultiToolbar, TB_SETIMAGELIST, (WPARAM)0, (LPARAM)hToolbarImageList);
SendMessage(hMultiToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); SendMessage(hMultiToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0);
memset(tbToolbarButtons, 0, sizeof(TBBUTTON) * ARRAYSIZE(tbToolbarButtons)); memset(tbToolbarButtons, 0, sizeof(TBBUTTON) * ARRAYSIZE(tbToolbarButtons));
tbToolbarButtons[0].idCommand = IDC_LANG; size = 2 * ARRAYSIZE(buttons_list) - 1;
tbToolbarButtons[0].fsStyle = BTNS_BUTTON; if (appstore_version) {
tbToolbarButtons[0].fsState = TBSTATE_ENABLED; // Remove the Update Settings button for the AppStore version
tbToolbarButtons[0].iBitmap = 0; buttons_list[2] = buttons_list[3];
tbToolbarButtons[1].fsStyle = BTNS_AUTOSIZE; bitmaps_list[2] = bitmaps_list[3];
tbToolbarButtons[1].fsState = TBSTATE_INDETERMINATE; size -= 2;
tbToolbarButtons[1].iBitmap = I_IMAGENONE; }
tbToolbarButtons[1].iString = (fScale < 1.5f) ? (INT_PTR)L"" : (INT_PTR)L" "; for (i = 0; i < size; i++) {
tbToolbarButtons[2].idCommand = IDC_ABOUT; if (i % 2 == 0) {
tbToolbarButtons[2].fsStyle = BTNS_BUTTON; tbToolbarButtons[i].idCommand = buttons_list[i / 2];
tbToolbarButtons[2].fsState = TBSTATE_ENABLED; tbToolbarButtons[i].fsStyle = BTNS_BUTTON;
tbToolbarButtons[2].iBitmap = 1; tbToolbarButtons[i].fsState = TBSTATE_ENABLED;
tbToolbarButtons[3].fsStyle = BTNS_AUTOSIZE; tbToolbarButtons[i].iBitmap = bitmaps_list[i / 2];
tbToolbarButtons[3].fsState = TBSTATE_INDETERMINATE; } else {
tbToolbarButtons[3].iBitmap = I_IMAGENONE; tbToolbarButtons[i].fsStyle = BTNS_AUTOSIZE;
tbToolbarButtons[3].iString = (fScale < 1.5f) ? (INT_PTR)L"" : (INT_PTR)L" "; tbToolbarButtons[i].fsState = TBSTATE_INDETERMINATE;
tbToolbarButtons[4].idCommand = IDC_SETTINGS; tbToolbarButtons[i].iBitmap = I_IMAGENONE;
tbToolbarButtons[4].fsStyle = BTNS_BUTTON; tbToolbarButtons[i].iString = (fScale < 1.5f) ? (INT_PTR)L"" : (INT_PTR)L" ";
tbToolbarButtons[4].fsState = TBSTATE_ENABLED; }
tbToolbarButtons[4].iBitmap = 2; }
tbToolbarButtons[5].fsStyle = BTNS_AUTOSIZE; SendMessage(hMultiToolbar, TB_ADDBUTTONS, (WPARAM)i, (LPARAM)&tbToolbarButtons);
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);
SendMessage(hMultiToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(i16, ddbh)); SendMessage(hMultiToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(i16, ddbh));
SetAccessibleName(hMultiToolbar, lmprintf(MSG_315)); SetAccessibleName(hMultiToolbar, lmprintf(MSG_315));