ReactOS 0.4.16-dev-401-g45b008d
storswtr.h
Go to the documentation of this file.
1#ifndef _STORSWTR_H_
2#define _STORSWTR_H_
3
4#include <stdarg.h>
5
6#ifdef TRACE_LEVEL_FATAL
7#undef TRACE_LEVEL_FATAL
8#endif
9
10#ifdef TRACE_LEVEL_ERROR
11#undef TRACE_LEVEL_ERROR
12#endif
13
14#ifdef TRACE_LEVEL_WARNING
15#undef TRACE_LEVEL_WARNING
16#endif
17
18#ifdef TRACE_LEVEL_INFORMATION
19#undef TRACE_LEVEL_INFORMATION
20#endif
21
22#ifdef TRACE_LEVEL_VERBOSE
23#undef TRACE_LEVEL_VERBOSE
24#endif
25
26#define TRACE_LEVEL_FATAL 1
27#define TRACE_LEVEL_ERROR 2
28#define TRACE_LEVEL_WARNING 3
29#define TRACE_LEVEL_INFORMATION 4
30#define TRACE_LEVEL_VERBOSE 5
31
32// if defined, uses KdPrint instead of WMI tracing
33#ifndef DEBUG_USE_KDPRINT
34
35#define WPP_NORMAL_FLAGS WPP_DEFINE_BIT(TRACE_FLAG_GENERAL) \
36 WPP_DEFINE_BIT(TRACE_FLAG_PNP) \
37 WPP_DEFINE_BIT(TRACE_FLAG_POWER) \
38 WPP_DEFINE_BIT(TRACE_FLAG_RW) \
39 WPP_DEFINE_BIT(TRACE_FLAG_IOCTL) \
40 WPP_DEFINE_BIT(TRACE_FLAG_QUEUE) \
41 WPP_DEFINE_BIT(TRACE_FLAG_WMI) \
42 WPP_DEFINE_BIT(TRACE_FLAG_TIMER) \
43 WPP_DEFINE_BIT(TRACE_FLAG_INIT) \
44 WPP_DEFINE_BIT(TRACE_FLAG_LOCK) \
45 WPP_DEFINE_BIT(TRACE_FLAG_DEBUG1) \
46 WPP_DEFINE_BIT(TRACE_FLAG_DEBUG2) \
47 WPP_DEFINE_BIT(TRACE_FLAG_MCN) \
48 WPP_DEFINE_BIT(TRACE_FLAG_ISR) \
49 WPP_DEFINE_BIT(TRACE_FLAG_ENUM) \
50 WPP_DEFINE_BIT(TRACE_FLAG_LOGOTEST) \
51 WPP_DEFINE_BIT(TRACE_FLAG_DUMP) \
52 WPP_DEFINE_BIT(TRACE_FLAG_SCSI)
53
54#define WPP_CONTROL_GUIDS_NORMAL_FLAGS(_GUID) \
55 WPP_DEFINE_CONTROL_GUID(wppCtlGuid, _GUID, WPP_NORMAL_FLAGS)
56
57#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
58 (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
59#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)
60
61#define DEBUG_USE_WPP
62
63#else // DEBUG_USE_KDPRINT
64
65#ifdef DEBUG_USE_WPP
66#undef DEBUG_USE_WPP
67#endif
68
69#ifdef WPP_INIT_TRACING
70#undef WPP_INIT_TRACING
71#endif
72
73#ifdef WPP_CLEANUP
74#undef WPP_CLEANUP
75#endif
76
77#define WPP_INIT_TRACING(_DRIVER, _REGISTRY)
78#define WPP_CLEANUP(_DRIVER)
79
80typedef enum _DEBUG_FLAGS {
81 TRACE_FLAG_GENERAL = 0,
82 TRACE_FLAG_PNP,
83 TRACE_FLAG_POWER,
84 TRACE_FLAG_RW,
85 TRACE_FLAG_IOCTL,
86 TRACE_FLAG_QUEUE,
87 TRACE_FLAG_WMI,
88 TRACE_FLAG_TIMER,
89 TRACE_FLAG_INIT,
90 TRACE_FLAG_LOCK,
91 TRACE_FLAG_DEBUG1,
92 TRACE_FLAG_DEBUG2,
93 TRACE_FLAG_MCN,
94 TRACE_FLAG_ISR,
95 TRACE_FLAG_ENUM,
96 TRACE_FLAG_LOGOTEST,
97 TRACE_FLAG_DUMP,
98 TRACE_FLAG_SCSI
99} DEBUG_FLAGS, *PDEBUG_FLAGS;
100
101#if DBG && (NTDDI_VERSION >= NTDDI_WINXP)
102
103#define TracePrint(x) StorDebugPrint x
104
105#if DEBUG_MAIN_SOURCE
106
107void StorDebugPrint(int DebugPrintLevel, DEBUG_FLAGS DebugPrintFlags, PCCHAR DebugMessage, ...)
108{
109 va_list ap;
110 UNREFERENCED_PARAMETER(DebugPrintFlags);
111 va_start(ap, DebugMessage);
112 vDbgPrintEx(DEBUG_COMP_ID, DebugPrintLevel, DebugMessage, ap);
113 va_end(ap);
114}
115
116#else
117
118void StorDebugPrint(int DebugPrintLevel, DEBUG_FLAGS DebugPrintFlags, PCCHAR DebugMessage, ...);
119
120#endif // DEBUG_MAIN_SOURCE
121
122#else // DBG && (NTDDI_VERSION >= NTDDI_WINXP)
123
124#define TracePrint(x)
125
126#endif // DBG && (NTDDI_VERSION >= NTDDI_WINXP)
127
128#endif // DEBUG_USE_KDPRINT
129
130#endif // _STORSWTR_H_
char * va_list
Definition: acmsvcex.h:78
#define va_end(ap)
Definition: acmsvcex.h:90
#define va_start(ap, A)
Definition: acmsvcex.h:91
NTSYSAPI ULONG NTAPI vDbgPrintEx(_In_ ULONG ComponentId, _In_ ULONG Level, _In_z_ PCCH Format, _In_ va_list ap)
#define DEBUG_COMP_ID
Definition: cdrom.h:48
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36