From d3b7cc9b3f5d4a02db38083a0a671fead5cc4c4a Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Wed, 15 Jan 2025 13:26:13 -0800 Subject: [PATCH 01/18] docs: Update RELEASE.md to include explicit cargo-semver-checks install (#247) Signed-off-by: Melvin Wang --- RELEASE.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELEASE.md b/RELEASE.md index 567cc08e..db562314 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -3,6 +3,9 @@ The release process for this repository leverages [`release-plz`](https://github.com/MarcoIeni/release-plz) to automate some of the steps. Only maintainers with the necessary permissions can release new versions of this repository. 1. Install `release-plz`: One option is by running `cargo install --locked release-plz` + 1. Ensure you are running the latest version of `release-plz` +1. Install `cargo-semver-checks`: One option is by running `cargo install --locked cargo-semver-checks` + 1. Ensure you are running the latest version of `cargo-semver-checks` 1. Checkout the latest code on `main` branch 1. Create a release PR: `release-plz release-pr --git-token ` 1. In the Pull Request: From 12593001d0632e40cd83368d1c625bd39086bb7e Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Wed, 15 Jan 2025 13:26:32 -0800 Subject: [PATCH 02/18] refactor: remove redundant code-path in `detect_wdk_content_root` (#249) --- crates/wdk-build/src/utils.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index 4f4f6351..44873372 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -128,19 +128,6 @@ pub fn detect_wdk_content_root() -> Option { } } - // Check WDKContentRoot environment variable - if let Ok(wdk_content_root) = env::var("WDKContentRoot") { - let path = Path::new(wdk_content_root.as_str()); - if path.is_dir() { - return Some(path.to_path_buf()); - } - eprintln!( - "WDKContentRoot({}) was found in environment, but does not exist or is not a valid \ - directory.", - path.display() - ); - } - // Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed // Roots@KitsRoot10 registry key if let Some(path) = read_registry_key_string_value( From 7849a876d2821bbf2d4bd4bb149efb72612eaed7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:50:02 +0530 Subject: [PATCH 03/18] chore: Bump quote from 1.0.36 to 1.0.38 (#267) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d521a67..4df7a4f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -427,9 +427,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] diff --git a/Cargo.toml b/Cargo.toml index 8254e142..05949442 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ lazy_static = "1.5.0" paste = "1.0.15" pretty_assertions = "1.4.0" proc-macro2 = "1.0.86" -quote = "1.0.36" +quote = "1.0.38" rustversion = "1.0.17" serde = "1.0" serde_json = "1.0" From 27e418e536a48ef558e3f436a5459d7a785c0c1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:50:26 +0530 Subject: [PATCH 04/18] chore: Bump syn from 2.0.77 to 2.0.87 (#266) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4df7a4f9..84d78136 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -585,9 +585,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.77" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 05949442..ecd8a60d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ quote = "1.0.38" rustversion = "1.0.17" serde = "1.0" serde_json = "1.0" -syn = "2.0.77" +syn = "2.0.87" thiserror = "1.0.62" tracing = "0.1.40" tracing-subscriber = "0.3.18" From 2e417400c6aa8daa7f0dfb2ddfc2f8c001babeb5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 13:50:47 +0530 Subject: [PATCH 05/18] chore: Bump cc from 1.1.5 to 1.2.9 (#265) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 7 +++++-- Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 84d78136..791eae57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,9 +129,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.5" +version = "1.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "324c74f2155653c90b04f25b2a47a8a631360cb908f92a772695f430c7e31052" +checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" diff --git a/Cargo.toml b/Cargo.toml index ecd8a60d..c98b76c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ anyhow = "1.0.86" bindgen = "0.69.4" camino = "1.1.9" cargo_metadata = "0.18.1" -cc = "1.1.0" +cc = "1.2.9" cfg-if = "1.0.0" clap = "4.5.9" clap-cargo = "0.14.1" From 3db522a84897ff1c1f04f3f7fe901b51475f9b62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:56:21 +0530 Subject: [PATCH 06/18] chore: Bump thiserror from 1.0.63 to 1.0.69 (#244) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 791eae57..0bba40f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -599,18 +599,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index c98b76c3..7d3ec3f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ rustversion = "1.0.17" serde = "1.0" serde_json = "1.0" syn = "2.0.87" -thiserror = "1.0.62" +thiserror = "1.0.69" tracing = "0.1.40" tracing-subscriber = "0.3.18" windows = "0.58.0" From e597e4ba0be2ecc37c989b12cfdd821079c5196f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:47:54 +0530 Subject: [PATCH 07/18] chore: Bump anyhow from 1.0.86 to 1.0.95 (#257) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shravan Vasista --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0bba40f1..474b5c13 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" diff --git a/Cargo.toml b/Cargo.toml index 7d3ec3f8..71e86f25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ wdk-panic = { path = "crates/wdk-panic", version = "0.3.0" } wdk-sys = { path = "crates/wdk-sys", version = "0.3.0" } # External Crates -anyhow = "1.0.86" +anyhow = "1.0.95" bindgen = "0.69.4" camino = "1.1.9" cargo_metadata = "0.18.1" From 994e5271739736ff8b282ba66b7693a317f149fb Mon Sep 17 00:00:00 2001 From: Leon Durrenberger Date: Wed, 22 Jan 2025 18:54:14 -0800 Subject: [PATCH 08/18] refactor: port certificate-generation condition script to Rust (#259) Co-authored-by: Leon Durrenberger (from Dev Box) --- crates/wdk-build/rust-driver-makefile.toml | 24 +++++---- crates/wdk-build/src/cargo_make.rs | 62 ++++++++++++++++++++++ 2 files changed, 77 insertions(+), 9 deletions(-) diff --git a/crates/wdk-build/rust-driver-makefile.toml b/crates/wdk-build/rust-driver-makefile.toml index 903af810..e681d441 100644 --- a/crates/wdk-build/rust-driver-makefile.toml +++ b/crates/wdk-build/rust-driver-makefile.toml @@ -406,17 +406,23 @@ args = [ [tasks.generate-certificate] private = true +condition_script_runner_args = [ + "--base-path", + "${CARGO_MAKE_CURRENT_TASK_INITIAL_MAKEFILE_DIRECTORY}", +] condition_script = ''' -#!@duckscript +#!@rust -out = exec certmgr.exe -put -s WDRTestCertStore -c -n WDRLocalTestCert ${WDK_BUILD_OUTPUT_DIRECTORY}/WDRLocalTestCert.cer -if eq ${out.code} 0 - echo WDRLocalTestCert found in WDRTestCertStore. Skipping certificate generation. - exit 1 -else - echo WDRLocalTestCert not found in WDRTestCertStore. Generating new certificate. - exit 0 -end +//! ```cargo +//! [dependencies] +//! wdk-build = { path = ".", version = "0.3.0" } +//! anyhow = "1" +//! ``` +#![allow(unused_doc_comments)] + +fn main() -> anyhow::Result<()> { + wdk_build::cargo_make::generate_certificate_condition_script() +} ''' command = "makecert" args = [ diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index a900bf35..7b967a5c 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -16,6 +16,7 @@ use std::{ env, panic::UnwindSafe, path::{Path, PathBuf}, + process::Command, }; use anyhow::Context; @@ -1007,6 +1008,67 @@ pub fn package_driver_flow_condition_script() -> anyhow::Result<()> { }) } +/// `cargo-make` condition script for `generate-certificate` task in +/// [`rust-driver-makefile.toml`](../rust-driver-makefile.toml) +/// +/// # Errors +/// +/// This functions returns an error whenever it determines that the +/// `generate-certificate` `cargo-make` task should be skipped. This only +/// occurs when `WdrLocalTestCert` already exists in `WDRTestCertStore`. +/// +/// # Panics +/// +/// Panics if `CARGO_MAKE_CURRENT_TASK_NAME` is not set in the environment. +pub fn generate_certificate_condition_script() -> anyhow::Result<()> { + condition_script(|| { + let mut command = Command::new("certmgr"); + + command.args([ + "-put".as_ref(), + "-s".as_ref(), + "WDRTestCertStore".as_ref(), + "-c".as_ref(), + "-n".as_ref(), + "WdrLocalTestCert".as_ref(), + get_wdk_build_output_directory() + .join("WDRLocalTestCert.cer") + .as_os_str(), + ]); + + let output = command.output().unwrap_or_else(|err| { + panic!( + "Failed to run certmgr.exe {} due to error: {}", + command + .get_args() + .map(|arg| arg.to_string_lossy()) + .collect::>() + .join(" "), + err + ) + }); + + match output.status.code() { + Some(0) => Err(anyhow::anyhow!( + "WDRLocalTestCert found in WDRTestCertStore. Skipping certificate generation." + )), + Some(1) => { + eprintln!( + "WDRLocalTestCert not found in WDRTestCertStore. Generating new certificate." + ); + Ok(()) + } + Some(_) => { + eprintln!("Unknown status code found from certmgr. Generating new certificate."); + Ok(()) + } + None => { + unreachable!("Unreachable, no status code found from certmgr."); + } + } + }) +} + fn configure_wdf_build_output_dir(target_arg: Option<&String>, cargo_make_cargo_profile: &str) { let cargo_make_crate_custom_triple_target_directory = env::var(CARGO_MAKE_CRATE_CUSTOM_TRIPLE_TARGET_DIRECTORY_ENV_VAR).unwrap_or_else(|_| { From 2f39f1d4faeb8d8858f5f49853be22dbb9005fae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:54:09 +0530 Subject: [PATCH 09/18] chore: Bump rustversion from 1.0.17 to 1.0.19 in /tests/wdk-macros-tests (#275) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shravan Vasista --- tests/wdk-macros-tests/Cargo.lock | 4 ++-- tests/wdk-macros-tests/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/wdk-macros-tests/Cargo.lock b/tests/wdk-macros-tests/Cargo.lock index a963b997..63cf183e 100644 --- a/tests/wdk-macros-tests/Cargo.lock +++ b/tests/wdk-macros-tests/Cargo.lock @@ -178,9 +178,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" diff --git a/tests/wdk-macros-tests/Cargo.toml b/tests/wdk-macros-tests/Cargo.toml index 7f16c6ef..c6b8a991 100644 --- a/tests/wdk-macros-tests/Cargo.toml +++ b/tests/wdk-macros-tests/Cargo.toml @@ -15,5 +15,5 @@ macrotest = "1.0.13" owo-colors = "4.0.0" paste = "1.0.15" pathdiff = "0.2.1" -rustversion = "1.0.17" +rustversion = "1.0.19" trybuild = "1.0.97" From e8a54ece9ccc4679b376d6acd84b0493daa9632b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:24:51 +0000 Subject: [PATCH 10/18] chore: Bump serde from 1.0.210 to 1.0.217 (#274) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shravan Vasista --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 474b5c13..bf5da046 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -523,18 +523,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", From e76b4e8b99b97240e650b29e2a3ba35faace4082 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:25:17 +0000 Subject: [PATCH 11/18] chore: Bump serde_json from 1.0.128 to 1.0.137 (#273) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shravan Vasista --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bf5da046..e6fe91e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -543,9 +543,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "930cfb6e6abf99298aaad7d29abbef7a9999a9a8806a40088f55f0dcec03146b" dependencies = [ "itoa", "memchr", From f4aec888e9b9032575d030f0b27604ff4be32ab6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:25:41 +0000 Subject: [PATCH 12/18] chore: Bump rustversion from 1.0.17 to 1.0.19 (#272) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shravan Vasista --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e6fe91e1..6d97ca66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -502,9 +502,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" diff --git a/Cargo.toml b/Cargo.toml index 71e86f25..8289b3c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ paste = "1.0.15" pretty_assertions = "1.4.0" proc-macro2 = "1.0.86" quote = "1.0.38" -rustversion = "1.0.17" +rustversion = "1.0.19" serde = "1.0" serde_json = "1.0" syn = "2.0.87" From 4357105bd3692345ae9623b0b0c5fe231695b193 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:25:56 +0000 Subject: [PATCH 13/18] chore: Bump pretty_assertions from 1.4.0 to 1.4.1 (#271) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shravan Vasista --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d97ca66..1fa64823 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -401,9 +401,9 @@ checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pretty_assertions" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" dependencies = [ "diff", "yansi", @@ -953,6 +953,6 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "yansi" -version = "0.5.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" diff --git a/Cargo.toml b/Cargo.toml index 8289b3c8..db847429 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ clap-cargo = "0.14.1" itertools = "0.13.0" lazy_static = "1.5.0" paste = "1.0.15" -pretty_assertions = "1.4.0" +pretty_assertions = "1.4.1" proc-macro2 = "1.0.86" quote = "1.0.38" rustversion = "1.0.19" From 2e7572a63bc9db2e07fef4b60da74d3d4a9d5c35 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:26:11 +0000 Subject: [PATCH 14/18] chore: Bump cc from 1.2.9 to 1.2.10 (#270) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shravan Vasista --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1fa64823..7c836a0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,9 +129,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.9" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8293772165d9345bdaaa39b45b2109591e63fe5e6fbc23c6ff930a048aa310b" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" dependencies = [ "shlex", ] diff --git a/Cargo.toml b/Cargo.toml index db847429..6877502f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ anyhow = "1.0.95" bindgen = "0.69.4" camino = "1.1.9" cargo_metadata = "0.18.1" -cc = "1.2.9" +cc = "1.2.10" cfg-if = "1.0.0" clap = "4.5.9" clap-cargo = "0.14.1" From 5c91e21258055853596a5a898dc812f014147c5a Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Fri, 24 Jan 2025 10:30:17 -0800 Subject: [PATCH 15/18] fix: add missing arm64rt library to linker flags for arm64 kernel-mode builds (#261) --- crates/wdk-build/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index db2e8aa8..73b31381 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -698,6 +698,12 @@ impl Config { println!("cargo::rustc-link-lib=static=hal"); println!("cargo::rustc-link-lib=static=wmilib"); + // Emit ARM64-specific libraries to link to derived from + // WindowsDriver.arm64.props + if self.cpu_architecture == CpuArchitecture::Arm64 { + println!("cargo::rustc-link-lib=static=arm64rt"); + } + // Linker arguments derived from WindowsDriver.KernelMode.props in Ni(22H2) WDK println!("cargo::rustc-cdylib-link-arg=/DRIVER"); println!("cargo::rustc-cdylib-link-arg=/NODEFAULTLIB"); @@ -717,6 +723,12 @@ impl Config { println!("cargo::rustc-link-lib=static=WdfLdr"); println!("cargo::rustc-link-lib=static=WdfDriverEntry"); + // Emit ARM64-specific libraries to link to derived from + // WindowsDriver.arm64.props + if self.cpu_architecture == CpuArchitecture::Arm64 { + println!("cargo::rustc-link-lib=static=arm64rt"); + } + // Linker arguments derived from WindowsDriver.KernelMode.props in Ni(22H2) WDK println!("cargo::rustc-cdylib-link-arg=/DRIVER"); println!("cargo::rustc-cdylib-link-arg=/NODEFAULTLIB"); From 34497aa964808bdcb99e33c00c1b253358e687c9 Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Fri, 24 Jan 2025 14:37:52 -0800 Subject: [PATCH 16/18] docs: fix panic condition docs for `package_driver_flow_condition_script` (#264) Signed-off-by: Melvin Wang --- crates/wdk-build/src/cargo_make.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index 7b967a5c..29e8e29c 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -944,7 +944,7 @@ where /// /// # Panics /// -/// Panics if `CARGO_MAKE_CRATE_NAME` is not set in the environment +/// Panics if `CARGO_MAKE_CURRENT_TASK_NAME` is not set in the environment pub fn package_driver_flow_condition_script() -> anyhow::Result<()> { condition_script(|| { // Get the current package name via `CARGO_MAKE_CRATE_NAME_ENV_VAR` instead of From 54b0fd4025d037e7b84f4063a66264c920dc367d Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Tue, 28 Jan 2025 15:29:56 -0800 Subject: [PATCH 17/18] fix: suppress linker warnings exposed by nightly rustc change (#279) --- crates/wdk-build/src/lib.rs | 13 ++++++++ examples/sample-kmdf-driver/Cargo.lock | 33 ++++++++++--------- examples/sample-umdf-driver/Cargo.lock | 33 ++++++++++--------- examples/sample-wdm-driver/Cargo.lock | 33 ++++++++++--------- tests/config-kmdf/Cargo.lock | 33 ++++++++++--------- tests/config-umdf/Cargo.lock | 33 ++++++++++--------- tests/mixed-package-kmdf-workspace/Cargo.lock | 33 ++++++++++--------- tests/umdf-driver-workspace/Cargo.lock | 33 ++++++++++--------- tests/wdk-sys-tests/Cargo.lock | 30 ++++++++--------- 9 files changed, 154 insertions(+), 120 deletions(-) diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index 73b31381..5bee66b3 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -713,6 +713,15 @@ impl Config { // Linker arguments derived from WindowsDriver.KernelMode.WDM.props in Ni(22H2) // WDK println!("cargo::rustc-cdylib-link-arg=/ENTRY:DriverEntry"); + + // Ignore `LNK4257: object file was not compiled for kernel mode; the image + // might not run` since `rustc` has no support for `/KERNEL` + println!("cargo::rustc-cdylib-link-arg=/IGNORE:4257"); + + // Ignore `LNK4216: Exported entry point DriverEntry` since Rust currently + // provides no way to set a symbol's name without also exporting the symbol: + // https://github.com/rust-lang/rust/issues/67399 + println!("cargo::rustc-cdylib-link-arg=/IGNORE:4216"); } DriverConfig::Kmdf(_) => { // Emit KMDF-specific libraries to link to @@ -738,6 +747,10 @@ impl Config { // Linker arguments derived from WindowsDriver.KernelMode.KMDF.props in // Ni(22H2) WDK println!("cargo::rustc-cdylib-link-arg=/ENTRY:FxDriverEntry"); + + // Ignore `LNK4257: object file was not compiled for kernel mode; the image + // might not run` since `rustc` has no support for `/KERNEL` + println!("cargo::rustc-cdylib-link-arg=/IGNORE:4257"); } DriverConfig::Umdf(umdf_config) => { // Emit UMDF-specific libraries to link to diff --git a/examples/sample-kmdf-driver/Cargo.lock b/examples/sample-kmdf-driver/Cargo.lock index 68afe172..3d97400d 100644 --- a/examples/sample-kmdf-driver/Cargo.lock +++ b/examples/sample-kmdf-driver/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" @@ -129,9 +129,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.0" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" @@ -411,9 +414,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -483,9 +486,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -579,9 +582,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -590,18 +593,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.62" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.62" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/examples/sample-umdf-driver/Cargo.lock b/examples/sample-umdf-driver/Cargo.lock index d95db0be..3346a657 100644 --- a/examples/sample-umdf-driver/Cargo.lock +++ b/examples/sample-umdf-driver/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" @@ -129,9 +129,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.0" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" @@ -411,9 +414,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -483,9 +486,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -577,9 +580,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -588,18 +591,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.62" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.62" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/examples/sample-wdm-driver/Cargo.lock b/examples/sample-wdm-driver/Cargo.lock index a79d27fb..2e31bb6e 100644 --- a/examples/sample-wdm-driver/Cargo.lock +++ b/examples/sample-wdm-driver/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" @@ -129,9 +129,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.0" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" @@ -411,9 +414,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -483,9 +486,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -579,9 +582,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -590,18 +593,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.62" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.62" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/tests/config-kmdf/Cargo.lock b/tests/config-kmdf/Cargo.lock index af8a88c1..e04cd224 100644 --- a/tests/config-kmdf/Cargo.lock +++ b/tests/config-kmdf/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "basic-toml" @@ -138,9 +138,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.6" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" @@ -494,9 +497,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -566,9 +569,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -660,9 +663,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -680,18 +683,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/tests/config-umdf/Cargo.lock b/tests/config-umdf/Cargo.lock index 99a963cd..98bc80b6 100644 --- a/tests/config-umdf/Cargo.lock +++ b/tests/config-umdf/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "basic-toml" @@ -138,9 +138,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.6" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aba8f4e9906c7ce3c73463f62a7f0c65183ada1a2d47e397cc8810827f9694f" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" @@ -494,9 +497,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -566,9 +569,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -660,9 +663,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -680,18 +683,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/tests/mixed-package-kmdf-workspace/Cargo.lock b/tests/mixed-package-kmdf-workspace/Cargo.lock index 93f31b48..9ede1b9c 100644 --- a/tests/mixed-package-kmdf-workspace/Cargo.lock +++ b/tests/mixed-package-kmdf-workspace/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" @@ -129,9 +129,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.7" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" @@ -426,9 +429,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -498,9 +501,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -584,9 +587,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -595,18 +598,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/tests/umdf-driver-workspace/Cargo.lock b/tests/umdf-driver-workspace/Cargo.lock index 1dee849d..12452f1a 100644 --- a/tests/umdf-driver-workspace/Cargo.lock +++ b/tests/umdf-driver-workspace/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" @@ -129,9 +129,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.7" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" +dependencies = [ + "shlex", +] [[package]] name = "cexpr" @@ -429,9 +432,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -501,9 +504,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -587,9 +590,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.79" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -598,18 +601,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", diff --git a/tests/wdk-sys-tests/Cargo.lock b/tests/wdk-sys-tests/Cargo.lock index 3b4cd777..cac2edd9 100644 --- a/tests/wdk-sys-tests/Cargo.lock +++ b/tests/wdk-sys-tests/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -62,9 +62,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" @@ -129,9 +129,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.16" +version = "1.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" +checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" dependencies = [ "shlex", ] @@ -414,9 +414,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -486,9 +486,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -572,9 +572,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.77" +version = "2.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" dependencies = [ "proc-macro2", "quote", @@ -583,18 +583,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", From 4d4f997ae99f2657b1677e83b0296c58ffa9b2fb Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Wed, 29 Jan 2025 16:47:43 -0800 Subject: [PATCH 18/18] feat!: expand `wdk-sys` coverage to include hid-related headers (#260) Signed-off-by: Melvin Wang --- .github/workflows/build.yaml | 2 +- .github/workflows/code-formatting-check.yaml | 1 - .github/workflows/codeql.yml | 2 +- .github/workflows/docs.yaml | 14 +- .github/workflows/lint.yaml | 10 +- .github/workflows/test.yaml | 6 +- .vscode/settings.json | 5 +- CONTRIBUTING.md | 16 +- Cargo.lock | 23 +-- Cargo.toml | 2 +- Makefile.toml | 7 +- crates/wdk-build/src/bindgen.rs | 22 +-- crates/wdk-build/src/lib.rs | 172 +++++++++++++++-- crates/wdk-sys/Cargo.toml | 4 + crates/wdk-sys/build.rs | 176 +++++++++++++++--- crates/wdk-sys/src/hid.rs | 25 +++ crates/wdk-sys/src/input.h | 72 ------- crates/wdk-sys/src/lib.rs | 11 ++ crates/wdk-sys/src/wdf.c | 4 - examples/sample-kmdf-driver/Cargo.lock | 21 ++- examples/sample-kmdf-driver/Cargo.toml | 3 + examples/sample-kmdf-driver/src/lib.rs | 7 +- examples/sample-umdf-driver/Cargo.lock | 21 ++- examples/sample-umdf-driver/Cargo.toml | 3 + examples/sample-umdf-driver/src/lib.rs | 7 +- examples/sample-wdm-driver/Cargo.lock | 21 ++- examples/sample-wdm-driver/Cargo.toml | 3 + tests/config-kmdf/Cargo.lock | 21 ++- tests/config-umdf/Cargo.lock | 21 ++- tests/mixed-package-kmdf-workspace/Cargo.lock | 21 ++- .../crates/driver/src/lib.rs | 8 +- tests/umdf-driver-workspace/Cargo.lock | 21 ++- .../crates/driver_1/src/lib.rs | 7 +- .../crates/driver_2/src/lib.rs | 7 +- tests/wdk-sys-tests/Cargo.lock | 21 ++- 35 files changed, 503 insertions(+), 284 deletions(-) create mode 100644 crates/wdk-sys/src/hid.rs delete mode 100644 crates/wdk-sys/src/input.h delete mode 100644 crates/wdk-sys/src/wdf.c diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3c916bf9..21a9dcbf 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -73,7 +73,7 @@ jobs: targets: ${{ matrix.target_triple }} - name: Run Cargo Build - run: cargo +${{ matrix.rust_toolchain }} build --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace + run: cargo +${{ matrix.rust_toolchain }} build --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --all-features - name: Install Cargo Make uses: taiki-e/install-action@v2 diff --git a/.github/workflows/code-formatting-check.yaml b/.github/workflows/code-formatting-check.yaml index fe4ff92d..f54851ec 100644 --- a/.github/workflows/code-formatting-check.yaml +++ b/.github/workflows/code-formatting-check.yaml @@ -6,7 +6,6 @@ on: schedule: # Trigger a job on default branch at 4AM PST everyday - cron: 0 11 * * * - jobs: cargo-fmt: name: .rs Formatting Check diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f7b28a66..3017eb26 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -89,7 +89,7 @@ jobs: - if: matrix.build-mode == 'manual' working-directory: ./examples - run: cargo +${{ matrix.rust_toolchain }} make default --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace + run: cargo +${{ matrix.rust_toolchain }} make default --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --all-features - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 56f9412b..f24123a5 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -72,19 +72,9 @@ jobs: - name: Run Cargo Doc # proc-macro crates must be excluded to avoid cargo doc bug: https://github.com/rust-lang/cargo/issues/10368 - run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --exclude wdk-macros - - - name: Run Cargo Doc (--features nightly) - if: matrix.rust_toolchain == 'nightly' - # proc-macro crates must be excluded to avoid cargo doc bug: https://github.com/rust-lang/cargo/issues/10368 - run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --exclude wdk-macros --features nightly + run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --workspace --exclude wdk-macros --all-features - name: Run Cargo Doc w/ proc-macro crates if: matrix.target_triple == 'x86_64-pc-windows-msvc' # cargo doc can only generate documentation for proc-macro crates when --target is not specified due to a cargo doc bug: https://github.com/rust-lang/cargo/issues/7677 - run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} - - - name: Run Cargo Doc w/ proc-macro crates (--features nightly) - if: ${{ matrix.target_triple == 'x86_64-pc-windows-msvc' && matrix.rust_toolchain == 'nightly' }} - # cargo doc can only generate documentation for proc-macro crates when --target is not specified due to a cargo doc bug: https://github.com/rust-lang/cargo/issues/7677 - run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --features nightly + run: cargo +${{ matrix.rust_toolchain }} doc --locked --profile ${{ matrix.cargo_profile }} --all-features diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 6bef9782..c5ca03d7 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -7,6 +7,10 @@ on: name: Lint +env: + RUSTFLAGS: >- + -D warnings + jobs: clippy: name: Clippy @@ -71,11 +75,7 @@ jobs: targets: ${{ matrix.target_triple }} - name: Run Cargo Clippy - run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --all-targets -- -D warnings - - - name: Run Cargo Clippy (--features nightly) - if: matrix.rust_toolchain == 'nightly' - run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --all-targets --features nightly -- -D warnings + run: cargo +${{ matrix.rust_toolchain }} clippy --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --all-targets --all-features unused_deps: name: Detect Unused Cargo Dependencies diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2f63b1e1..7c7fe4cd 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -73,8 +73,4 @@ jobs: tool: cargo-expand@1.0.85 - name: Run Cargo Test - run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} - - - name: Run Cargo Test (--features nightly) - if: matrix.rust_toolchain == 'nightly' - run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --features nightly + run: cargo +${{ matrix.rust_toolchain }} test --locked --profile ${{ matrix.cargo_profile }} --target ${{ matrix.target_triple }} --all-features diff --git a/.vscode/settings.json b/.vscode/settings.json index 38e5522c..c1d287ed 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -19,5 +19,6 @@ "./tests/umdf-driver-workspace/Cargo.toml", "./tests/wdk-macros-tests/Cargo.toml", "./tests/wdk-sys-tests/Cargo.toml", - ] -} \ No newline at end of file + ], + "rust-analyzer.cargo.features": "all" +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index afaa715f..5bf47f8a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -96,9 +96,8 @@ The following tools should be installed as a part of the `windows-drivers-rs` de ### Generating Documentation -* To compile and open documentation: `cargo doc --locked --open` - * To include nightly features: `cargo +nightly doc --locked --open --features nightly` - * To open docs for non-host architecture: `cargo doc --locked --open --target --workspace --exclude wdk-macros` +* To compile and open documentation: `cargo doc --locked --all-features --open` + * To open docs for non-host architecture: `cargo doc --locked --all-features --open --target --workspace --exclude wdk-macros` * `--target` is incompatible with `proc-macro` crates due to a [cargo bug](https://github.com/rust-lang/cargo/issues/10368) ### Policy on using Nightly/Unstable Features @@ -113,7 +112,7 @@ The crates in this repository are designed to work with `stable` rust. Some of t ### Build and Test -To **only build** the workspace: `cargo build` +To **only build** the workspace: `cargo build --locked --all-features` To **both** build and package the samples in the workspace: `cargo make --cwd .\crates\` @@ -123,13 +122,13 @@ To maintain the quality of code, tests and tools are required to pass before con **_Functional Correctness:_** -* `cargo test --locked` +* `cargo test --locked --all-features` * To test `nightly` features: `cargo +nightly test --locked --features nightly` **_Static Analysis and Linting:_** -* `cargo clippy --locked --all-targets -- -D warnings` - * To lint `nightly` features: `cargo +nightly clippy --locked --all-targets --features nightly -- -D warnings` +* `cargo clippy --locked --all-features --all-targets -- -D warnings` + * To lint `nightly` features: `cargo +nightly clippy --locked --all-features --all-targets --features nightly -- -D warnings` **_Formatting:_** @@ -146,8 +145,7 @@ To maintain the quality of code, tests and tools are required to pass before con **_Rust Documentation Build Test_** -* `cargo doc --locked` - * To build docs for `nightly` features: `cargo +nightly doc --locked --features nightly` +* `cargo doc --locked --all-features` ### A Note on Code-Style diff --git a/Cargo.lock b/Cargo.lock index 7c836a0e..db6fccad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aho-corasick" @@ -68,9 +68,9 @@ checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -629,9 +629,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -640,9 +640,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -651,9 +651,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -672,9 +672,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -770,6 +770,7 @@ dependencies = [ "bindgen", "cargo_metadata", "cc", + "cfg-if", "lazy_static", "rustversion", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 6877502f..fa00ba03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ wdk-sys = { path = "crates/wdk-sys", version = "0.3.0" } # External Crates anyhow = "1.0.95" -bindgen = "0.69.4" +bindgen = "0.69.5" camino = "1.1.9" cargo_metadata = "0.18.1" cc = "1.2.10" diff --git a/Makefile.toml b/Makefile.toml index 2137bc1b..df0bcb92 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -6,9 +6,10 @@ additional_profiles = ["all-default-tasks"] [env] CARGO_MAKE_SKIP_SLOW_SECONDARY_FLOWS = false -CARGO_MAKE_CLIPPY_ARGS = "--all-targets -- -D warnings" -RUSTFLAGS = "-D warnings" +CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = "${CARGO_MAKE_CARGO_ALL_FEATURES}" +CARGO_MAKE_CLIPPY_ARGS = "--all-targets --all-features" CARGO_MAKE_RUST_DEFAULT_TOOLCHAIN = "stable" +RUSTFLAGS = "-D warnings" RUSTDOCFLAGS = "-D warnings" [tasks.wdk-pre-commit-flow] @@ -71,12 +72,10 @@ alias = "pre-test" [tasks.nightly-test] extend = "test" -env = { CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = "--features nightly" } toolchain = "nightly" [tasks.post-nightly-test] extend = "post-test" -env = { CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = { unset = true } } [tasks.nightly-clippy-flow] extend = "clippy-flow" diff --git a/crates/wdk-build/src/bindgen.rs b/crates/wdk-build/src/bindgen.rs index 5609304a..63b417de 100644 --- a/crates/wdk-build/src/bindgen.rs +++ b/crates/wdk-build/src/bindgen.rs @@ -20,10 +20,7 @@ pub trait BuilderExt { /// /// Implementation may return `wdk_build::ConfigError` if it fails to create /// a builder - fn wdk_default( - c_header_files: Vec<&str>, - config: impl Borrow, - ) -> Result; + fn wdk_default(config: impl Borrow) -> Result; } #[derive(Debug)] @@ -39,19 +36,10 @@ impl BuilderExt for Builder { /// /// Will return `wdk_build::ConfigError` if any of the resolved include or /// library paths do not exist - fn wdk_default( - c_header_files: Vec<&str>, - config: impl Borrow, - ) -> Result { + fn wdk_default(config: impl Borrow) -> Result { let config = config.borrow(); - let mut builder = Self::default(); - - for c_header in c_header_files { - builder = builder.header(c_header); - } - - builder = builder + let builder = Self::default() .use_core() // Can't use std for kernel code .derive_default(true) // allows for default initializing structs // CStr types are safer and easier to work with when interacting with string constants @@ -60,7 +48,7 @@ impl BuilderExt for Builder { // Building in eWDK can pollute system search path when clang-sys tries to detect // c_search_paths .detect_include_paths(false) - .clang_args(config.get_include_paths()?.iter().map(|include_path| { + .clang_args(config.include_paths()?.map(|include_path| { format!( "--include-directory={}", include_path @@ -70,7 +58,7 @@ impl BuilderExt for Builder { })) .clang_args( config - .get_preprocessor_definitions_iter() + .preprocessor_definitions() .map(|(key, value)| { format!( "--define-macro={key}{}", diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index 5bee66b3..8a8defa9 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -190,6 +190,17 @@ rustflags = [\"-C\", \"target-feature=+crt-static\"] SerdeError(#[from] metadata::Error), } +/// Subset of APIs in the Windows Driver Kit +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum ApiSubset { + /// API subset typically required for all Windows drivers + Base, + /// API subset required for WDF (Windows Driver Framework) drivers: + Wdf, + /// API subset for HID (Human Interface Device) drivers: + Hid, +} + impl Default for Config { #[must_use] fn default() -> Self { @@ -320,8 +331,7 @@ impl Config { /// /// This function will return an error if any of the required paths do not /// exist. - pub fn get_include_paths(&self) -> Result, ConfigError> { - // FIXME: consider deprecating in favor of iter + pub fn include_paths(&self) -> Result, ConfigError> { let mut include_paths = vec![]; let include_directory = self.wdk_content_root.join("Include"); @@ -408,7 +418,7 @@ impl Config { } } - Ok(include_paths) + Ok(include_paths.into_iter()) } /// Return library include paths required to build and link based off of @@ -420,7 +430,7 @@ impl Config { /// /// This function will return an error if any of the required paths do not /// exist. - pub fn get_library_paths(&self) -> Result, ConfigError> { + pub fn library_paths(&self) -> Result, ConfigError> { let mut library_paths = vec![]; let library_directory = self.wdk_content_root.join("Lib"); @@ -495,14 +505,12 @@ impl Config { // Reverse order of library paths so that paths pushed later into the vec take // precedence library_paths.reverse(); - Ok(library_paths) + Ok(library_paths.into_iter()) } /// Return an iterator of strings that represent compiler definitions /// derived from the `Config` - pub fn get_preprocessor_definitions_iter( - &self, - ) -> impl Iterator)> { + pub fn preprocessor_definitions(&self) -> impl Iterator)> { // _WIN32_WINNT=$(WIN32_WINNT_VERSION); // WINVER=$(WINVER_VERSION); // WINNT=1; @@ -541,10 +549,13 @@ impl Config { .chain( match self.driver_config { DriverConfig::Wdm => { - vec![] + vec![ + ("_KERNEL_MODE", None), // Normally defined by msvc via /kernel flag + ] } DriverConfig::Kmdf(kmdf_config) => { let mut kmdf_definitions = vec![ + ("_KERNEL_MODE", None), // Normally defined by msvc via /kernel flag ("KMDF_VERSION_MAJOR", Some(kmdf_config.kmdf_version_major)), ( "KMDF_VERSION_MINOR", @@ -623,6 +634,139 @@ impl Config { .map(std::string::ToString::to_string) } + /// Returns a [`String`] iterator over all the headers for a given + /// [`ApiSubset`] + /// + /// The iterator considers both the [`ApiSubset`] and the [`Config`] to + /// determine which headers to yield + pub fn headers(&self, api_subset: ApiSubset) -> impl Iterator { + match api_subset { + ApiSubset::Base => match &self.driver_config { + DriverConfig::Wdm | DriverConfig::Kmdf(_) => { + vec!["ntifs.h", "ntddk.h"] + } + DriverConfig::Umdf(_) => { + vec!["windows.h"] + } + }, + ApiSubset::Wdf => { + if let DriverConfig::Kmdf(_) | DriverConfig::Umdf(_) = self.driver_config { + vec!["wdf.h"] + } else { + vec![] + } + } + ApiSubset::Hid => { + let mut hid_headers = vec!["hidclass.h", "hidsdi.h", "hidpi.h", "vhf.h"]; + + if let DriverConfig::Wdm | DriverConfig::Kmdf(_) = self.driver_config { + hid_headers.extend(["hidpddi.h", "hidport.h", "kbdmou.h", "ntdd8042.h"]); + } + + if let DriverConfig::Kmdf(_) = self.driver_config { + hid_headers.extend(["HidSpiCx/1.0/hidspicx.h"]); + } + + hid_headers + } + } + .into_iter() + .map(std::string::ToString::to_string) + } + + /// Returns a [`String`] containing the contents of a header file designed + /// for [`bindgen`](https://docs.rs/bindgen) to processs + /// + /// The contents contain `#include`'ed headers based off the [`ApiSubset`] + /// and [`Config`], as well as any additional definitions required for the + /// headers to be processed successfully + pub fn bindgen_header_contents( + &self, + api_subsets: impl IntoIterator, + ) -> String { + api_subsets + .into_iter() + .fold(String::new(), |mut acc, api_subset| { + acc.push_str( + self.headers(api_subset) + .fold(String::new(), |mut acc, header| { + acc.push_str(r#"#include ""#); + acc.push_str(&header); + acc.push_str("\"\n"); + acc + }) + .as_str(), + ); + + if api_subset == ApiSubset::Base + && matches!( + self.driver_config, + DriverConfig::Wdm | DriverConfig::Kmdf(_) + ) + { + // TODO: Why is there no definition for this struct? Maybe blocklist this struct + // in bindgen. + acc.push_str( + r" +typedef union _KGDTENTRY64 +{ + struct + { + unsigned short LimitLow; + unsigned short BaseLow; + union + { + struct + { + unsigned char BaseMiddle; + unsigned char Flags1; + unsigned char Flags2; + unsigned char BaseHigh; + } Bytes; + struct + { + unsigned long BaseMiddle : 8; + unsigned long Type : 5; + unsigned long Dpl : 2; + unsigned long Present : 1; + unsigned long LimitHigh : 4; + unsigned long System : 1; + unsigned long LongMode : 1; + unsigned long DefaultBig : 1; + unsigned long Granularity : 1; + unsigned long BaseHigh : 8; + } Bits; + }; + unsigned long BaseUpper; + unsigned long MustBeZero; + }; + unsigned __int64 Alignment; +} KGDTENTRY64, *PKGDTENTRY64; + +typedef union _KIDTENTRY64 +{ + struct + { + unsigned short OffsetLow; + unsigned short Selector; + unsigned short IstIndex : 3; + unsigned short Reserved0 : 5; + unsigned short Type : 5; + unsigned short Dpl : 2; + unsigned short Present : 1; + unsigned short OffsetMiddle; + unsigned long OffsetHigh; + unsigned long Reserved1; + }; + unsigned __int64 Alignment; +} KIDTENTRY64, *PKIDTENTRY64; +", + ); + } + acc + }) + } + /// Configure a Cargo build of a library that depends on the WDK. This /// emits specially formatted prints to Cargo based on this [`Config`]. /// @@ -683,10 +827,8 @@ impl Config { }; } - let library_paths: Vec = self.get_library_paths()?; - // Emit linker search paths - for path in library_paths { + for path in self.library_paths()? { println!("cargo::rustc-link-search={}", path.display()); } @@ -864,8 +1006,6 @@ impl CpuArchitecture { } /// Converts from a cargo-provided [`std::str`] to a [`CpuArchitecture`]. - /// - /// # #[must_use] pub fn try_from_cargo_str>(cargo_str: S) -> Option { // Specifically not using the [`std::convert::TryFrom`] trait to be more @@ -917,7 +1057,7 @@ pub fn find_top_level_cargo_manifest() -> PathBuf { /// /// Cargo build graphs that have no valid WDK configurations will emit a /// warning, but will still return [`Ok`]. This allows libraries -/// designed for multiple configurations to sucessfully compile when built in +/// designed for multiple configurations to successfully compile when built in /// isolation. /// /// # Errors @@ -956,7 +1096,7 @@ pub fn configure_wdk_library_build() -> Result<(), ConfigError> { /// /// Cargo build graphs that have no valid WDK configurations will emit a /// warning, but will still return [`Ok`]. This allows libraries -/// designed for multiple configurations to sucessfully compile when built in +/// designed for multiple configurations to successfully compile when built in /// isolation. /// /// # Errors diff --git a/crates/wdk-sys/Cargo.toml b/crates/wdk-sys/Cargo.toml index d1de5c29..531c4adf 100644 --- a/crates/wdk-sys/Cargo.toml +++ b/crates/wdk-sys/Cargo.toml @@ -21,6 +21,7 @@ anyhow.workspace = true bindgen.workspace = true cargo_metadata.workspace = true cc.workspace = true +cfg-if.workspace = true lazy_static.workspace = true serde_json.workspace = true thiserror.workspace = true @@ -35,6 +36,9 @@ wdk-macros.workspace = true [features] default = [] + +hid = [] + nightly = ["wdk-macros/nightly"] test-stubs = [] diff --git a/crates/wdk-sys/build.rs b/crates/wdk-sys/build.rs index 37f350f3..a69346a2 100644 --- a/crates/wdk-sys/build.rs +++ b/crates/wdk-sys/build.rs @@ -8,7 +8,9 @@ use std::{ env, + fs::File, io::Write, + panic, path::{Path, PathBuf}, thread, }; @@ -16,13 +18,14 @@ use std::{ use anyhow::Context; use bindgen::CodegenConfig; use lazy_static::lazy_static; -use tracing::{info, info_span, Span}; +use tracing::{info, info_span, trace, Span}; use tracing_subscriber::{ filter::{LevelFilter, ParseError}, EnvFilter, }; use wdk_build::{ configure_wdk_library_build_and_then, + ApiSubset, BuilderExt, Config, ConfigError, @@ -40,10 +43,20 @@ const OUT_DIR_PLACEHOLDER: &str = const WDFFUNCTIONS_SYMBOL_NAME_PLACEHOLDER: &str = ""; +/// Rust code snippet that declares and initializes `wdf_function_count` based +/// off the bindgen-generated `WdfFunctionCount` symbol +/// +/// This is only used in configurations where WDF generates a +/// `WdfFunctionCount`. const WDF_FUNCTION_COUNT_DECLARATION_EXTERNAL_SYMBOL: &str = " // SAFETY: `crate::WdfFunctionCount` is generated as a mutable static, but is not supposed \ to be ever mutated by WDF. let wdf_function_count = unsafe { crate::WdfFunctionCount } as usize;"; +/// Rust code snippet that declares and initializes `wdf_function_count` based +/// off the bindgen-generated `WdfFunctionTableNumEntries` constant +/// +/// This is only used in older WDF versions that didn't generate a +/// `WdfFunctionCount` symbol const WDF_FUNCTION_COUNT_DECLARATION_TABLE_INDEX: &str = " let wdf_function_count = crate::_WDFFUNCENUM::WdfFunctionTableNumEntries as usize;"; @@ -133,7 +146,7 @@ use crate::WDFFUNC; /// 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(); -", +" ); } @@ -144,6 +157,7 @@ const BINDGEN_FILE_GENERATORS_TUPLES: &[(&str, GenerateFn)] = &[ ("types.rs", generate_types), ("base.rs", generate_base), ("wdf.rs", generate_wdf), + ("hid.rs", generate_hid), ]; fn initialize_tracing() -> Result<(), ParseError> { @@ -203,8 +217,20 @@ fn initialize_tracing() -> Result<(), ParseError> { fn generate_constants(out_path: &Path, config: &Config) -> Result<(), ConfigError> { info!("Generating bindings to WDK: constants.rs"); - Ok(bindgen::Builder::wdk_default(vec!["src/input.h"], config)? + let header_contents = config.bindgen_header_contents([ + ApiSubset::Base, + ApiSubset::Wdf, + #[cfg(feature = "hid")] + ApiSubset::Hid, + ]); + trace!(header_contents = ?header_contents); + + let bindgen_builder = bindgen::Builder::wdk_default(config)? .with_codegen_config(CodegenConfig::VARS) + .header_contents("constants-input.h", &header_contents); + trace!(bindgen_builder = ?bindgen_builder); + + Ok(bindgen_builder .generate() .expect("Bindings should succeed to generate") .write_to_file(out_path.join("constants.rs"))?) @@ -213,8 +239,20 @@ fn generate_constants(out_path: &Path, config: &Config) -> Result<(), ConfigErro fn generate_types(out_path: &Path, config: &Config) -> Result<(), ConfigError> { info!("Generating bindings to WDK: types.rs"); - Ok(bindgen::Builder::wdk_default(vec!["src/input.h"], config)? + let header_contents = config.bindgen_header_contents([ + ApiSubset::Base, + ApiSubset::Wdf, + #[cfg(feature = "hid")] + ApiSubset::Hid, + ]); + trace!(header_contents = ?header_contents); + + let bindgen_builder = bindgen::Builder::wdk_default(config)? .with_codegen_config(CodegenConfig::TYPES) + .header_contents("types-input.h", &header_contents); + trace!(bindgen_builder = ?bindgen_builder); + + Ok(bindgen_builder .generate() .expect("Bindings should succeed to generate") .write_to_file(out_path.join("types.rs"))?) @@ -222,31 +260,45 @@ fn generate_types(out_path: &Path, config: &Config) -> Result<(), ConfigError> { fn generate_base(out_path: &Path, config: &Config) -> Result<(), ConfigError> { let outfile_name = match &config.driver_config { - DriverConfig::Wdm | DriverConfig::Kmdf(_) => "ntddk.rs", - DriverConfig::Umdf(_) => "windows.rs", + DriverConfig::Wdm | DriverConfig::Kmdf(_) => "ntddk", + DriverConfig::Umdf(_) => "windows", }; info!("Generating bindings to WDK: {outfile_name}.rs"); - Ok(bindgen::Builder::wdk_default(vec!["src/input.h"], config)? + let header_contents = config.bindgen_header_contents([ApiSubset::Base]); + trace!(header_contents = ?header_contents); + + let bindgen_builder = bindgen::Builder::wdk_default(config)? .with_codegen_config((CodegenConfig::TYPES | CodegenConfig::VARS).complement()) + .header_contents(&format!("{outfile_name}-input.h"), &header_contents); + trace!(bindgen_builder = ?bindgen_builder); + + Ok(bindgen_builder .generate() .expect("Bindings should succeed to generate") - .write_to_file(out_path.join(outfile_name))?) + .write_to_file(out_path.join(format!("{outfile_name}.rs")))?) } fn generate_wdf(out_path: &Path, config: &Config) -> Result<(), ConfigError> { - if let DriverConfig::Kmdf(_) | DriverConfig::Umdf(_) = &config.driver_config { + if let DriverConfig::Kmdf(_) | DriverConfig::Umdf(_) = config.driver_config { info!("Generating bindings to WDK: wdf.rs"); + let header_contents = config.bindgen_header_contents([ApiSubset::Base, ApiSubset::Wdf]); + trace!(header_contents = ?header_contents); + + let bindgen_builder = bindgen::Builder::wdk_default(config)? + .with_codegen_config((CodegenConfig::TYPES | CodegenConfig::VARS).complement()) + .header_contents("wdf-input.h", &header_contents) + // Only generate for files that are prefixed with (case-insensitive) wdf (ie. + // /some/path/WdfSomeHeader.h), to prevent duplication of code in ntddk.rs + .allowlist_file("(?i).*wdf.*"); + trace!(bindgen_builder = ?bindgen_builder); + // As of NI WDK, this may generate an empty file due to no non-type and non-var // items in the wdf headers(i.e. functions are all inlined). This step is // intentionally left here in case older/newer WDKs have non-inlined functions // or new WDKs may introduce non-inlined functions. - Ok(bindgen::Builder::wdk_default(vec!["src/input.h"], config)? - .with_codegen_config((CodegenConfig::TYPES | CodegenConfig::VARS).complement()) - // Only generate for files that are prefixed with (case-insensitive) wdf (ie. - // /some/path/WdfSomeHeader.h), to prevent duplication of code in ntddk.rs - .allowlist_file("(?i).*wdf.*") + Ok(bindgen_builder .generate() .expect("Bindings should succeed to generate") .write_to_file(out_path.join("wdf.rs"))?) @@ -259,6 +311,42 @@ fn generate_wdf(out_path: &Path, config: &Config) -> Result<(), ConfigError> { } } +fn generate_hid(out_path: &Path, config: &Config) -> Result<(), ConfigError> { + cfg_if::cfg_if! { + if #[cfg(feature = "hid")] { + info!("Generating bindings to WDK: hid.rs"); + + let header_contents = config.bindgen_header_contents([ApiSubset::Base, ApiSubset::Wdf, ApiSubset::Hid]); + trace!(header_contents = ?header_contents); + + let bindgen_builder = { + let mut builder = bindgen::Builder::wdk_default(config)? + .with_codegen_config((CodegenConfig::TYPES | CodegenConfig::VARS).complement()) + .header_contents("hid-input.h", &header_contents); + + // Only allowlist files in the hid-specific files to avoid duplicate definitions + for header_file in config.headers(ApiSubset::Hid) + { + builder = builder.allowlist_file(format!("(?i).*{header_file}.*")); + } + builder + }; + trace!(bindgen_builder = ?bindgen_builder); + + Ok(bindgen_builder + .generate() + .expect("Bindings should succeed to generate") + .write_to_file(out_path.join("hid.rs"))?) + } else { + let _ = (out_path, config); // Silence unused variable warnings when hid feature is not enabled + + info!( + "Skipping hid.rs generation since hid feature is not enabled"); + Ok(()) + } + } +} + /// Generates a `wdf_function_table.rs` file in `OUT_DIR` which contains the /// definition of `WDF_FUNCTION_TABLE`. This is required to be generated here /// since the size of the table is derived from either a global symbol @@ -394,7 +482,7 @@ fn main() -> anyhow::Result<()> { .name(format!("bindgen {file_name} generator")) .spawn_scoped(thread_scope, move || { // Parent span must be manually set since spans do not persist across thread boundaries: https://github.com/tokio-rs/tracing/issues/1391 - info_span!(parent: current_span, "worker thread", generated_file_name = file_name).in_scope(|| generate_function(out_path, config)) + info_span!(parent: ¤t_span, "worker thread", generated_file_name = file_name).in_scope(|| generate_function(out_path, config)) }) .expect("Scoped Thread should spawn successfully"), ); @@ -403,23 +491,48 @@ fn main() -> anyhow::Result<()> { if let DriverConfig::Kmdf(_) | DriverConfig::Umdf(_) = config.driver_config { let current_span = Span::current(); + let config = &config; + let out_path = &out_path; + // Compile a c library to expose symbols that are not exposed because of // __declspec(selectany) thread_join_handles.push( thread::Builder::new() .name("wdf.c cc compilation".to_string()) - .spawn_scoped(thread_scope, || { + .spawn_scoped(thread_scope, move || { // Parent span must be manually set since spans do not persist across thread boundaries: https://github.com/tokio-rs/tracing/issues/1391 info_span!(parent: current_span, "cc").in_scope(|| { info!("Compiling wdf.c"); + + // Write all included headers into wdf.c (existing file, if present + // (i.e. incremental rebuild), is truncated) + let wdf_c_file_path = out_path.join("wdf.c"); + { + let mut wdf_c_file = File::create(&wdf_c_file_path)?; + wdf_c_file.write_all( + config + .bindgen_header_contents([ + ApiSubset::Base, + ApiSubset::Wdf, + #[cfg(feature = "hid")] + ApiSubset::Hid, + ]) + .as_bytes(), + )?; + + // Explicitly sync_all to surface any IO errors (File::drop + // silently ignores close errors) + wdf_c_file.sync_all()?; + } + let mut cc_builder = cc::Build::new(); - for (key, value) in config.get_preprocessor_definitions_iter() { + for (key, value) in config.preprocessor_definitions() { cc_builder.define(&key, value.as_deref()); } cc_builder - .includes(config.get_include_paths()?) - .file("src/wdf.c") + .includes(config.include_paths()?) + .file(wdf_c_file_path) .compile("wdf"); Ok::<(), ConfigError>(()) }) @@ -428,29 +541,36 @@ fn main() -> anyhow::Result<()> { ); info_span!("wdf_function_table.rs generation").in_scope(|| { - generate_wdf_function_table(&out_path, &config)?; + generate_wdf_function_table(out_path, config)?; Ok::<(), std::io::Error>(()) })?; info_span!("call_unsafe_wdf_function_binding.rs generation").in_scope(|| { - generate_call_unsafe_wdf_function_binding_macro(&out_path)?; + generate_call_unsafe_wdf_function_binding_macro(out_path)?; Ok::<(), std::io::Error>(()) })?; info_span!("test_stubs.rs generation").in_scope(|| { - generate_test_stubs(&out_path, &config)?; + generate_test_stubs(out_path, config)?; Ok::<(), std::io::Error>(()) })?; } for join_handle in thread_join_handles { let thread_name = join_handle.thread().name().unwrap_or("UNNAMED").to_string(); - join_handle - .join() - .expect("Thread should complete without panicking") - .with_context(|| { - format!(r#""{thread_name}" thread failed to exit successfully"#) - })?; + + match join_handle.join() { + // Forward panics to the main thread + Err(panic_payload) => { + panic::resume_unwind(panic_payload); + } + + Ok(thread_result) => { + thread_result.with_context(|| { + format!(r#""{thread_name}" thread failed to exit successfully"#) + })?; + } + } } Ok::<(), anyhow::Error>(()) })?; diff --git a/crates/wdk-sys/src/hid.rs b/crates/wdk-sys/src/hid.rs new file mode 100644 index 00000000..1e5d67f0 --- /dev/null +++ b/crates/wdk-sys/src/hid.rs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation +// License: MIT OR Apache-2.0 + +//! Direct FFI bindings to HID APIs from the Windows Driver Kit (WDK) +//! +//! This module contains all bindings to functions, constants, methods, +//! constructors and destructors in the following headers: `hidpddi.h`, +//! `hidport.h`, `HidSpiCx/1.0/hidspicx.h`, `kbdmou.h`, `ntdd8042.h`, +//! `hidclass.h`, `hidsdi.h`, `hidpi.h`, `vhf.h`. Types are not included in this +//! module, but are available in the top-level `wdk_sys` module. + +#[allow( + missing_docs, + reason = "most items in the WDK headers have no inline documentation, so bindgen is unable to \ + generate documentation for their bindings" +)] +mod bindings { + // allow wildcards for types module since underlying c code relies on all + // type definitions being in scope + #[allow(clippy::wildcard_imports)] + use crate::types::*; + + include!(concat!(env!("OUT_DIR"), "/hid.rs")); +} +pub use bindings::*; diff --git a/crates/wdk-sys/src/input.h b/crates/wdk-sys/src/input.h deleted file mode 100644 index dec71ce3..00000000 --- a/crates/wdk-sys/src/input.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) Microsoft Corporation - License: MIT OR Apache-2.0 */ - -#if defined(UMDF_VERSION_MAJOR) - -#include - -#else // !defined(UMDF_VERSION_MAJOR) - -#include "ntifs.h" -#include "ntddk.h" - -// FIXME: Why is there no definition for this struct? Maybe blocklist this struct in bindgen. -typedef union _KGDTENTRY64 -{ - struct - { - unsigned short LimitLow; - unsigned short BaseLow; - union - { - struct - { - unsigned char BaseMiddle; - unsigned char Flags1; - unsigned char Flags2; - unsigned char BaseHigh; - } Bytes; - struct - { - unsigned long BaseMiddle : 8; - unsigned long Type : 5; - unsigned long Dpl : 2; - unsigned long Present : 1; - unsigned long LimitHigh : 4; - unsigned long System : 1; - unsigned long LongMode : 1; - unsigned long DefaultBig : 1; - unsigned long Granularity : 1; - unsigned long BaseHigh : 8; - } Bits; - }; - unsigned long BaseUpper; - unsigned long MustBeZero; - }; - unsigned __int64 Alignment; -} KGDTENTRY64, *PKGDTENTRY64; - -typedef union _KIDTENTRY64 -{ - struct - { - unsigned short OffsetLow; - unsigned short Selector; - unsigned short IstIndex : 3; - unsigned short Reserved0 : 5; - unsigned short Type : 5; - unsigned short Dpl : 2; - unsigned short Present : 1; - unsigned short OffsetMiddle; - unsigned long OffsetHigh; - unsigned long Reserved1; - }; - unsigned __int64 Alignment; -} KIDTENTRY64, *PKIDTENTRY64; -#endif // !defined(UMDF_VERSION_MAJOR) - -#if defined(KMDF_VERSION_MAJOR) || defined(UMDF_VERSION_MAJOR) - -#include - -#endif // defined(KMDF_VERSION_MAJOR) || defined(UMDF_VERSION_MAJOR) diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index e6627c2e..9f0342ac 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -24,12 +24,23 @@ pub use crate::{constants::*, types::*}; #[cfg(any(driver_model__driver_type = "WDM", driver_model__driver_type = "KMDF"))] pub mod ntddk; + #[cfg(any(driver_model__driver_type = "KMDF", driver_model__driver_type = "UMDF"))] pub mod wdf; #[cfg(driver_model__driver_type = "UMDF")] pub mod windows; +#[cfg(all( + any( + driver_model__driver_type = "WDM", + driver_model__driver_type = "KMDF", + driver_model__driver_type = "UMDF" + ), + feature = "hid" +))] +pub mod hid; + #[cfg(feature = "test-stubs")] pub mod test_stubs; diff --git a/crates/wdk-sys/src/wdf.c b/crates/wdk-sys/src/wdf.c deleted file mode 100644 index 37275965..00000000 --- a/crates/wdk-sys/src/wdf.c +++ /dev/null @@ -1,4 +0,0 @@ -/* Copyright (c) Microsoft Corporation - License: MIT OR Apache-2.0 */ - -#include "input.h" diff --git a/examples/sample-kmdf-driver/Cargo.lock b/examples/sample-kmdf-driver/Cargo.lock index 3d97400d..526dfb40 100644 --- a/examples/sample-kmdf-driver/Cargo.lock +++ b/examples/sample-kmdf-driver/Cargo.lock @@ -68,9 +68,9 @@ checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -623,9 +623,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -634,9 +634,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -645,9 +645,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -666,9 +666,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -763,6 +763,7 @@ dependencies = [ "bindgen", "cargo_metadata", "cc", + "cfg-if", "lazy_static", "rustversion", "serde_json", diff --git a/examples/sample-kmdf-driver/Cargo.toml b/examples/sample-kmdf-driver/Cargo.toml index e5bf2ef8..42c92bb6 100644 --- a/examples/sample-kmdf-driver/Cargo.toml +++ b/examples/sample-kmdf-driver/Cargo.toml @@ -31,6 +31,9 @@ wdk-sys = { path = "../../crates/wdk-sys", version = "0.3.0" } [features] default = [] + +hid = ["wdk-sys/hid"] + nightly = ["wdk/nightly", "wdk-sys/nightly"] [profile.dev] diff --git a/examples/sample-kmdf-driver/src/lib.rs b/examples/sample-kmdf-driver/src/lib.rs index 62540648..72266c3c 100644 --- a/examples/sample-kmdf-driver/src/lib.rs +++ b/examples/sample-kmdf-driver/src/lib.rs @@ -135,9 +135,10 @@ pub unsafe extern "system" fn driver_entry( // of the slice must be no larger than `isize::MAX`. This is proven by the below // `debug_assert!`. unsafe { - debug_assert!( - isize::try_from(number_of_slice_elements * core::mem::size_of::()).is_ok() - ); + debug_assert!(isize::try_from( + number_of_slice_elements * core::mem::size_of::() + ) + .is_ok()); slice::from_raw_parts(registry_path.Buffer, number_of_slice_elements) }, ); diff --git a/examples/sample-umdf-driver/Cargo.lock b/examples/sample-umdf-driver/Cargo.lock index 3346a657..4c1630ea 100644 --- a/examples/sample-umdf-driver/Cargo.lock +++ b/examples/sample-umdf-driver/Cargo.lock @@ -68,9 +68,9 @@ checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -621,9 +621,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -632,9 +632,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -643,9 +643,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -664,9 +664,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -747,6 +747,7 @@ dependencies = [ "bindgen", "cargo_metadata", "cc", + "cfg-if", "lazy_static", "rustversion", "serde_json", diff --git a/examples/sample-umdf-driver/Cargo.toml b/examples/sample-umdf-driver/Cargo.toml index 36e72907..9b8d9003 100644 --- a/examples/sample-umdf-driver/Cargo.toml +++ b/examples/sample-umdf-driver/Cargo.toml @@ -29,6 +29,9 @@ wdk-sys = { path = "../../crates/wdk-sys", version = "0.3.0" } [features] default = [] + +hid = ["wdk-sys/hid"] + nightly = ["wdk/nightly", "wdk-sys/nightly"] [profile.dev] diff --git a/examples/sample-umdf-driver/src/lib.rs b/examples/sample-umdf-driver/src/lib.rs index 70010e80..61607443 100644 --- a/examples/sample-umdf-driver/src/lib.rs +++ b/examples/sample-umdf-driver/src/lib.rs @@ -120,9 +120,10 @@ pub unsafe extern "system" fn driver_entry( // of the slice must be no larger than `isize::MAX`. This is proven by the below // `debug_assert!`. unsafe { - debug_assert!( - isize::try_from(number_of_slice_elements * core::mem::size_of::()).is_ok() - ); + debug_assert!(isize::try_from( + number_of_slice_elements * core::mem::size_of::() + ) + .is_ok()); slice::from_raw_parts(registry_path.Buffer, number_of_slice_elements) }, ); diff --git a/examples/sample-wdm-driver/Cargo.lock b/examples/sample-wdm-driver/Cargo.lock index 2e31bb6e..25dbf949 100644 --- a/examples/sample-wdm-driver/Cargo.lock +++ b/examples/sample-wdm-driver/Cargo.lock @@ -68,9 +68,9 @@ checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -623,9 +623,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -634,9 +634,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -645,9 +645,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -666,9 +666,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -763,6 +763,7 @@ dependencies = [ "bindgen", "cargo_metadata", "cc", + "cfg-if", "lazy_static", "rustversion", "serde_json", diff --git a/examples/sample-wdm-driver/Cargo.toml b/examples/sample-wdm-driver/Cargo.toml index 529876d9..96457bd1 100644 --- a/examples/sample-wdm-driver/Cargo.toml +++ b/examples/sample-wdm-driver/Cargo.toml @@ -30,6 +30,9 @@ wdk-sys = { path = "../../crates/wdk-sys", version = "0.3.0" } [features] default = [] + +hid = ["wdk-sys/hid"] + nightly = ["wdk/nightly", "wdk-sys/nightly"] [profile.dev] diff --git a/tests/config-kmdf/Cargo.lock b/tests/config-kmdf/Cargo.lock index e04cd224..4b2cb1c9 100644 --- a/tests/config-kmdf/Cargo.lock +++ b/tests/config-kmdf/Cargo.lock @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -747,9 +747,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -758,9 +758,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -769,9 +769,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -790,9 +790,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -891,6 +891,7 @@ dependencies = [ "bindgen", "cargo_metadata", "cc", + "cfg-if", "lazy_static", "rustversion", "serde_json", diff --git a/tests/config-umdf/Cargo.lock b/tests/config-umdf/Cargo.lock index 98bc80b6..89275340 100644 --- a/tests/config-umdf/Cargo.lock +++ b/tests/config-umdf/Cargo.lock @@ -77,9 +77,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -747,9 +747,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -758,9 +758,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -769,9 +769,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -790,9 +790,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -891,6 +891,7 @@ dependencies = [ "bindgen", "cargo_metadata", "cc", + "cfg-if", "lazy_static", "rustversion", "serde_json", diff --git a/tests/mixed-package-kmdf-workspace/Cargo.lock b/tests/mixed-package-kmdf-workspace/Cargo.lock index 9ede1b9c..2a9075f2 100644 --- a/tests/mixed-package-kmdf-workspace/Cargo.lock +++ b/tests/mixed-package-kmdf-workspace/Cargo.lock @@ -68,9 +68,9 @@ checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -628,9 +628,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -639,9 +639,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -650,9 +650,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -671,9 +671,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -768,6 +768,7 @@ dependencies = [ "bindgen", "cargo_metadata", "cc", + "cfg-if", "lazy_static", "rustversion", "serde_json", diff --git a/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs b/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs index c7053e02..289d22f5 100644 --- a/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs +++ b/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs @@ -24,6 +24,7 @@ use wdk_sys::{ DRIVER_OBJECT, NTSTATUS, PCUNICODE_STRING, + PDRIVER_OBJECT, ULONG, UNICODE_STRING, WCHAR, @@ -132,9 +133,10 @@ pub unsafe extern "system" fn driver_entry( // of the slice must be no larger than `isize::MAX`. This is proven by the below // `debug_assert!`. unsafe { - debug_assert!( - isize::try_from(number_of_slice_elements * core::mem::size_of::()).is_ok() - ); + debug_assert!(isize::try_from( + number_of_slice_elements * core::mem::size_of::() + ) + .is_ok()); slice::from_raw_parts(registry_path.Buffer, number_of_slice_elements) }, ); diff --git a/tests/umdf-driver-workspace/Cargo.lock b/tests/umdf-driver-workspace/Cargo.lock index 12452f1a..9afb1139 100644 --- a/tests/umdf-driver-workspace/Cargo.lock +++ b/tests/umdf-driver-workspace/Cargo.lock @@ -68,9 +68,9 @@ checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -631,9 +631,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -642,9 +642,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -653,9 +653,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -674,9 +674,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -757,6 +757,7 @@ dependencies = [ "bindgen", "cargo_metadata", "cc", + "cfg-if", "lazy_static", "rustversion", "serde_json", diff --git a/tests/umdf-driver-workspace/crates/driver_1/src/lib.rs b/tests/umdf-driver-workspace/crates/driver_1/src/lib.rs index a322d789..71623cce 100644 --- a/tests/umdf-driver-workspace/crates/driver_1/src/lib.rs +++ b/tests/umdf-driver-workspace/crates/driver_1/src/lib.rs @@ -120,9 +120,10 @@ pub unsafe extern "system" fn driver_entry( // of the slice must be no larger than `isize::MAX`. This is proven by the below // `debug_assert!`. unsafe { - debug_assert!( - isize::try_from(number_of_slice_elements * core::mem::size_of::()).is_ok() - ); + debug_assert!(isize::try_from( + number_of_slice_elements * core::mem::size_of::() + ) + .is_ok()); slice::from_raw_parts(registry_path.Buffer, number_of_slice_elements) }, ); diff --git a/tests/umdf-driver-workspace/crates/driver_2/src/lib.rs b/tests/umdf-driver-workspace/crates/driver_2/src/lib.rs index a322d789..71623cce 100644 --- a/tests/umdf-driver-workspace/crates/driver_2/src/lib.rs +++ b/tests/umdf-driver-workspace/crates/driver_2/src/lib.rs @@ -120,9 +120,10 @@ pub unsafe extern "system" fn driver_entry( // of the slice must be no larger than `isize::MAX`. This is proven by the below // `debug_assert!`. unsafe { - debug_assert!( - isize::try_from(number_of_slice_elements * core::mem::size_of::()).is_ok() - ); + debug_assert!(isize::try_from( + number_of_slice_elements * core::mem::size_of::() + ) + .is_ok()); slice::from_raw_parts(registry_path.Buffer, number_of_slice_elements) }, ); diff --git a/tests/wdk-sys-tests/Cargo.lock b/tests/wdk-sys-tests/Cargo.lock index cac2edd9..df4f3799 100644 --- a/tests/wdk-sys-tests/Cargo.lock +++ b/tests/wdk-sys-tests/Cargo.lock @@ -68,9 +68,9 @@ checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "bindgen" -version = "0.69.4" +version = "0.69.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" dependencies = [ "bitflags", "cexpr", @@ -613,9 +613,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -624,9 +624,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -635,9 +635,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -656,9 +656,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -729,6 +729,7 @@ dependencies = [ "bindgen", "cargo_metadata", "cc", + "cfg-if", "lazy_static", "rustversion", "serde_json",