feat(windows-drivers): vendor wdk 0.5.1 + add ApiSubset::Iddcx (M1 spike)
windows-drivers / probe-and-proto (push) Successful in 24s
apple / swift (push) Successful in 1m8s
windows-drivers / driver-build (push) Failing after 43s
ci / rust (push) Successful in 1m31s
ci / web (push) Successful in 1m5s
ci / docs-site (push) Successful in 52s
apple / screenshots (push) Failing after 2m35s
windows-host / package (push) Successful in 5m23s
ci / bench (push) Successful in 4m48s
android / android (push) Successful in 10m1s
decky / build-publish (push) Successful in 26s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 4s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 4s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 4s
deb / build-publish (push) Successful in 3m29s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 4s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 2m21s
rpm / build-publish (bazzite, punktfunk-fedora-rpm) (push) Successful in 8m23s
rpm / build-publish (fedora-44, punktfunk-fedora44-rpm) (push) Successful in 8m18s
docker / deploy-docs (push) Successful in 21s
windows-drivers / probe-and-proto (push) Successful in 24s
apple / swift (push) Successful in 1m8s
windows-drivers / driver-build (push) Failing after 43s
ci / rust (push) Successful in 1m31s
ci / web (push) Successful in 1m5s
ci / docs-site (push) Successful in 52s
apple / screenshots (push) Failing after 2m35s
windows-host / package (push) Successful in 5m23s
ci / bench (push) Successful in 4m48s
android / android (push) Successful in 10m1s
decky / build-publish (push) Successful in 26s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 4s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 4s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 4s
deb / build-publish (push) Successful in 3m29s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 4s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 2m21s
rpm / build-publish (bazzite, punktfunk-fedora-rpm) (push) Successful in 8m23s
rpm / build-publish (fedora-44, punktfunk-fedora44-rpm) (push) Successful in 8m18s
docker / deploy-docs (push) Successful in 21s
Vendor the published, self-contained windows-drivers-rs 0.5.1 crates (wdk-build, wdk-sys) under vendor/ and add a first-class ApiSubset::Iddcx that bindgens iddcx/1.10/IddCx.h in an extra pass reusing bindgen::Builder::wdk_default (allowlist_file (?i).*iddcx.* — emits only IddCx items; WDF/DXGI types resolve to the shared base/wdf bindings, type-identity by construction). Mirrors the existing gpio/hid/spb subsets exactly: wdk-build gets the enum variant + iddcx_headers() (UMDF-only), wdk-sys gets generate_iddcx + the iddcx feature + pub mod iddcx. [patch.crates-io] redirects all wdk-sys/wdk-build (incl. wdk 0.4.1 transitive) to the patched copies. wdk-probe enables the iddcx feature. MAKE-OR-BREAK: does IddCx.h bindgen in wdk-sys config without a header conflict (issue #515) + does the generated module compile (type-identity)? CI answers it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct FFI bindings to GPIO APIs from the Windows Driver Kit (WDK)
|
||||
//!
|
||||
//! This module contains all bindings to functions, constants, methods,
|
||||
//! constructors and destructors in the following headers: `gpio.h`,
|
||||
//! `gpioclx.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(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain versions of the WDK, there are no functions related to GPIO that can \
|
||||
be generated by bindgen, so these types are unused"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/gpio.rs"));
|
||||
}
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain versions of the WDK, there are no functions related to GPIO that can be \
|
||||
generated by bindgen, so the `bindings` module is empty"
|
||||
)]
|
||||
pub use bindings::*;
|
||||
@@ -0,0 +1,28 @@
|
||||
// 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(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/hid.rs"));
|
||||
}
|
||||
pub use bindings::*;
|
||||
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct FFI bindings to IddCx APIs from the Windows Driver Kit (WDK)
|
||||
//!
|
||||
//! This module contains all bindings to functions, constants, methods,
|
||||
//! constructors and destructors in the following headers: `iddcx/1.10/IddCx.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(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain versions of the WDK, there are no functions related to IddCx that can \
|
||||
be generated by bindgen, so these types are unused"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/iddcx.rs"));
|
||||
}
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain versions of the WDK, there are no functions related to IddCx that can be \
|
||||
generated by bindgen, so the `bindings` module is empty"
|
||||
)]
|
||||
pub use bindings::*;
|
||||
+242
@@ -0,0 +1,242 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct bindings to APIs available in the Windows Development Kit (WDK)
|
||||
|
||||
#![no_std]
|
||||
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
#[doc(hidden)]
|
||||
pub use wdk_macros as __proc_macros;
|
||||
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
pub use crate::{constants::*, types::*};
|
||||
|
||||
#[cfg(any(driver_model__driver_type = "WDM", driver_model__driver_type = "KMDF"))]
|
||||
pub mod ntddk;
|
||||
|
||||
#[cfg(driver_model__driver_type = "UMDF")]
|
||||
pub mod windows;
|
||||
|
||||
#[cfg(any(driver_model__driver_type = "KMDF", driver_model__driver_type = "UMDF"))]
|
||||
pub mod wdf;
|
||||
|
||||
#[cfg(all(
|
||||
any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
),
|
||||
feature = "gpio"
|
||||
))]
|
||||
pub mod gpio;
|
||||
|
||||
#[cfg(all(
|
||||
any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
),
|
||||
feature = "hid"
|
||||
))]
|
||||
pub mod hid;
|
||||
|
||||
#[cfg(all(
|
||||
any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
),
|
||||
feature = "parallel-ports"
|
||||
))]
|
||||
pub mod parallel_ports;
|
||||
|
||||
#[cfg(all(
|
||||
any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
),
|
||||
feature = "spb"
|
||||
))]
|
||||
pub mod spb;
|
||||
|
||||
#[cfg(all(
|
||||
any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
),
|
||||
feature = "storage"
|
||||
))]
|
||||
pub mod storage;
|
||||
|
||||
#[cfg(all(
|
||||
any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
),
|
||||
feature = "usb"
|
||||
))]
|
||||
pub mod usb;
|
||||
|
||||
#[cfg(all(driver_model__driver_type = "UMDF", feature = "iddcx"))]
|
||||
pub mod iddcx;
|
||||
|
||||
#[cfg(feature = "test-stubs")]
|
||||
pub mod test_stubs;
|
||||
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
mod constants;
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
mod types;
|
||||
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
mod macros;
|
||||
|
||||
// This is fine because we don't actually have any floating point instruction in
|
||||
// our binary, thanks to our target defining soft-floats. fltused symbol is
|
||||
// necessary due to LLVM being too eager to set it: it checks the LLVM IR for
|
||||
// floating point instructions - even if soft-float is enabled!
|
||||
#[allow(missing_docs)]
|
||||
// SAFETY: _fltused is a required Windows linker symbol for floating point support.
|
||||
// No other symbols in this crate export this name, preventing linker conflicts.
|
||||
#[unsafe(no_mangle)]
|
||||
pub static _fltused: () = ();
|
||||
|
||||
// FIXME: Is there any way to avoid these stubs? See https://github.com/rust-lang/rust/issues/101134
|
||||
#[cfg(panic = "abort")]
|
||||
#[allow(missing_docs)]
|
||||
// SAFETY: __CxxFrameHandler3 is a required Windows C++ exception handler symbol.
|
||||
// No other symbols in this crate export this name, preventing linker conflicts.
|
||||
#[unsafe(no_mangle)]
|
||||
pub const extern "system" fn __CxxFrameHandler3() -> i32 {
|
||||
0
|
||||
}
|
||||
|
||||
#[cfg(panic = "abort")]
|
||||
#[allow(missing_docs)]
|
||||
// SAFETY: __CxxFrameHandler4 is a required Windows C++ exception handler symbol.
|
||||
// No other symbols in this crate export this name, preventing linker conflicts.
|
||||
#[unsafe(no_mangle)]
|
||||
pub const extern "system" fn __CxxFrameHandler4() -> i32 {
|
||||
// This is a stub for the C++ exception handling frame handler. It's never
|
||||
// called but it needs to be distinct from __CxxFrameHandler3 to not confuse
|
||||
// binary analysis tools. We return a different value to prevent folding.
|
||||
1
|
||||
}
|
||||
|
||||
#[cfg(panic = "abort")]
|
||||
#[allow(missing_docs)]
|
||||
// SAFETY: __GSHandlerCheck_EH4 is a required Windows C++ exception handler symbol.
|
||||
// No other symbols in this crate export this name, preventing linker conflicts.
|
||||
#[unsafe(no_mangle)]
|
||||
pub const extern "system" fn __GSHandlerCheck_EH4() -> i32 {
|
||||
// This is a stub for the C++ exception handling frame handler. It's never
|
||||
// called but it needs to be distinct from __CxxFrameHandler3 and
|
||||
// __CxxFrameHandler4 to not confuse binary analysis tools. We return a
|
||||
// different value to prevent folding.
|
||||
2
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
#[must_use]
|
||||
#[allow(non_snake_case)]
|
||||
/// 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 >= 0
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
#[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 >> 30) == 1
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
#[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 >> 30) == 2
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
#[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 >> 30) == 3
|
||||
}
|
||||
|
||||
#[cfg(any(driver_model__driver_type = "WDM", driver_model__driver_type = "KMDF"))]
|
||||
#[allow(missing_docs)]
|
||||
#[macro_export]
|
||||
#[allow(non_snake_case)]
|
||||
macro_rules! PAGED_CODE {
|
||||
() => {
|
||||
debug_assert!(unsafe { $crate::ntddk::KeGetCurrentIrql() <= $crate::APC_LEVEL as u8 });
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Macros for use in the `wdk-sys` crate. This is especially useful for
|
||||
//! interacting with WDK apis which are inlined, and so are impossible to
|
||||
//! generate with [bindgen](https://docs.rs/bindgen/latest/bindgen/).
|
||||
|
||||
#[cfg(any(driver_model__driver_type = "KMDF", driver_model__driver_type = "UMDF"))]
|
||||
mod wdf {
|
||||
include!(concat!(
|
||||
env!("OUT_DIR"),
|
||||
"/call_unsafe_wdf_function_binding.rs"
|
||||
));
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct FFI bindings to NTDDK APIs from the Windows Driver Kit (WDK)
|
||||
//!
|
||||
//! This module contains all bindings to functions, constants, methods,
|
||||
//! constructors and destructors in `ntddk.h`. Types are not included in this
|
||||
//! module, but are available in the top-level `wdk_sys` module.
|
||||
|
||||
pub use bindings::*;
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
mod bindings {
|
||||
#[allow(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/ntddk.rs"));
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct FFI bindings to Parallel Ports APIs from the Windows Driver Kit (WDK)
|
||||
//!
|
||||
//! This module contains all bindings to functions, constants, methods,
|
||||
//! constructors and destructors in the following headers: `ntddpar.h`,
|
||||
//! `ntddser.h`, `parallel.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(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain versions of the WDK, there are no functions related to SPB that can \
|
||||
be generated by bindgen, so these types are unused"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/parallel_ports.rs"));
|
||||
}
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain versions of the WDK, there are no functions related to SPB that can be \
|
||||
generated by bindgen, so the `bindings` module is empty"
|
||||
)]
|
||||
pub use bindings::*;
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct FFI bindings to SPB APIs from the Windows Driver Kit (WDK)
|
||||
//!
|
||||
//! This module contains all bindings to functions, constants, methods,
|
||||
//! constructors and destructors in the following headers: `spb.h`, `spbcx.h`,
|
||||
//! `reshub.h`, `pwmutil.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(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain versions of the WDK, there are no functions related to SPB that can \
|
||||
be generated by bindgen, so these types are unused"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/spb.rs"));
|
||||
}
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain versions of the WDK, there are no functions related to SPB that can be \
|
||||
generated by bindgen, so the `bindings` module is empty"
|
||||
)]
|
||||
pub use bindings::*;
|
||||
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct FFI bindings to Storage APIs from the Windows Driver Kit (WDK)
|
||||
//!
|
||||
//! This module contains all bindings to functions, constants, methods,
|
||||
//! constructors and destructors for Storage headers. 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(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain configurations of the WDK (ex. UMDF), there are no functions related \
|
||||
to Storage that can be generated by bindgen, so these types are unused"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/storage.rs"));
|
||||
}
|
||||
#[allow(
|
||||
unused_imports,
|
||||
reason = "in certain configurations of the WDK (ex. UMDF), there are no functions related to \
|
||||
Storage that can be generated by bindgen, so the `bindings` module is empty"
|
||||
)]
|
||||
pub use bindings::*;
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Any library dependency that depends on `wdk-sys` requires these stubs to
|
||||
//! provide symbols to successfully compile and run tests.
|
||||
//!
|
||||
//! These stubs can be brought into scope by introducing `wdk-sys` with the
|
||||
//! `test-stubs` feature in the `dev-dependencies` of the crate's `Cargo.toml`
|
||||
|
||||
#[cfg(any(driver_model__driver_type = "KMDF", driver_model__driver_type = "UMDF"))]
|
||||
pub use wdf::*;
|
||||
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
use crate::{DRIVER_OBJECT, NTSTATUS, PCUNICODE_STRING};
|
||||
|
||||
/// Stubbed version of `DriverEntry` Symbol so that test targets will compile
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This function should never be called, so its safety is irrelevant
|
||||
#[cfg(any(
|
||||
driver_model__driver_type = "WDM",
|
||||
driver_model__driver_type = "KMDF",
|
||||
driver_model__driver_type = "UMDF"
|
||||
))]
|
||||
// SAFETY: "DriverEntry" is the required symbol name for Windows driver entry points.
|
||||
// No other function in this compilation unit exports this name, preventing symbol conflicts.
|
||||
#[unsafe(export_name = "DriverEntry")] // WDF expects a symbol with the name DriverEntry
|
||||
pub const unsafe extern "system" fn driver_entry_stub(
|
||||
_driver: &mut DRIVER_OBJECT,
|
||||
_registry_path: PCUNICODE_STRING,
|
||||
) -> NTSTATUS {
|
||||
0
|
||||
}
|
||||
|
||||
#[cfg(any(driver_model__driver_type = "KMDF", driver_model__driver_type = "UMDF"))]
|
||||
mod wdf {
|
||||
use crate::ULONG;
|
||||
|
||||
/// Stubbed version of `WdfFunctionCount` Symbol so that test targets will
|
||||
/// compile
|
||||
// SAFETY: WdfFunctionCount is a required WDF symbol for test compilation.
|
||||
// No other symbols in this crate export this name, preventing linker conflicts.
|
||||
#[unsafe(no_mangle)]
|
||||
pub static mut WdfFunctionCount: ULONG = 0;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/test_stubs.rs"));
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
pub use bindings::*;
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[allow(non_upper_case_globals)]
|
||||
#[allow(non_camel_case_types)]
|
||||
#[allow(non_snake_case)]
|
||||
#[rustversion::attr(
|
||||
any(
|
||||
all(not(nightly), since(1.88)),
|
||||
all(nightly, since(2025-04-25)),
|
||||
),
|
||||
allow(unnecessary_transmutes)
|
||||
)]
|
||||
#[allow(unsafe_op_in_unsafe_fn)]
|
||||
#[allow(clippy::cast_lossless)]
|
||||
#[allow(clippy::cast_possible_truncation)]
|
||||
#[allow(clippy::cast_possible_wrap)]
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
#[allow(clippy::doc_markdown)]
|
||||
#[allow(clippy::default_trait_access)]
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[rustversion::attr(
|
||||
any(
|
||||
all(not(nightly), before(1.74)),
|
||||
all(nightly, before(2023-09-13)),
|
||||
),
|
||||
allow(clippy::incorrect_clone_impl_on_copy_type)
|
||||
)]
|
||||
#[rustversion::attr(
|
||||
any(
|
||||
all(not(nightly), since(1.74)),
|
||||
all(nightly, since(2023-09-13)),
|
||||
),
|
||||
allow(clippy::non_canonical_clone_impl)
|
||||
)]
|
||||
#[allow(clippy::missing_const_for_fn)]
|
||||
#[allow(clippy::missing_safety_doc)]
|
||||
#[allow(clippy::module_name_repetitions)]
|
||||
#[allow(clippy::multiple_unsafe_ops_per_block)]
|
||||
#[allow(clippy::must_use_candidate)]
|
||||
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||
#[allow(clippy::ptr_as_ptr)]
|
||||
#[allow(clippy::ptr_offset_with_cast)]
|
||||
#[rustversion::attr(
|
||||
any(
|
||||
all(not(nightly), since(1.77)),
|
||||
all(nightly, since(2024-01-11)),
|
||||
),
|
||||
allow(clippy::pub_underscore_fields)
|
||||
)]
|
||||
#[rustversion::attr(
|
||||
any(
|
||||
all(not(nightly), since(1.78)),
|
||||
all(nightly, since(2024-02-09)),
|
||||
),
|
||||
allow(clippy::ref_as_ptr)
|
||||
)]
|
||||
#[allow(clippy::semicolon_if_nothing_returned)]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[allow(clippy::too_many_lines)]
|
||||
#[allow(clippy::transmute_ptr_to_ptr)]
|
||||
#[allow(clippy::undocumented_unsafe_blocks)]
|
||||
#[allow(clippy::unnecessary_cast)]
|
||||
#[allow(clippy::unreadable_literal)]
|
||||
#[allow(clippy::used_underscore_binding)]
|
||||
#[allow(clippy::useless_transmute)]
|
||||
#[allow(clippy::use_self)]
|
||||
mod bindings {
|
||||
include!(concat!(env!("OUT_DIR"), "/types.rs"));
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct FFI bindings to USB APIs from the Windows Driver Kit (WDK)
|
||||
//!
|
||||
//! This module contains all bindings to functions, constants, methods,
|
||||
//! constructors and destructors for USB headers. 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(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/usb.rs"));
|
||||
}
|
||||
pub use bindings::*;
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct FFI bindings to WDF APIs from the Windows Driver Kit (WDK)
|
||||
//!
|
||||
//! This module contains all bindings to functions, constants, methods,
|
||||
//! constructors and destructors in `wdf.h`. Types are not included in this
|
||||
//! module, but are available in the top-level `wdk_sys` module.
|
||||
|
||||
pub use bindings::*;
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[allow(clippy::unreadable_literal)]
|
||||
mod bindings {
|
||||
#[allow(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/wdf.rs"));
|
||||
}
|
||||
|
||||
// This is a workaround to expose the generated function count to the
|
||||
// `call_unsafe_wdf_function_binding` proc-macro, so that the macro-generated
|
||||
// code can determine the slice size at runtime. When we are able to
|
||||
// conditionally compile based off a cfg range for WDF version, this module
|
||||
// can be removed and the runtime check can be replaced with a conditional
|
||||
// compilation: https://github.com/microsoft/windows-drivers-rs/issues/276
|
||||
#[doc(hidden)]
|
||||
pub mod __private {
|
||||
include!(concat!(env!("OUT_DIR"), "/wdf_function_count.rs"));
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// License: MIT OR Apache-2.0
|
||||
|
||||
//! Direct FFI bindings to WIN32 APIs from the Windows Driver Kit (WDK)
|
||||
//!
|
||||
//! This module contains all bindings to functions, constants, methods,
|
||||
//! constructors and destructors in `windows.h`. Types are not included in this
|
||||
//! module, but are available in the top-level `wdk_sys` module.
|
||||
|
||||
pub use bindings::*;
|
||||
|
||||
#[allow(missing_docs)]
|
||||
mod bindings {
|
||||
#[allow(
|
||||
clippy::wildcard_imports,
|
||||
reason = "the underlying c code relies on all type definitions being in scope, which \
|
||||
results in the bindgen generated code relying on the generated types being in \
|
||||
scope as well"
|
||||
)]
|
||||
use crate::types::*;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/windows.rs"));
|
||||
}
|
||||
Reference in New Issue
Block a user