diff --git a/.gitea/workflows/windows-drivers.yml b/.gitea/workflows/windows-drivers.yml index b7caa06..9aba2d7 100644 --- a/.gitea/workflows/windows-drivers.yml +++ b/.gitea/workflows/windows-drivers.yml @@ -125,7 +125,8 @@ jobs: run: cargo build -p wdk-probe -v - name: Inspect the produced DLL's /INTEGRITYCHECK bit run: | - $dll = "target\debug\wdk_probe.dll" + # explicit --target (.cargo/config.toml) -> output under the triple subdir. + $dll = "target\x86_64-pc-windows-msvc\debug\wdk_probe.dll" if (-not (Test-Path $dll)) { throw "wdk_probe.dll not produced at $dll" } $b = [IO.File]::ReadAllBytes($dll) $pe = [BitConverter]::ToInt32($b, 0x3c) diff --git a/packaging/windows/drivers/.cargo/config.toml b/packaging/windows/drivers/.cargo/config.toml new file mode 100644 index 0000000..309b188 --- /dev/null +++ b/packaging/windows/drivers/.cargo/config.toml @@ -0,0 +1,12 @@ +# windows-drivers-rs requires UMDF drivers to link the STATIC CRT (wdk-build errors `StaticCrtNotEnabled` +# otherwise, and the generated wdk-sys bindings' layout asserts only hold with it). +# +# Setting an EXPLICIT build target is the trick that makes `target-feature=+crt-static` apply ONLY to the +# driver cdylib and NOT to host build-scripts/proc-macros (which must stay dynamic-CRT): with an explicit +# --target, cargo compiles host artifacts for the implicit host and the `[target.]` rustflags +# apply only to the target. The Windows host (and thus its drivers) is x64-only by design. +[build] +target = "x86_64-pc-windows-msvc" + +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"]