StorPortEtwEvent2 function (storport.h)

StorPortEtwEvent2 logs an Event Tracing for Windows (ETW) event with two general-purpose ETW parameters to a storage trace channel.


ULONG StorPortEtwEvent2(
  [in]           PVOID                                                        HwDeviceExtension,
  [in, optional] PSTOR_ADDRESS                                                Address,
  [in]           ULONG                                                        EventId,
  [in]           PWSTR                                                        EventDescription,
  [in]           ULONGLONG                                                    EventKeywords,
  [in]           STORPORT_ETW_LEVEL                                           EventLevel,
  [in]           STORPORT_ETW_EVENT_OPCODE                                    EventOpcode,
  [in, optional] PSCSI_REQUEST_BLOCK                                          Srb,
  [in, optional] _In_reads_or_z_opt_(STORPORT_ETW_MAX_PARAM_NAME_LENGTH)PWSTR Parameter1Name,
  [in]           ULONGLONG                                                    Parameter1Value,
  [in, optional] _In_reads_or_z_opt_(STORPORT_ETW_MAX_PARAM_NAME_LENGTH)PWSTR Parameter2Name,
  [in]           ULONGLONG                                                    Parameter2Value


[in] HwDeviceExtension

A pointer to the miniport's device extension.

[in, optional] Address

The storage unit device address. This parameter is NULL for adapter devices.

[in] EventId

A miniport-defined identifier for the ETW event.

[in] EventDescription

The description text for the event. This text string must be <= STORPORT_ETW_MAX_DESCRIPTION_LENGTH.

[in] EventKeywords

Keyword flags for event categorization. Set to 0 if no keyword is desired. The keywords are a bitwise OR combination of the following.

Value Meaning
STORPORT_ETW_EVENT_KEYWORD_IO The event is related to device IO operations.
STORPORT_ETW_EVENT_KEYWORD_PERFORMANCE The event is performance related.
STORPORT_ETW_EVENT_KEYWORD_POWER The event is related to device power.
STORPORT_ETW_EVENT_KEYWORD_ENUMERATION The event is related to device enumeration.

[in] EventLevel

The event level. This value can indicate the importance or severity of the event. This is one of the following values.

Value Meaning
StorportEtwLevelLogAlways Log the event unconditionally. The event is logged regardless of any filters set.
StorportEtwLevelCritical Critical level event.
StorportEtwLevelError Error level event.
StorportEtwLevelWarning Warning level event.
StorportEtwLevelInformational Informational event.
StorportEtwLevelVerbose Verbose event information provided.

[in] EventOpcode

The operational nature of the event. This is one of the following values.

Value Meaning
StorportEtwEventOpcodeInfo General informational event.
StorportEtwEventOpcodeStart Device or unit was starting.
StorportEtwEventOpcodeStop Device or unit was stopping. The event corresponds to the last unpaired start event.
StorportEtwEventOpcodeDC_Start A data collection starting event. These are rundown event types.
StorportEtwEventOpcodeDC_Stop A data collection stopping event. These are rundown event types.
StorportEtwEventOpcodeExtension An extension event.
StorportEtwEventOpcodeReply A reply event.
StorportEtwEventOpcodeResume Device or unit was resuming after suspend.
StorportEtwEventOpcodeSuspend Device or unit is suspended pending completion of another operation.
StorportEtwEventOpcodeReceive Transfer of activity is received from another component.

[in, optional] Srb

A pointer to the SRB associated with the logged event. If this parameter contains a valid SRB, this SRB pointer and the associated SRB pointer are logged.

[in, optional] Parameter1Name

A description of the meaning of Parameter1Value. This parameter name string must be <= STORPORT_ETW_MAX_PARAM_NAME_LENGTH.

[in] Parameter1Value

The value for parameter 1.

[in, optional] Parameter2Name

A description of the meaning of Parameter2Value. This parameter name string must be <= STORPORT_ETW_MAX_PARAM_NAME_LENGTH.

[in] Parameter2Value

The value for parameter 2.

Return value

StorPortEtwEvent2 returns one of the following status codes:

Return code Description
STOR_STATUS_SUCCESS The event was successfully logged.
STOR_STATUS_NOT_IMPLEMENTED Tracing is not enabled for storage events.
STOR_STATUS_INVALID_PARAMETER One of the parameters is invalid. For example, HwDeviceExtension or EventDescription are NULL, EventDescription is greater than the maximum name length, or an ETW parameter name is greater than the maximum name length.


A miniport can call StorPortEtwEvent2 to log two general-purpose ETW parameters. The ETW parameters are expressed as two name-value pairs. If a parameter is not named (ParameterXName = NULL), the routine will set the corresponding parameter value to 0.

Events generated from StorPort miniport drivers are logged to the "Microsoft-Windows-Storage-Storport/Diagnose" ETW channel.


Minimum supported client Windows 8.1
Target Platform Universal
Header storport.h (include Storport.h)

See also