26#pragma warning(disable: 4505)
36template<
class _Ty,
class _Ax>
37static _Success_(
return == ERROR_SUCCESS) ULONG
TdhGetProperty(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _In_ ULONG PropertyDataCount, _In_reads_(PropertyDataCount) PPROPERTY_DATA_DESCRIPTOR pPropertyData, _Inout_ std::vector<_Ty, _Ax> &aData)
39 ULONG ulSize, ulResult;
42 ulResult = TdhGetPropertySize(pEvent, TdhContextCount, pTdhContext, PropertyDataCount, pPropertyData, &ulSize);
43 if (ulResult == ERROR_SUCCESS) {
46 aData.resize((ulSize +
sizeof(_Ty) - 1) /
sizeof(_Ty));
47 ulResult =
TdhGetProperty(pEvent, TdhContextCount, pTdhContext, PropertyDataCount, pPropertyData, ulSize,
reinterpret_cast<LPBYTE
>(aData.data()));
62static _Success_(
return == ERROR_SUCCESS) ULONG
TdhGetEventInformation(_In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _Out_ std::unique_ptr<TRACE_EVENT_INFO> &info)
65 ULONG ulSize =
sizeof(szBuffer), ulResult;
68 ulResult =
TdhGetEventInformation(pEvent, TdhContextCount, pTdhContext, (PTRACE_EVENT_INFO)szBuffer, &ulSize);
69 if (ulResult == ERROR_SUCCESS) {
71 info.reset(
reinterpret_cast<PTRACE_EVENT_INFO
>(
new char[ulSize]));
72 memcpy(info.get(), szBuffer, ulSize);
74 }
else if (ulResult == ERROR_INSUFFICIENT_BUFFER) {
76 info.reset(
reinterpret_cast<PTRACE_EVENT_INFO
>(
new char[ulSize]));
88static _Success_(
return == ERROR_SUCCESS) ULONG
TdhGetEventMapInformation(_In_ PEVENT_RECORD pEvent, _In_ LPWSTR pMapName, _Inout_ std::unique_ptr<EVENT_MAP_INFO> &info)
91 ULONG ulSize =
sizeof(szBuffer), ulResult;
95 if (ulResult == ERROR_SUCCESS) {
97 info.reset(
reinterpret_cast<PEVENT_MAP_INFO
>(
new char[ulSize]));
98 memcpy(info.get(), szBuffer, ulSize);
100 }
else if (ulResult == ERROR_INSUFFICIENT_BUFFER) {
102 info.reset(
reinterpret_cast<PEVENT_MAP_INFO
>(
new char[ulSize]));
131 Reserved = (ULONG)-1;
141 #pragma warning(suppress: 26495)
144 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
154 #pragma warning(suppress: 26495)
157 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
167 #pragma warning(suppress: 26495)
170 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
180 #pragma warning(suppress: 26495)
183 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
193 #pragma warning(suppress: 26495)
196 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
206 #pragma warning(suppress: 26495)
209 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
219 #pragma warning(suppress: 26495)
222 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
232 #pragma warning(suppress: 26495)
236 EventDataDescCreate(
this, data, (ULONG)((strlen(data) + 1) *
sizeof(*data)));
239 static const char null[] =
"(null)";
240 EventDataDescCreate(
this, null,
sizeof(null));
251 #pragma warning(suppress: 26495)
255 EventDataDescCreate(
this, data, (ULONG)((wcslen(data) + 1) *
sizeof(*data)));
258 static const wchar_t null[] = L
"(null)";
259 EventDataDescCreate(
this, null,
sizeof(null));
270 #pragma warning(suppress: 26495)
271 template<
class _Elem,
class _Traits,
class _Ax>
272 event_data(_In_
const std::basic_string<_Elem, _Traits, _Ax> &data)
274 EventDataDescCreate(
this, data.c_str(), (ULONG)((data.length() + 1) *
sizeof(_Elem)));
285 #pragma warning(suppress: 26495)
286 event_data(_In_bytecount_(size)
const void *data, _In_ ULONG size)
288 EventDataDescCreate(
this, data, size);
308 memset((EVENT_RECORD*)
this, 0,
sizeof(EVENT_RECORD));
327 event_rec(_In_
const EVENT_RECORD &other) : EVENT_RECORD(other)
340 memset((EVENT_RECORD*)&other, 0,
sizeof(EVENT_RECORD));
349 delete reinterpret_cast<unsigned char*
>(ExtendedData);
352 delete reinterpret_cast<unsigned char*
>(UserData);
362 if (
this != std::addressof(other)) {
363 (EVENT_RECORD&)*
this = other;
378 if (
this != std::addressof(other)) {
379 (EVENT_RECORD&)*
this = other;
394 if (
this != std::addressof(other)) {
395 (EVENT_RECORD&)*
this = other;
396 memset((EVENT_RECORD*)&other, 0,
sizeof(EVENT_RECORD));
408 void set_extended_data(_In_ USHORT count, _In_count_(count)
const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
411 delete reinterpret_cast<unsigned char*
>(ExtendedData);
425 delete reinterpret_cast<unsigned char*
>(UserData);
443 size_t data_size = 0;
444 for (
size_t i = 0; i < count; i++)
445 data_size += data[i].DataSize;
448 ExtendedData =
reinterpret_cast<EVENT_HEADER_EXTENDED_DATA_ITEM*
>(
new unsigned char[
sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM)*count + data_size]);
451 memcpy(ExtendedData, data,
sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM) * count);
454 unsigned char *ptr =
reinterpret_cast<unsigned char*
>(ExtendedData + count);
455 for (
size_t i = 0; i < count; i++) {
456 if (data[i].DataSize) {
457 memcpy(ptr, (
void*)(data[i].DataPtr), data[i].DataSize);
458 ExtendedData[i].DataPtr = (ULONGLONG)ptr;
459 ptr += data[i].DataSize;
461 ExtendedData[i].DataPtr = NULL;
466 ExtendedDataCount = count;
481 UserData =
new unsigned char[size];
484 memcpy(UserData, data, size);
488 UserDataLength = size;
524 if (ulRes == ERROR_SUCCESS)
538 ULONG
write(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
541 return EventWrite(
m_h, EventDescriptor, 0, NULL);
553 ULONG
write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG UserDataCount = 0, _In_opt_count_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData = NULL)
556 return EventWrite(
m_h, EventDescriptor, UserDataCount, UserData);
570 ULONG
write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_
const EVENT_DATA_DESCRIPTOR param1, ...)
578 return EventWrite(
m_h, EventDescriptor, 0, NULL);
581 va_start(arg, param1);
582 va_list arg_start = arg;
583 std::vector<EVENT_DATA_DESCRIPTOR> params;
587 for (param_count = 1; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
588 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg,
const EVENT_DATA_DESCRIPTOR);
593 params.reserve(param_count);
597 params.push_back(param1);
599 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg,
const EVENT_DATA_DESCRIPTOR);
608#pragma warning(disable: 28020)
609 return EventWrite(
m_h, EventDescriptor, param_count, params.data());
624 ULONG
write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ va_list arg)
628 va_list arg_start = arg;
629 std::vector<EVENT_DATA_DESCRIPTOR> params;
633 for (param_count = 0; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
634 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg,
const EVENT_DATA_DESCRIPTOR);
639 params.reserve(param_count);
644 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg,
const EVENT_DATA_DESCRIPTOR);
652#pragma warning(disable: 28020)
653 return EventWrite(
m_h, EventDescriptor, param_count, params.data());
666 ULONG
write(_In_ UCHAR Level, _In_ ULONGLONG Keyword, _In_z_ _Printf_format_string_ PCWSTR String, ...)
674 va_start(arg, String);
679 return EventWriteString(
m_h, Level, Keyword, msg.c_str());
690 EventUnregister(
m_h);
698 virtual void enable_callback(_In_ LPCGUID SourceId, _In_ ULONG IsEnabled, _In_ UCHAR Level, _In_ ULONGLONG MatchAnyKeyword, _In_ ULONGLONG MatchAllKeyword, _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData)
700 UNREFERENCED_PARAMETER(SourceId);
701 UNREFERENCED_PARAMETER(IsEnabled);
702 UNREFERENCED_PARAMETER(Level);
703 UNREFERENCED_PARAMETER(MatchAnyKeyword);
704 UNREFERENCED_PARAMETER(MatchAllKeyword);
705 UNREFERENCED_PARAMETER(FilterData);
713 static VOID NTAPI
enable_callback(_In_ LPCGUID SourceId, _In_ ULONG IsEnabled, _In_ UCHAR Level, _In_ ULONGLONG MatchAnyKeyword, _In_ ULONGLONG MatchAllKeyword, _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData, _Inout_opt_ PVOID CallbackContext)
744 m_prop(reinterpret_cast<EVENT_TRACE_PROPERTIES*>(new char[prop->Wnode.BufferSize])),
747 memcpy(
m_prop.get(), prop, prop->Wnode.BufferSize);
756 m_prop(std::move(other.m_prop)),
779 if (
this != std::addressof(other)) {
781 m_prop = std::move(other.m_prop);
791 operator const EVENT_TRACE_PROPERTIES*()
const
803 const EVENT_TRACE_PROPERTIES *prop =
m_prop.get();
804 return reinterpret_cast<LPCTSTR
>(
reinterpret_cast<const char*
>(prop) + prop->LoggerNameOffset);
830 ULONG
create(_In_z_ LPCTSTR SessionName, _In_
const EVENT_TRACE_PROPERTIES *Properties)
833 std::unique_ptr<EVENT_TRACE_PROPERTIES> prop(
reinterpret_cast<EVENT_TRACE_PROPERTIES*
>(
new char[Properties->Wnode.BufferSize]));
834 memcpy(prop.get(), Properties, Properties->Wnode.BufferSize);
835 ULONG ulRes = StartTrace(&h, SessionName, prop.get());
836 if (ulRes == ERROR_SUCCESS)
837 attach(h, prop.release());
850 ULONG
enable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
853 return EnableTraceEx(
857 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
874 ULONG
disable_trace(_In_ LPCGUID ProviderId, _In_ UCHAR Level, _In_opt_ ULONGLONG MatchAnyKeyword = 0, _In_opt_ ULONGLONG MatchAllKeyword = 0, _In_opt_ ULONG EnableProperty = 0, _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL)
877 return EnableTraceEx(
881 EVENT_CONTROL_CODE_DISABLE_PROVIDER,
897 ControlTrace(
m_h,
name(),
m_prop.get(), EVENT_TRACE_CONTROL_STOP);
901 std::unique_ptr<EVENT_TRACE_PROPERTIES>
m_prop;
949 _In_opt_ LPCGUID SourceId,
950 _In_ TRACEHANDLE TraceHandle,
951 _In_ LPCGUID ProviderId,
953 _In_opt_ ULONGLONG MatchAnyKeyword = 0,
954 _In_opt_ ULONGLONG MatchAllKeyword = 0,
955 _In_opt_ ULONG EnableProperty = 0,
956 _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL) :
970 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
985 _In_ LPCGUID ProviderId,
987 _In_opt_ ULONGLONG MatchAnyKeyword = 0,
988 _In_opt_ ULONGLONG MatchAllKeyword = 0,
989 _In_opt_ ULONG EnableProperty = 0,
990 _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL) :
992 m_source_id(&((const EVENT_TRACE_PROPERTIES*)session)->Wnode.Guid),
1004 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
1034 EVENT_CONTROL_CODE_DISABLE_PROVIDER,
1069 EventDataDescCreate(&
m_fn_name, pszFnName, (ULONG)(strlen(pszFnName) + 1)*
sizeof(*pszFnName));
1091 other.m_event_dest = NULL;
1108 if (
this != &other) {
1109 assert(&
m_ep == &other.m_ep);
1122 if (
this != &other) {
1123 assert(&
m_ep == &other.m_ep);
1126 other.m_event_dest = NULL;
1155 EventDataDescCreate(
m_desc + 0, pszFnName, (ULONG)(strlen(pszFnName) + 1)*
sizeof(*pszFnName));
1167 m_desc[0] = other.m_desc[0];
1178 m_desc[0] = std::move(other.m_desc[0]);
1179 other.m_event_dest = NULL;
1198 if (
this != &other) {
1199 assert(&
m_ep == &other.m_ep);
1201 m_desc[0] = other.m_desc[0];
1202 assert(&
m_result == &other.m_result);
1213 if (
this != &other) {
1214 assert(&
m_ep == &other.m_ep);
1216 m_desc[0] = std::move(other.m_desc[0]);
1217 assert(&
m_result == &other.m_result);
1218 other.m_event_dest = NULL;
EVENT_DATA_DESCRIPTOR wrapper.
Definition: ETW.h:122
event_data(const char &data)
Construct class pointing to an char.
Definition: ETW.h:142
event_data(const wchar_t *data)
Construct class pointing to a wide string.
Definition: ETW.h:252
event_data(const int &data)
Construct class pointing to an int.
Definition: ETW.h:168
event_data(const void *data, ULONG size)
Construct class pointing to binary data.
Definition: ETW.h:286
event_data(const GUID &data)
Construct class pointing to a GUID.
Definition: ETW.h:220
event_data(const unsigned int &data)
Construct class pointing to an unsigned int.
Definition: ETW.h:181
event_data(const char *data)
Construct class pointing to a string.
Definition: ETW.h:233
event_data(const unsigned char &data)
Construct class pointing to an unsigned char.
Definition: ETW.h:155
event_data(const std::basic_string< _Elem, _Traits, _Ax > &data)
Template to construct pointing to a std::basic_string<>.
Definition: ETW.h:272
event_data(const unsigned long &data)
Construct class pointing to an unsigned long.
Definition: ETW.h:207
event_data()
Construct empty class.
Definition: ETW.h:127
event_data(const long &data)
Construct class pointing to a long.
Definition: ETW.h:194
Helper template to write an event on entry/exit of scope with one parameter (typically result).
Definition: ETW.h:1145
event_fn_auto_ret(const event_fn_auto_ret< T > &other)
Copies the object.
Definition: ETW.h:1162
~event_fn_auto_ret()
Writes the event_dest event.
Definition: ETW.h:1185
EVENT_DATA_DESCRIPTOR m_desc[2]
Function name and return value.
Definition: ETW.h:1227
event_provider & m_ep
Reference to event provider in use.
Definition: ETW.h:1225
event_fn_auto_ret(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName, T &result)
Writes the event_cons event.
Definition: ETW.h:1150
T & m_result
Function result.
Definition: ETW.h:1228
event_fn_auto_ret & operator=(const event_fn_auto_ret< T > &other)
Copies the object.
Definition: ETW.h:1196
const EVENT_DESCRIPTOR * m_event_dest
Event descriptor at destruction.
Definition: ETW.h:1226
event_fn_auto_ret(event_fn_auto_ret< T > &&other)
Moves the object.
Definition: ETW.h:1173
event_fn_auto_ret & operator=(event_fn_auto_ret< T > &&other)
Moves the object.
Definition: ETW.h:1211
Helper class to write an event on entry/exit of scope.
Definition: ETW.h:1060
const EVENT_DESCRIPTOR * m_event_dest
Event descriptor at destruction.
Definition: ETW.h:1134
event_fn_auto(event_fn_auto &&other) noexcept
Moves the object.
Definition: ETW.h:1086
event_fn_auto(event_provider &ep, const EVENT_DESCRIPTOR *event_cons, const EVENT_DESCRIPTOR *event_dest, LPCSTR pszFnName)
Writes the event_cons event.
Definition: ETW.h:1065
~event_fn_auto()
Writes the event_dest event.
Definition: ETW.h:1097
event_fn_auto & operator=(event_fn_auto &&other) noexcept
Moves the object.
Definition: ETW.h:1120
event_fn_auto & operator=(const event_fn_auto &other)
Copies the object.
Definition: ETW.h:1106
event_provider & m_ep
Reference to event provider in use.
Definition: ETW.h:1133
EVENT_DATA_DESCRIPTOR m_fn_name
Function name.
Definition: ETW.h:1135
event_fn_auto(const event_fn_auto &other)
Copies the object.
Definition: ETW.h:1076
ETW event provider.
Definition: ETW.h:496
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor)
Writes an event with no parameters.
Definition: ETW.h:538
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, ULONG UserDataCount=0, PEVENT_DATA_DESCRIPTOR UserData=NULL)
Writes an event with parameters stored in array.
Definition: ETW.h:553
ULONG write(UCHAR Level, ULONGLONG Keyword, PCWSTR String,...)
Writes a string event.
Definition: ETW.h:666
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, va_list arg)
Writes an event with variable number of parameters.
Definition: ETW.h:624
virtual ~event_provider()
Closes the event provider.
Definition: ETW.h:505
virtual void enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData)
Receive enable or disable notification requests.
Definition: ETW.h:698
void free_internal() noexcept override
Releases the event provider.
Definition: ETW.h:688
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, const EVENT_DATA_DESCRIPTOR param1,...)
Writes an event with one or more parameter.
Definition: ETW.h:570
static VOID NTAPI enable_callback(LPCGUID SourceId, ULONG IsEnabled, UCHAR Level, ULONGLONG MatchAnyKeyword, ULONGLONG MatchAllKeyword, PEVENT_FILTER_DESCRIPTOR FilterData, PVOID CallbackContext)
Receive enable or disable notification requests.
Definition: ETW.h:713
ULONG create(LPCGUID ProviderId)
Registers the event provider.
Definition: ETW.h:520
EVENT_RECORD wrapper.
Definition: ETW.h:301
void set_extended_data_internal(USHORT count, const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
Sets event record extended data.
Definition: ETW.h:437
void set_user_data(USHORT size, LPCVOID data)
Sets event record user data.
Definition: ETW.h:422
event_rec & operator=(event_rec &&other) noexcept
Moves the event record.
Definition: ETW.h:392
~event_rec()
Destroys event record data and frees the allocated memory.
Definition: ETW.h:346
event_rec & operator=(const EVENT_RECORD &other)
Copies an existing event record.
Definition: ETW.h:376
event_rec(const EVENT_RECORD &other)
Copies an existing event record.
Definition: ETW.h:327
event_rec & operator=(const event_rec &other)
Copies an existing event record.
Definition: ETW.h:360
void set_extended_data(USHORT count, const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
Sets event record extended data.
Definition: ETW.h:408
event_rec(event_rec &&other) noexcept
Moves the event record.
Definition: ETW.h:338
event_rec()
Constructs a blank event record.
Definition: ETW.h:306
void set_user_data_internal(USHORT size, LPCVOID data)
Sets event record user data.
Definition: ETW.h:475
event_rec(const event_rec &other)
Copies an existing event record.
Definition: ETW.h:316
ETW session.
Definition: ETW.h:726
LPCTSTR name() const
Auto-typecasting operator.
Definition: ETW.h:801
event_session(event_session &&other) noexcept
Move constructor.
Definition: ETW.h:755
event_session(handle_type h, const EVENT_TRACE_PROPERTIES *prop)
Initializes a new session with an already available object handle.
Definition: ETW.h:743
event_session()
Initializes a new empty session.
Definition: ETW.h:733
virtual ~event_session()
Closes the session.
Definition: ETW.h:766
void free_internal() noexcept override
Releases the session.
Definition: ETW.h:895
event_session & operator=(event_session &&other) noexcept
Move assignment.
Definition: ETW.h:777
ULONG disable_trace(LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Disables the specified event trace provider.
Definition: ETW.h:874
ULONG enable_trace(LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Enables the specified event trace provider.
Definition: ETW.h:850
std::unique_ptr< EVENT_TRACE_PROPERTIES > m_prop
Session properties.
Definition: ETW.h:901
ULONG create(LPCTSTR SessionName, const EVENT_TRACE_PROPERTIES *Properties)
Registers and starts an event tracing session.
Definition: ETW.h:830
void attach(handle_type h, EVENT_TRACE_PROPERTIES *prop)
Sets a new session handle for the class.
Definition: ETW.h:815
Helper class to enable event provider in constructor and disables it in destructor.
Definition: ETW.h:941
UCHAR m_level
Logging level.
Definition: ETW.h:1047
PEVENT_FILTER_DESCRIPTOR m_enable_filter_desc
Event filter descriptor.
Definition: ETW.h:1051
ULONGLONG m_match_any_keyword
Keyword match mask (any)
Definition: ETW.h:1048
event_trace_enabler(LPCGUID SourceId, TRACEHANDLE TraceHandle, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Enables event trace.
Definition: ETW.h:948
ULONG m_status
Result of EnableTraceEx call.
Definition: ETW.h:1043
TRACEHANDLE m_trace_handle
Trace handle.
Definition: ETW.h:1046
virtual ~event_trace_enabler()
Disables event trace.
Definition: ETW.h:1027
ULONG status() const
Return result of EnableTraceEx() call.
Definition: ETW.h:1017
event_trace_enabler(const event_session &session, LPCGUID ProviderId, UCHAR Level, ULONGLONG MatchAnyKeyword=0, ULONGLONG MatchAllKeyword=0, ULONG EnableProperty=0, PEVENT_FILTER_DESCRIPTOR EnableFilterDesc=NULL)
Enables event trace.
Definition: ETW.h:983
ULONGLONG m_match_all_keyword
Keyword match mask (all)
Definition: ETW.h:1049
LPCGUID m_provider_id
Provider ID.
Definition: ETW.h:1044
LPCGUID m_source_id
Session ID.
Definition: ETW.h:1045
ULONG m_enable_property
Enable property.
Definition: ETW.h:1050
ETW trace.
Definition: ETW.h:910
virtual ~event_trace()
Closes the trace.
Definition: ETW.h:919
void free_internal() noexcept override
Closes the trace.
Definition: ETW.h:931
Base abstract template class to support generic object handle keeping.
Definition: Common.h:615
handle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition: Common.h:630
REGHANDLE handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:620
handle_type m_h
Object handle.
Definition: Common.h:866
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:829
static ULONG TdhGetEventInformation(PEVENT_RECORD pEvent, ULONG TdhContextCount, PTDH_CONTEXT pTdhContext, std::unique_ptr< TRACE_EVENT_INFO > &info)
Retrieves metadata about an event.
Definition: ETW.h:62
static ULONG TdhGetProperty(PEVENT_RECORD pEvent, ULONG TdhContextCount, PTDH_CONTEXT pTdhContext, ULONG PropertyDataCount, PPROPERTY_DATA_DESCRIPTOR pPropertyData, std::vector< _Ty, _Ax > &aData)
Retrieves a property value from the event data.
Definition: ETW.h:37
static ULONG TdhGetEventMapInformation(PEVENT_RECORD pEvent, LPWSTR pMapName, std::unique_ptr< EVENT_MAP_INFO > &info)
Retrieves information about the event map contained in the event.
Definition: ETW.h:88
static const event_data blank_event_data
Blank event data used as terminator.
Definition: ETW.h:295
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:74
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:101
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:171
static const REGHANDLE invalid
Invalid handle value.
Definition: Common.h:625