Skip to content
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0402d08
Use stack-based formatter.
Zero-Tang Oct 8, 2024
b903a2a
Fix formatting isssue.
Zero-Tang Oct 8, 2024
ab03b9a
Merge branch 'main' into main
Zero-Tang Oct 10, 2024
d3d5bcc
Merge branch 'main' into main
Zero-Tang Oct 24, 2024
6d69406
Merge branch 'main' into main
wmmc88 Nov 11, 2024
279a134
Merge remote-tracking branch 'upstream/main' into Zero-Tang/main
wmmc88 Mar 20, 2025
4101e6f
allow `wdk` to use `std` w/ UMDF
wmmc88 Mar 24, 2025
10d13de
feat: buffer writes in KM to allow strings >=512 bytes
wmmc88 Mar 28, 2025
5f573bd
handle internal null bytes in umdf
wmmc88 Mar 29, 2025
7092179
improve comments
wmmc88 Mar 31, 2025
1831ccd
fix off by one error
wmmc88 Mar 31, 2025
7a213a5
add tests
wmmc88 Mar 31, 2025
80c757b
Merge branch 'main' into main
wmmc88 Mar 31, 2025
940e1aa
Merge remote-tracking branch 'wmmc88/stack-formatter'
wmmc88 Mar 31, 2025
2c13afb
Updated print function & relevant tests
Apr 5, 2025
be2e26b
Update crates/wdk/src/print.rs
leon-xd Apr 5, 2025
58499e4
updated lockfiles
Apr 5, 2025
3211c6a
merged microsoft/main
Apr 5, 2025
6241350
Deleted fixme comment
Apr 5, 2025
f9a5ee6
Reverted to be2e26b
Apr 7, 2025
acc4974
Revert "Reverted to be2e26b"
Apr 7, 2025
91709e3
Brought back lockfiles from be2e26b
Apr 7, 2025
7fde00e
built lockfiles with current configuration
Apr 7, 2025
bc9247c
addressed Melvin's comments
Apr 7, 2025
df36f39
Addressed comments
Apr 7, 2025
28af21c
added const to driver_entry_stub for 1.86 nightly clippy
Apr 7, 2025
f934c11
cargo fmt fix
Apr 7, 2025
2f3026c
changed from_utf8 usage from str to String
Apr 8, 2025
aea25ec
Removed link to WdfFunctions in doc
Apr 8, 2025
be082ce
Removed ToString import in sample-kmdf-driver
Apr 8, 2025
eea7fda
added proper import syntax
Apr 8, 2025
075fb65
Addressed Gurinder's comments
Apr 14, 2025
dec9d8f
updated used for DbgPrintBufWriter
Apr 16, 2025
11958b3
added assertions to catch previous bug
Apr 17, 2025
84aeb34
fmt fix
Apr 17, 2025
01984b8
added correct testing method for discovered bug
Apr 18, 2025
5db7623
adjust comment & formatting
Apr 18, 2025
84052d0
fix fmt?
Apr 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/wdk-build/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ fn read_registry_key_string_value(
return Some(
CStr::from_bytes_with_nul(&buffer[..len as usize])
.expect(
"RegGetValueA should always return a null terminated string. The read \
"RegGetValueA should always return a null-terminated string. The read \
string (REG_SZ) from the registry should not contain any interior \
nulls.",
)
Expand Down
2 changes: 1 addition & 1 deletion crates/wdk-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static TEST_STUBS_TEMPLATE: LazyLock<String> = LazyLock::new(|| {
r"
use crate::WDFFUNC;

/// Stubbed version of the symbol that [`WdfFunctions`] links to so that test targets will compile
/// Stubbed version of the symbol that `WdfFunctions` links to so that test targets will compile
#[no_mangle]
pub static mut {WDFFUNCTIONS_SYMBOL_NAME_PLACEHOLDER}: *const WDFFUNC = core::ptr::null();
",
Expand Down
2 changes: 1 addition & 1 deletion crates/wdk-sys/src/test_stubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::{DRIVER_OBJECT, NTSTATUS, PCUNICODE_STRING};
driver_model__driver_type = "UMDF"
))]
#[export_name = "DriverEntry"] // WDF expects a symbol with the name DriverEntry
pub unsafe extern "system" fn driver_entry_stub(
pub const unsafe extern "system" fn driver_entry_stub(
_driver: &mut DRIVER_OBJECT,
_registry_path: PCUNICODE_STRING,
) -> NTSTATUS {
Expand Down
1 change: 1 addition & 0 deletions crates/wdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] }
wdk-build.workspace = true

[dependencies]
cfg-if.workspace = true
wdk-sys.workspace = true

[dev-dependencies]
Expand Down
5 changes: 4 additions & 1 deletion crates/wdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
//! built on top of the raw FFI bindings provided by [`wdk-sys`], and provides a
//! safe, idiomatic rust interface to the WDK.

#![no_std]
#![cfg_attr(
any(driver_model__driver_type = "WDM", driver_model__driver_type = "KMDF"),
no_std
)]

#[cfg(any(
all(
Expand Down
458 changes: 443 additions & 15 deletions crates/wdk/src/print.rs

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions examples/sample-kmdf-driver/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions examples/sample-kmdf-driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ extern crate alloc;
#[cfg(not(test))]
extern crate wdk_panic;

use alloc::{ffi::CString, slice, string::String};
use alloc::{
ffi::CString,
slice,
string::String,
};

use wdk::println;
#[cfg(not(test))]
Expand Down Expand Up @@ -56,9 +60,9 @@ pub unsafe extern "system" fn driver_entry(
let string = CString::new("Hello World!\n").unwrap();

// SAFETY: This is safe because `string` is a valid pointer to a null-terminated
// string
// string (`CString` guarantees null-termination)
unsafe {
DbgPrint(string.as_ptr());
DbgPrint(c"%s".as_ptr().cast(), string.as_ptr());
}

driver.DriverUnload = Some(driver_exit);
Expand Down
21 changes: 11 additions & 10 deletions examples/sample-umdf-driver/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/sample-umdf-driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub unsafe extern "system" fn driver_entry(
let string = CString::new("Hello World!\n").unwrap();

// SAFETY: This is safe because `string` is a valid pointer to a null-terminated
// string
// string (`CString` guarantees null-termination)
unsafe {
OutputDebugStringA(string.as_ptr());
}
Expand Down
21 changes: 11 additions & 10 deletions examples/sample-wdm-driver/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion examples/sample-wdm-driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ pub unsafe extern "system" fn driver_entry(
) -> NTSTATUS {
// This is an example of directly using DbgPrint binding to print
let string = CString::new("Hello World!\n").unwrap();

// SAFETY: This is safe because `string` is a valid pointer to a null-terminated
// string (`CString` guarantees null-termination)
unsafe {
DbgPrint(string.as_ptr());
DbgPrint(c"%s".as_ptr().cast(), string.as_ptr());
}

driver.DriverUnload = Some(driver_exit);
Expand Down
14 changes: 7 additions & 7 deletions tests/config-kmdf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions tests/config-umdf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading