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:
		
							parent
							
								
									33c8bdfabf
								
							
						
					
					
						commit
						ad062486ff
					
				
							
								
								
									
										14
									
								
								.github/workflows/flutter-build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								.github/workflows/flutter-build.yml
									
									
									
									
										vendored
									
									
								
							| @ -115,16 +115,11 @@ jobs: | ||||
|       - name: Build rustdesk | ||||
|         run: | | ||||
|           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 | ||||
|           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 x86 | ||||
|           sed -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 --bins | ||||
|           mkdir -p ./Release | ||||
|           mv ./target/release/rustdesk.exe ./Release/rustdesk.exe | ||||
|           curl -LJ -o ./Release/sciter.dll https://github.com/c-smile/sciter-sdk/raw/master/bin.win/x32/sciter.dll | ||||
|           echo "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.res | ||||
|  | ||||
| @ -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,11 +628,12 @@ UINT __stdcall RemoveAmyuniIdd( | ||||
|         goto LExit; | ||||
|     } | ||||
| 
 | ||||
|     isWow64Res = IsWow64Process2(GetCurrentProcess(), &processMachine, &nativeMachine); | ||||
|     if (isWow64Res == TRUE) { | ||||
|         if (nativeMachine == IMAGE_FILE_MACHINE_AMD64) { | ||||
|     GetNativeSystemInfo(&si); | ||||
|     if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) { | ||||
|         exe = L"deviceinstaller64.exe"; | ||||
|     } else { | ||||
|         // 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); | ||||
| @ -646,9 +645,6 @@ UINT __stdcall RemoveAmyuniIdd( | ||||
|     else { | ||||
|         WcaLog(LOGMSG_STANDARD, "Amyuni idd is removed"); | ||||
|     } | ||||
|     } else { | ||||
|         WcaLog(LOGMSG_STANDARD, "Failed to call IsWow64Process2(): %d", GetLastError()); | ||||
|     } | ||||
| 
 | ||||
| LExit: | ||||
|     ReleaseStr(installFolder); | ||||
|  | ||||
| @ -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; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user