GetTraceEnableFlags function (evntrace.h)

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

Providers call this function from their ControlCallback function.


ULONG WMIAPI GetTraceEnableFlags(


[in] TraceHandle

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

Return value

Returns the value the controller specified in the EnableFlag 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 GetTraceEnableFlags function to retrieve the enable flags.
  3. If the enable flags 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 flags to 0; otherwise, the GetTraceEnableFlags function failed with the last known error.


Providers can use this value to control which events that it generates. For example, a provider can group events into logical categories of events and use this value to enable or disable their generation.


For an example that uses GetTraceEnableFlags, 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