From a292cc42aa2d45b0949b5f675177f8850a30d1b5 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Tue, 12 Dec 2023 23:53:16 +0100 Subject: [PATCH] Fix Windows architecture reporting in sysinfo --- src/porting.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/porting.cpp b/src/porting.cpp index 54c9ee2c9..7784a671f 100644 --- a/src/porting.cpp +++ b/src/porting.cpp @@ -204,7 +204,6 @@ bool detectMSVCBuildDir(const std::string &path) std::string get_sysinfo() { #ifdef _WIN32 - std::ostringstream oss; LPSTR filePath = new char[MAX_PATH]; UINT blockSize; @@ -224,15 +223,25 @@ std::string get_sysinfo() << LOWORD(fixedFileInfo->dwProductVersionMS) << '.' // Minor << HIWORD(fixedFileInfo->dwProductVersionLS) << ' '; // Build - #ifdef _WIN64 - oss << "x86_64"; - #else - BOOL is64 = FALSE; - if (IsWow64Process(GetCurrentProcess(), &is64) && is64) - oss << "x86_64"; // 32-bit app on 64-bit OS - else + SYSTEM_INFO info; + GetNativeSystemInfo(&info); + switch (info.wProcessorArchitecture) { + case PROCESSOR_ARCHITECTURE_AMD64: + oss << "x86_64"; + break; + case PROCESSOR_ARCHITECTURE_ARM: + oss << "arm"; + break; + case PROCESSOR_ARCHITECTURE_ARM64: + oss << "arm64"; + break; + case PROCESSOR_ARCHITECTURE_INTEL: oss << "x86"; - #endif + break; + default: + oss << "unknown"; + break; + } delete[] lpVersionInfo; delete[] filePath;