Skip to content

Commit cc78d53

Browse files
committed
Improvements to HRESULT
1 parent 13965e2 commit cc78d53

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Microsoft.Windows.CsWin32/templates/HRESULT.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ internal HRESULT ThrowOnFailure(IntPtr errorInfo = default)
6161
return this;
6262
}
6363

64-
public override string ToString() => this.Value.ToString();
64+
internal static HRESULT HRESULT_FROM_WIN32(WIN32_ERROR error) => new(((int)error & 0x0000FFFF) | unchecked((int)0x80070000));
6565

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

0 commit comments

Comments
 (0)