Skip to content

Handle empty package enumeration during COM manual activation - #6496

Open
Ratin Gao (RatinCN) wants to merge 1 commit into
microsoft:masterfrom
RatinCN:codex/handle-empty-package-enumeration
Open

Handle empty package enumeration during COM manual activation#6496
Ratin Gao (RatinCN) wants to merge 1 commit into
microsoft:masterfrom
RatinCN:codex/handle-empty-package-enumeration

Conversation

@RatinCN

@RatinCN Ratin Gao (RatinCN) commented Aug 31, 2026

Copy link
Copy Markdown

📖 Description

The initial sizing call to FindPackagesByPackageFamily returns ERROR_INSUFFICIENT_BUFFER when matching packages exist, but can validly return ERROR_SUCCESS with a count of zero when no package is registered for the current identity.

The current code passes that success result to a failure-only WIL macro, causing the calling process to CRASH through FAIL_FAST instead of receiving a normal HRESULT. This change accepts the valid empty result and lets the existing control flow return ERROR_PACKAGE_NOT_REGISTERED_FOR_USER instead.

The registered-package path and propagation of other Win32 errors remain unchanged. This is consistent with the handling established in #2922.

For the SYSTEM scenario in #4944, this prevents the direct CRASH caused by FAIL_FAST, but does not add OutOfProc COM support, enumerate packages registered to other users, or use staged packages.

🔗 References

🔍 Validation

  • Reproduced the existing SYSTEM CRASH with 0xC0000409 (FAIL_FAST).
  • Confirmed that the API returns ERROR_SUCCESS with a package count of zero under SYSTEM.
  • Built Microsoft.Management.Deployment.OutOfProc for x64 Debug with the production package family and CLSIDs.
  • Verified the modified DLL as a normal user: exit code 0 and 237 packages enumerated.
  • Verified the modified DLL under SYSTEM: caught COMException with HRESULT 0x80073D35; exit code 0 with no process crash.

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@RatinCN
Ratin Gao (RatinCN) marked this pull request as ready for review August 31, 2026 16:09
@RatinCN
Ratin Gao (RatinCN) requested a review from a team as a code owner August 31, 2026 16:09
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@JohnMcPMS

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@JohnMcPMS

Copy link
Copy Markdown
Member

This code is not relevant for SYSTEM use, but the change appears righteous for standard users.

@RatinCN

Copy link
Copy Markdown
Author

This code is not relevant for SYSTEM use, but the change appears righteous for standard users.

Agreed. SYSTEM is not supported for this OutOfProc path and was only used to reproduce the issue. This change handles the valid empty result by returning ERROR_PACKAGE_NOT_REGISTERED_FOR_USER instead of crashing through FAIL_FAST.

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.

2 participants