|
|
@ -224,35 +224,22 @@ protected:
|
|
|
|
formatted.push_back('\0');
|
|
|
|
formatted.push_back('\0');
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
|
|
|
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
|
|
|
|
try
|
|
|
|
wmemory_buf_t buf;
|
|
|
|
{
|
|
|
|
details::os::utf8_to_wstrbuf(string_view_t(formatted.data(), formatted.size()), buf);
|
|
|
|
memory_buf_t buf;
|
|
|
|
|
|
|
|
details::os::utf8_to_wstrbuf(string_view_t(formatted.data(), formatted.size()), buf);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LPCWSTR lp_wstr = reinterpret_cast<LPCWSTR>(buf.data());
|
|
|
|
LPCWSTR lp_wstr = buf.data();
|
|
|
|
succeeded = ::ReportEventW(event_log_handle(), eventlog::get_event_type(msg), eventlog::get_event_category(msg), event_id_,
|
|
|
|
succeeded = ::ReportEventW(event_log_handle(), eventlog::get_event_type(msg), eventlog::get_event_category(msg), event_id_,
|
|
|
|
current_user_sid_.as_sid(), 1, 0, &lp_wstr, nullptr);
|
|
|
|
current_user_sid_.as_sid(), 1, 0, &lp_wstr, nullptr);
|
|
|
|
|
|
|
|
|
|
|
|
if (!succeeded)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SPDLOG_THROW(win32_error("ReportEvent"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (...)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// WCHAR string conversion can fail and if it does, we shouldn't call to report event function.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
LPCSTR lp_str = reinterpret_cast<LPCSTR>(formatted.data());
|
|
|
|
LPCSTR lp_str = formatted.data();
|
|
|
|
|
|
|
|
|
|
|
|
succeeded = ::ReportEventA(event_log_handle(), eventlog::get_event_type(msg), eventlog::get_event_category(msg), event_id_,
|
|
|
|
succeeded = ::ReportEventA(event_log_handle(), eventlog::get_event_type(msg), eventlog::get_event_category(msg), event_id_,
|
|
|
|
current_user_sid_.as_sid(), 1, 0, &lp_str, nullptr);
|
|
|
|
current_user_sid_.as_sid(), 1, 0, &lp_str, nullptr);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (!succeeded)
|
|
|
|
if (!succeeded)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SPDLOG_THROW(win32_error("ReportEvent"));
|
|
|
|
SPDLOG_THROW(win32_error("ReportEvent"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void flush_() override {}
|
|
|
|
void flush_() override {}
|
|
|
|