Add ARM64 support

This commit is contained in:
Calyx Hikari 2025-07-01 22:45:17 +08:00
parent 2bf0a92ded
commit 9e128e7a5c
4 changed files with 38 additions and 2 deletions

6
32
View file

@ -6,6 +6,12 @@ function Main {
return 1
}
$procArch = $Env:PROCESSOR_ARCHITECTURE
if ($procArch -eq 'ARM') {
Write-Warning "This script does not support Windows RT. Exiting..."
return 1
}
$flagPath = "$env:TEMP\elevation_success.flag"
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }

15
64
View file

@ -7,10 +7,18 @@ function Main {
}
$procArch = $Env:PROCESSOR_ARCHITECTURE
$buildVersion = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').CurrentBuild
if ($procArch -eq 'x86') {
Write-Warning "This script does not support 32-bit Windows. Exiting..."
return 1
}
elseif ($procArch -eq 'ARM64' -and $buildVersion -lt 22000) {
Write-Warning "X64 emulation is not supported in this version of ARM64 Windows. Only x86 and ARM64 Runtime will be installed."
}
elseif ($procArch -eq 'ARM') {
Write-Warning "This script does not support Windows RT. Exiting..."
return 1
}
$flagPath = "$env:TEMP\elevation_success.flag"
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
@ -99,8 +107,15 @@ function Main {
@{ Name = "vcredist_2015-2022_x64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.x64.exe"; Year = "2012-2022" }
)
if ($procArch -eq "ARM64") {
$downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" }
}
# --- Download everything up front ---
foreach ($item in $downloads) {
if ($item.Name -Match "x64" -and $procArch -eq 'ARM64' -and $buildVersion -lt 22000) {
continue
}
$outFile = Join-Path $tempDir $item.Name
Write-Host "Downloading $($item.Name)..."
$argumentList = @(

6
dx
View file

@ -6,6 +6,12 @@ function Main {
return 1
}
$procArch = $Env:PROCESSOR_ARCHITECTURE
if ($procArch -eq 'ARM') {
Write-Warning "This script does not support Windows RT. Exiting..."
return 1
}
$flagPath = "$env:TEMP\elevation_success.flag"
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }

View file

@ -10,6 +10,11 @@ function Main {
}
$procArch = $Env:PROCESSOR_ARCHITECTURE
$buildVersion = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').CurrentBuild
if ($procArch -eq 'ARM') {
Write-Warning "This script does not support Windows RT. Exiting..."
return 1
}
$flagPath = "$env:TEMP\elevation_success.flag"
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
@ -101,9 +106,13 @@ function Main {
@{ Name = "vcredist_2015-2022_x64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.x64.exe"; Year = "2012-2022" }
)
if ($procArch -eq "ARM64") {
$downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" }
}
# --- Download everything up front ---
foreach ($item in $downloads) {
if ($item.Name -Match "x64" -and $procArch -ne "AMD64") {
if ($item.Name -Match "x64" -and $procArch -ne "AMD64" -and $buildVersion -lt 22000) {
continue
}
$outFile = Join-Path $tempDir $item.Name
@ -154,7 +163,7 @@ function Main {
# --- Install VC++ Redistributables ---
foreach ($item in $downloads | Where-Object { $_.Name -like "vcredist*" }) {
if ($item.Name -Match "x64" -and $procArch -ne "AMD64") {
if ($item.Name -Match "x64" -and $procArch -ne "AMD64" -and $buildVersion -lt 22000) {
continue
}
$exePath = Join-Path $tempDir $item.Name