microsoft / cppwinrt

C++/WinRT
MIT License
1.64k stars 238 forks source link

Function to throw errno as HRESULT #1308

Closed JaiganeshKumaran closed 1 year ago

JaiganeshKumaran commented 1 year ago

When calling C runtime functions, they often set error information to errno. Unfortunately, there's no function to convert these error codes to HRESULT, but on Windows, it will also set _doserrno, which is a Win32 error code that can be converted to HRESULT using HRESULT_FROM_WIN32 inline function. Could C++/WinRT provide a check_errno function to automatically throw that as a winrt::hresult_error?

kennykerr commented 1 year ago

This is out of scope for WinRT.