From 5a4c925f50e219e70df7bc6401136d5d89e2d1b1 Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Thu, 5 Dec 2024 20:11:59 +0100 Subject: [PATCH] [Windows] Set correct platform name when running BOINC client on Windows on ARM. With this commit a new platform name 'windows_arm64' added. Also, according to the https://learn.microsoft.com/en-us/windows/arm/apps-on-arm-x86-emulation, Windows 10 on ARM supports x86 applications, and Windows 11 on ARM supports x64 applications. That is why we will be checking what version of Windows we are running on, and adding 'windows_intelx86' on Windows 10 and later (I suppose, this is will set always) and 'windows_x86_64' on Windows 11 and later (nothing later at the moment, but we are looking into the future!). This fixes #5934. Signed-off-by: Vitalii Koshura --- client/cs_platforms.cpp | 22 +++++++++++++++++++++- client/hostinfo_win.cpp | 4 ++-- lib/hostinfo.h | 6 ++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/client/cs_platforms.cpp b/client/cs_platforms.cpp index 5c8e7fa063..0cdd294857 100644 --- a/client/cs_platforms.cpp +++ b/client/cs_platforms.cpp @@ -24,6 +24,9 @@ #include "boinc_win.h" typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); LPFN_ISWOW64PROCESS fnIsWow64Process; +#ifndef SIM +#include "hostinfo.h" +#endif #else #include "config.h" #include @@ -172,7 +175,24 @@ int launch_child_process_to_detect_emulated_cpu() { void CLIENT_STATE::detect_platforms() { #if defined(_WIN32) && !defined(__CYGWIN32__) -#if defined(_WIN64) && defined(_M_X64) +#if defined(_ARM64_) + add_platform("windows_arm64"); +#ifndef SIM + // according to + // https://learn.microsoft.com/en-us/windows/arm/apps-on-arm-x86-emulation + // Windows 10 on ARM can run x86 applications, + // and Windows 11 on ARM can run x86_64 applications + // so we will add these platfroms as well + OSVERSIONINFOEX osvi; + BOOL bOsVersionInfoEx = get_OSVERSIONINFO(osvi); + if (osvi.dwMajorVersion >= 10) { + add_platform("windows_intelx86"); + if (osvi.dwBuildNumber >= 22000) { + add_platform("windows_x86_64"); + } + } +#endif +#elif defined(_WIN64) && defined(_M_X64) add_platform("windows_x86_64"); add_platform("windows_intelx86"); #else diff --git a/client/hostinfo_win.cpp b/client/hostinfo_win.cpp index 7f49b86306..02c3fcfc81 100644 --- a/client/hostinfo_win.cpp +++ b/client/hostinfo_win.cpp @@ -386,8 +386,8 @@ int get_os_information( } } else { if (osvi.dwBuildNumber >= 26100) { - strlcat(os_name, "Windows Server 2025", os_name_size); - } else if (osvi.dwBuildNumber >= 25398) { + strlcat(os_name, "Windows Server 2025", os_name_size); + } else if (osvi.dwBuildNumber >= 25398) { strlcat(os_name, "Windows Server 23H2", os_name_size); } else if (osvi.dwBuildNumber >= 20348) { strlcat(os_name, "Windows Server 2022", os_name_size); diff --git a/lib/hostinfo.h b/lib/hostinfo.h index 22b27c520a..54191b3c9e 100644 --- a/lib/hostinfo.h +++ b/lib/hostinfo.h @@ -172,6 +172,12 @@ public: extern void make_secure_random_string(char*); +#ifdef _WIN32 +#ifndef SIM +extern BOOL get_OSVERSIONINFO(OSVERSIONINFOEX& osvi); +#endif +#endif + #ifdef _WIN64 extern int get_wsl_information(WSL_DISTROS &distros); extern int get_processor_group(HANDLE);