diff --git a/.vs/rufus.vcxproj b/.vs/rufus.vcxproj
index 8c9b40f97e..befb03f54e 100644
--- a/.vs/rufus.vcxproj
+++ b/.vs/rufus.vcxproj
@@ -381,7 +381,6 @@
-
@@ -413,7 +412,6 @@
-
diff --git a/.vs/rufus.vcxproj.filters b/.vs/rufus.vcxproj.filters
index fa818f9add..90e4a67b97 100644
--- a/.vs/rufus.vcxproj.filters
+++ b/.vs/rufus.vcxproj.filters
@@ -93,9 +93,6 @@
Source Files
-
- Source Files
-
@@ -194,9 +191,6 @@
Header Files
-
- Header Files
-
diff --git a/src/Makefile.am b/src/Makefile.am
index 6d3dc08aa4..f9416588e8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -17,7 +17,7 @@ AM_V_WINDRES = $(AM_V_WINDRES_$(V))
%_rc.o: %.rc ../res/loc/embedded.loc
$(AM_V_WINDRES) $(AM_RCFLAGS) -i $< -o $@
-rufus_SOURCES = badblocks.c cpu.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
+rufus_SOURCES = badblocks.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
localization.c net.c parser.c pki.c process.c re.c rufus.c smart.c stdfn.c stdio.c stdlg.c syslinux.c ui.c vhd.c wue.c
rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/syslinux/libinstaller -I$(srcdir)/syslinux/win -I$(srcdir)/libcdio $(AM_CFLAGS) \
-DEXT2_FLAT_INCLUDES=0 -DSOLUTION=rufus
diff --git a/src/Makefile.in b/src/Makefile.in
index 003ffb8ed1..1b3d4e3cbf 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -87,12 +87,11 @@ mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
-am_rufus_OBJECTS = rufus-badblocks.$(OBJEXT) rufus-cpu.$(OBJEXT) \
- rufus-dev.$(OBJEXT) rufus-dos.$(OBJEXT) \
- rufus-dos_locale.$(OBJEXT) rufus-drive.$(OBJEXT) \
- rufus-format.$(OBJEXT) rufus-format_ext.$(OBJEXT) \
- rufus-format_fat32.$(OBJEXT) rufus-hash.$(OBJEXT) \
- rufus-icon.$(OBJEXT) rufus-iso.$(OBJEXT) \
+am_rufus_OBJECTS = rufus-badblocks.$(OBJEXT) rufus-dev.$(OBJEXT) \
+ rufus-dos.$(OBJEXT) rufus-dos_locale.$(OBJEXT) \
+ rufus-drive.$(OBJEXT) rufus-format.$(OBJEXT) \
+ rufus-format_ext.$(OBJEXT) rufus-format_fat32.$(OBJEXT) \
+ rufus-hash.$(OBJEXT) rufus-icon.$(OBJEXT) rufus-iso.$(OBJEXT) \
rufus-localization.$(OBJEXT) rufus-net.$(OBJEXT) \
rufus-parser.$(OBJEXT) rufus-pki.$(OBJEXT) \
rufus-process.$(OBJEXT) rufus-re.$(OBJEXT) \
@@ -285,7 +284,7 @@ AM_V_WINDRES_0 = @echo " RC $@";$(WINDRES)
AM_V_WINDRES_1 = $(WINDRES)
AM_V_WINDRES_ = $(AM_V_WINDRES_$(AM_DEFAULT_VERBOSITY))
AM_V_WINDRES = $(AM_V_WINDRES_$(V))
-rufus_SOURCES = badblocks.c cpu.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
+rufus_SOURCES = badblocks.c dev.c dos.c dos_locale.c drive.c format.c format_ext.c format_fat32.c hash.c icon.c iso.c \
localization.c net.c parser.c pki.c process.c re.c rufus.c smart.c stdfn.c stdio.c stdlg.c syslinux.c ui.c vhd.c wue.c
rufus_CFLAGS = -I$(srcdir)/ms-sys/inc -I$(srcdir)/syslinux/libfat -I$(srcdir)/syslinux/libinstaller -I$(srcdir)/syslinux/win -I$(srcdir)/libcdio $(AM_CFLAGS) \
@@ -355,12 +354,6 @@ rufus-badblocks.o: badblocks.c
rufus-badblocks.obj: badblocks.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-badblocks.obj `if test -f 'badblocks.c'; then $(CYGPATH_W) 'badblocks.c'; else $(CYGPATH_W) '$(srcdir)/badblocks.c'; fi`
-rufus-cpu.o: cpu.c
- $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-cpu.o `test -f 'cpu.c' || echo '$(srcdir)/'`cpu.c
-
-rufus-cpu.obj: cpu.c
- $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-cpu.obj `if test -f 'cpu.c'; then $(CYGPATH_W) 'cpu.c'; else $(CYGPATH_W) '$(srcdir)/cpu.c'; fi`
-
rufus-dev.o: dev.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rufus_CFLAGS) $(CFLAGS) -c -o rufus-dev.o `test -f 'dev.c' || echo '$(srcdir)/'`dev.c
diff --git a/src/bled/header_verbose_list.c b/src/bled/header_verbose_list.c
index a575a08a02..74b97f95c4 100644
--- a/src/bled/header_verbose_list.c
+++ b/src/bled/header_verbose_list.c
@@ -9,7 +9,6 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
{
struct tm tm_time;
struct tm *ptm = &tm_time; //localtime(&file_header->mtime);
- char modestr[12];
#if ENABLE_FEATURE_TAR_UNAME_GNAME
char uid[sizeof(int)*3 + 2];
@@ -29,8 +28,8 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
/*sprintf(gid, "%u", (unsigned)file_header->gid);*/
group = utoa(file_header->gid);
}
- printf("%s %s/%s %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
- bb_mode_string(modestr, file_header->mode),
+ printf("%u %s/%s %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
+ file_header->mode,
user,
group,
file_header->size,
@@ -46,8 +45,8 @@ void FAST_FUNC header_verbose_list(const file_header_t *file_header)
localtime_r(&file_header->mtime, ptm);
- printf("%s %u/%u %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
- bb_mode_string(modestr, file_header->mode),
+ printf("%u %u/%u %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
+ file_header->mode,
(unsigned)file_header->uid,
(unsigned)file_header->gid,
file_header->size,
diff --git a/src/bled/libbb.h b/src/bled/libbb.h
index 94ae9dd4b6..f1cf7d6e05 100644
--- a/src/bled/libbb.h
+++ b/src/bled/libbb.h
@@ -180,7 +180,6 @@ static inline void *xrealloc(void *ptr, size_t size) {
#define bb_msg_read_error "read error"
#define bb_msg_write_error "write error"
-#define bb_mode_string(str, mode) str
#define bb_make_directory(path, mode, flags) SHCreateDirectoryExU(NULL, path, NULL)
static inline int link(const char *oldpath, const char *newpath) { errno = ENOSYS; return -1; }
diff --git a/src/cpu.c b/src/cpu.c
deleted file mode 100644
index 11f84915bb..0000000000
--- a/src/cpu.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Rufus: The Reliable USB Formatting Utility
- * CPU features detection
- * Copyright © 2022 Pete Batard
- * Copyright © 2022 Jeffrey Walton
- *
- * 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-#include "cpu.h"
-
-#if (defined(CPU_X86_SHA1_ACCELERATION) || defined(CPU_X86_SHA256_ACCELERATION))
-#if defined(RUFUS_MSC_VERSION)
-#include
-#elif (defined(RUFUS_GCC_VERSION) || defined(RUFUS_CLANG_VERSION))
-#include
-#elif defined(RUFUS_INTEL_VERSION)
-#include
-#endif
-#endif
-
-BOOL cpu_has_sha1_accel = FALSE;
-BOOL cpu_has_sha256_accel = FALSE;
-
-/*
- * Three elements must be in place to make a meaningful call to the
- * DetectSHA###Acceleration() calls. First, the compiler must support
- * the underlying intrinsics. Second, the platform must provide a
- * cpuid() function. And third, the cpu must actually support the SHA-1
- * and SHA-256 instructions.
- *
- * If any of the conditions are not met, then DetectSHA###Acceleration()
- * returns FALSE.
- */
-
-/*
- * Detect if the processor supports SHA-1 acceleration. We only check for
- * the three ISAs we need - SSSE3, SSE4.1 and SHA. We don't check for OS
- * support or XSAVE because that's been enabled since Windows 2000.
- */
-BOOL DetectSHA1Acceleration(void)
-{
-#if defined(CPU_X86_SHA1_ACCELERATION)
-#if defined(_MSC_VER)
- uint32_t regs0[4] = {0,0,0,0}, regs1[4] = {0,0,0,0}, regs7[4] = {0,0,0,0};
- const uint32_t SSSE3_BIT = 1u << 9; /* Function 1, Bit 9 of ECX */
- const uint32_t SSE41_BIT = 1u << 19; /* Function 1, Bit 19 of ECX */
- const uint32_t SHA_BIT = 1u << 29; /* Function 7, Bit 29 of EBX */
-
- __cpuid(regs0, 0);
- const uint32_t highest = regs0[0]; /*EAX*/
-
- if (highest >= 0x01) {
- __cpuidex(regs1, 1, 0);
- }
- if (highest >= 0x07) {
- __cpuidex(regs7, 7, 0);
- }
-
- return (regs1[2] /*ECX*/ & SSSE3_BIT) && (regs1[2] /*ECX*/ & SSE41_BIT) && (regs7[1] /*EBX*/ & SHA_BIT) ? TRUE : FALSE;
-#elif defined(__GNUC__) || defined(__clang__)
- /* __builtin_cpu_supports available in GCC 4.8.1 and above */
- return __builtin_cpu_supports("ssse3") && __builtin_cpu_supports("sse4.1") && __builtin_cpu_supports("sha") ? TRUE : FALSE;
-#elif defined(__INTEL_COMPILER)
- /* https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_may_i_use_cpu_feature */
- return _may_i_use_cpu_feature(_FEATURE_SSSE3|_FEATURE_SSE4_1|_FEATURE_SHA) ? TRUE : FALSE;
-#else
- return FALSE;
-#endif
-#else
- return FALSE;
-#endif
-}
-
-/*
- * Detect if the processor supports SHA-256 acceleration. We only check for
- * the three ISAs we need - SSSE3, SSE4.1 and SHA. We don't check for OS
- * support or XSAVE because that's been enabled since Windows 2000.
- */
-BOOL DetectSHA256Acceleration(void)
-{
-#if defined(CPU_X86_SHA256_ACCELERATION)
-#if defined(_MSC_VER)
- uint32_t regs0[4] = {0,0,0,0}, regs1[4] = {0,0,0,0}, regs7[4] = {0,0,0,0};
- const uint32_t SSSE3_BIT = 1u << 9; /* Function 1, Bit 9 of ECX */
- const uint32_t SSE41_BIT = 1u << 19; /* Function 1, Bit 19 of ECX */
- const uint32_t SHA_BIT = 1u << 29; /* Function 7, Bit 29 of EBX */
-
- __cpuid(regs0, 0);
- const uint32_t highest = regs0[0]; /*EAX*/
-
- if (highest >= 0x01) {
- __cpuidex(regs1, 1, 0);
- }
- if (highest >= 0x07) {
- __cpuidex(regs7, 7, 0);
- }
-
- return (regs1[2] /*ECX*/ & SSSE3_BIT) && (regs1[2] /*ECX*/ & SSE41_BIT) && (regs7[1] /*EBX*/ & SHA_BIT) ? TRUE : FALSE;
-#elif defined(__GNUC__) || defined(__clang__)
- /* __builtin_cpu_supports available in GCC 4.8.1 and above */
- return __builtin_cpu_supports("ssse3") && __builtin_cpu_supports("sse4.1") && __builtin_cpu_supports("sha") ? TRUE : FALSE;
-#elif defined(__INTEL_COMPILER)
- /* https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_may_i_use_cpu_feature */
- return _may_i_use_cpu_feature(_FEATURE_SSSE3|_FEATURE_SSE4_1|_FEATURE_SHA) ? TRUE : FALSE;
-#else
- return FALSE;
-#endif
-#else
- return FALSE;
-#endif
-}
diff --git a/src/cpu.h b/src/cpu.h
deleted file mode 100644
index 077f19fd92..0000000000
--- a/src/cpu.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Rufus: The Reliable USB Formatting Utility
- * CPU features detection
- * Copyright © 2022 Pete Batard
- * Copyright © 2022 Jeffrey Walton
- *
- * 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-/*
- * Primarily added to support SHA instructions on x86 machines.
- * SHA acceleration is becoming as ubiquitous as AES acceleration.
- * SHA support was introduced in Intel Goldmont architecture, like
- * Celeron J3455 and Pentium J4205. The instructions are now present
- * in AMD Ryzen 3 (Zen architecture) and above, and Intel Core
- * 10th-gen processors (Ice Lake), 11th-gen processors (Rocket Lake)
- * and above.
- *
- * Typical benchmarks for x86 SHA acceleration is about a 6x to 10x
- * speedup over a C/C++ implementation. The rough measurements are
- * 1.0 to 1.8 cpb for SHA-1, and 1.5 to 2.5 cpb for SHA-256. On a
- * Celeron J3455, that's 1.1 GB/s for SHA-1 and 800 MB/s for SHA-256.
- * On a 10th-gen Core i5, that's about 1.65 GB/s for SHA-1 and about
- * 1.3 GB/s for SHA-256.
- */
-
-#include "rufus.h"
-
-#pragma once
-
-#ifdef _MSC_VER
-#define RUFUS_MSC_VERSION (_MSC_VER)
-#if (RUFUS_MSC_VERSION < 1900)
-#error "Your compiler is too old to build this application"
-#endif
-#endif
-
-#if defined(__GNUC__)
-#define RUFUS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
-#if (RUFUS_GCC_VERSION < 40900)
-#error "Your compiler is too old to build this application"
-#endif
-#endif
-
-#ifdef __INTEL_COMPILER
-#define RUFUS_INTEL_VERSION (__INTEL_COMPILER)
-#if (RUFUS_INTEL_VERSION < 1600)
-#error "Your compiler is too old to build this application"
-#endif
-#endif
-
-#if defined(__clang__)
-#define RUFUS_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
-#if (RUFUS_CLANG_VERSION < 30400)
-#error "Your compiler is too old to build this application"
-#endif
-#endif
-
-#if (defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || \
- defined(_X86_) || defined(__I86__) || defined(__x86_64__))
-#define CPU_X86_SHA1_ACCELERATION 1
-#define CPU_X86_SHA256_ACCELERATION 1
-#endif
-
-extern BOOL cpu_has_sha1_accel, cpu_has_sha256_accel;
-
-extern BOOL DetectSHA1Acceleration(void);
-extern BOOL DetectSHA256Acceleration(void);
diff --git a/src/hash.c b/src/hash.c
index 88ffca31da..74e4e99ad4 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -65,11 +65,11 @@
#include
#include
#include
+#include
#include
#include
#include "db.h"
-#include "cpu.h"
#include "rufus.h"
#include "winio.h"
#include "missing.h"
@@ -77,14 +77,10 @@
#include "msapi_utf8.h"
#include "localization.h"
-/* Includes for SHA-1 and SHA-256 intrinsics */
-#if defined(CPU_X86_SHA1_ACCELERATION) || defined(CPU_X86_SHA256_ACCELERATION)
-#if defined(_MSC_VER)
-#include
-#elif defined(__GNUC__)
-#include
-#include
-#endif
+#if (defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || \
+ defined(_X86_) || defined(__I86__) || defined(__x86_64__))
+#define CPU_X86_SHA1_ACCELERATION 1
+#define CPU_X86_SHA256_ACCELERATION 1
#endif
#if defined(_MSC_VER)
@@ -107,6 +103,7 @@ char hash_str[HASH_MAX][150];
HANDLE data_ready[HASH_MAX] = { 0 }, thread_ready[HASH_MAX] = { 0 };
DWORD read_size[NUM_BUFFERS];
BOOL enable_extra_hashes = FALSE, validate_md5sum = FALSE;
+BOOL cpu_has_sha1_accel = FALSE, cpu_has_sha256_accel = FALSE;
uint8_t ALIGNED(64) buffer[NUM_BUFFERS][BUFFER_SIZE];
uint8_t* pe256ssp = NULL;
uint32_t proc_bufnum, hash_count[HASH_MAX] = { MD5_HASHSIZE, SHA1_HASHSIZE, SHA256_HASHSIZE, SHA512_HASHSIZE };
@@ -119,6 +116,78 @@ extern const char* efi_archname[ARCH_MAX];
extern char* sbat_level_txt;
extern BOOL expert_mode, usb_debug;
+/*
+ * Detect if the processor supports SHA-1 acceleration. We only check for
+ * the three ISAs we need - SSSE3, SSE4.1 and SHA. We don't check for OS
+ * support or XSAVE because that's been enabled since Windows 2000.
+ */
+BOOL DetectSHA1Acceleration(void)
+{
+#if defined(CPU_X86_SHA1_ACCELERATION)
+#if defined(_MSC_VER)
+ uint32_t regs0[4] = { 0,0,0,0 }, regs1[4] = { 0,0,0,0 }, regs7[4] = { 0,0,0,0 };
+ const uint32_t SSSE3_BIT = 1u << 9; /* Function 1, Bit 9 of ECX */
+ const uint32_t SSE41_BIT = 1u << 19; /* Function 1, Bit 19 of ECX */
+ const uint32_t SHA_BIT = 1u << 29; /* Function 7, Bit 29 of EBX */
+
+ __cpuid(regs0, 0);
+ const uint32_t highest = regs0[0]; /*EAX*/
+
+ if (highest >= 0x01) {
+ __cpuidex(regs1, 1, 0);
+ }
+ if (highest >= 0x07) {
+ __cpuidex(regs7, 7, 0);
+ }
+
+ return (regs1[2] /*ECX*/ & SSSE3_BIT) && (regs1[2] /*ECX*/ & SSE41_BIT) && (regs7[1] /*EBX*/ & SHA_BIT) ? TRUE : FALSE;
+#elif defined(__GNUC__) || defined(__clang__)
+ /* __builtin_cpu_supports available in GCC 4.8.1 and above */
+ return __builtin_cpu_supports("ssse3") && __builtin_cpu_supports("sse4.1") && __builtin_cpu_supports("sha") ? TRUE : FALSE;
+#else
+ return FALSE;
+#endif
+#else
+ return FALSE;
+#endif
+}
+
+/*
+ * Detect if the processor supports SHA-256 acceleration. We only check for
+ * the three ISAs we need - SSSE3, SSE4.1 and SHA. We don't check for OS
+ * support or XSAVE because that's been enabled since Windows 2000.
+ */
+BOOL DetectSHA256Acceleration(void)
+{
+#if defined(CPU_X86_SHA256_ACCELERATION)
+#if defined(_MSC_VER)
+ uint32_t regs0[4] = { 0,0,0,0 }, regs1[4] = { 0,0,0,0 }, regs7[4] = { 0,0,0,0 };
+ const uint32_t SSSE3_BIT = 1u << 9; /* Function 1, Bit 9 of ECX */
+ const uint32_t SSE41_BIT = 1u << 19; /* Function 1, Bit 19 of ECX */
+ const uint32_t SHA_BIT = 1u << 29; /* Function 7, Bit 29 of EBX */
+
+ __cpuid(regs0, 0);
+ const uint32_t highest = regs0[0]; /*EAX*/
+
+ if (highest >= 0x01) {
+ __cpuidex(regs1, 1, 0);
+ }
+ if (highest >= 0x07) {
+ __cpuidex(regs7, 7, 0);
+ }
+
+ return (regs1[2] /*ECX*/ & SSSE3_BIT) && (regs1[2] /*ECX*/ & SSE41_BIT) && (regs7[1] /*EBX*/ & SHA_BIT) ? TRUE : FALSE;
+#elif defined(__GNUC__) || defined(__clang__)
+ /* __builtin_cpu_supports available in GCC 4.8.1 and above */
+ return __builtin_cpu_supports("ssse3") && __builtin_cpu_supports("sse4.1") && __builtin_cpu_supports("sha") ? TRUE : FALSE;
+#else
+ return FALSE;
+#endif
+#else
+ return FALSE;
+#endif
+}
+
/*
* Rotate 32 or 64 bit integers by n bytes.
* Don't bother trying to hand-optimize those, as the
diff --git a/src/iso.c b/src/iso.c
index 664136569b..66c7bf969c 100644
--- a/src/iso.c
+++ b/src/iso.c
@@ -99,7 +99,7 @@ static const char* casper_dirname = "/casper";
static const char* proxmox_dirname = "/proxmox";
const char* efi_dirname = "/efi/boot";
const char* efi_bootname[3] = { "boot", "grub", "mm" };
-const char* efi_archname[ARCH_MAX] = { "", "ia32", "x64", "arm", "aa64", "ia64", "riscv64", "ebc" };
+const char* efi_archname[ARCH_MAX] = { "", "ia32", "x64", "arm", "aa64", "ia64", "riscv64", "loongarch64", "ebc" };
static const char* sources_str = "/sources";
static const char* wininst_name[] = { "install.wim", "install.esd", "install.swm" };
// We only support GRUB/BIOS (x86) that uses a standard config dir (/boot/grub/i386-pc/)
@@ -1801,7 +1801,7 @@ BOOL HasEfiImgBootLoaders(void)
for (i = 0; i < ARRAYSIZE(efi_archname); i++) {
static_sprintf(bootloader_name, "boot%s.efi", efi_archname[i]);
- // TODO: bootriscv###.efi will need LFN support but cross that bridge when/if we get there...
+ // TODO: bootriscv64.efi and bootloongarch64.efi need LFN support
if (strlen(bootloader_name) > 12)
continue;
for (j = 0, k = 0; bootloader_name[j] != 0; j++) {
diff --git a/src/missing.h b/src/missing.h
index 3528f745ef..4bf4b38782 100644
--- a/src/missing.h
+++ b/src/missing.h
@@ -18,6 +18,7 @@
*/
#include
+#include
#pragma once
@@ -40,10 +41,10 @@
* line has already been fetched, or if the address is invalid.
*/
#if defined(__GNUC__) || defined(__clang__)
-#define PREFETCH64(m) do { __builtin_prefetch(m, 0, 0); __builtin_prefetch(m+32, 0, 0); } while(0)
+#define PREFETCH64(m) do { __builtin_prefetch((m), 0, 0); __builtin_prefetch((m) + 32, 0, 0); } while(0)
#elif defined(_MSC_VER)
#if defined(_M_IX86) || defined (_M_X64)
-#define PREFETCH64(m) do { _m_prefetch(m); _m_prefetch(m+32); } while(0)
+#define PREFETCH64(m) do { _m_prefetch((void*)(m)); _m_prefetch((void*)((m) + 32)); } while(0)
#else
// _m_prefetch() doesn't seem to exist for MSVC/ARM
#define PREFETCH64(m)
diff --git a/src/net.c b/src/net.c
index f5fc821546..d19d0f935c 100644
--- a/src/net.c
+++ b/src/net.c
@@ -60,6 +60,7 @@ HANDLE update_check_thread = NULL;
extern loc_cmd* selected_locale;
extern HANDLE dialog_handle;
extern BOOL is_x86_64;
+extern USHORT NativeMachine;
static DWORD error_code, fido_len = 0;
static BOOL force_update_check = FALSE;
static const char* request_headers = "Accept-Encoding: gzip, deflate";
@@ -522,6 +523,9 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
#endif
vuprintf("Using %s for the update check", RUFUS_URL);
for (k = 0; (k < max_channel) && (!found_new_version); k++) {
+ // Get the arch name and convert it lowercase
+ char* archname = strdup(GetArchName(WindowsVersion.Arch));
+ safe_strtolower(archname);
// Free any previous buffers we might have used
safe_free(buf);
safe_free(sig);
@@ -533,7 +537,8 @@ static DWORD WINAPI CheckForUpdatesThread(LPVOID param)
// This allows sunsetting OS versions (eg XP) or providing different downloads for different archs/groups.
// Note that for BETAs, we only catter for x64 regardless of the OS arch.
static_sprintf(urlpath, "%s%s%s_win_%s_%lu.%lu.ver", APPLICATION_NAME, (k == 0) ? "": "_",
- (k == 0) ? "" : channel[k], GetArchName(WindowsVersion.Arch), WindowsVersion.Major, WindowsVersion.Minor);
+ (k == 0) ? "" : channel[k], archname, WindowsVersion.Major, WindowsVersion.Minor);
+ safe_free(archname);
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] == '_')) {
@@ -796,8 +801,8 @@ static DWORD WINAPI DownloadISOThread(LPVOID param)
}
static_sprintf(cmdline, "\"%s\" -NonInteractive -Sta -NoProfile –ExecutionPolicy Bypass "
- "-File \"%s\" -PipeName %s -LocData \"%s\" -Icon \"%s\" -AppTitle \"%s\"",
- powershell_path, script_path, &pipe[9], locale_str, icon_path, lmprintf(MSG_149));
+ "-File \"%s\" -PipeName %s -LocData \"%s\" -Icon \"%s\" -AppTitle \"%s\" -PlatformArch \"%s\"",
+ powershell_path, script_path, &pipe[9], locale_str, icon_path, lmprintf(MSG_149), GetArchName(NativeMachine));
#ifndef RUFUS_TEST
// For extra security, even after we validated that the LZMA download is properly
diff --git a/src/parser.c b/src/parser.c
index 4c5828268c..3d6a6a587e 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -893,7 +893,7 @@ static __inline char* get_sanitized_token_data_buffer(const char* token, unsigne
size_t i;
char* data = get_token_data_buffer(token, n, buffer, buffer_size);
if (data != NULL) {
- for (i=0; i