EventWrite function
Use this function to write an event.
Syntax
ULONG EventWrite( _In_ REGHANDLE RegHandle, _In_ PCEVENT_DESCRIPTOR EventDescriptor, _In_ ULONG UserDataCount, _In_opt_ PEVENT_DATA_DESCRIPTOR UserData );
Parameters
- RegHandle [in]
-
Registration handle of the provider. The handle comes from EventRegister.
- EventDescriptor [in]
-
Metadata that identifies the event to write. For details, see EVENT_DESCRIPTOR.
- UserDataCount [in]
-
Number of EVENT_DATA_DESCRIPTOR structures in UserData. The maximum number is 128.
- UserData [in, optional]
-
The event data to write. Allocate a block of memory that contains one or more EVENT_DATA_DESCRIPTOR structures. Set this parameter to NULL if UserDataCount is zero. The data must be in the order specified in the manifest.
Return value
Returns ERROR_SUCCESS if successful or one of the following values on error.
| Return code | Description |
|---|---|
|
One or more of the parameters is not valid. |
|
The registration handle of the provider is not valid. |
|
The event size is larger than the allowed maximum (64k - header). |
|
The session buffer size is too small for the event. |
|
Occurs when filled buffers are trying to flush to disk, but disk IOs are not happening fast enough. This happens when the disk is slow and event traffic is heavy. Eventually, there are no more free (empty) buffers and the event is dropped. |
|
The real-time playback file is full. Events are not logged to the session until a real-time consumer consumes the events from the playback file. Do not stop logging events based on this error code. |
Remarks
Event data written with this function requires a manifest to consume the data.
ETW decides based on the event descriptor if the event is written to a session (for details, see EnableTraceEx).
If you call the EventActivityIdControl function to specify an activity identifier for the event, EventWrite retrieves the identifier from thread local storage and includes it with the event.
Examples
For an example that uses EventWrite, see Writing Manifest-based Events.
Requirements
|
Minimum supported client |
Windows Vista [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2008 [desktop apps | Windows Store apps] |
|
Minimum supported phone |
Windows Phone 8 |
|
Header |
|
|
Library |
|
|
DLL |
|
See also