Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/wdk-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ignored = [

[features]
nightly = []
vhf = []

[dependencies]
anyhow.workspace = true
Expand Down
18 changes: 18 additions & 0 deletions crates/wdk-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,12 @@ impl Config {
// 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");

// Link against VhfKm.lib (Virtual HID Framework, kernel-mode) when
// the "vhf" feature is enabled. Required by drivers that create
// virtual HID devices.
#[cfg(feature = "vhf")]
Comment thread
wmmc88 marked this conversation as resolved.
Outdated
println!("cargo::rustc-cdylib-link-arg=VhfKm.lib");
}
DriverConfig::Kmdf(_) => {
// Emit KMDF-specific libraries to link to
Expand Down Expand Up @@ -1186,6 +1192,12 @@ impl Config {
// 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");

// Link against VhfKm.lib (Virtual HID Framework, kernel-mode) when
// the "vhf" feature is enabled. Required by drivers that create
// virtual HID devices.
#[cfg(feature = "vhf")]
println!("cargo::rustc-cdylib-link-arg=VhfKm.lib");
}
DriverConfig::Umdf(umdf_config) => {
// Emit UMDF-specific libraries to link to
Expand All @@ -1200,6 +1212,12 @@ impl Config {

// Linker arguments derived from WindowsDriver.UserMode.props in Ni(22H2) WDK
println!("cargo::rustc-cdylib-link-arg=/SUBSYSTEM:WINDOWS");

// Link against VhfUm.lib (Virtual HID Framework, user-mode) when
// the "vhf" feature is enabled. Required by drivers that create
// virtual HID devices.
#[cfg(feature = "vhf")]
println!("cargo::rustc-cdylib-link-arg=VhfUm.lib");
}
}

Expand Down
Loading