Skip to content

Commit

Permalink
Improvements to HRESULT
Browse files Browse the repository at this point in the history
  • Loading branch information
elachlan committed Aug 24, 2022
1 parent 13965e2 commit f46cd5f
Showing 1 changed file with 4 additions and 2 deletions.
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));

internal string ToString(string format, IFormatProvider formatProvider) => ((uint)this.Value).ToString(format, formatProvider);
public override string ToString() => this.Value.ToString("X");

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

0 comments on commit f46cd5f

Please sign in to comment.