To add the default form of WPP software tracing to a trace provider, such as a kernel-mode driver or a user-mode application, add the following C preprocessor directives and WPP macro calls to the provider's source code:
An #include directive of the following form to each source file that contains any WPP macros. This statement includes the trace message header file created by the WPP preprocessor for each source file:
The trace message header file must be included in a source file before any WPP macro calls and after defining a WPP_CONTROL_GUIDS macro.
A WPP_CONTROL_GUIDS definition directive to each source file that includes other WPP macros.
This definition specifies the driver's control GUID and the driver-defined trace flag names. The definition must be added to a source file before the #include statement that includes the file's trace message header file.
One WPP_INIT_TRACING macro call to the driver's source code.
For drivers, this macro activates software tracing in the driver. This macro is typically called during driver initialization, for example in a DriverEntry routine.
For user-mode applications, call this macro at a point in your source code where no tracing attempts have been previously made.
For drivers, this macro call is typically added to the driver's Unload routine.
For user-mode applications, call this macro at a point in your source code after the last tracing attempts has been made.
DoTraceMessage macro calls to log trace messages.