Skip to content

Commit 3ccc4eb

Browse files
committed
fix(wdk): preserve default debug component
1 parent b3883fc commit 3ccc4eb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

crates/wdk/src/print.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ macro_rules! println {
8989
///
9090
/// This is the no_std equivalent of the standard library's `eprintln!` macro.
9191
/// For WDM and KMDF drivers, output is routed through `DbgPrintEx` using the
92-
/// `DPFLTR_IHVDRIVER_ID` component and `DPFLTR_ERROR_LEVEL`. UMDF drivers use
92+
/// `DPFLTR_DEFAULT_ID` component and `DPFLTR_ERROR_LEVEL`. UMDF drivers use
9393
/// `OutputDebugStringA`, which does not expose debug message levels.
9494
#[macro_export]
9595
macro_rules! eprintln {
@@ -167,8 +167,8 @@ macro_rules! dbg {
167167

168168
#[derive(Clone, Copy)]
169169
enum DebugPrintLevel {
170-
Error = 0,
171-
Info = 3,
170+
Error,
171+
Info,
172172
}
173173

174174
/// Internal implementation of `print!` and `println!`.
@@ -204,13 +204,13 @@ fn _print_with_level(args: fmt::Arguments, level: DebugPrintLevel) {
204204
// - `cstr` is a valid NUL-terminated CStr from `FormatBuffer::as_c_str`.
205205
// - Using `%s` prevents `DbgPrintEx` from interpreting format specifiers
206206
// in the buffer contents, which could cause UB.
207-
// - `DPFLTR_IHVDRIVER_ID` is the documented component ID for third-party
208-
// drivers, and `level` is one of the documented DPFLTR levels.
207+
// - `DPFLTR_DEFAULT_ID` preserves the component used by `DbgPrint`, while
208+
// `level` selects the requested INFO or ERROR debug-message level.
209209
// - IRQL requirements (must be <= DIRQL) are the caller's responsibility,
210210
// as documented on the print macros.
211211
unsafe {
212212
wdk_sys::ntddk::DbgPrintEx(
213-
wdk_sys::DPFLTR_IHVDRIVER_ID,
213+
wdk_sys::DPFLTR_DEFAULT_ID,
214214
level,
215215
c"%s".as_ptr().cast(),
216216
cstr.as_ptr().cast::<wdk_sys::CHAR>(),

0 commit comments

Comments
 (0)