22 #if defined(_CPPUNWIND)
23 #define THROW_DEF throw()
25 #define THROW_DEF __noop
29 #define SUCCEEDED(x) (((HRESULT)(x)) >= S_OK)
30 #define FAILED(x) (((HRESULT)(x)) < S_OK)
44 FACILITY_DISPATCH = 2,
51 FACILITY_SECURITY = 9,
52 FACILITY_INTERNET = 12,
53 FACILITY_COMPLUS = 17,
68 #define HRESULT_WIN32_DEF(a,b,c) a=b,
70 #undef HRESULT_WIN32_DEF
73 #if ! defined(LSTATUS) && ! defined(_WIN32)
77 #define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) )
79 #define HRESULT_WIN32_C(x) MAKE_HRESULT(1,FACILITY_WIN32,(WORD)(x))
97 #define HRESULT_ENTRY(a,b,c,d) a=MAKE_HRESULT(1,b,c),
112 int FindCode(
HRESULT hRes)
const;
156 return (DWORD)((hRes) & 0xFFFF);
160 return GetCode(m_hRes);
170 return GetFacility(m_hRes);
207 if (dwWin32Code > 0xFFFF)
210 dwWin32Code &= 0xFFFF;
216 static inline HRESULT FromWaitRet(DWORD dwRet) noexcept
219 if (dwRet == WAIT_FAILED)
221 if (dwRet == WAIT_TIMEOUT)
223 if (dwRet >= STATUS_ABANDONED_WAIT_0)
246 return GetDef(GetLast(), hResDef);
255 return GetDef(GetPOSIXLast(), hResDef);
260 static void GRAYCALL AddCodesDefault();
#define GRAYCORE_LINK
Definition: GrayCore.h:47
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define SUCCEEDED(x)
Definition: HResult.h:29
#define HRESULT_WIN32_C(x)
a constant LSTATUS/error_status_t with no check, unlike HRESULT_FROM_WIN32()
Definition: HResult.h:79
#define MAKE_HRESULT(sev, fac, code)
Definition: HResult.h:77
#define FAILED(x)
Definition: HResult.h:30
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
#define UNITTEST_FRIEND(n)
Define this in the class body to be unit tested. Allow the unit test to access private/protected stuf...
Definition: cUnitTestDecl.h:17
Definition: HResult.h:103
HRESULT m_hRes
Definition: HResult.h:108
const char * m_pszMsg
error code for a FACILITY_TYPE. might just use WORD?
Definition: HResult.h:109
Definition: HResult.h:116
static HRESULT GetLastDef(HRESULT hResDef=E_FAIL) noexcept
Definition: HResult.h:242
HResult(HRESULT hRes) noexcept
Definition: HResult.h:130
static FACILITY_TYPE GetFacility(HRESULT hRes) noexcept
Definition: HResult.h:163
HResult(FACILITY_TYPE eFacility, WORD wCode) noexcept
Definition: HResult.h:134
HResult(int eFacility, long wCode) noexcept
Definition: HResult.h:140
static HRESULT Make(BYTE bReserved, FACILITY_TYPE eFacility, WORD wCode) noexcept
Definition: HResult.h:191
static DWORD GetCode(HRESULT hRes) noexcept
Definition: HResult.h:152
FACILITY_TYPE get_Facility() const noexcept
Definition: HResult.h:168
bool isFailure() const noexcept
Definition: HResult.h:179
HRESULT m_hRes
Definition: HResult.h:127
static HRESULT Make(FACILITY_TYPE eFacility, WORD wCode) noexcept
Definition: HResult.h:186
cPair< FACILITY_TYPE, const GChar_t * > Facility_t
Definition: HResult.h:124
static bool IsFailure(HRESULT hRes) noexcept
Definition: HResult.h:173
static HRESULT FromWin32(DWORD dwWin32Code) noexcept
Definition: HResult.h:198
DWORD get_Code() const noexcept
Definition: HResult.h:158
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
LONG LSTATUS
AKA error_status_t. FACILITY_WIN32 codes returned from RegCreateKeyEx() etc. Maybe NOT GetLastError()...
Definition: HResult.h:74
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32
HRESULT_OTHER_TYPE_
Definition: HResult.h:82
__DECL_IMPORT va_list k_va_list_empty
Definition: HResult.cpp:18
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
HRESULT_WIN32_TYPE_
Definition: HResult.h:64
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26
FACILITY_TYPE
Definition: HResult.h:36
@ FACILITY_MMSYS
Facility for _WIN32 MMSYSTEM MMRESULT error codes. MMSYSERR_BASE.
Definition: HResult.h:57
@ FACILITY_D3D
max = 2048 = 0x800 = 11 bits ?
Definition: HResult.h:59
@ FACILITY_POSIX
Facility for POSIX _errno in a _WIN32 style code.
Definition: HResult.h:49