Skip to content

Commit

Permalink
Fix CPU arch retrieval on Windows (#1296)
Browse files Browse the repository at this point in the history
Fix CPU arch retrieval on Windows
  • Loading branch information
Enaium authored and GuillaumeGomez committed Jul 8, 2024
1 parent 57ea114 commit 0662e60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/windows/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use windows::Win32::System::Performance::{
use windows::Win32::System::Power::{
CallNtPowerInformation, ProcessorInformation, PROCESSOR_POWER_INFORMATION,
};
use windows::Win32::System::SystemInformation;
use windows::Win32::System::SystemInformation::{self, GetSystemInfo};
use windows::Win32::System::SystemInformation::{
GetLogicalProcessorInformationEx, GetSystemInfo, RelationAll, RelationProcessorCore,
SYSTEM_INFO, SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX,
GetLogicalProcessorInformationEx, RelationAll, RelationProcessorCore, SYSTEM_INFO,
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX,
};
use windows::Win32::System::Threading::{
CreateEventA, RegisterWaitForSingleObject, INFINITE, WT_EXECUTEDEFAULT,
Expand Down
7 changes: 4 additions & 3 deletions src/windows/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use windows::Win32::System::ProcessStatus::{K32GetPerformanceInfo, PERFORMANCE_I
use windows::Win32::System::Registry::HKEY_LOCAL_MACHINE;
use windows::Win32::System::SystemInformation;
use windows::Win32::System::SystemInformation::{
ComputerNamePhysicalDnsHostname, GetComputerNameExW, GetTickCount64, GlobalMemoryStatusEx,
MEMORYSTATUSEX, SYSTEM_INFO,
ComputerNamePhysicalDnsHostname, GetComputerNameExW, GetSystemInfo, GetTickCount64,
GlobalMemoryStatusEx, MEMORYSTATUSEX, SYSTEM_INFO,
};
use windows::Win32::System::Threading::GetExitCodeProcess;

Expand Down Expand Up @@ -476,7 +476,8 @@ impl SystemInner {
pub(crate) fn cpu_arch() -> Option<String> {
unsafe {
// https://docs.microsoft.com/fr-fr/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info
let info = SYSTEM_INFO::default();
let mut info = SYSTEM_INFO::default();
GetSystemInfo(&mut info);
match info.Anonymous.Anonymous.wProcessorArchitecture {
SystemInformation::PROCESSOR_ARCHITECTURE_ALPHA => Some("alpha".to_string()),
SystemInformation::PROCESSOR_ARCHITECTURE_ALPHA64 => Some("alpha64".to_string()),
Expand Down

0 comments on commit 0662e60

Please # to comment.