20#pragma warning(disable: 4505)
33template<
class _Ty,
class _Ax>
34static _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)
36 ULONG ulSize, ulResult;
39 ulResult = TdhGetPropertySize(pEvent, TdhContextCount, pTdhContext, PropertyDataCount, pPropertyData, &ulSize);
40 if (ulResult == ERROR_SUCCESS) {
43 aData.resize((ulSize +
sizeof(_Ty) - 1) /
sizeof(_Ty));
44 ulResult = TdhGetProperty(pEvent, TdhContextCount, pTdhContext, PropertyDataCount, pPropertyData, ulSize,
reinterpret_cast<LPBYTE
>(aData.data()));
59static _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)
62 ULONG ulSize =
sizeof(szBuffer), ulResult;
65 ulResult = TdhGetEventInformation(pEvent, TdhContextCount, pTdhContext, (PTRACE_EVENT_INFO)szBuffer, &ulSize);
66 if (ulResult == ERROR_SUCCESS) {
68 info.reset(
reinterpret_cast<PTRACE_EVENT_INFO
>(
new char[ulSize]));
69 memcpy(info.get(), szBuffer, ulSize);
71 }
else if (ulResult == ERROR_INSUFFICIENT_BUFFER) {
73 info.reset(
reinterpret_cast<PTRACE_EVENT_INFO
>(
new char[ulSize]));
74 return TdhGetEventInformation(pEvent, TdhContextCount, pTdhContext, info.get(), &ulSize);
85static _Success_(
return == ERROR_SUCCESS) ULONG TdhGetEventMapInformation(_In_ PEVENT_RECORD pEvent, _In_ LPWSTR pMapName, _Inout_ std::unique_ptr<EVENT_MAP_INFO> &info)
88 ULONG ulSize =
sizeof(szBuffer), ulResult;
91 ulResult = TdhGetEventMapInformation(pEvent, pMapName, (PEVENT_MAP_INFO)szBuffer, &ulSize);
92 if (ulResult == ERROR_SUCCESS) {
94 info.reset(
reinterpret_cast<PEVENT_MAP_INFO
>(
new char[ulSize]));
95 memcpy(info.get(), szBuffer, ulSize);
97 }
else if (ulResult == ERROR_INSUFFICIENT_BUFFER) {
99 info.reset(
reinterpret_cast<PEVENT_MAP_INFO
>(
new char[ulSize]));
100 return TdhGetEventMapInformation(pEvent, pMapName, info.get(), &ulSize);
128 Reserved = (ULONG)-1;
138 #pragma warning(suppress: 26495)
141 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
151 #pragma warning(suppress: 26495)
154 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
164 #pragma warning(suppress: 26495)
167 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
177 #pragma warning(suppress: 26495)
180 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
190 #pragma warning(suppress: 26495)
193 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
203 #pragma warning(suppress: 26495)
206 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
216 #pragma warning(suppress: 26495)
219 EventDataDescCreate(
this, &data, (ULONG)(
sizeof(data)));
229 #pragma warning(suppress: 26495)
233 EventDataDescCreate(
this, data, (ULONG)((strlen(data) + 1) *
sizeof(*data)));
236 static const char null[] =
"(null)";
237 EventDataDescCreate(
this, null,
sizeof(null));
248 #pragma warning(suppress: 26495)
252 EventDataDescCreate(
this, data, (ULONG)((wcslen(data) + 1) *
sizeof(*data)));
255 static const wchar_t null[] = L
"(null)";
256 EventDataDescCreate(
this, null,
sizeof(null));
267 #pragma warning(suppress: 26495)
268 template<
class _Elem,
class _Traits,
class _Ax>
269 event_data(_In_
const std::basic_string<_Elem, _Traits, _Ax> &data)
271 EventDataDescCreate(
this, data.c_str(), (ULONG)((data.length() + 1) *
sizeof(_Elem)));
282 #pragma warning(suppress: 26495)
283 event_data(_In_bytecount_(size)
const void *data, _In_ ULONG size)
285 EventDataDescCreate(
this, data, size);
292 static const event_data blank_event_data;
305 memset((EVENT_RECORD*)
this, 0,
sizeof(EVENT_RECORD));
324 event_rec(_In_
const EVENT_RECORD &other) : EVENT_RECORD(other)
337 memset((EVENT_RECORD*)&other, 0,
sizeof(EVENT_RECORD));
346 delete reinterpret_cast<unsigned char*
>(ExtendedData);
349 delete reinterpret_cast<unsigned char*
>(UserData);
359 if (
this != std::addressof(other)) {
360 (EVENT_RECORD&)*
this = other;
375 if (
this != std::addressof(other)) {
376 (EVENT_RECORD&)*
this = other;
391 if (
this != std::addressof(other)) {
392 (EVENT_RECORD&)*
this = other;
393 memset((EVENT_RECORD*)&other, 0,
sizeof(EVENT_RECORD));
405 void set_extended_data(_In_ USHORT count, _In_count_(count)
const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
408 delete reinterpret_cast<unsigned char*
>(ExtendedData);
422 delete reinterpret_cast<unsigned char*
>(UserData);
440 size_t data_size = 0;
441 for (
size_t i = 0; i < count; i++)
442 data_size += data[i].DataSize;
445 ExtendedData =
reinterpret_cast<EVENT_HEADER_EXTENDED_DATA_ITEM*
>(
new unsigned char[
sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM)*count + data_size]);
448 memcpy(ExtendedData, data,
sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM) * count);
451 unsigned char *ptr =
reinterpret_cast<unsigned char*
>(ExtendedData + count);
452 for (
size_t i = 0; i < count; i++) {
453 if (data[i].DataSize) {
454 memcpy(ptr, (
void*)(data[i].DataPtr), data[i].DataSize);
455 ExtendedData[i].DataPtr = (ULONGLONG)ptr;
456 ptr += data[i].DataSize;
458 ExtendedData[i].DataPtr = NULL;
463 ExtendedDataCount = count;
478 UserData =
new unsigned char[size];
481 memcpy(UserData, data, size);
485 UserDataLength = size;
521 if (ulRes == ERROR_SUCCESS)
535 ULONG
write(_In_ PCEVENT_DESCRIPTOR EventDescriptor)
538 return EventWrite(
m_h, EventDescriptor, 0, NULL);
550 ULONG
write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG UserDataCount = 0, _In_opt_count_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData = NULL)
553 return EventWrite(
m_h, EventDescriptor, UserDataCount, UserData);
567 ULONG
write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_
const EVENT_DATA_DESCRIPTOR param1, ...)
572 if (param1.Ptr == winstd::blank_event_data.Ptr &&
573 param1.Size == winstd::blank_event_data.Size &&
574 param1.Reserved == winstd::blank_event_data.Reserved)
575 return EventWrite(
m_h, EventDescriptor, 0, NULL);
578 va_start(arg, param1);
579 va_list arg_start = arg;
580 std::vector<EVENT_DATA_DESCRIPTOR> params;
584 for (param_count = 1; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
585 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg,
const EVENT_DATA_DESCRIPTOR);
586 if (p.Ptr == winstd::blank_event_data.Ptr &&
587 p.Size == winstd::blank_event_data.Size &&
588 p.Reserved == winstd::blank_event_data.Reserved)
break;
590 params.reserve(param_count);
594 params.push_back(param1);
596 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg,
const EVENT_DATA_DESCRIPTOR);
597 if (p.Ptr == winstd::blank_event_data.Ptr &&
598 p.Size == winstd::blank_event_data.Size &&
599 p.Reserved == winstd::blank_event_data.Reserved)
break;
605#pragma warning(disable: 28020)
606 return EventWrite(
m_h, EventDescriptor, param_count, params.data());
621 ULONG
write(_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ va_list arg)
625 va_list arg_start = arg;
626 std::vector<EVENT_DATA_DESCRIPTOR> params;
630 for (param_count = 0; param_count < MAX_EVENT_DATA_DESCRIPTORS; param_count++) {
631 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg,
const EVENT_DATA_DESCRIPTOR);
632 if (p.Ptr == winstd::blank_event_data.Ptr &&
633 p.Size == winstd::blank_event_data.Size &&
634 p.Reserved == winstd::blank_event_data.Reserved)
break;
636 params.reserve(param_count);
641 const EVENT_DATA_DESCRIPTOR &p = va_arg(arg,
const EVENT_DATA_DESCRIPTOR);
642 if (p.Ptr == winstd::blank_event_data.Ptr &&
643 p.Size == winstd::blank_event_data.Size &&
644 p.Reserved == winstd::blank_event_data.Reserved)
break;
649#pragma warning(disable: 28020)
650 return EventWrite(
m_h, EventDescriptor, param_count, params.data());
663 ULONG
write(_In_ UCHAR Level, _In_ ULONGLONG Keyword, _In_z_ _Printf_format_string_ PCWSTR String, ...)
671 va_start(arg, String);
672 vsprintf(msg, String, arg);
676 return EventWriteString(
m_h, Level, Keyword, msg.c_str());
687 EventUnregister(
m_h);
695 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)
697 UNREFERENCED_PARAMETER(SourceId);
698 UNREFERENCED_PARAMETER(IsEnabled);
699 UNREFERENCED_PARAMETER(Level);
700 UNREFERENCED_PARAMETER(MatchAnyKeyword);
701 UNREFERENCED_PARAMETER(MatchAllKeyword);
702 UNREFERENCED_PARAMETER(FilterData);
710 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)
741 m_prop(reinterpret_cast<EVENT_TRACE_PROPERTIES*>(new char[prop->Wnode.BufferSize])),
744 memcpy(
m_prop.get(), prop, prop->Wnode.BufferSize);
753 m_prop(std::move(other.m_prop)),
776 if (
this != std::addressof(other)) {
778 m_prop = std::move(other.m_prop);
788 operator const EVENT_TRACE_PROPERTIES*()
const
800 const EVENT_TRACE_PROPERTIES *prop =
m_prop.get();
801 return reinterpret_cast<LPCTSTR
>(
reinterpret_cast<const char*
>(prop) + prop->LoggerNameOffset);
827 ULONG
create(_In_z_ LPCTSTR SessionName, _In_
const EVENT_TRACE_PROPERTIES *Properties)
830 std::unique_ptr<EVENT_TRACE_PROPERTIES> prop(
reinterpret_cast<EVENT_TRACE_PROPERTIES*
>(
new char[Properties->Wnode.BufferSize]));
831 memcpy(prop.get(), Properties, Properties->Wnode.BufferSize);
832 ULONG ulRes = StartTrace(&h, SessionName, prop.get());
833 if (ulRes == ERROR_SUCCESS)
834 attach(h, prop.release());
847 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)
850 return EnableTraceEx(
854 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
871 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)
874 return EnableTraceEx(
878 EVENT_CONTROL_CODE_DISABLE_PROVIDER,
894 ControlTrace(
m_h,
name(),
m_prop.get(), EVENT_TRACE_CONTROL_STOP);
898 std::unique_ptr<EVENT_TRACE_PROPERTIES>
m_prop;
946 _In_opt_ LPCGUID SourceId,
947 _In_ TRACEHANDLE TraceHandle,
948 _In_ LPCGUID ProviderId,
950 _In_opt_ ULONGLONG MatchAnyKeyword = 0,
951 _In_opt_ ULONGLONG MatchAllKeyword = 0,
952 _In_opt_ ULONG EnableProperty = 0,
953 _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL) :
967 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
982 _In_ LPCGUID ProviderId,
984 _In_opt_ ULONGLONG MatchAnyKeyword = 0,
985 _In_opt_ ULONGLONG MatchAllKeyword = 0,
986 _In_opt_ ULONG EnableProperty = 0,
987 _In_opt_ PEVENT_FILTER_DESCRIPTOR EnableFilterDesc = NULL) :
989 m_source_id(&((const EVENT_TRACE_PROPERTIES*)session)->Wnode.Guid),
1001 EVENT_CONTROL_CODE_ENABLE_PROVIDER,
1031 EVENT_CONTROL_CODE_DISABLE_PROVIDER,
1066 EventDataDescCreate(&
m_fn_name, pszFnName, (ULONG)(strlen(pszFnName) + 1)*
sizeof(*pszFnName));
1088 other.m_event_dest = NULL;
1105 if (
this != &other) {
1106 assert(&
m_ep == &other.m_ep);
1119 if (
this != &other) {
1120 assert(&
m_ep == &other.m_ep);
1123 other.m_event_dest = NULL;
1152 EventDataDescCreate(
m_desc + 0, pszFnName, (ULONG)(strlen(pszFnName) + 1)*
sizeof(*pszFnName));
1164 m_desc[0] = other.m_desc[0];
1175 m_desc[0] = std::move(other.m_desc[0]);
1176 other.m_event_dest = NULL;
1195 if (
this != &other) {
1196 assert(&
m_ep == &other.m_ep);
1198 m_desc[0] = other.m_desc[0];
1199 assert(&
m_result == &other.m_result);
1210 if (
this != &other) {
1211 assert(&
m_ep == &other.m_ep);
1213 m_desc[0] = std::move(other.m_desc[0]);
1214 assert(&
m_result == &other.m_result);
1215 other.m_event_dest = NULL;
EVENT_DATA_DESCRIPTOR wrapper.
Definition: ETW.h:119
event_data(const char &data)
Construct class pointing to an char.
Definition: ETW.h:139
event_data(const wchar_t *data)
Construct class pointing to a wide string.
Definition: ETW.h:249
event_data(const int &data)
Construct class pointing to an int.
Definition: ETW.h:165
event_data(const void *data, ULONG size)
Construct class pointing to binary data.
Definition: ETW.h:283
event_data(const GUID &data)
Construct class pointing to a GUID.
Definition: ETW.h:217
event_data(const unsigned int &data)
Construct class pointing to an unsigned int.
Definition: ETW.h:178
event_data(const char *data)
Construct class pointing to a string.
Definition: ETW.h:230
event_data(const unsigned char &data)
Construct class pointing to an unsigned char.
Definition: ETW.h:152
event_data(const std::basic_string< _Elem, _Traits, _Ax > &data)
Template to construct pointing to a std::basic_string<>.
Definition: ETW.h:269
event_data(const unsigned long &data)
Construct class pointing to an unsigned long.
Definition: ETW.h:204
event_data()
Construct empty class.
Definition: ETW.h:124
event_data(const long &data)
Construct class pointing to a long.
Definition: ETW.h:191
Helper template to write an event on entry/exit of scope with one parameter (typically result).
Definition: ETW.h:1142
event_fn_auto_ret(const event_fn_auto_ret< T > &other)
Copies the object.
Definition: ETW.h:1159
~event_fn_auto_ret()
Writes the event_dest event.
Definition: ETW.h:1182
EVENT_DATA_DESCRIPTOR m_desc[2]
Function name and return value.
Definition: ETW.h:1224
event_provider & m_ep
Reference to event provider in use.
Definition: ETW.h:1222
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:1147
T & m_result
Function result.
Definition: ETW.h:1225
event_fn_auto_ret & operator=(const event_fn_auto_ret< T > &other)
Copies the object.
Definition: ETW.h:1193
const EVENT_DESCRIPTOR * m_event_dest
Event descriptor at destruction.
Definition: ETW.h:1223
event_fn_auto_ret(event_fn_auto_ret< T > &&other)
Moves the object.
Definition: ETW.h:1170
event_fn_auto_ret & operator=(event_fn_auto_ret< T > &&other)
Moves the object.
Definition: ETW.h:1208
Helper class to write an event on entry/exit of scope.
Definition: ETW.h:1057
const EVENT_DESCRIPTOR * m_event_dest
Event descriptor at destruction.
Definition: ETW.h:1131
event_fn_auto(event_fn_auto &&other) noexcept
Moves the object.
Definition: ETW.h:1083
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:1062
~event_fn_auto()
Writes the event_dest event.
Definition: ETW.h:1094
event_fn_auto & operator=(event_fn_auto &&other) noexcept
Moves the object.
Definition: ETW.h:1117
event_fn_auto & operator=(const event_fn_auto &other)
Copies the object.
Definition: ETW.h:1103
event_provider & m_ep
Reference to event provider in use.
Definition: ETW.h:1130
EVENT_DATA_DESCRIPTOR m_fn_name
Function name.
Definition: ETW.h:1132
event_fn_auto(const event_fn_auto &other)
Copies the object.
Definition: ETW.h:1073
ETW event provider.
Definition: ETW.h:493
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor)
Writes an event with no parameters.
Definition: ETW.h:535
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, ULONG UserDataCount=0, PEVENT_DATA_DESCRIPTOR UserData=NULL)
Writes an event with parameters stored in array.
Definition: ETW.h:550
ULONG write(UCHAR Level, ULONGLONG Keyword, PCWSTR String,...)
Writes a string event.
Definition: ETW.h:663
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, va_list arg)
Writes an event with variable number of parameters.
Definition: ETW.h:621
virtual ~event_provider()
Closes the event provider.
Definition: ETW.h:502
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:695
void free_internal() noexcept override
Releases the event provider.
Definition: ETW.h:685
ULONG write(PCEVENT_DESCRIPTOR EventDescriptor, const EVENT_DATA_DESCRIPTOR param1,...)
Writes an event with one or more parameter.
Definition: ETW.h:567
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:710
ULONG create(LPCGUID ProviderId)
Registers the event provider.
Definition: ETW.h:517
EVENT_RECORD wrapper.
Definition: ETW.h:298
void set_extended_data_internal(USHORT count, const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
Sets event record extended data.
Definition: ETW.h:434
void set_user_data(USHORT size, LPCVOID data)
Sets event record user data.
Definition: ETW.h:419
event_rec & operator=(event_rec &&other) noexcept
Moves the event record.
Definition: ETW.h:389
~event_rec()
Destroys event record data and frees the allocated memory.
Definition: ETW.h:343
event_rec & operator=(const EVENT_RECORD &other)
Copies an existing event record.
Definition: ETW.h:373
event_rec(const EVENT_RECORD &other)
Copies an existing event record.
Definition: ETW.h:324
event_rec & operator=(const event_rec &other)
Copies an existing event record.
Definition: ETW.h:357
void set_extended_data(USHORT count, const EVENT_HEADER_EXTENDED_DATA_ITEM *data)
Sets event record extended data.
Definition: ETW.h:405
event_rec(event_rec &&other) noexcept
Moves the event record.
Definition: ETW.h:335
event_rec()
Constructs a blank event record.
Definition: ETW.h:303
void set_user_data_internal(USHORT size, LPCVOID data)
Sets event record user data.
Definition: ETW.h:472
event_rec(const event_rec &other)
Copies an existing event record.
Definition: ETW.h:313
ETW session.
Definition: ETW.h:723
LPCTSTR name() const
Auto-typecasting operator.
Definition: ETW.h:798
event_session(event_session &&other) noexcept
Move constructor.
Definition: ETW.h:752
event_session(handle_type h, const EVENT_TRACE_PROPERTIES *prop)
Initializes a new session with an already available object handle.
Definition: ETW.h:740
event_session()
Initializes a new empty session.
Definition: ETW.h:730
virtual ~event_session()
Closes the session.
Definition: ETW.h:763
void free_internal() noexcept override
Releases the session.
Definition: ETW.h:892
event_session & operator=(event_session &&other) noexcept
Move assignment.
Definition: ETW.h:774
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:871
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:847
std::unique_ptr< EVENT_TRACE_PROPERTIES > m_prop
Session properties.
Definition: ETW.h:898
ULONG create(LPCTSTR SessionName, const EVENT_TRACE_PROPERTIES *Properties)
Registers and starts an event tracing session.
Definition: ETW.h:827
void attach(handle_type h, EVENT_TRACE_PROPERTIES *prop)
Sets a new session handle for the class.
Definition: ETW.h:812
Helper class to enable event provider in constructor and disables it in destructor.
Definition: ETW.h:938
UCHAR m_level
Logging level.
Definition: ETW.h:1044
PEVENT_FILTER_DESCRIPTOR m_enable_filter_desc
Event filter descriptor.
Definition: ETW.h:1048
ULONGLONG m_match_any_keyword
Keyword match mask (any)
Definition: ETW.h:1045
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:945
ULONG m_status
Result of EnableTraceEx call.
Definition: ETW.h:1040
TRACEHANDLE m_trace_handle
Trace handle.
Definition: ETW.h:1043
virtual ~event_trace_enabler()
Disables event trace.
Definition: ETW.h:1024
ULONG status() const
Return result of EnableTraceEx() call.
Definition: ETW.h:1014
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:980
ULONGLONG m_match_all_keyword
Keyword match mask (all)
Definition: ETW.h:1046
LPCGUID m_provider_id
Provider ID.
Definition: ETW.h:1041
LPCGUID m_source_id
Session ID.
Definition: ETW.h:1042
ULONG m_enable_property
Enable property.
Definition: ETW.h:1047
ETW trace.
Definition: ETW.h:907
virtual ~event_trace()
Closes the trace.
Definition: ETW.h:916
void free_internal() noexcept override
Closes the trace.
Definition: ETW.h:928
Base abstract template class to support generic object handle keeping.
Definition: Common.h:603
handle() noexcept
Initializes a new class instance with the object handle set to INVAL.
Definition: Common.h:618
REGHANDLE handle_type
Datatype of the object handle this template class handles.
Definition: Common.h:608
handle_type m_h
Object handle.
Definition: Common.h:854
void attach(handle_type h) noexcept
Sets a new object handle for the class.
Definition: Common.h:817
#define WINSTD_NONCOPYABLE(C)
Declares a class as non-copyable.
Definition: Common.h:52
#define WINSTD_STACK_BUFFER_BYTES
Size of the stack buffer in bytes used for initial system function call.
Definition: Common.h:79
#define WINSTD_HANDLE_IMPL(C, INVAL)
Implements default constructors and operators to prevent their auto-generation by compiler.
Definition: Common.h:161
static const REGHANDLE invalid
Invalid handle value.
Definition: Common.h:613