From a79f3b4b0498538cd6b85a1b375b366aec7a9130 Mon Sep 17 00:00:00 2001 From: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com> Date: Tue, 9 Jul 2024 12:28:46 -0700 Subject: [PATCH 1/7] Add more precise NTSTATUS macros. --- crates/wdk-sys/src/lib.rs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index 63844a3e..79a13d8e 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -64,8 +64,33 @@ lazy_static! { #[allow(missing_docs)] #[must_use] #[allow(non_snake_case)] +#[allow(clippy::cast_sign_loss)] pub const fn NT_SUCCESS(nt_status: NTSTATUS) -> bool { - nt_status >= 0 + nt_status as u32 <= 0x7FFF_FFFF +} + +#[allow(missing_docs)] +#[must_use] +#[allow(non_snake_case)] +#[allow(clippy::cast_sign_loss)] +pub const fn NT_INFORMATION(nt_status: NTSTATUS) -> bool { + nt_status as u32 >= 0x4000_0000 && nt_status as u32 <= 0x7FFF_FFFF +} + +#[allow(missing_docs)] +#[must_use] +#[allow(non_snake_case)] +#[allow(clippy::cast_sign_loss)] +pub const fn NT_WARNING(nt_status: NTSTATUS) -> bool { + nt_status as u32 >= 0x8000_0000 && nt_status as u32 <= 0xBFFF_FFFF +} + +#[allow(missing_docs)] +#[must_use] +#[allow(non_snake_case)] +#[allow(clippy::cast_sign_loss)] +pub const fn NT_ERROR(nt_status: NTSTATUS) -> bool { + nt_status as u32 >= 0xC000_0000 } #[allow(missing_docs)] From 274ac9ecc8e8a661dbdfcaf8127e9235d1843b69 Mon Sep 17 00:00:00 2001 From: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com> Date: Wed, 17 Jul 2024 16:34:06 -0700 Subject: [PATCH 2/7] Update functions to match WDK and provide docs. --- crates/wdk-sys/src/lib.rs | 40 +++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index 79a13d8e..5f12aaaf 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -61,36 +61,52 @@ lazy_static! { }; } -#[allow(missing_docs)] #[must_use] #[allow(non_snake_case)] -#[allow(clippy::cast_sign_loss)] +/// Evaluates to TRUE if the return value specified by `nt_status` is a success +/// type (0 − 0x3FFFFFFF) or an informational type (0x40000000 − 0x7FFFFFFF). +/// This function is taken from ntdef.h in the WDK. +/// +/// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and +/// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details. pub const fn NT_SUCCESS(nt_status: NTSTATUS) -> bool { - nt_status as u32 <= 0x7FFF_FFFF + nt_status >= 0 } -#[allow(missing_docs)] #[must_use] #[allow(non_snake_case)] -#[allow(clippy::cast_sign_loss)] +/// Evaluates to TRUE if the return value specified by `nt_status` is an +/// informational type (0x40000000 − 0x7FFFFFFF). This function is taken from +/// ntdef.h in the WDK. +/// +/// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and +/// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details. pub const fn NT_INFORMATION(nt_status: NTSTATUS) -> bool { - nt_status as u32 >= 0x4000_0000 && nt_status as u32 <= 0x7FFF_FFFF + nt_status >> 30 == 1 } -#[allow(missing_docs)] #[must_use] #[allow(non_snake_case)] -#[allow(clippy::cast_sign_loss)] +/// Evaluates to TRUE if the return value specified by `nt_status` is a warning +/// type (0x80000000 − 0xBFFFFFFF). This function is taken from ntdef.h in the +/// WDK. +/// +/// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and +/// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details. pub const fn NT_WARNING(nt_status: NTSTATUS) -> bool { - nt_status as u32 >= 0x8000_0000 && nt_status as u32 <= 0xBFFF_FFFF + nt_status >> 30 == 2 } -#[allow(missing_docs)] #[must_use] #[allow(non_snake_case)] -#[allow(clippy::cast_sign_loss)] +/// Evaluates to TRUE if the return value specified by `nt_status` is an error +/// type (0xC0000000 - 0xFFFFFFFF). This function is taken from ntdef.h in the +/// WDK. +/// +/// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and +/// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details. pub const fn NT_ERROR(nt_status: NTSTATUS) -> bool { - nt_status as u32 >= 0xC000_0000 + nt_status >> 30 == 3 } #[allow(missing_docs)] From 81c281182703c9155bcc5a4f66675a5ebc58f62b Mon Sep 17 00:00:00 2001 From: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:40:22 -0700 Subject: [PATCH 3/7] Add tests and fix parentheses+casting. --- crates/wdk-sys/src/lib.rs | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index 5f12aaaf..633ba2b3 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -82,7 +82,7 @@ pub const fn NT_SUCCESS(nt_status: NTSTATUS) -> bool { /// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and /// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details. pub const fn NT_INFORMATION(nt_status: NTSTATUS) -> bool { - nt_status >> 30 == 1 + (nt_status as u32 >> 30) == 1 } #[must_use] @@ -94,7 +94,7 @@ pub const fn NT_INFORMATION(nt_status: NTSTATUS) -> bool { /// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and /// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details. pub const fn NT_WARNING(nt_status: NTSTATUS) -> bool { - nt_status >> 30 == 2 + (nt_status as u32 >> 30) == 2 } #[must_use] @@ -106,7 +106,7 @@ pub const fn NT_WARNING(nt_status: NTSTATUS) -> bool { /// See the [NTSTATUS reference](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/87fba13e-bf06-450e-83b1-9241dc81e781) and /// [Using NTSTATUS values](https://learn.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values) for details. pub const fn NT_ERROR(nt_status: NTSTATUS) -> bool { - nt_status >> 30 == 3 + (nt_status as u32 >> 30) == 3 } #[allow(missing_docs)] @@ -117,3 +117,28 @@ macro_rules! PAGED_CODE { debug_assert!(unsafe { KeGetCurrentIrql() <= APC_LEVEL as u8 }); }; } + +#[cfg(test)] +mod tests { + use crate::{ + NT_ERROR, + NT_INFORMATION, + NT_SUCCESS, + NT_WARNING, + STATUS_BREAKPOINT, + STATUS_HIBERNATED, + STATUS_PRIVILEGED_INSTRUCTION, + STATUS_SUCCESS, + }; + #[test] + pub fn status_tests() { + const { + assert!(NT_SUCCESS(STATUS_SUCCESS)); + assert!(NT_SUCCESS(STATUS_HIBERNATED)); + assert!(NT_INFORMATION(STATUS_HIBERNATED)); + assert!(NT_WARNING(STATUS_BREAKPOINT)); + assert!(NT_ERROR(STATUS_PRIVILEGED_INSTRUCTION)); + assert!(!(NT_INFORMATION(STATUS_SUCCESS))); + } + } +} From 8f80b01964118aca3d8a0e29f26aa1485be841c6 Mon Sep 17 00:00:00 2001 From: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com> Date: Wed, 17 Jul 2024 17:43:56 -0700 Subject: [PATCH 4/7] Re-introduce clippy allow for sign loss --- crates/wdk-sys/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index 633ba2b3..e4621107 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -75,6 +75,7 @@ pub const fn NT_SUCCESS(nt_status: NTSTATUS) -> bool { #[must_use] #[allow(non_snake_case)] +#[allow(clippy::cast_sign_loss)] /// Evaluates to TRUE if the return value specified by `nt_status` is an /// informational type (0x40000000 − 0x7FFFFFFF). This function is taken from /// ntdef.h in the WDK. @@ -87,6 +88,7 @@ pub const fn NT_INFORMATION(nt_status: NTSTATUS) -> bool { #[must_use] #[allow(non_snake_case)] +#[allow(clippy::cast_sign_loss)] /// Evaluates to TRUE if the return value specified by `nt_status` is a warning /// type (0x80000000 − 0xBFFFFFFF). This function is taken from ntdef.h in the /// WDK. @@ -99,6 +101,7 @@ pub const fn NT_WARNING(nt_status: NTSTATUS) -> bool { #[must_use] #[allow(non_snake_case)] +#[allow(clippy::cast_sign_loss)] /// Evaluates to TRUE if the return value specified by `nt_status` is an error /// type (0xC0000000 - 0xFFFFFFFF). This function is taken from ntdef.h in the /// WDK. From 5e427e7e1547531b7efb6d7c94058ef48341129b Mon Sep 17 00:00:00 2001 From: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com> Date: Wed, 17 Jul 2024 20:11:12 -0700 Subject: [PATCH 5/7] Fix clippy issues in test and add cases --- crates/wdk-sys/src/lib.rs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index e4621107..6ba3a1e7 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -134,14 +134,22 @@ mod tests { STATUS_SUCCESS, }; #[test] - pub fn status_tests() { - const { - assert!(NT_SUCCESS(STATUS_SUCCESS)); - assert!(NT_SUCCESS(STATUS_HIBERNATED)); - assert!(NT_INFORMATION(STATUS_HIBERNATED)); - assert!(NT_WARNING(STATUS_BREAKPOINT)); - assert!(NT_ERROR(STATUS_PRIVILEGED_INSTRUCTION)); - assert!(!(NT_INFORMATION(STATUS_SUCCESS))); - } + pub const fn nt_status_validation() { + assert!(NT_SUCCESS(STATUS_SUCCESS)); + assert!(NT_SUCCESS(STATUS_HIBERNATED)); + assert!(NT_INFORMATION(STATUS_HIBERNATED)); + assert!(NT_WARNING(STATUS_BREAKPOINT)); + assert!(NT_ERROR(STATUS_PRIVILEGED_INSTRUCTION)); + assert!(!NT_SUCCESS(STATUS_BREAKPOINT)); + assert!(!NT_SUCCESS(STATUS_PRIVILEGED_INSTRUCTION)); + assert!(!NT_INFORMATION(STATUS_SUCCESS)); + assert!(!NT_INFORMATION(STATUS_BREAKPOINT)); + assert!(!NT_INFORMATION(STATUS_PRIVILEGED_INSTRUCTION)); + assert!(!NT_WARNING(STATUS_SUCCESS)); + assert!(!NT_WARNING(STATUS_HIBERNATED)); + assert!(!NT_WARNING(STATUS_PRIVILEGED_INSTRUCTION)); + assert!(!NT_ERROR(STATUS_SUCCESS)); + assert!(!NT_ERROR(STATUS_HIBERNATED)); + assert!(!NT_ERROR(STATUS_BREAKPOINT)); } } From 372b40b206e254222d440b2bb4a2322cdbba2908 Mon Sep 17 00:00:00 2001 From: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com> Date: Wed, 4 Sep 2024 16:46:51 -0700 Subject: [PATCH 6/7] Factor out wdk_sys NT_SUCCESS tests to a new folder. --- Cargo.toml | 1 + crates/wdk-sys/src/lib.rs | 33 - tests/Makefile.toml | 1 + tests/wdk-sys-tests/Cargo.lock | 917 ++++++++++++++++++ tests/wdk-sys-tests/Cargo.toml | 15 + tests/wdk-sys-tests/src/lib.rs | 2 + .../tests/nt_status_functions.rs | 35 + 7 files changed, 971 insertions(+), 33 deletions(-) create mode 100644 tests/wdk-sys-tests/Cargo.lock create mode 100644 tests/wdk-sys-tests/Cargo.toml create mode 100644 tests/wdk-sys-tests/src/lib.rs create mode 100644 tests/wdk-sys-tests/tests/nt_status_functions.rs diff --git a/Cargo.toml b/Cargo.toml index 2ba2a93a..b136f24f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ exclude = [ "tests/config-umdf", "tests/config-wdm", "tests/wdk-macros-tests", + "tests/wdk-sys-tests", ] resolver = "2" diff --git a/crates/wdk-sys/src/lib.rs b/crates/wdk-sys/src/lib.rs index 5d74a5e4..449964ee 100644 --- a/crates/wdk-sys/src/lib.rs +++ b/crates/wdk-sys/src/lib.rs @@ -149,36 +149,3 @@ macro_rules! PAGED_CODE { debug_assert!(unsafe { KeGetCurrentIrql() <= APC_LEVEL as u8 }); }; } - -#[cfg(test)] -mod tests { - use crate::{ - NT_ERROR, - NT_INFORMATION, - NT_SUCCESS, - NT_WARNING, - STATUS_BREAKPOINT, - STATUS_HIBERNATED, - STATUS_PRIVILEGED_INSTRUCTION, - STATUS_SUCCESS, - }; - #[test] - pub const fn nt_status_validation() { - assert!(NT_SUCCESS(STATUS_SUCCESS)); - assert!(NT_SUCCESS(STATUS_HIBERNATED)); - assert!(NT_INFORMATION(STATUS_HIBERNATED)); - assert!(NT_WARNING(STATUS_BREAKPOINT)); - assert!(NT_ERROR(STATUS_PRIVILEGED_INSTRUCTION)); - assert!(!NT_SUCCESS(STATUS_BREAKPOINT)); - assert!(!NT_SUCCESS(STATUS_PRIVILEGED_INSTRUCTION)); - assert!(!NT_INFORMATION(STATUS_SUCCESS)); - assert!(!NT_INFORMATION(STATUS_BREAKPOINT)); - assert!(!NT_INFORMATION(STATUS_PRIVILEGED_INSTRUCTION)); - assert!(!NT_WARNING(STATUS_SUCCESS)); - assert!(!NT_WARNING(STATUS_HIBERNATED)); - assert!(!NT_WARNING(STATUS_PRIVILEGED_INSTRUCTION)); - assert!(!NT_ERROR(STATUS_SUCCESS)); - assert!(!NT_ERROR(STATUS_HIBERNATED)); - assert!(!NT_ERROR(STATUS_BREAKPOINT)); - } -} diff --git a/tests/Makefile.toml b/tests/Makefile.toml index 2d397273..12d362e1 100644 --- a/tests/Makefile.toml +++ b/tests/Makefile.toml @@ -9,4 +9,5 @@ CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = [ "mixed-package-kmdf-workspace", "umdf-driver-workspace", "wdk-macros-tests", + "wdk-sys-tests" ] diff --git a/tests/wdk-sys-tests/Cargo.lock b/tests/wdk-sys-tests/Cargo.lock new file mode 100644 index 00000000..7ff6a215 --- /dev/null +++ b/tests/wdk-sys-tests/Cargo.lock @@ -0,0 +1,917 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "itertools 0.12.1", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", + "which", +] + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "camino" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" +dependencies = [ + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "4.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap-cargo" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2ea69cefa96b848b73ad516ad1d59a195cdf9263087d977f648a818c8b43e" +dependencies = [ + "anstyle", + "clap", +] + +[[package]] +name = "clap_builder" +version = "4.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.158" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" + +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "prettyplease" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] + +[[package]] +name = "serde" +version = "1.0.209" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.209" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.128" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "wdk-build" +version = "0.2.0" +dependencies = [ + "anyhow", + "bindgen", + "camino", + "cargo_metadata", + "clap", + "clap-cargo", + "lazy_static", + "paste", + "rustversion", + "serde", + "serde_json", + "thiserror", + "tracing", + "windows", +] + +[[package]] +name = "wdk-macros" +version = "0.2.0" +dependencies = [ + "itertools 0.13.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wdk-sys" +version = "0.2.0" +dependencies = [ + "anyhow", + "bindgen", + "cargo_metadata", + "cc", + "lazy_static", + "rustversion", + "serde_json", + "thiserror", + "tracing", + "tracing-subscriber", + "wdk-build", + "wdk-macros", +] + +[[package]] +name = "wdk-sys-tests" +version = "0.1.0" +dependencies = [ + "wdk-sys", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" +dependencies = [ + "windows-core", + "windows-targets", +] + +[[package]] +name = "windows-core" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-result", + "windows-strings", + "windows-targets", +] + +[[package]] +name = "windows-implement" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/tests/wdk-sys-tests/Cargo.toml b/tests/wdk-sys-tests/Cargo.toml new file mode 100644 index 00000000..775298de --- /dev/null +++ b/tests/wdk-sys-tests/Cargo.toml @@ -0,0 +1,15 @@ +[package] +edition = "2021" +name = "wdk-sys-tests" +version = "0.1.0" +description = "Tests for wdk-sys that rely on there being a WDM, KMDF, or UMDF config enabled" +license = "MIT OR Apache-2.0" +publish = false + +[package.metadata.wdk.driver-model] +driver-type = "WDM" + +[lib] + +[dependencies] +wdk-sys = { path = "../../crates/wdk-sys" } diff --git a/tests/wdk-sys-tests/src/lib.rs b/tests/wdk-sys-tests/src/lib.rs new file mode 100644 index 00000000..30594960 --- /dev/null +++ b/tests/wdk-sys-tests/src/lib.rs @@ -0,0 +1,2 @@ +// Copyright (c) Microsoft Corporation +// License: MIT OR Apache-2.0 diff --git a/tests/wdk-sys-tests/tests/nt_status_functions.rs b/tests/wdk-sys-tests/tests/nt_status_functions.rs new file mode 100644 index 00000000..6ce27586 --- /dev/null +++ b/tests/wdk-sys-tests/tests/nt_status_functions.rs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation +// License: MIT OR Apache-2.0 + +#[cfg(test)] +mod tests { + use wdk_sys::{ + NT_ERROR, + NT_INFORMATION, + NT_SUCCESS, + NT_WARNING, + STATUS_BREAKPOINT, + STATUS_HIBERNATED, + STATUS_PRIVILEGED_INSTRUCTION, + STATUS_SUCCESS, + }; + #[test] + pub const fn nt_status_validation() { + assert!(NT_SUCCESS(STATUS_SUCCESS)); + assert!(NT_SUCCESS(STATUS_HIBERNATED)); + assert!(NT_INFORMATION(STATUS_HIBERNATED)); + assert!(NT_WARNING(STATUS_BREAKPOINT)); + assert!(NT_ERROR(STATUS_PRIVILEGED_INSTRUCTION)); + assert!(!NT_SUCCESS(STATUS_BREAKPOINT)); + assert!(!NT_SUCCESS(STATUS_PRIVILEGED_INSTRUCTION)); + assert!(!NT_INFORMATION(STATUS_SUCCESS)); + assert!(!NT_INFORMATION(STATUS_BREAKPOINT)); + assert!(!NT_INFORMATION(STATUS_PRIVILEGED_INSTRUCTION)); + assert!(!NT_WARNING(STATUS_SUCCESS)); + assert!(!NT_WARNING(STATUS_HIBERNATED)); + assert!(!NT_WARNING(STATUS_PRIVILEGED_INSTRUCTION)); + assert!(!NT_ERROR(STATUS_SUCCESS)); + assert!(!NT_ERROR(STATUS_HIBERNATED)); + assert!(!NT_ERROR(STATUS_BREAKPOINT)); + } +} From 5cecebbb068e4ccb591763b018f8cd2a96431f37 Mon Sep 17 00:00:00 2001 From: NateD-MSFT <34494373+NateD-MSFT@users.noreply.github.com> Date: Wed, 4 Sep 2024 16:48:24 -0700 Subject: [PATCH 7/7] TOML format fix --- tests/Makefile.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.toml b/tests/Makefile.toml index 12d362e1..33fd10ab 100644 --- a/tests/Makefile.toml +++ b/tests/Makefile.toml @@ -9,5 +9,5 @@ CARGO_MAKE_CRATE_WORKSPACE_MEMBERS = [ "mixed-package-kmdf-workspace", "umdf-driver-workspace", "wdk-macros-tests", - "wdk-sys-tests" + "wdk-sys-tests", ]