#include <HResult.h>
|
static DWORD | GetCode (HRESULT hRes) noexcept |
|
static FACILITY_TYPE | GetFacility (HRESULT hRes) noexcept |
|
static bool | IsFailure (HRESULT hRes) noexcept |
|
static HRESULT | Make (FACILITY_TYPE eFacility, WORD wCode) noexcept |
|
static HRESULT | Make (BYTE bReserved, FACILITY_TYPE eFacility, WORD wCode) noexcept |
|
static HRESULT | FromWin32 (DWORD dwWin32Code) noexcept |
|
static HRESULT __stdcall | GetLast () noexcept |
|
static HRESULT | GetDef (HRESULT hRes, HRESULT hResDef=E_FAIL) noexcept |
|
static HRESULT | GetLastDef (HRESULT hResDef=E_FAIL) noexcept |
|
static HRESULT __stdcall | FromPOSIX (int iErrNo) noexcept |
|
static HRESULT __stdcall | GetPOSIXLast () noexcept |
|
static HRESULT __stdcall | GetPOSIXLastDef (HRESULT hResDef=E_FAIL) noexcept |
|
static void __stdcall | AddCodes (const HResultCode *pCodes) |
|
static void __stdcall | AddCodesDefault () |
|
static HRESULT __stdcall | AddCodesText (const char *pszText) |
|
static HRESULT __stdcall | AddCodesFile (const FILECHAR_t *pszFilePath) |
|
static const char *__stdcall | GetTextBase (HRESULT hRes) |
|
static StrLen_t __stdcall | GetTextSys (HRESULT hRes, GChar_t *lpszError, StrLen_t nLenMaxError, void *pSource=nullptr, va_list vargs=k_va_list_empty) |
|
static StrLen_t __stdcall | GetTextV (HRESULT hRes, GChar_t *lpszError, StrLen_t nLenMaxError, void *pSource=nullptr, va_list vargs=k_va_list_empty) |
|
static HRESULT __stdcall | GetHResFromStr (const GChar_t *pszError, StrLen_t nLenError=-1) |
|
HRESULT code processing. HRESULT = (high bit=SEVERITY_ERROR, 4bit=reserve, 11bit=facility, 16bits=code) AKA SCODE in old _WIN32 MFC. https://msdn.microsoft.com/en-us/library/cc231198.aspx
◆ Facility_t
◆ HResult() [1/3]
Gray::HResult::HResult |
( |
HRESULT |
hRes | ) |
|
|
inlinenoexcept |
◆ HResult() [2/3]
◆ HResult() [3/3]
Gray::HResult::HResult |
( |
int |
eFacility, |
|
|
long |
wCode |
|
) |
| |
|
inlinenoexcept |
◆ AddCodes()
◆ AddCodesDefault()
void GRAYCALL Gray::HResult::AddCodesDefault |
( |
| ) |
|
|
static |
configure error text for normal system errors.
- Todo:
- get rid of these in favor of dynamic loading of s_HResult_CodeSets from file.
< Known codes in FACILITY_WIN32
< Known codes NOT in FACILITY_WIN32
◆ AddCodesFile()
add a block of codes (and text) from a text file. Lines of comma separated text.
◆ AddCodesText()
add a block of codes (and text) from some text blob (that i parse). Lines of comma separated text.
◆ FromPOSIX()
◆ FromWin32()
static HRESULT Gray::HResult::FromWin32 |
( |
DWORD |
dwWin32Code | ) |
|
|
inlinestaticnoexcept |
- dwWin32Code = maybe LSTATUS/error_status_t or already HRESULT (see GetLastError() docs) like HRESULT_FROM_WIN32(dwWin32Code) NOT HRESULT_WIN32_C(WORD)
◆ get_Code()
DWORD Gray::HResult::get_Code |
( |
| ) |
const |
|
inlinenoexcept |
◆ get_Facility()
◆ GetCode()
static DWORD Gray::HResult::GetCode |
( |
HRESULT |
hRes | ) |
|
|
inlinestaticnoexcept |
Get just the facility sub code portion of the HRESULT. may be LSTATUS/error_status_t HRESULT_CODE(hRes) = WORD or LSTATUS
◆ GetDef()
We know there was an error! If the hRes isn't an error supply a default error as hResDef.
◆ GetFacility()
◆ GetHResFromStr()
Reverse lookup of error string. given a string from GetTextV() get the original HRESULT code.
- Returns
- HRESULT Error code from a string.
◆ GetLast()
◆ GetLastDef()
Get the last system error recorded for this thread. A known failure. If there isn't one then just use the supplied default. E_FAIL
◆ GetPOSIXLast()
Get last POSIX error code. 'errno' converted to HRESULT
◆ GetPOSIXLastDef()
static HRESULT __stdcall Gray::HResult::GetPOSIXLastDef |
( |
HRESULT |
hResDef = E_FAIL | ) |
|
|
inlinestaticnoexcept |
◆ GetTextBase()
Get raw unformatted text for HRESULT codes from s_HResult_CodeSets first
◆ GetTextSys()
Ask the system what text there is for hRes. don't call strerror() here since it has just a pointer. use GetTextBase().
◆ GetTextV()
Get a string for the error code hRes. copies error message text to a string pszError. Append numeric code to the end. similar to the linux strerror() In windows there is a COM API for resolving these ?
- pszError = destination buffer
- nLenMaxError = buffer size for pszError in chars including room for null.
- pSource = module handle for "pdh.dll" ?
- vargs = additional arguments.
- Returns
- destination buffer length in chars.
◆ isFailure()
bool Gray::HResult::isFailure |
( |
| ) |
const |
|
inlinenoexcept |
◆ IsFailure()
◆ Make() [1/2]
Make a special HRESULT error code from FACILITY_TYPE + WORD code + bReserved. bReserved = 4 for a PerfMon Code. 8=app specific error. leave 0 for normal system error code.
◆ Make() [2/2]
Make a HRESULT error code from FACILITY_TYPE + WORD code.
◆ operator HRESULT()
Gray::HResult::operator HRESULT |
( |
| ) |
const |
|
inlinenoexcept |
◆ HResultTests
friend class HResultTests |
|
friend |
◆ k_Facility
Initial value:=
{
}
#define _GT(x)
like _T(x) macro for static text.
Definition: StrConst.h:27
cPair< FACILITY_TYPE, const GChar_t * > Facility_t
Definition: HResult.h:124
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
names of all known FACILITY_TYPE.
◆ m_hRes
The documentation for this class was generated from the following files: