WinStd
Additional templates and function helpers for Microsoft Windows using Standard C++ classes
Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
winstd::event_provider Class Reference

ETW event provider. More...

#include <ETW.h>

Inheritance diagram for winstd::event_provider:
winstd::handle< REGHANDLE, NULL >

Public Member Functions

virtual ~event_provider ()
 Closes the event provider. More...
 
ULONG create (_In_ LPCGUID ProviderId)
 Registers the event provider. More...
 
ULONG write (_In_ PCEVENT_DESCRIPTOR EventDescriptor)
 Writes an event with no parameters. More...
 
ULONG write (_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG UserDataCount=0, _In_opt_count_(UserDataCount) PEVENT_DATA_DESCRIPTOR UserData=NULL)
 Writes an event with parameters stored in array. More...
 
ULONG write (_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ const EVENT_DATA_DESCRIPTOR param1,...)
 Writes an event with one or more parameter. More...
 
ULONG write (_In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ va_list arg)
 Writes an event with variable number of parameters. More...
 
ULONG write (_In_ UCHAR Level, _In_ ULONGLONG Keyword, _In_z_ _Printf_format_string_ PCWSTR String,...)
 Writes a string event. More...
 
- Public Member Functions inherited from winstd::handle< REGHANDLE, NULL >
 handle () noexcept
 Initializes a new class instance with the object handle set to INVAL.
 
 handle (_In_opt_ handle_type h) noexcept
 Initializes a new class instance with an already available object handle. More...
 
 handle (_Inout_ handle< handle_type, INVAL > &&h) noexcept
 Move constructor. More...
 
handle< handle_type, INVAL > & operator= (_In_opt_ handle_type h) noexcept
 Attaches already available object handle. More...
 
handle< handle_type, INVAL > & operator= (_Inout_ handle< handle_type, INVAL > &&h) noexcept
 Move assignment. More...
 
 operator handle_type () const
 Auto-typecasting operator. More...
 
handle_type *& operator* () const
 Returns the object handle value when the object handle is a pointer to a value (class, struct, etc.). More...
 
handle_typeoperator& ()
 Returns the object handle reference. More...
 
handle_type operator-> () const
 Provides object handle member access when the object handle is a pointer to a class or struct. More...
 
bool operator! () const
 Tests if the object handle is INVAL. More...
 
bool operator< (_In_opt_ handle_type h) const
 Is handle less than? More...
 
bool operator<= (_In_opt_ handle_type h) const
 Is handle less than or equal to? More...
 
bool operator>= (_In_opt_ handle_type h) const
 Is handle greater than or equal to? More...
 
bool operator> (_In_opt_ handle_type h) const
 Is handle greater than? More...
 
bool operator!= (_In_opt_ handle_type h) const
 Is handle not equal to? More...
 
bool operator== (_In_opt_ handle_type h) const
 Is handle equal to? More...
 
void attach (_In_opt_ handle_type h) noexcept
 Sets a new object handle for the class. More...
 
handle_type detach ()
 Dismisses the object handle from this class. More...
 
void free ()
 Destroys the object.
 

Protected Member Functions

void free_internal () noexcept override
 Releases the event provider. More...
 
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)
 Receive enable or disable notification requests. More...
 
virtual void free_internal () noexcept=0
 Abstract member function that must be implemented by child classes to do the actual object destruction. More...
 

Static Protected Member Functions

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)
 Receive enable or disable notification requests. More...
 

Additional Inherited Members

- Public Types inherited from winstd::handle< REGHANDLE, NULL >
typedef REGHANDLE handle_type
 Datatype of the object handle this template class handles.
 
- Static Public Attributes inherited from winstd::handle< REGHANDLE, NULL >
static const REGHANDLE invalid
 Invalid handle value.
 
- Protected Attributes inherited from winstd::handle< REGHANDLE, NULL >
handle_type m_h
 Object handle.
 

Detailed Description

ETW event provider.

Constructor & Destructor Documentation

◆ ~event_provider()

virtual winstd::event_provider::~event_provider ( )
inlinevirtual

Closes the event provider.

See also
EventUnregister function

Member Function Documentation

◆ create()

ULONG winstd::event_provider::create ( _In_ LPCGUID  ProviderId)
inline

Registers the event provider.

Returns
  • ERROR_SUCCESS when creation succeeds;
  • error code otherwise.
See also
EventRegister function

◆ enable_callback() [1/2]

virtual void winstd::event_provider::enable_callback ( _In_ LPCGUID  SourceId,
_In_ ULONG  IsEnabled,
_In_ UCHAR  Level,
_In_ ULONGLONG  MatchAnyKeyword,
_In_ ULONGLONG  MatchAllKeyword,
_In_opt_ PEVENT_FILTER_DESCRIPTOR  FilterData 
)
inlineprotectedvirtual

Receive enable or disable notification requests.

See also
EnableCallback callback function

◆ enable_callback() [2/2]

static VOID NTAPI winstd::event_provider::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 
)
inlinestaticprotected

Receive enable or disable notification requests.

See also
EnableCallback callback function

◆ free_internal()

void winstd::event_provider::free_internal ( )
inlineoverrideprotectedvirtualnoexcept

Releases the event provider.

See also
EventUnregister function

Implements winstd::handle< REGHANDLE, NULL >.

◆ write() [1/5]

ULONG winstd::event_provider::write ( _In_ PCEVENT_DESCRIPTOR  EventDescriptor)
inline

Writes an event with no parameters.

Returns
  • ERROR_SUCCESS when write succeeds;
  • error code otherwise.
See also
EventWrite function

◆ write() [2/5]

ULONG winstd::event_provider::write ( _In_ PCEVENT_DESCRIPTOR  EventDescriptor,
_In_ const EVENT_DATA_DESCRIPTOR  param1,
  ... 
)
inline

Writes an event with one or more parameter.

Note
The list must be terminated with winstd::blank_event_data.
Returns
  • ERROR_SUCCESS when write succeeds;
  • error code otherwise.
See also
EventWrite function

◆ write() [3/5]

ULONG winstd::event_provider::write ( _In_ PCEVENT_DESCRIPTOR  EventDescriptor,
_In_ ULONG  UserDataCount = 0,
_In_opt_count_(UserDataCount) PEVENT_DATA_DESCRIPTOR  UserData = NULL 
)
inline

Writes an event with parameters stored in array.

Returns
  • ERROR_SUCCESS when write succeeds;
  • error code otherwise.
See also
EventWrite function

◆ write() [4/5]

ULONG winstd::event_provider::write ( _In_ PCEVENT_DESCRIPTOR  EventDescriptor,
_In_ va_list  arg 
)
inline

Writes an event with variable number of parameters.

Note
The list must be terminated with winstd::blank_event_data.
Returns
  • ERROR_SUCCESS when write succeeds;
  • error code otherwise.
See also
EventWrite function

◆ write() [5/5]

ULONG winstd::event_provider::write ( _In_ UCHAR  Level,
_In_ ULONGLONG  Keyword,
_In_z_ _Printf_format_string_ PCWSTR  String,
  ... 
)
inline

Writes a string event.

Returns
  • ERROR_SUCCESS when write succeeds;
  • error code otherwise.
See also
EventWriteString function

The documentation for this class was generated from the following file: