Skip to content

fix: 修复新版安装器卸载卡住问题#646

Merged
Yundi339 merged 2 commits into
masterfrom
feat_fixuninstall
May 12, 2026
Merged

fix: 修复新版安装器卸载卡住问题#646
Yundi339 merged 2 commits into
masterfrom
feat_fixuninstall

Conversation

@Yundi339
Copy link
Copy Markdown
Collaborator

@Yundi339 Yundi339 commented May 12, 2026

Summary by CodeRabbit

发布说明

  • Bug 修复

    • 改进了网络操作的超时控制,提高安装可靠性
    • 增强了服务停止和启动逻辑,确保正确清理资源
    • 优化了设备驱动程序卸载流程,防止无限循环
  • Chores

    • 重构路径更新脚本以提高系统兼容性
    • 改进了虚拟设备管理和错误处理机制

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f207e843-35d2-43a1-b0fc-13df3c2957c8

📥 Commits

Reviewing files that changed from the base of the PR and between ff31bf2 and 18f5d45.

📒 Files selected for processing (1)
  • src_assets/windows/misc/path/update-path.bat
🚧 Files skipped from review as they are similar to previous changes (1)
  • src_assets/windows/misc/path/update-path.bat
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Windows

Summary by CodeRabbit

发布说明

  • Bug 修复

    • 增强了 Windows 安装和卸载过程的可靠性,改进了服务管理和设备清理逻辑。
    • 强化了网络请求的超时处理,提高了下载稳定性。
    • 优化了虚拟设备驱动程序移除过程,防止潜在的无限循环。
  • 其他改进

    • 更新了 PATH 环境变量配置机制。

Hidden review stack artifact

Walkthrough

一组变更:打包脚本改为无条件包含若干安装脚本;多个 Windows 批处理脚本将服务控制从 net 转为 sc/taskkill、为设备清理引入迭代上限,并增强下载超时与 PATH 更新实现。

变更

Windows 服务和设备管理的稳健性改进

层级 / 文件 摘要
安装程序配置和卸载协调
cmake/packaging/sunshine.iss.in
自动启动和防火墙脚本无条件复制(移除 Components 约束),将虚拟音频接收器脚本加入主文件列表(skipifsourcedoesntexist),卸载预处理新增对 sunshinesvc.exe 的强制终止。
服务管理命令的现代化
src_assets/windows/misc/service/uninstall-service.bat, src_assets/windows/misc/vmouse/install-vmouse.bat, src_assets/windows/misc/vmouse/uninstall-vmouse.bat
多处脚本将阻塞性的 net stop/net start 流程替换为 sc query 检测 + sc stop/sc starttaskkill 组合,以更快地释放服务进程并避免阻塞。
设备清理迭代上限和防护
src_assets/windows/misc/vmouse/install-vmouse.bat, src_assets/windows/misc/vmouse/uninstall-vmouse.bat, src_assets/windows/misc/vdd/uninstall-vdd.bat
对使用 nefconw.exe 的设备移除循环添加迭代上限(CLEANUP_MAX / NEFCON_MAX_ITERS = 20),vdd 脚本增加 chcp 65001、条件驱动包卸载和错误抑制的清理路径。
下载可靠性和路径管理实用程序
src_assets/windows/misc/gamepad/install-gamepad.bat, src_assets/windows/misc/path/update-path.bat
install-gamepad.bat 为 GitHub Releases API 与安装程序下载加入 curl --connect-timeout/--max-time 超时;update-path.bat 从纯批处理迁移到嵌入式 PowerShell 来读取/规范化/写回 HKLM Path 并返回 PowerShell 错误码。

序列图

不生成序列图:变更为多个独立脚本的局部改进,未形成单一跨 3 个以上组件的明确顺序交互流。

估计代码审查工作量

🎯 3 (中等复杂度) | ⏱️ ~25 分钟

可能相关的 PR

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive 未提供拉取请求描述,但根据代码改动内容,标题充分说明了意图,无法完全评估。 建议添加拉取请求描述,说明卸载卡住问题的根本原因、解决方案以及测试方法。
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰地描述了主要改动:修复安装器卸载过程中出现卡住的问题,与所有文件的改动(优化卸载和停止服务逻辑)相符。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat_fixuninstall

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src_assets/windows/misc/path/update-path.bat (1)

16-17: ⚡ Quick win

建议将 setlocal 提前到临时 PATH 赋值之前。

Line 16 先改 PATH、Line 17 才 setlocal。在当前仓库中未发现通过 call 复用此脚本的地方,不过遵循最佳实践,应在赋值之前先局部化环境。这样即使将来有其他脚本通过 call 调用或在不同部署环境下使用,也不会继承被裁剪过的 PATH,是一个低成本、高收益的改进。

建议修改
-set "PATH=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0"
-setlocal
+setlocal
+set "PATH=%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\WindowsPowerShell\v1.0"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src_assets/windows/misc/path/update-path.bat` around lines 16 - 17, Move the
setlocal call to before the temporary PATH assignment so the environment changes
are localized; specifically, ensure setlocal is executed prior to the statement
that modifies PATH (the line that uses set "PATH=%SystemRoot%\System32;..."),
i.e., swap the order so setlocal runs first to avoid permanently altering the
caller's PATH when this script is called.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src_assets/windows/misc/path/update-path.bat`:
- Around line 16-17: Move the setlocal call to before the temporary PATH
assignment so the environment changes are localized; specifically, ensure
setlocal is executed prior to the statement that modifies PATH (the line that
uses set "PATH=%SystemRoot%\System32;..."), i.e., swap the order so setlocal
runs first to avoid permanently altering the caller's PATH when this script is
called.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 314aa02a-4c81-4998-8cb1-ff610a5308c2

📥 Commits

Reviewing files that changed from the base of the PR and between 4c2ddef and ff31bf2.

📒 Files selected for processing (7)
  • cmake/packaging/sunshine.iss.in
  • src_assets/windows/misc/gamepad/install-gamepad.bat
  • src_assets/windows/misc/path/update-path.bat
  • src_assets/windows/misc/service/uninstall-service.bat
  • src_assets/windows/misc/vdd/uninstall-vdd.bat
  • src_assets/windows/misc/vmouse/install-vmouse.bat
  • src_assets/windows/misc/vmouse/uninstall-vmouse.bat

@Yundi339 Yundi339 merged commit d913e2f into master May 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant