From 58727f8fb2a4840b3170806bb87a058b03194e12 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 28 Aug 2021 16:01:52 +0300 Subject: [PATCH] Detect CPU architecture on Windows --- source/sysutils.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/source/sysutils.cpp b/source/sysutils.cpp index 6e1828c..8fa3d48 100644 --- a/source/sysutils.cpp +++ b/source/sysutils.cpp @@ -1,17 +1,30 @@ -#ifndef _WIN32 +#define WIN32_LEAN_AND_MEAN +#ifdef _WIN32 +#include +#else #include #endif #include #include #include "sysutils.h" +#if defined(_WIN32) && !defined(PROCESSOR_ARCHITECTURE_ARM64) +#define PROCESSOR_ARCHITECTURE_ARM64 12 +#endif + using namespace std; using namespace Msp; string get_system_type() { #ifdef _WIN32 - return "windows"; + SYSTEM_INFO sysinfo; + GetSystemInfo(&sysinfo); + WORD machine = sysinfo.wProcessorArchitecture; + if(machine==PROCESSOR_ARCHITECTURE_AMD64 || machine==PROCESSOR_ARCHITECTURE_INTEL) + return "x86-windows"; + else if(machine==PROCESSOR_ARCHITECTURE_ARM || machine==PROCESSOR_ARCHITECTURE_ARM64) + return "arm-windows"; #else utsname un; if(uname(&un)==0) -- 2.45.2