An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
Fix/win query arch (#7786)
fufesouad062486ff21
diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.ymlindex f9281a658..fde9ff6cb 100644--- a/.github/workflows/flutter-build.yml+++ b/.github/workflows/flutter-build.yml@@ -115,16 +115,11 @@ jobs:- name: Build rustdeskrun: |Invoke-WebRequest -Uri https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip -OutFile usbmmidd_v2.zip- $SHA256_SUM = '629b51e9944762bae73948171c65d09a79595cf4c771a82ebc003fbba5b24f51'- if ((Get-FileHash -Path .\usbmmidd_v2.zip -Algorithm SHA256).Hash -ne $SHA256_SUM) {- Write-Error "SHA256 sum mismatch, falling back to the non-virtual-display version"- python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack- } else {- Write-Host "SHA256 sum matched, using the virtual-display version"- Expand-Archive usbmmidd_v2.zip -DestinationPath .- python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack --virtual-display- mv -Force .\usbmmidd_v2 ./flutter/build/windows/x64/runner/Release/- }+ Expand-Archive usbmmidd_v2.zip -DestinationPath .+ python3 .\build.py --portable --hwcodec --flutter --vram --skip-portable-pack --virtual-display+ Remove-Item -Path usbmmidd_v2\Win32 -Recurse+ Remove-Item -Path usbmmidd_v2\deviceinstaller.exe+ mv -Force .\usbmmidd_v2 ./flutter/build/windows/x64/runner/Release/- name: find Runner.res# Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.res@@ -262,11 +257,14 @@ jobs:python3 res/inline-sciter.py# Patch sciter x86sed -i 's/branch = "dyn"/branch = "dyn_x86"/g' ./Cargo.toml- cargo build --features inline,vram,hwcodec --release --bins+ cargo build --features inline,vram,hwcodec,virtual_display_driver --release --binsmkdir -p ./Releasemv ./target/release/rustdesk.exe ./Release/rustdesk.execurl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dllecho "output_folder=./Release" >> $GITHUB_OUTPUT+ curl -LJ -o ./usbmmidd_v2.zip https://github.com/rustdesk-org/rdev/releases/download/usbmmidd_v2/usbmmidd_v2.zip+ unzip usbmmidd_v2.zip+ mv ./usbmmidd_v2 ./Release || true- name: find Runner.res# Windows: find Runner.res (compiled from ./flutter/windows/runner/Runner.rc), copy to ./Runner.resdiff --git a/res/msi/CustomActions/CustomActions.cpp b/res/msi/CustomActions/CustomActions.cppindex 3643ea9ce..9a019ea49 100644--- a/res/msi/CustomActions/CustomActions.cpp+++ b/res/msi/CustomActions/CustomActions.cpp@@ -607,9 +607,7 @@ UINT __stdcall RemoveAmyuniIdd(DWORD fileAttributes = 0;HINSTANCE hi = 0;- USHORT processMachine = 0;- USHORT nativeMachine = 0;- BOOL isWow64Res = FALSE;+ SYSTEM_INFO si;LPCWSTR exe = NULL;hr = WcaInitialize(hInstall, "RemoveAmyuniIdd");@@ -630,24 +628,22 @@ UINT __stdcall RemoveAmyuniIdd(goto LExit;}- isWow64Res = IsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine);- if (isWow64Res == TRUE) {- if (nativeMachine == IMAGE_FILE_MACHINE_AMD64) {- exe = L"deviceinstaller64.exe";- } else {- exe = L"deviceinstaller.exe";- }- WcaLog(LOGMSG_STANDARD, "Remove amyuni idd %ls in %ls", exe, workDir);- hi = ShellExecuteW(NULL, L"open", exe, L"remove usbmmidd", workDir, SW_HIDE);- // https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew- if ((int)hi <= 32) {- WcaLog(LOGMSG_STANDARD, "Failed to remove amyuni idd : %d, last error: %d", (int)hi, GetLastError());- }- else {- WcaLog(LOGMSG_STANDARD, "Amyuni idd is removed");- }+ GetNativeSystemInfo(&si);+ if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {+ exe = L"deviceinstaller64.exe";} else {- WcaLog(LOGMSG_STANDARD, "Failed to call IsWow64Process2(): %d", GetLastError());+ // No need to check if is other architecture.+ // Because the driver is only for x86 and x64. It will not work at on other architectures.+ exe = L"deviceinstaller.exe";+ }+ WcaLog(LOGMSG_STANDARD, "Remove amyuni idd %ls in %ls", exe, workDir);+ hi = ShellExecuteW(NULL, L"open", exe, L"remove usbmmidd", workDir, SW_HIDE);+ // https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew+ if ((int)hi <= 32) {+ WcaLog(LOGMSG_STANDARD, "Failed to remove amyuni idd : %d, last error: %d", (int)hi, GetLastError());+ }+ else {+ WcaLog(LOGMSG_STANDARD, "Amyuni idd is removed");}LExit:diff --git a/src/platform/windows.rs b/src/platform/windows.rsindex 6542d1023..4e213c501 100644--- a/src/platform/windows.rs+++ b/src/platform/windows.rs@@ -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;