TraceQueryInformation function (evntrace.h)

The TraceQueryInformation function provides information about an event tracing session.

Syntax

ULONG WMIAPI TraceQueryInformation(
  [in]            TRACEHANDLE      SessionHandle,
  [in]            TRACE_INFO_CLASS InformationClass,
  [out]           PVOID            TraceInformation,
  [in]            ULONG            InformationLength,
  [out, optional] PULONG           ReturnLength
);

Parameters

[in] SessionHandle

Handle of the event tracing session for which you are collecting information. The StartTrace function returns this handle when a new trace is started. To obtain the handle of an existing trace, use ControlTrace to query the trace properties based on the trace's name and then get the handle from the Wnode.HistoricalContext field of the returned EVENT_TRACE_PROPERTIES data.

[in] InformationClass

The information class to query. The information that the class captures is included in the extended data section of the event. For a list of information classes that you can query, see the TRACE_QUERY_INFO_CLASS enumeration.

[out] TraceInformation

A pointer to a buffer to receive the returned information class specific data. The information class determines the contents of this parameter. For example, for the TraceStackTracingInfo information class, this parameter is an array of CLASSIC_EVENT_ID structures. The structures specify the event GUIDs for which stack tracing is enabled. The array is limited to 256 elements.

[in] InformationLength

The size, in bytes, of the data returned in the TraceInformation buffer. If the function fails, this value indicates the required size of the TraceInformation buffer that is needed.

[out, optional] ReturnLength

A pointer a value that receives the size, in bytes, of the specific data returned in the TraceInformation buffer.

Return value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is one of the following error codes.

  • ERROR_BAD_LENGTH

    The program issued a command but the command length is incorrect. This error is returned if the InformationLength parameter is less than a minimum size.

  • ERROR_INVALID_PARAMETER

    The parameter is incorrect.

  • ERROR_NOT_SUPPORTED

    The request is not supported.

  • Other

    Use FormatMessage to obtain the message string for the returned error.

Remarks

The TraceQueryInformation function queries event tracing session settings from a trace session. Call this function after calling StartTrace.

Requirements

   
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header evntrace.h
Library Sechost.lib on Windows 8.1 and Windows Server 2012 R2; Advapi32.lib on Windows 8 and Windows Server 2012
DLL Sechost.dll on Windows 8.1 and Windows Server 2012 R2; Advapi32.dll on Windows 8 and Windows Server 2012

See also

TRACE_QUERY_INFO_CLASS

TraceSetInformation