Update build for ARM.

This commit is contained in:
Bruce
2026-03-28 19:11:29 +08:00
parent 3c35a8acaa
commit 2f0d1dc27f
10 changed files with 30 additions and 367 deletions

1
.gitignore vendored
View File

@@ -249,3 +249,4 @@ ModelManifest.xml
# Arm Build Files # Arm Build Files
package.zip package.zip
ArmPackage.zip

View File

@@ -1,41 +1,51 @@
# ArmBuild.ps1
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
$root = Split-Path -Parent $MyInvocation.MyCommand.Path $root = Split-Path -Parent $MyInvocation.MyCommand.Path
$staging = Join-Path $root "_staging" $staging = Join-Path $root "_staging"
$outZip = Join-Path $root "package.zip" $outZip = Join-Path $root "ArmPackage.zip"
$packageFolderName = "Desktop App Installer"
$destRoot = Join-Path $staging $packageFolderName
function Copy-Binaries-ToRoot($src) function Copy-Binaries-ToDest($src, $dest)
{ {
if (!(Test-Path $src)) { return } if (!(Test-Path $src)) { return }
Get-ChildItem $src -File | Where-Object { Get-ChildItem $src -File | Where-Object {
$_.Extension -in ".exe", ".dll" $_.Extension -in ".exe", ".dll"
} | ForEach-Object { } | ForEach-Object {
Copy-Item $_.FullName $staging -Force Copy-Item -Path $_.FullName -Destination $dest -Force
} }
} }
Write-Host "Preparing staging..." Write-Host "Preparing staging..."
Remove-Item $staging -Recurse -Force -ErrorAction Ignore # 清理旧的 staging
New-Item $staging -ItemType Directory | Out-Null if (Test-Path $staging) { Remove-Item $staging -Recurse -Force }
New-Item $destRoot -ItemType Directory | Out-Null
# ① 先放 Release # ① 先放 Release
Copy-Binaries-ToRoot (Join-Path $root "Release") Copy-Binaries-ToDest (Join-Path $root "Release") $destRoot
# ② 再放 ARM\Release覆盖同名 # ② 再放 ARM\Release覆盖同名
Copy-Binaries-ToRoot (Join-Path $root "ARM\Release") Copy-Binaries-ToDest (Join-Path $root "ARM\Release") $destRoot
# ③ shared 全部铺到根目录 # ③ shared 全部铺到 Desktop App Installer 里
$shared = Join-Path $root "shared" $shared = Join-Path $root "shared"
if (Test-Path $shared) { if (Test-Path $shared) {
Get-ChildItem $shared -Recurse | ForEach-Object { Get-ChildItem $shared -Recurse | ForEach-Object {
$rel = $_.FullName.Substring($shared.Length).TrimStart('\') $relativePath = $_.FullName.Substring($shared.Length).TrimStart('\')
$dest = Join-Path $staging $rel $destinationPath = Join-Path $destRoot $relativePath
if ($_.PSIsContainer) { if ($_.PSIsContainer) {
New-Item $dest -ItemType Directory -Force | Out-Null if (!(Test-Path $destinationPath)) {
New-Item -Path $destinationPath -ItemType Directory | Out-Null
}
} else { } else {
Copy-Item $_.FullName $dest -Force $parentDir = Split-Path $destinationPath -Parent
if (!(Test-Path $parentDir)) {
New-Item -Path $parentDir -ItemType Directory | Out-Null
}
Copy-Item -Path $_.FullName -Destination $destinationPath -Force
} }
} }
} }
@@ -43,11 +53,10 @@ if (Test-Path $shared) {
Write-Host "Creating ZIP..." Write-Host "Creating ZIP..."
if (Test-Path $outZip) { Remove-Item $outZip -Force } if (Test-Path $outZip) { Remove-Item $outZip -Force }
Compress-Archive ` # 压缩 _staging 下的 Desktop App Installer 文件夹
-Path (Join-Path $staging "*") ` Compress-Archive -Path $destRoot -DestinationPath $outZip -CompressionLevel Optimal
-DestinationPath $outZip `
-CompressionLevel Fastest
# 清理 staging
Remove-Item $staging -Recurse -Force Remove-Item $staging -Recurse -Force
Write-Host "Done: $outZip" Write-Host "Done: $outZip"

View File

@@ -1,4 +1,5 @@
@echo off @echo off
cd /d "%~dp0"
set SCRIPT_DIR=%~dp0 set SCRIPT_DIR=%~dp0
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%ArmBuild.ps1" powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%ArmBuild.ps1"
pause pause

View File

@@ -1,169 +0,0 @@
#Requires -RunAsAdministrator
Push-Location $PSScriptRoot
try {
# 语言检测函数
function Get-Language {
$lang = [System.Globalization.CultureInfo]::CurrentUICulture.TwoLetterISOLanguageName
if ($lang -eq "zh") { return "zh" }
return "en"
}
$lang = Get-Language
# 本地化消息
$messages = @{
en = @{
title = "Desktop App Installer Setup"
confirm = "Do you want to install Desktop App Installer? (y/n)"
invalid = "Invalid input. Please enter y or n."
cancelled = "Installation cancelled."
arch_error = "Error: Cannot continue installation because the computer's processor architecture is not ARM."
creating_shortcuts = "Creating shortcuts in Start Screen..."
registering = "Registering..."
complete = "Installation complete!"
}
zh = @{
title = "Desktop App Installer 安装程序"
confirm = "是否安装 Desktop App Installer(y/n)"
invalid = "无效输入,请输入 y 或 n。"
cancelled = "安装已取消。"
arch_error = "错误:无法继续安装,因为计算机的处理器架构不是 ARM。"
creating_shortcuts = "正在创建开始屏幕快捷方式..."
registering = "正在注册..."
complete = "安装完成!"
}
}
$msg = $messages[$lang]
# 函数定义
function Create-Shortcut {
param(
[string]$LnkPath,
[string]$TargetPath,
[string]$AppId
)
$toolShortcutPath = Join-Path $PSScriptRoot "shortcut.exe"
if (-not (Test-Path $toolShortcutPath)) {
throw "Error: cannot find file 'shortcut.exe' in folder '$PSScriptRoot'"
}
& $toolShortcutPath $LnkPath $TargetPath $AppId
return $LASTEXITCODE
}
function Set-DesktopInit {
param(
[string]$IniPath,
[string]$Section,
[string]$Key,
[string]$Value
)
$toolDesktopIniPath = Join-Path $PSScriptRoot "desktopini.exe"
if (-not (Test-Path $toolDesktopIniPath)) {
throw "Error: cannot find file 'desktopini.exe' in folder '$PSScriptRoot'"
}
& $toolDesktopIniPath $IniPath $Section $Key $Value
return $LASTEXITCODE
}
# 检查处理器架构
if ($env:PROCESSOR_ARCHITECTURE.Trim() -ne "ARM") {
throw $msg.arch_error
}
# 确认安装
do {
$response = Read-Host $msg.confirm
$response = $response.ToLower()
if ($response -eq 'y') {
$confirmed = $true
break
} elseif ($response -eq 'n') {
Write-Host $msg.cancelled
exit 0
} else {
Write-Host $msg.invalid
}
} while ($true)
# 安装目录和快捷方式目录
$appStartMenuFolder = "Desktop App Installer"
$appPublicStartMenuFolder = [System.IO.Path]::Combine($env:ProgramData, "Microsoft\Windows\Start Menu\Programs")
$startitemfolder = [System.IO.Path]::Combine($appPublicStartMenuFolder, $appStartMenuFolder)
$AppFolder = $PSScriptRoot
Write-Output $msg.creating_shortcuts
if (-not (Test-Path $startitemfolder)) {
New-Item -ItemType Directory -Path $startitemfolder -Force | Out-Null
}
$shortcuts = @(
@{
LnkPath = Join-Path $startitemfolder "App Installer.lnk"
TargetPath = Join-Path $AppFolder "appinstaller.exe"
AppId = "Microsoft.DesktopAppInstaller!App"
},
@{
LnkPath = Join-Path $startitemfolder "Settings.lnk"
TargetPath = Join-Path $AppFolder "settings.exe"
AppId = "WindowsModern.PracticalToolsProject!Settings"
},
@{
LnkPath = Join-Path $startitemfolder "Package Manager.lnk"
TargetPath = Join-Path $AppFolder "Manager.exe"
AppId = "WindowsModern.PracticalToolsProject!Manager"
},
@{
LnkPath = Join-Path $startitemfolder "Update.lnk"
TargetPath = Join-Path $AppFolder "Update.exe"
AppId = "WindowsModern.PracticalToolsProject!Update"
},
@{
LnkPath = Join-Path $startitemfolder "Package Reader.lnk"
TargetPath = Join-Path $AppFolder "Reader.exe"
AppId = "WindowsModern.PracticalToolsProject!Reader"
}
)
foreach ($item in $shortcuts) {
$exitCode = Create-Shortcut -LnkPath $item.LnkPath -TargetPath $item.TargetPath -AppId $item.AppId
}
# $desktopini = Join-Path $startitemfolder "desktop.ini"
$desktopini = $startitemfolder
Set-DesktopInit -IniPath $desktopini -Section ".ShellClassInfo" -Key "ConfirmFileOp" -Value 0
Set-DesktopInit -IniPath $desktopini -Section "LocalizedFileNames" -Key "App Installer.lnk" -Value "@$AppFolder\appinstaller.exe,-300"
Set-DesktopInit -IniPath $desktopini -Section "LocalizedFileNames" -Key "Settings.lnk" -Value "@$AppFolder\settings.exe,-200"
Set-DesktopInit -IniPath $desktopini -Section "LocalizedFileNames" -Key "Update.lnk" -Value "@$AppFolder\reslib.dll,-103"
Set-DesktopInit -IniPath $desktopini -Section "LocalizedFileNames" -Key "Package Manager.lnk" -Value "@$AppFolder\reslib.dll,-228"
Set-DesktopInit -IniPath $desktopini -Section "LocalizedFileNames" -Key "Uninstall.lnk" -Value "@$AppFolder\reslib.dll,-131"
Set-DesktopInit -IniPath $desktopini -Section ".ShellClassInfo" -Key "LocalizedResourceName" -Value "@$AppFolder\appinstaller.exe,-300"
Write-Output $msg.registering
$reg = [Microsoft.Win32.Registry]::ClassesRoot
$key = $reg.CreateSubKey("Microsoft.DesktopAppInstaller")
$key.SetValue("", "Windows Store App Package")
$key.Close()
$subKey = $reg.CreateSubKey("Microsoft.DesktopAppInstaller\Shell\Open\Command")
$subKey.SetValue("", "`"$AppFolder\appinstaller.exe`" `"%1`"")
$subKey.Close()
$subKey = $reg.CreateSubKey("Microsoft.DesktopAppInstaller\DefaultIcon")
$subKey.SetValue("", "$AppFolder\appinstaller.exe,2")
$subKey.Close()
$subKey = $reg.CreateSubKey("Applications\AppInstaller.exe\DefaultIcon")
$subKey.SetValue("", "$AppFolder\appinstaller.exe,-136")
$subKey.Close()
$subKey = $reg.CreateSubKey(".appx")
$subKey.SetValue("", "Microsoft.DesktopAppInstaller")
$subKey.Close()
$subKey = $reg.CreateSubKey(".appxbundle")
$subKey.SetValue("", "Microsoft.DesktopAppInstaller")
$subKey.Close()
Write-Output ""
Write-Output $msg.complete
Start-Sleep -Seconds 5
} finally {
Pop-Location
}

BIN
shared/ArmInstaller.exe Normal file

Binary file not shown.

View File

@@ -1,153 +0,0 @@
#Requires -RunAsAdministrator
Push-Location $PSScriptRoot
try {
# 语言检测函数
function Get-Language {
$lang = [System.Globalization.CultureInfo]::CurrentUICulture.TwoLetterISOLanguageName
if ($lang -eq "zh") { return "zh" }
return "en"
}
$lang = Get-Language
# 本地化消息
$messages = @{
en = @{
title = "Uninstall Desktop App Installer"
confirm = "Are you sure you want to uninstall Desktop App Installer? (y/n)"
invalid = "Invalid input. Please enter y or n."
removing_start = "Removing Start Menu folder..."
removing_reg = "Removing registry entries..."
removing_dir = "Removing installation directory..."
confirm_dir = "Do you also want to delete the installation directory? (y/n)"
complete = "Uninstallation complete."
error = "Error: "
cancelled = "Uninstall cancelled."
}
zh = @{
title = "卸载 Desktop App Installer"
confirm = "确定要卸载 Desktop App Installer 吗?(y/n)"
invalid = "无效输入,请输入 y 或 n。"
removing_start = "正在删除开始菜单文件夹..."
removing_reg = "正在删除注册表项..."
removing_dir = "正在删除安装目录..."
confirm_dir = "是否同时删除安装目录?(y/n)"
complete = "卸载完成。"
error = "错误:"
cancelled = "卸载已取消。"
}
}
$msg = $messages[$lang]
if ($env:PROCESSOR_ARCHITECTURE.Trim() -ne "ARM") {
throw "Error: Cannot continue installation because the computer's processor architecture is not ARM."
}
# 确认卸载(控制台交互)
do {
$response = Read-Host $msg.confirm
$response = $response.ToLower()
if ($response -eq 'y') {
$confirmed = $true
break
} elseif ($response -eq 'n') {
Write-Host $msg.cancelled
exit 0
} else {
Write-Host $msg.invalid
}
} while ($true)
# 定义路径
$appStartMenuFolder = "Desktop App Installer"
$appPublicStartMenuFolder = [System.IO.Path]::Combine($env:ProgramData, "Microsoft\Windows\Start Menu\Programs")
$startitemfolder = [System.IO.Path]::Combine($appPublicStartMenuFolder, $appStartMenuFolder)
$AppFolder = $PSScriptRoot
# 删除开始菜单文件夹
Write-Host $msg.removing_start
if (Test-Path $startitemfolder) {
Remove-Item -Path $startitemfolder -Recurse -Force -ErrorAction SilentlyContinue
if (Test-Path $startitemfolder) {
Write-Warning "$msg.error Could not remove $startitemfolder"
} else {
Write-Output "Removed $startitemfolder"
}
} else {
Write-Output "Start Menu folder not found, skipping."
}
# 删除注册表项
Write-Host $msg.removing_reg
$reg = [Microsoft.Win32.Registry]::ClassesRoot
$keysToDelete = @(
"Microsoft.DesktopAppInstaller",
".appx",
".appxbundle"
)
foreach ($keyName in $keysToDelete) {
try {
if ($reg.OpenSubKey($keyName) -ne $null) {
$reg.DeleteSubKeyTree($keyName)
Write-Output "Removed registry key: HKCR\$keyName"
} else {
Write-Output "Registry key not found: HKCR\$keyName"
}
} catch {
Write-Warning "$msg.error Could not remove HKCR\$keyName : $_"
}
}
# 删除 Applications\AppInstaller.exe 下的 DefaultIcon
$appPath = "Applications\AppInstaller.exe"
try {
$appKey = $reg.OpenSubKey($appPath, $true)
if ($appKey) {
$subKeyNames = $appKey.GetSubKeyNames()
if ($subKeyNames -contains "DefaultIcon") {
$appKey.DeleteSubKey("DefaultIcon")
Write-Output "Removed registry key: HKCR\$appPath\DefaultIcon"
}
$appKey.Close()
} else {
Write-Output "Registry key not found: HKCR\$appPath"
}
} catch {
Write-Warning "$msg.error Could not process HKCR\$appPath : $_"
}
# 删除安装目录
Write-Host $msg.removing_dir
do {
$respDir = Read-Host $msg.confirm_dir
$respDir = $respDir.ToLower()
if ($respDir -eq 'y') {
if (Test-Path $AppFolder) {
Remove-Item -Path $AppFolder -Recurse -Force -ErrorAction SilentlyContinue
if (Test-Path $AppFolder) {
Write-Warning "$msg.error Could not delete $AppFolder"
} else {
Write-Output "Deleted installation directory."
}
} else {
Write-Output "Installation directory not found."
}
break
} elseif ($respDir -eq 'n') {
Write-Output "Skipped deleting installation directory."
break
} else {
Write-Host $msg.invalid
}
} while ($true)
Write-Host $msg.complete
Start-Sleep -Seconds 3
} catch {
Write-Error "Uninstall failed: $_"
} finally {
Pop-Location
}

BIN
shared/ArmUninstaller.exe Normal file

Binary file not shown.

View File

@@ -1,13 +0,0 @@
@echo off
if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0
bcdedit >nul
if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin)
:UACPrompt
%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
exit /B
:UACAdmin
cd /d "%~dp0"
set SCRIPT_DIR=%~dp0
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%ArmInstall.ps1"
pause

View File

@@ -1,11 +1,11 @@
对于 Windows RT 用户,请以管理员身份运行 arm_install.batarm_uninstall.bat 进行安装或卸载。安装前请务必将压缩包中的所有文件放置在一个独立的文件夹中,该文件夹请勿随意移动或删除,不建议放置在桌面上。若需更新或移动程序,请先执行卸载脚本,然后再进行安装操作。x86、x64 以及支持 x86 兼容层的 ARM64 系统请使用标准安装程序,本方案仅适用于 ARM 设备。 对于 Windows RT 用户,请以管理员身份运行 ArmInstaller.exeArmUninstaller.exe 进行安装或卸载。安装前请务必将压缩包中的所有文件放置在一个独立的文件夹中,该文件夹请勿随意移动或删除,不建议放置在桌面上。若需更新或移动程序,请先执行卸载程序,然后再进行安装操作。请不要使用程序中具有的安装程序来更新。 x86、x64 以及 具有 Windows on ARM 的 ARM64 系统 请使用标准安装程序,本方案仅适用于 ARM 设备。
感谢“冰糖XH”主页https://github.com/bingtangxh帮助我完成了针对 ARM 架构的程序编译。 感谢“冰糖XH”主页https://github.com/bingtangxh帮助我完成了针对 ARM 架构的程序编译。
适用于 ARM 设备的项目发行https://github.com/bingtangxh/App-Installer-For-Windows-8.x-Reset/releases 适用于 ARM 设备的项目发行https://github.com/bingtangxh/App-Installer-For-Windows-8.x-Reset/releases
其余设备的项目发行https://github.com/modernw/App-Installer-For-Windows-8.x-Reset/releases 其余设备的项目发行https://github.com/modernw/App-Installer-For-Windows-8.x-Reset/releases
(Translated by DeepSeek) (Translated by DeepSeek)
For Windows RT users, please run arm_install.bat or arm_uninstall.bat as an administrator to install or uninstall. Before installation, extract all files from the compressed package into a dedicated folder; do not move or delete this folder arbitrarily, and it is not recommended to place it on the desktop. If you need to update or relocate the program, first run the original uninstall script, then proceed with the installation. For x86, x64, and ARM64 systems that support the x86 compatibility layer, please use the standard installer; this solution is specifically for ARM devices. For Windows RT users, please run ArmInstaller.exe or ArmUninstaller.exe as an administrator to install or uninstall. Before installation, extract all files from the compressed package into a dedicated folder; do not move or delete this folder arbitrarily, and it is not recommended to place it on the desktop. If you need to update or relocate the program, first run the uninstaller, then proceed with the installation. Do not use the installer included in the program to update. For x86, x64, and ARM64 systems with Windows on ARM please use the standard installer; this solution is specifically for ARM devices.
Thanks to "BingTangXH" (Homepage: https://github.com/bingtangxh) for helping me complete the program compilation for the ARM architecture. Thanks to "BingTangXH" (Homepage: https://github.com/bingtangxh) for helping me complete the program compilation for the ARM architecture.
Project release for ARM devices: https://github.com/bingtangxh/App-Installer-For-Windows-8.x-Reset/releases Project release for ARM devices: https://github.com/bingtangxh/App-Installer-For-Windows-8.x-Reset/releases

View File

@@ -1,13 +0,0 @@
@echo off
if exist "%SystemRoot%\SysWOW64" path %path%;%windir%\SysNative;%SystemRoot%\SysWOW64;%~dp0
bcdedit >nul
if '%errorlevel%' NEQ '0' (goto UACPrompt) else (goto UACAdmin)
:UACPrompt
%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
exit /B
:UACAdmin
cd /d "%~dp0"
set SCRIPT_DIR=%~dp0
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%ArmUninstall.ps1"
pause