7#include "../macros.hpp"
8#include "hresult_error_intf.hpp"
13hi_export_module(hikogui.win32 : win32_error_impl);
15hi_export
namespace hi {
18[[nodiscard]]
inline std::string hresult_error_category::message(
int code)
const
20 auto const code_ =
static_cast<uint32_t
>(
code);
22 auto const value =
code & 0xffff;
23 auto const facility = (
code >> 16) & 0x7ff;
24 auto const is_message_id = ((
code >> 27) & 1) != 0;
25 auto const is_ntstatus = ((
code >> 28) & 1) != 0;
26 auto const is_custom = ((
code >> 29) & 1) != 0;
27 auto const is_severe_failure = ((
code >> 30) & 1) != 0;
28 auto const is_failure = ((
code >> 31) & 1) != 0;
30 if (not is_ntstatus and not is_custom and not is_message_id and facility == 7) {
31 if (
auto msg = win32_FormatMessage(
static_cast<win32_error
>(value))) {
39 auto const facility_str = [&] {
42 }
else if (is_custom) {
44 }
else if (is_message_id) {
67 return std::format(
"Unknown Facility {}", facility);
72 auto const failure_str = [&] {
74 if (is_severe_failure) {
84 return std::format(
"HRESULT({}): {}: 0x{:08x}", facility_str, failure_str, code_);
@ code
Text is a piece of programming-code; a variable name, a function name.
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20