xref: /reactos/sdk/include/xdk/kdfuncs.h (revision 8a978a17)
1 /******************************************************************************
2  *                          Kernel Debugger Functions                         *
3  ******************************************************************************/
4 $if (_NTDDK_)
5 NTSYSAPI
6 ULONG
7 NTAPI
8 DbgPrompt(
9   _In_z_ PCCH Prompt,
10   _Out_writes_bytes_(MaximumResponseLength) PCH Response,
11   _In_ ULONG MaximumResponseLength);
12 $endif (_NTDDK_)
13 
14 $if (_WDMDDK_)
15 #ifndef _DBGNT_
16 
17 ULONG
18 __cdecl
19 DbgPrint(
20   _In_z_ _Printf_format_string_ PCSTR Format,
21   ...);
22 
23 #if (NTDDI_VERSION >= NTDDI_WIN2K)
24 NTSYSAPI
25 ULONG
26 __cdecl
27 DbgPrintReturnControlC(
28   _In_z_ _Printf_format_string_ PCCH Format,
29   ...);
30 #endif
31 
32 #if (NTDDI_VERSION >= NTDDI_WINXP)
33 
34 NTSYSAPI
35 ULONG
36 __cdecl
37 DbgPrintEx(
38   _In_ ULONG ComponentId,
39   _In_ ULONG Level,
40   _In_z_ _Printf_format_string_ PCSTR Format,
41   ...);
42 
43 #ifdef _VA_LIST_DEFINED
44 
45 NTSYSAPI
46 ULONG
47 NTAPI
48 vDbgPrintEx(
49   _In_ ULONG ComponentId,
50   _In_ ULONG Level,
51   _In_z_ PCCH Format,
52   _In_ va_list ap);
53 
54 NTSYSAPI
55 ULONG
56 NTAPI
57 vDbgPrintExWithPrefix(
58   _In_z_ PCCH Prefix,
59   _In_ ULONG ComponentId,
60   _In_ ULONG Level,
61   _In_z_ PCCH Format,
62   _In_ va_list ap);
63 
64 #endif /* _VA_LIST_DEFINED */
65 
66 NTSYSAPI
67 NTSTATUS
68 NTAPI
69 DbgQueryDebugFilterState(
70   _In_ ULONG ComponentId,
71   _In_ ULONG Level);
72 
73 NTSYSAPI
74 NTSTATUS
75 NTAPI
76 DbgSetDebugFilterState(
77   _In_ ULONG ComponentId,
78   _In_ ULONG Level,
79   _In_ BOOLEAN State);
80 
81 #endif /* (NTDDI_VERSION >= NTDDI_WINXP) */
82 
83 #if (NTDDI_VERSION >= NTDDI_VISTA)
84 
85 typedef VOID
86 (*PDEBUG_PRINT_CALLBACK)(
87   _In_ PSTRING Output,
88   _In_ ULONG ComponentId,
89   _In_ ULONG Level);
90 
91 NTSYSAPI
92 NTSTATUS
93 NTAPI
94 DbgSetDebugPrintCallback(
95   _In_ PDEBUG_PRINT_CALLBACK DebugPrintCallback,
96   _In_ BOOLEAN Enable);
97 
98 #endif /* (NTDDI_VERSION >= NTDDI_VISTA) */
99 
100 #endif /* _DBGNT_ */
101 
102 #if DBG
103 
104 #define KdPrint(_x_) DbgPrint _x_
105 #define KdPrintEx(_x_) DbgPrintEx _x_
106 #define vKdPrintEx(_x_) vDbgPrintEx _x_
107 #define vKdPrintExWithPrefix(_x_) vDbgPrintExWithPrefix _x_
108 #define KdBreakPoint() DbgBreakPoint()
109 #define KdBreakPointWithStatus(s) DbgBreakPointWithStatus(s)
110 
111 #else /* !DBG */
112 
113 #define KdPrint(_x_)
114 #define KdPrintEx(_x_)
115 #define vKdPrintEx(_x_)
116 #define vKdPrintExWithPrefix(_x_)
117 #define KdBreakPoint()
118 #define KdBreakPointWithStatus(s)
119 
120 #endif /* !DBG */
121 
122 #ifdef _NTSYSTEM_
123 extern BOOLEAN KdDebuggerEnabled;
124 #define KD_DEBUGGER_ENABLED KdDebuggerEnabled
125 extern BOOLEAN KdDebuggerNotPresent;
126 #define KD_DEBUGGER_NOT_PRESENT KdDebuggerNotPresent
127 #else
128 __CREATE_NTOS_DATA_IMPORT_ALIAS(KdDebuggerEnabled)
129 extern BOOLEAN *KdDebuggerEnabled;
130 #define KD_DEBUGGER_ENABLED (*KdDebuggerEnabled)
131 __CREATE_NTOS_DATA_IMPORT_ALIAS(KdDebuggerNotPresent)
132 extern BOOLEAN *KdDebuggerNotPresent;
133 #define KD_DEBUGGER_NOT_PRESENT (*KdDebuggerNotPresent)
134 #endif
135 
136 #if (NTDDI_VERSION >= NTDDI_WIN2K)
137 
138 NTKERNELAPI
139 NTSTATUS
140 NTAPI
141 KdDisableDebugger(VOID);
142 
143 NTKERNELAPI
144 NTSTATUS
145 NTAPI
146 KdEnableDebugger(VOID);
147 
148 #if (_MSC_FULL_VER >= 150030729) && !defined(IMPORT_NATIVE_DBG_BREAK)
149 #define DbgBreakPoint __debugbreak
150 #else
151 __analysis_noreturn
152 VOID
153 NTAPI
154 DbgBreakPoint(VOID);
155 #endif
156 
157 __analysis_noreturn
158 NTSYSAPI
159 VOID
160 NTAPI
161 DbgBreakPointWithStatus(
162     _In_ ULONG Status);
163 
164 #endif /* (NTDDI_VERSION >= NTDDI_WIN2K) */
165 
166 #if (NTDDI_VERSION >= NTDDI_WS03)
167 NTKERNELAPI
168 BOOLEAN
169 NTAPI
170 KdRefreshDebuggerNotPresent(VOID);
171 #endif
172 
173 #if (NTDDI_VERSION >= NTDDI_WS03SP1)
174 NTKERNELAPI
175 NTSTATUS
176 NTAPI
177 KdChangeOption(
178   _In_ KD_OPTION Option,
179   _In_opt_ ULONG InBufferBytes,
180   _In_ PVOID InBuffer,
181   _In_opt_ ULONG OutBufferBytes,
182   _Out_ PVOID OutBuffer,
183   _Out_opt_ PULONG OutBufferNeeded);
184 #endif
185 $endif (_WDMDDK_)
186