Repository navigation
Fix GetFullNameFromFamilyName for non-elevated context - #2922
Merged
Merged
Conversation
Ryan (ryfu-msft)
approved these changes
Feb 4, 2023
Flor Chacón (florelis)
approved these changes
Feb 4, 2023
|
|
||
| std::wstring pfn = Utility::ConvertToUTF16(familyName); | ||
| auto packages = packageManager.FindPackages(pfn); | ||
| if (Runtime::IsRunningAsAdmin()) |
There was a problem hiding this comment.
Nit: Can we add a comment about why this check is needed?
| { | ||
| // More than 1 package found. Don't directly error, let caller deal with it. | ||
| // Don't directly error, let caller deal with it | ||
| AICLI_LOG(Core, Error, << "Multiple packages found for family name: " << fullNameCount); |
There was a problem hiding this comment.
Nit: Can we also log something like this in the other case?
6 of 8 tasks
JohnMcPMS
pushed a commit
that referenced
this pull request
Sep 3, 2026
## 📖 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PackageManager.FindPackages requires elevated context, the fix will be to revert to use previous FindPackagesByPackageFamily
Microsoft Reviewers: Open in CodeFlow