GetTraceEnableLevel function (evntrace.h)

A RegisterTraceGuids-based ("Classic") event provider uses the GetTraceEnableLevel function to retrieve the enable level specified by the trace controller to indicate which level of events to trace.

Providers call this function from their ControlCallback function.


UCHAR WMIAPI GetTraceEnableLevel(


[in] TraceHandle

Handle to an event tracing session, obtained by calling the GetTraceLoggerHandle function.

Return value

Returns the value the controller specified in the EnableLevel parameter when calling the EnableTrace function.

To determine if the function failed or the controller set the enable flags to 0, follow these steps:

  1. Call the SetLastError function to set the last error to ERROR_SUCCESS.
  2. Call the GetTraceEnableLevel function to retrieve the enable level.
  3. If the enable level value is 0, call the GetLastError function to retrieve the last known error.
  4. If the last known error is ERROR_SUCCESS, the controller set the enable level to 0; otherwise, the GetTraceEnableLevel function failed with the last known error.


Providers use this value to control the severity of events that it generates. For example, providers can use this value to determine if it should generate informational, warning, or error events.


For an example that uses GetTraceEnableLevel, see Retrieving Event Data Using MOF.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps | UWP apps]
Minimum supported server Windows 2000 Server [desktop apps | UWP apps]
Target Platform Windows
Header evntrace.h
Library Advapi32.lib
DLL Advapi32.dll

See also