Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to HRESULT #666

Merged
merged 6 commits into from
Sep 7, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Microsoft.Windows.CsWin32/templates/HRESULT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ internal HRESULT ThrowOnFailure(IntPtr errorInfo = default)
return this;
}

public override string ToString() => this.Value.ToString();
internal static HRESULT HRESULT_FROM_WIN32(WIN32_ERROR error) => new(((int)error & 0x0000FFFF) | unchecked((int)0x80070000));
AArnott marked this conversation as resolved.
Show resolved Hide resolved

internal string ToString(string format, IFormatProvider formatProvider) => ((uint)this.Value).ToString(format, formatProvider);
public override string ToString() => $"0x{this.Value:X8}";

internal string ToString(string format, IFormatProvider formatProvider) => ((uint)this.Value).ToString(format, formatProvider);
}