共用方式為


WPP_CONTROL_GUIDS

The driver must define a WPP_CONTROL_GUIDS macro, which specifies a GUID and trace flag names for software tracing. The driver should use the following template, and set the driver-specified fields described following the template:

#define WPP_CONTROL_GUIDS \
    WPP_DEFINE_CONTROL_GUID(GUIDFriendlyName, (ControlGUID),  \
        WPP_DEFINE_BIT(NameOfTraceFlag1)  \
        WPP_DEFINE_BIT(NameOfTraceFlag2)  \
        .............................   \
        .............................   \
        WPP_DEFINE_BIT(NameOfTraceFlag31) )

Driver-Specified Fields

  • GUIDFriendlyName
    Specifies the friendly name of a driver-defined control GUID associated with the software tracing session. This is the friendly name specified in the control file used by Tracelog. The friendly name must comply with C variable name conventions.

  • ControlGUID
    Specifies the value of the control GUID in the following format, which consists of five comma-separated fields that contain a total of 32 hexadecimal digits: "XXXXXXXX, XXXX, XXXX, XXXX, XXXXXXXXXXXX". The first field is 8 hexadecimal digits, followed by three fields, each with 4 hexadecimal digits, and the last field is 12 hexadecimal digits.

  • NameOfTraceFlag1, NameOfTraceFlag2, ... , ... , NameOfTraceFlag31
    Specifies a sequence of driver-defined trace flag names containing at least one and at most 31 names. Trace flag names must comply with C variable name conventions.

Headers

This directive must be defined in a driver source file before the #include directive for the file's trace message header file. (The WPP preprocessor generates the trace message header file and saves it in the output directory for the build process. )

Comments

The WPP preprocessor requires the definition of the WPP_CONTROL_GUIDS macro to generate a source file's trace message header file. The macros in the trace message header file also require this definition to implement the software tracing.

Each trace flag name has a corresponding bit associated with it in the EnableFlags parameter of the -flagsEnableFlags option used with Tracelog. The flag names are assigned consecutively to the bits of the EnableFlags parameter, starting with bit 1 (the least significant bit), in the lexical order in which the flag names are defined. To enable a flag, set the corresponding bit in EnableFlags.

For an example of defining the WPP_CONTROL_GUIDS macro, see TraceDrv, a sample driver that was designed for software tracing. The sample is available in the Windows driver samples repository on GitHub.

 

 

Send comments about this topic to Microsoft