From 70f99c18fac26c71cc2191e717804e464bc775f3 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Sun, 13 Mar 2022 20:26:38 +0200 Subject: [PATCH] Updates: Allow downgrades (#1051) --- ExplorerPatcher/settings.reg | 2 ++ ExplorerPatcher/settings10.reg | 2 ++ ExplorerPatcher/updates.c | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ExplorerPatcher/settings.reg b/ExplorerPatcher/settings.reg index 8cc129a..e50795c 100644 --- a/ExplorerPatcher/settings.reg +++ b/ExplorerPatcher/settings.reg @@ -562,6 +562,8 @@ "UpdatePolicy"=dword:00000001 ;b Receive pre-release versions, if available (not recommended) "UpdatePreferStaging"=dword:00000000 +;b Suggest the latest version on the server, even if it's older (not recommended) +"UpdateAllowDowngrades"=dword:00000000 ;t Update servers: ;w Releases ;Type a URL that serves resources adhering to GitHub's releases API. To learn how to configure your own update server, please consult the wiki. diff --git a/ExplorerPatcher/settings10.reg b/ExplorerPatcher/settings10.reg index 832ccde..509cfa3 100644 --- a/ExplorerPatcher/settings10.reg +++ b/ExplorerPatcher/settings10.reg @@ -492,6 +492,8 @@ "UpdatePolicy"=dword:00000001 ;b Receive pre-release versions, if available (not recommended) "UpdatePreferStaging"=dword:00000000 +;b Suggest the latest version on the server, even if it's older (not recommended) +"UpdateAllowDowngrades"=dword:00000000 ;t Update servers: ;w Releases ;Type a URL that serves resources adhering to GitHub's releases API. To learn how to configure your own update server, please consult the wiki. diff --git a/ExplorerPatcher/updates.c b/ExplorerPatcher/updates.c index 1591ee9..cd30b51 100644 --- a/ExplorerPatcher/updates.c +++ b/ExplorerPatcher/updates.c @@ -287,7 +287,9 @@ BOOL IsUpdateAvailableHelper( } } } - if (res == -1) + DWORD dwAllowDowngrades = FALSE, dwSize = sizeof(DWORD); + RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), L"UpdateAllowDowngrades", RRF_RT_DWORD, NULL, &dwAllowDowngrades, &dwSize); + if ((res == 1 && dwAllowDowngrades) || res == -1) { bIsUpdateAvailable = TRUE; }