QueryTraceW function

The QueryTrace function retrieves the property settings and session statistics for the specified event tracing session.

The ControlTrace function supersedes this function.

Syntax

ULONG WMIAPI QueryTraceW(
  TRACEHANDLE             TraceHandle,
  LPCWSTR                 InstanceName,
  PEVENT_TRACE_PROPERTIES Properties
);

Parameters

TraceHandle

TBD

InstanceName

TBD

Properties

TBD

Return Value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is one of the system error codes. The following table includes some common errors and their causes.

Return code Description
ERROR_BAD_LENGTH
One of the following is true:
  • The Wnode.BufferSize member of Properties specifies an incorrect size.
  • Properties does not have sufficient space allocated to hold a copy of the session name and log file name (if used).
ERROR_INVALID_PARAMETER
One of the following is true:
  • Properties is NULL.
  • SessionName and SessionHandle are both NULL.
ERROR_ACCESS_DENIED
Only users running with elevated administrative privileges, users in the Performance Log Users group, and services running as LocalSystem, LocalService, NetworkService can query event tracing sessions. To grant a restricted user the ability to query trace sessions, add them to the Performance Log Users group or see EventAccessControl.

Windows XP and Windows 2000:  Anyone can control a trace session.

ERROR_WMI_INSTANCE_NOT_FOUND
The given session is not running.

Remarks

Controllers call this function.

To update the property settings and session statistics for an event tracing session, call the UpdateTrace function.

Requirements

   
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

ControlTrace

QueryAllTraces