Decode Win32 HRESULT messages before formatting#6321
Open
starSumi wants to merge 1 commit into
Open
Conversation
Decode HRESULT_FROM_WIN32 values before asking std::system_category for user-facing text so WinINet errors do not render as unknown error. Adds a regression test for ERROR_INTERNET_CANNOT_CONNECT.
Author
|
@microsoft-github-policy-service agree |
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.
Summary
Fixes #6319.
When a Win32 error is wrapped as an HRESULT via
HRESULT_FROM_WIN32,GetUserPresentableMessageForHRcurrently passes the full HRESULT value tostd::system_category().message(...). For errors such as0x80072efd(ERROR_INTERNET_CANNOT_CONNECT), this can render asunknown errorinstead of the underlying Win32/WinINet message.This change decodes
FACILITY_WIN32HRESULTs withHRESULT_CODE(hr)before askingstd::system_categoryfor the message.Changes
FACILITY_WIN32HRESULTs before formatting unknown external error messages.HRESULT_FROM_WIN32(ERROR_INTERNET_CANNOT_CONNECT).Validation
git diff --checkpassed locally.AppInstallerCLITests.exelocally because this environment does not have Visual Studio/MSBuild or an already-built test binary available.Opened as draft for maintainer feedback and CI validation.
Microsoft Reviewers: Open in CodeFlow