WPP_INIT_TRACING for Kernel-Mode Drivers

The WPP_INIT_TRACING macro registers the provider GUID and initializes the structures that are needed for software tracing in a kernel-mode driver.


    VOID
  WPP_INIT_TRACING(
    IN PDRIVER_OBJECT  DriverObject,
    IN OPT PUNICODE_STRING  RegistryPath
    );


   

Parameters

DriverObject

A pointer to the driver object that represents the driver. Starting with Windows XP, if the driver is not using Inflight Trace Recorder (IFR), this parameter is not used and can be set to NULL.

RegistryPath

A pointer to a Unicode string that specifies the path to the driver's registry key. Starting with Windows XP, if the driver is not using Inflight Trace Recorder (IFR), this parameter is not used and can be set to NULL.

Headers

Defined in a source file's trace message header file. The WPP preprocessor generates the header file and saves in the same directory as the source file.

Comments

A kernel-mode driver must use WPP_INIT_TRACING to activate software tracing. After the driver has activated software tracing, a user can enable and control tracing by using Tracelog.

The driver should only make one call to activate software tracing. Before the driver unloads, it should call WPP_CLEANUP to do the following:

  • Unregister the provider that was registered by calling WPP_INIT_TRACING.

  • Deactivate the software tracing.

For an example of how to make a WPP_INIT_TRACING call in a driver, see TraceDrv, a sample driver that was designed for software tracing. The sample is available in the Windows driver samples repository on GitHub.

See also

WPP_CLEANUP

 

 

Send comments about this topic to Microsoft

Show: