WSAPatch 项目使用教程
1. 项目的目录结构及介绍
WSAPatch 项目的目录结构如下:
WSAPatch/
├── github/
│ └── workflows/
├── original_dll_win11_22h2/
│ └── x86_64/
├── pic/
├── .gitignore
├── CMakeLists.txt
├── ErrnoRestorer.h
├── LICENSE
├── Log.cpp
├── Log.h
├── README.md
├── README_zhs.md
├── TimeUtils.cpp
├── TimeUtils.h
├── WsaPatch.cpp
├── WsaPatch.h
└── macros.h
目录介绍
github/workflows/
: 包含 GitHub Actions 的工作流配置文件。original_dll_win11_22h2/x86_64/
: 包含 Windows 11 22H2 的原版 DLL 文件。pic/
: 包含项目相关的图片文件。.gitignore
: Git 忽略文件配置。CMakeLists.txt
: CMake 构建配置文件。ErrnoRestorer.h
: 错误恢复相关的头文件。LICENSE
: 项目许可证文件。Log.cpp
和Log.h
: 日志功能的实现和头文件。README.md
和README_zhs.md
: 项目的英文和中文介绍文档。TimeUtils.cpp
和TimeUtils.h
: 时间处理功能的实现和头文件。WsaPatch.cpp
和WsaPatch.h
: 项目核心功能的实现和头文件。macros.h
: 宏定义头文件。
2. 项目的启动文件介绍
项目的启动文件主要是 Run.bat
,该文件用于启动 WSA 并应用补丁。以下是 Run.bat
的内容和功能介绍:
@echo off
:: 需要管理员权限
echo 正在运行 WSA 补丁...
:: 复制编译好的 WsaPatch.dll 和修改过的 icu.dll 到 WSA 的 WsaClient 文件夹
copy WsaPatch.dll WSA\WsaClient\
copy icu.dll WSA\WsaClient\
:: 修改 AppxManifest.xml
:: 在 AppxManifest.xml 找到 TargetDeviceFamily 节点
:: 把 MinVersion 从 10.0.22000.120 改成 10.0.19045.2311
:: 删除 "customInstall" 相关节点
:: 运行 Add-AppxPackage -Register \AppxManifest.xml
powershell -Command "Add-AppxPackage -Register 'WSA\AppxManifest.xml'"
echo WSA 补丁应用完成。
pause
功能介绍
- 复制
WsaPatch.dll
和icu.dll
到 WSA 的WsaClient
文件夹。 - 修改
AppxManifest.xml
文件,调整MinVersion
并删除customInstall
相关节点。 - 使用 PowerShell 命令注册 WSA 应用包。
3. 项目的配置文件介绍
项目的配置文件主要是 AppxManifest.xml
,该文件用于定义 WSA 应用包的属性和配置。以下是 AppxManifest.xml
的部分内容和功能介绍:
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:desktop6="http://schemas.microsoft.com/appx/manifest/desktop/windows10/6"
IgnorableNamespaces="uap rescap desktop6">
<Identity Name="Microsoft.WSA"
Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
Version="1.0.0.0" />
<Properties>
<DisplayName>Windows Subsystem for Android</DisplayName>
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
<Logo>Assets\StoreLogo.png