Fix/win query arch (#7786)

* fix: win, query arch with GetNativeSystemInfo

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* refact: idd, ci

Signed-off-by: fufesou <shuanglongchen@yeah.net>

---------

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2024-04-21 14:55:42 +08:00
committed by GitHub
parent 33c8bdfabf
commit ad062486ff
3 changed files with 36 additions and 34 deletions

View File

@@ -42,6 +42,7 @@ use winapi::{
},
securitybaseapi::GetTokenInformation,
shellapi::ShellExecuteW,
sysinfoapi::{GetNativeSystemInfo, SYSTEM_INFO},
winbase::*,
wingdi::*,
winnt::{
@@ -2370,9 +2371,16 @@ impl Drop for WallPaperRemover {
}
pub fn get_amyuni_exe_name() -> Option<String> {
let exe = match std::env::consts::ARCH {
"x86" => "deviceinstaller.exe",
"x86_64" => "deviceinstaller64.exe",
let mut sys_info = SYSTEM_INFO::default();
unsafe {
GetNativeSystemInfo(&mut sys_info as _);
}
const PROCESSOR_ARCHITECTURE_INTEL: u16 = 0;
const PROCESSOR_ARCHITECTURE_AMD64: u16 = 9;
let exe = match unsafe { sys_info.u.s().wProcessorArchitecture } {
PROCESSOR_ARCHITECTURE_INTEL => "deviceinstaller.exe",
PROCESSOR_ARCHITECTURE_AMD64 => "deviceinstaller64.exe",
_ => {
log::error!("Unsupported machine architecture");
return None;