diff --git a/src/Microsoft.Windows.CsWin32/templates/HRESULT.cs b/src/Microsoft.Windows.CsWin32/templates/HRESULT.cs index 1952eb84..c0503e6e 100644 --- a/src/Microsoft.Windows.CsWin32/templates/HRESULT.cs +++ b/src/Microsoft.Windows.CsWin32/templates/HRESULT.cs @@ -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); }