Files
punktfunk/packaging/windows/drivers/pf-vdisplay/build.rs
T
enricobuehler 3d3dd3627c
apple / swift (push) Failing after 2s
apple / screenshots (push) Has been skipped
windows-drivers / probe-and-proto (push) Successful in 19s
windows-drivers / driver-build (push) Successful in 1m7s
windows-host / package (push) Successful in 5m27s
android / android (push) Successful in 4m5s
ci / web (push) Successful in 47s
ci / rust (push) Successful in 4m41s
ci / docs-site (push) Successful in 57s
deb / build-publish (push) Successful in 2m26s
decky / build-publish (push) Successful in 13s
docker / build-push (--build-arg FEDORA_VERSION=44, ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm) (push) Successful in 5s
docker / build-push (., web/Dockerfile, punktfunk-web) (push) Successful in 5s
docker / build-push (ci, ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 4s
docker / build-push (ci, ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 4s
docker / build-push (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 5s
ci / bench (push) Successful in 5m1s
rpm / build-publish (bazzite, punktfunk-fedora-rpm) (push) Successful in 9m21s
rpm / build-publish (fedora-44, punktfunk-fedora44-rpm) (push) Successful in 9m23s
docker / deploy-docs (push) Successful in 6s
feat(windows-drivers): STEP 3 on-glass — driver LOADS + runs full IddCx init chain
Major on-glass progress on the RTX box. The all-Rust wdk-sys IddCx driver now LOADS
under Secure Boot and runs the ENTIRE init chain: DriverEntry -> WdfDriverCreate ->
driver_add -> IddCxDeviceInitConfig(0x0) -> WdfDeviceCreate -> CreateDeviceInterface
-> IddCxDeviceInitialize -> D0Entry -> init_adapter. Findings:
- Signing was a RED HERRING (the driver loads); std works in WUDFHost (DualSense uses
  it too).
- THE unblock: link the iddcx **1.10** IddCxStub (build.rs now picks the highest
  version-aware), not 1.0 — the 1.0 stub lacks the version-table symbols AND its
  dispatch table mismatched the 1.10 framework, which made IddCxDeviceInitConfig
  return INVALID_PARAMETER. With 1.10 the whole chain runs.
- Added a file/OutputDebugString logger (log.rs, matches the DualSense driver) — the
  driver was silent; this is how the chain was traced.
- size.rs: framework_struct_size() reads the frameworks authoritative struct sizes
  from IddStructures[] (the config keeps size_of=208, validated working).
- adapter.rs: version ptrs + ObjectAttributes(InheritFromParent) + FP16 + framework
  caps/diag/version sizes — matches the oracle.

KNOWN WIP: IddCxAdapterInitAsync still returns INVALID_PARAMETER though caps match
the framework size table (88/56/24) + the oracle exactly — likely a subtle wdk-sys
bindgen field-layout detail in IDDCX_ADAPTER_CAPS/IDDCX_ENDPOINT_DIAGNOSTIC_INFO.
CI gate (compile+link) stays green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 17:46:58 +00:00

53 lines
2.3 KiB
Rust

//! WDK link flags for the cdylib (wdk-build) + `IddCxStub` (the driver calls IddCx DDIs via wdk-iddcx,
//! and exports `IddMinimumVersionRequired`). `/INTEGRITYCHECK` (set by wdk-build) is cleared by the CI
//! packaging step. Glob recipe matches wdk-probe/build.rs.
fn main() -> Result<(), wdk_build::ConfigError> {
wdk_build::configure_wdk_binary_build()?;
link_iddcx_stub();
Ok(())
}
/// Link `IddCxStub.lib`. It ships under `Lib\<sdkver>\um\<arch>\iddcx\<iddcxver>\`, and the iddcx
/// versions are NOT equivalent: the `1.0`/`1.2` stubs lack the versioned-struct-size table symbols
/// (`IddStructures`/`IddStructureCount`/`IddClientVersionHigherThanFramework`) that `size.rs` needs —
/// `1.3`+ and `1.10` have them. So pick the HIGHEST `iddcx\<X.Y>` dir that has the lib (version-aware,
/// since "1.10" < "1.2" lexically). x64 only.
fn link_iddcx_stub() {
const ARCH: &str = "x64";
const ROOTS: [&str; 2] = [
r"C:\Program Files (x86)\Windows Kits\10\Lib",
r"C:\Program Files\Windows Kits\10\Lib",
];
let mut best: Option<((u32, u32), std::path::PathBuf)> = None;
for root in ROOTS {
let Ok(versions) = std::fs::read_dir(root) else {
continue;
};
for ver in versions.flatten() {
let iddcx = ver.path().join("um").join(ARCH).join("iddcx");
let Ok(subdirs) = std::fs::read_dir(&iddcx) else {
continue;
};
for sub in subdirs.flatten() {
if !sub.path().join("IddCxStub.lib").is_file() {
continue;
}
let name = sub.file_name().to_string_lossy().into_owned();
let mut parts = name.split('.');
let v = (
parts.next().and_then(|x| x.parse().ok()).unwrap_or(0u32),
parts.next().and_then(|x| x.parse().ok()).unwrap_or(0u32),
);
if best.as_ref().is_none_or(|(bv, _)| v > *bv) {
best = Some((v, sub.path()));
}
}
}
}
let Some((_, dir)) = best else {
panic!("IddCxStub.lib not found under any Windows Kits Lib\\<ver>\\um\\{ARCH}\\iddcx\\<iddcxver>\\");
};
println!("cargo:rustc-link-search={}", dir.display());
println!("cargo:rustc-link-lib=static=IddCxStub");
}