1 /*++
2 
3 Copyright (c) Microsoft Corporation
4 
5 Module Name:
6 
7     FxTrace.h
8 
9 Abstract:
10 
11     This module contains the private tracing definitions
12 
13 Author:
14 
15 
16 
17 
18 Environment:
19 
20     Both kernel and user mode
21 
22 Revision History:
23 
24 
25 --*/
26 
27 #ifndef _FXTRACE_H_
28 #define _FXTRACE_H_
29 
30 typedef struct _WDF_DRIVER_CONFIG *PWDF_DRIVER_CONFIG;
31 
32 /**
33  * Tracing Definitions:
34  */
35 
36 #if FX_CORE_MODE == FX_CORE_KERNEL_MODE
37 #define WDF_FX_TRACE_WPPGUID        (544d4c9d,942c,46d5,bf50,df5cd9524a50)
38 #elif FX_CORE_MODE == FX_CORE_USER_MODE
39 #define WDF_FX_TRACE_WPPGUID        (485e7de9,0a80,11d8,ad15,505054503030)
40 #endif
41 
42 #define WDF_FRAMEWORKS_TRACE_FLAGS                  \
43     WPP_DEFINE_WDF_CONTROL_GUID(                    \
44         KmdfTraceGuid,                              \
45         WDF_FX_TRACE_WPPGUID,                       \
46         WPP_DEFINE_BIT(TRACINGFULL)                 \
47         WPP_DEFINE_BIT(TRACINGERROR)                \
48         WPP_DEFINE_BIT(TRACINGDBGPRINT)             \
49         WPP_DEFINE_BIT(TRACINGFRAMEWORKS)           \
50         WPP_DEFINE_BIT(TRACINGAPI)                  \
51         WPP_DEFINE_BIT(TRACINGAPIERROR)             \
52         WPP_DEFINE_BIT(TRACINGRESOURCES)            \
53         WPP_DEFINE_BIT(TRACINGLOCKING)              \
54         WPP_DEFINE_BIT(TRACINGCONTEXT)              \
55         WPP_DEFINE_BIT(TRACINGPOOL)                 \
56         WPP_DEFINE_BIT(TRACINGHANDLE)               \
57         WPP_DEFINE_BIT(TRACINGPNP)                  \
58         WPP_DEFINE_BIT(TRACINGIO)                   \
59         WPP_DEFINE_BIT(TRACINGIOTARGET)             \
60         WPP_DEFINE_BIT(TRACINGDMA)                  \
61         WPP_DEFINE_BIT(TRACINGREQUEST)              \
62         WPP_DEFINE_BIT(TRACINGDRIVER)               \
63         WPP_DEFINE_BIT(TRACINGDEVICE)               \
64         WPP_DEFINE_BIT(TRACINGUSEROBJECT)           \
65         WPP_DEFINE_BIT(TRACINGOBJECT)               \
66         WPP_DEFINE_BIT(TRACINGPNPPOWERSTATES)       \
67         )
68 
69 #define WPP_CONTROL_GUIDS \
70     WDF_FRAMEWORKS_TRACE_FLAGS
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 //#define WPP_DEBUG(args) DbgPrint args , DbgPrint("\n")
81 
82 #define WPP_GLOBALS_LEVEL_FLAGS_LOGGER(globals,lvl,flags) WPP_LEVEL_LOGGER(flags)
83 #define WPP_GLOBALS_LEVEL_FLAGS_ENABLED(globals,lvl,flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
84 
85 #define IFR_GLOBALS_LEVEL_FLAGS_FILTER(globals,lvl,flags) (lvl < TRACE_LEVEL_VERBOSE || globals->FxVerboseOn)
86 
87 //
88 // These are pure enums (one and only one value)
89 //
90 // begin_wpp config
91 // CUSTOM_TYPE(WdfDmaEnablerCallback, ItemListLong(FxEvtDmaEnablerInvalid,FxEvtDmaEnablerFill,FxEvtDmaEnablerFlush,FxEvtDmaEnablerEnable,FxEvtDmaEnablerDisable,FxEvtDmaEnablerSelfManagedIoStart,FxEvtDmaEnablerSelfManagedIoStop),"s");
92 // CUSTOM_TYPE(IRPMJ, ItemListByte(IRP_MJ_CREATE,IRP_MJ_CREATE_NAMED_PIPE,IRP_MJ_CLOSE,IRP_MJ_READ,IRP_MJ_WRITE,IRP_MJ_QUERY_INFORMATION,IRP_MJ_SET_INFORMATION,IRP_MJ_QUERY_EA,IRP_MJ_SET_EA,IRP_MJ_FLUSH_BUFFERS,IRP_MJ_QUERY_VOLUME_INFORMATION,IRP_MJ_SET_VOLUME_INFORMATION,IRP_MJ_DIRECTORY_CONTROL,IRP_MJ_FILE_SYSTEM_CONTROL,IRP_MJ_DEVICE_CONTROL,IRP_MJ_INTERNAL_DEVICE_CONTROL,IRP_MJ_SHUTDOWN,IRP_MJ_LOCK_CONTROL,IRP_MJ_CLEANUP,IRP_MJ_CREATE_MAILSLOT,IRP_MJ_QUERY_SECURITY,IRP_MJ_SET_SECURITY,IRP_MJ_POWER,IRP_MJ_SYSTEM_CONTROL,IRP_MJ_DEVICE_CHANGE,IRP_MJ_QUERY_QUOTA,IRP_MJ_SET_QUOTA,IRP_MJ_PNP));
93 // end_wpp
94 
95 
96 _Must_inspect_result_
97 NTSTATUS
98 FxTraceInitialize(
99     VOID
100     );
101 
102 VOID
103 TraceUninitialize(
104     VOID
105     );
106 
107 VOID
108 FxIFRStart(
109     __in PFX_DRIVER_GLOBALS FxDriverGlobals,
110     __in PCUNICODE_STRING RegistryPath,
111     __in MdDriverObject DriverObject
112     );
113 
114 VOID
115 FxIFRStop(
116     __in PFX_DRIVER_GLOBALS FxDriverGlobals
117     );
118 
119 #endif // _FXTRACE_H
120