Enumerate and display blocking processes when installer exits with packageInUse / packageInUseByApplication

未關閉
#6,537 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
55/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
cpp

研究方向

Start by reading InstallFlow.cpp and ShellExecuteInstallerHandler.cpp in AppInstallerCLICore, then review the Windows Restart Manager APIs in rstrtmgr.h. Implement the detection flow only for packageInUse and packageInUseByApplication responses, and verify that the error block displays each blocking application's name and PID while retaining the installer exit code.

由索引模型根據 Issue 內容生成。

描述

Issue-Feature
Relevant area(s)

WinGet CLI

Description of the new feature / enhancement
Problem Statement

When an installer exits due to locked files (e.g. exit code 6 mapped to packageInUse or packageInUseByApplication in the manifest schema), WinGet outputs a localized message:

"The files modified by the installer are currently being used by another application. Please close the applications, then try again."
However, WinGet provides no visibility into which specific application or process is holding the lock.
In automated workflows, silent upgrades (-h / --silent), or scenarios involving shared DLLs/drivers, users are left completely in the dark.

Real-World Example

Upgrading OBSProject.OBSStudio from 32.2.1 to 32.2.2 silently fails with exit code 6 when an Electron/Chromium app (such as VS Code, Discord, Slack, or Antigravity) has loaded obs-virtualcam-module64.dll via DirectShow camera device enumeration. Even if the user closes OBS Studio itself, the lock remains held by an unrelated background process. Identifying the culprit currently requires manual inspection of process modules or handles.

User Value

Displaying the locking process names and PIDs allows users to immediately identify and close the conflicting application without guesswork, without running interactive installers, and without opening external tools like Process Explorer.

Proposed technical implementation details
Proposed Architecture
  1. Trigger Condition:
    In AppInstallerCLICore (InstallFlow.cpp / ShellExecuteInstallerHandler.cpp), execute the detection flow only when an installer returns an exit code mapped to ReturnResponse::packageInUse or ReturnResponse::packageInUseByApplication (e.g. exit code 6).
  2. Process Enumeration via Windows Restart Manager:
    Utilize the native Win32 Restart Manager API (rstrtmgr.h / rstrtmgr.dll):
    • Call RmStartSession to obtain a session handle.
    • Register the target package install path or modified files via RmRegisterResources.
    • Call RmGetList to obtain the array of RM_PROCESS_INFO structures (retrieving strAppName and Process.dwProcessId).
    • Clean up with RmEndSession.
  3. CLI Output Format:
    Render the list of blocking processes directly in the error block:
    The files modified by the installer are currently being used by another application:
      - Antigravity (PID: 9468)
    Please close these applications and try again.
    Installer failed with exit code: '6'
主要語言
C++
星號
26.6k
分支
1.8k
平均合併
3 天 10 小時
30 天內合併 PR
41

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoft/winget-cli 的其他 Issue

查看 microsoft/winget-cli 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。