mirror of
https://github.com/pbatard/rufus.git
synced 2024-08-14 23:57:05 +00:00
[net] fix incorrect architectures when querying for updates
This commit is contained in:
parent
f27dda1164
commit
6280e8020a
5 changed files with 33 additions and 39 deletions
|
@ -625,7 +625,6 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
|
|||
int status = 0;
|
||||
const char* server_url = RUFUS_URL "/";
|
||||
int i, j, k, max_channel, verbose = 0, verpos[4];
|
||||
static const char* archname[] = {"win_x86", "win_x64", "win_arm", "win_arm64", "win_none"};
|
||||
static const char* channel[] = { "release", "beta", "test" }; // release channel
|
||||
const char* accept_types[] = { "*/*\0", NULL };
|
||||
char* buf = NULL;
|
||||
|
@ -734,8 +733,8 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
|
|||
// and then remove each of the <os_> components until we find our match. For instance, we may first
|
||||
// look for rufus_win_x64_6.2.ver (Win8 x64) but only get a match for rufus_win_x64_6.ver (Vista x64 or later)
|
||||
// This allows sunsetting OS versions (eg XP) or providing different downloads for different archs/groups.
|
||||
static_sprintf(urlpath, "%s%s%s_%s_%lu.%lu.ver", APPLICATION_NAME, (k==0)?"":"_",
|
||||
(k==0)?"":channel[k], archname[GetCpuArch()], os_version.dwMajorVersion, os_version.dwMinorVersion);
|
||||
static_sprintf(urlpath, "%s%s%s_win_%s_%lu.%lu.ver", APPLICATION_NAME, (k == 0) ? "": "_",
|
||||
(k == 0) ? "" : channel[k], GetAppArchName(), os_version.dwMajorVersion, os_version.dwMinorVersion);
|
||||
vuprintf("Base update check: %s", urlpath);
|
||||
for (i = 0, j = (int)safe_strlen(urlpath) - 5; (j > 0) && (i < ARRAYSIZE(verpos)); j--) {
|
||||
if ((urlpath[j] == '.') || (urlpath[j] == '_')) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Rufus: The Reliable USB Formatting Utility
|
||||
* Elementary Unicode compliant find/replace parser
|
||||
* Copyright © 2012-2022 Pete Batard <pete@akeo.ie>
|
||||
* Copyright © 2012-2023 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
|
||||
|
@ -914,7 +914,6 @@ void parse_update(char* buf, size_t len)
|
|||
char allowed_rtf_chars[] = "abcdefghijklmnopqrstuvwxyz|~-_:*'";
|
||||
char allowed_std_chars[] = "\r\n ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\"$%^&+=<>(){}[].,;#@/?";
|
||||
char download_url_name[24];
|
||||
char *arch_names[5] = { "unknown", "x86", "x64", "arm", "arm64" };
|
||||
|
||||
// strchr includes the NUL terminator in the search, so take care of backslash before NUL
|
||||
if ((buf == NULL) || (len < 2) || (len > 64 * KB) || (buf[len-1] != 0) || (buf[len-2] == '\\'))
|
||||
|
@ -951,7 +950,7 @@ void parse_update(char* buf, size_t len)
|
|||
}
|
||||
safe_free(data);
|
||||
}
|
||||
static_sprintf(download_url_name, "download_url_%s", arch_names[GetCpuArch()]);
|
||||
static_sprintf(download_url_name, "download_url_%s", GetAppArchName());
|
||||
update.download_url = get_sanitized_token_data_buffer(download_url_name, 1, buf, len);
|
||||
if (update.download_url == NULL)
|
||||
update.download_url = get_sanitized_token_data_buffer("download_url", 1, buf, len);
|
||||
|
|
|
@ -557,7 +557,7 @@ extern char app_data_dir[MAX_PATH], *image_path, *fido_url;
|
|||
*/
|
||||
extern void GetWindowsVersion(void);
|
||||
extern BOOL is_x64(void);
|
||||
extern int GetCpuArch(void);
|
||||
extern const char* GetAppArchName(void);
|
||||
extern const char* WindowsErrorString(void);
|
||||
extern void DumpBufferHex(void *buf, size_t size);
|
||||
extern void PrintStatusInfo(BOOL info, BOOL debug, unsigned int duration, int msg_id, ...);
|
||||
|
|
10
src/rufus.rc
10
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.23.2019"
|
||||
CAPTION "Rufus 3.23.2020"
|
||||
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
|
||||
|
@ -392,8 +392,8 @@ END
|
|||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,23,2019,0
|
||||
PRODUCTVERSION 3,23,2019,0
|
||||
FILEVERSION 3,23,2020,0
|
||||
PRODUCTVERSION 3,23,2020,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -411,13 +411,13 @@ BEGIN
|
|||
VALUE "Comments", "https://rufus.ie"
|
||||
VALUE "CompanyName", "Akeo Consulting"
|
||||
VALUE "FileDescription", "Rufus"
|
||||
VALUE "FileVersion", "3.23.2019"
|
||||
VALUE "FileVersion", "3.23.2020"
|
||||
VALUE "InternalName", "Rufus"
|
||||
VALUE "LegalCopyright", "© 2011-2023 Pete Batard (GPL v3)"
|
||||
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
|
||||
VALUE "OriginalFilename", "rufus-3.23.exe"
|
||||
VALUE "ProductName", "Rufus"
|
||||
VALUE "ProductVersion", "3.23.2019"
|
||||
VALUE "ProductVersion", "3.23.2020"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
28
src/stdfn.c
28
src/stdfn.c
|
@ -223,22 +223,18 @@ BOOL is_x64(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int GetCpuArch(void)
|
||||
{
|
||||
SYSTEM_INFO info = { 0 };
|
||||
GetNativeSystemInfo(&info);
|
||||
switch (info.wProcessorArchitecture) {
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
return ARCH_X86_64;
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
return ARCH_X86_64;
|
||||
case PROCESSOR_ARCHITECTURE_ARM64:
|
||||
return ARCH_ARM_64;
|
||||
case PROCESSOR_ARCHITECTURE_ARM:
|
||||
return ARCH_ARM_32;
|
||||
default:
|
||||
return ARCH_UNKNOWN;
|
||||
}
|
||||
const char* GetAppArchName(void) {
|
||||
#if defined(_M_AMD64)
|
||||
return "x64";
|
||||
#elif defined(_M_IX86)
|
||||
return "x86";
|
||||
#elif defined(_M_ARM64)
|
||||
return "arm64";
|
||||
#elif defined(_M_ARM)
|
||||
return "arm";
|
||||
#else
|
||||
return "unknown";
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char* GetEdition(DWORD ProductType)
|
||||
|
|
Loading…
Reference in a new issue