2e6553744b6684eb5f5420718cbe77dd614455eb
[reactos.git] / include / psdk / ksdebug.h
1 #include <evntrace.h>
2
3 #if !defined(_KSDEBUG_)
4 #define _KSDEBUG_
5
6 #if !defined(REMIND)
7 #define QUOTE(x) #x
8 #define QQUOTE(y) QUOTE(y)
9 #define REMIND(str) __FILE__ "(" QQUOTE(__LINE__) ") : " str
10 #endif
11
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15
16 #if (DBG)
17
18 #if defined(IRPMJFUNCDESC)
19 static const PCHAR IrpMjFuncDesc[] = {
20 "IRP_MJ_CREATE",
21 "IRP_MJ_CREATE_NAMED_PIPE",
22 "IRP_MJ_CLOSE",
23 "IRP_MJ_READ",
24 "IRP_MJ_WRITE",
25 "IRP_MJ_QUERY_INFORMATION",
26 "IRP_MJ_SET_INFORMATION",
27 "IRP_MJ_QUERY_EA",
28 "IRP_MJ_SET_EA",
29 "IRP_MJ_FLUSH_BUFFERS",
30 "IRP_MJ_QUERY_VOLUME_INFORMATION",
31 "IRP_MJ_SET_VOLUME_INFORMATION",
32 "IRP_MJ_DIRECTORY_CONTROL",
33 "IRP_MJ_FILE_SYSTEM_CONTROL",
34 "IRP_MJ_DEVICE_CONTROL",
35 "IRP_MJ_INTERNAL_DEVICE_CONTROL",
36 "IRP_MJ_SHUTDOWN",
37 "IRP_MJ_LOCK_CONTROL",
38 "IRP_MJ_CLEANUP",
39 "IRP_MJ_CREATE_MAILSLOT",
40 "IRP_MJ_QUERY_SECURITY",
41 "IRP_MJ_SET_SECURITY",
42 "IRP_MJ_SET_POWER",
43 "IRP_MJ_QUERY_POWER"
44 };
45 #endif /* defined(IRPMJFUNCDESC) */
46
47 #endif /* DBG */
48
49 #if defined(_NTDDK_)
50
51 #define DEBUGLVL_BLAB TRACE_LEVEL_VERBOSE
52 #define DEBUGLVL_VERBOSE TRACE_LEVEL_VERBOSE
53 #define DEBUGLVL_TERSE TRACE_LEVEL_INFORMATION
54 #define DEBUGLVL_ERROR TRACE_LEVEL_ERROR
55
56 #define DEBUGLVL_WARNING TRACE_LEVEL_WARNING
57 #define DEBUGLVL_INFO TRACE_LEVEL_INFORMATION
58
59 #if (DBG)
60 #if !defined( DEBUG_LEVEL )
61 #if defined( DEBUG_VARIABLE )
62 #if defined( KSDEBUG_INIT )
63 ULONG DEBUG_VARIABLE = DEBUGLVL_TERSE;
64 #else
65 extern ULONG DEBUG_VARIABLE;
66 #endif
67 #else
68 #define DEBUG_VARIABLE DEBUGLVL_TERSE
69 #endif
70 #else
71 #if defined( DEBUG_VARIABLE )
72 #if defined( KSDEBUG_INIT )
73 ULONG DEBUG_VARIABLE = DEBUG_LEVEL;
74 #else
75 extern ULONG DEBUG_VARIABLE;
76 #endif
77 #else
78 #define DEBUG_VARIABLE DEBUG_LEVEL
79 #endif
80 #endif
81
82 #if (NTDDI_VERSION >= NTDDI_WINXP)
83 #define _DbgPrintFEx(component, lvl, strings) { \
84 if ((lvl) <= DEBUG_VARIABLE) { \
85 DbgPrintEx(component, lvl, STR_MODULENAME); \
86 DbgPrintEx(component, lvl, strings); \
87 DbgPrintEx(component, lvl, "\n"); \
88 if ((lvl) == DEBUGLVL_ERROR) { \
89 DbgBreakPoint(); \
90 } \
91 } \
92 }
93 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
94
95 #define _DbgPrintF(lvl, strings) { \
96 if (((lvl)==DEBUG_VARIABLE) || (lvl < DEBUG_VARIABLE)) { \
97 DbgPrint(STR_MODULENAME); \
98 DbgPrint##strings; \
99 DbgPrint("\n"); \
100 if ((lvl) == DEBUGLVL_ERROR) { \
101 DbgBreakPoint(); \
102 } \
103 } \
104 }
105
106 #else
107
108 #define _DbgPrintF(lvl, strings)
109
110 #if (NTDDI_VERSION >= NTDDI_WINXP)
111 #define _DbgPrintFEx(component, lvl, strings)
112 #endif
113
114 #endif /* DBG */
115
116 #endif /* defined(_NTDDK_) */
117
118 #if defined(__cplusplus)
119 }
120 #endif
121
122 #endif /* _KSDEBUG_ */