HRESULT_FROM_WIN32 function

int HRESULT_FROM_WIN32(
  1. int x
)

Maps a system error code to an HRESULT value.

Implementation

//
// #define __HRESULT_FROM_WIN32(x) ((HRESULT)(x) <= 0 ? ((HRESULT)(x)) :
//       ((HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000)))
int HRESULT_FROM_WIN32(int x) => (x <= 0
        ? x
        : (x & 0x0000FFFF | (FACILITY_CODE.FACILITY_WIN32 << 16) | 0x80000000))
    .toSigned(32);