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