Table of contents
TOC
Collapse the table of content
Expand the table of content

How do I notify a driver when enabling, disabling, or changing certain flags?

Last Updated: 11/22/2016

Some drivers need to do some additional work when trace flags are enabled, disabled, or changed. To notify a driver when such changes occur, use the following command:

#define WPP_PRIVATE_ENABLE_CALLBACK

This symbolic constant must be defined before including the TMH file. The function signature that you will need to write is as follows:

typedef
VOID
(*PFN_WPP_PRIVATE_ENABLE_CALLBACK)(
__in LPCGUID Guid,
__in __int64 Logger,
__in BOOLEAN Enable,
__in ULONG Flags,
__in UCHAR Level);

The following is an example of how to notify a driver when certain flags are enabled:

#define WPP_PRIVATE_ENABLE_CALLBACK MyOwnCallback
#include "tracedrv.tmh" // this is the file that will be auto-generated 
VOID MyOwnCallback (
                 __in LPCGUID Guid,
                 __in __int64 Logger,
                 __in BOOLEAN Enable,
                 __in ULONG Flags,
                 __in UCHAR Level) 
{
//                
//                  This callback function will be called with the current values of : GUID, Logger, Enable, Flags, and Level
//                 

                  if (Enable) {
                        .
                        .
                   }
}

Send comments about this topic to Microsoft

© 2017 Microsoft