From 6d8c7a51853240092387445bd30a03c9680a482d Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Wed, 24 Jun 2026 15:01:22 +0000 Subject: [PATCH] fix(windows-drivers): translate iddcx enum repr ints (UINT in nested mods) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Last UINT errors were all `pub type Type = UINT;` inside bindgen enum modules (pub mod _DXGI_X {..}) — the top-level UINT alias cannot reach nested modules. C++ parsing made bindgen keep the UINT typedef as the enum underlying repr (C mode emits a primitive). translate_enum_integer_types(true) emits native u32 reprs, so the enum modules are self-contained; struct-field UINT stays covered by the src/iddcx.rs alias. Co-Authored-By: Claude Opus 4.8 (1M context) --- packaging/windows/drivers/vendor/wdk-sys/build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packaging/windows/drivers/vendor/wdk-sys/build.rs b/packaging/windows/drivers/vendor/wdk-sys/build.rs index db95e2d..2f9ae3a 100644 --- a/packaging/windows/drivers/vendor/wdk-sys/build.rs +++ b/packaging/windows/drivers/vendor/wdk-sys/build.rs @@ -362,6 +362,12 @@ fn generate_iddcx(out_path: &Path, config: &Config) -> Result<(), ConfigError> { // parses wdf.h non-stubbed; stubbing only here would desync WDF type-identity). .clang_arg("--language=c++") .clang_arg("-DIDD_STUB") + // Parsing as C++ makes bindgen preserve the `UINT` typedef as the underlying repr of the + // DXGI/OPM enums it emits as `pub mod _X { pub type Type = UINT; }` — and `UINT` isn't in + // scope inside those nested modules. Translate enum repr types to native Rust ints (u32) so + // the enum modules are self-contained. (Struct fields still use `UINT`, covered by the + // alias in src/iddcx.rs.) + .translate_enum_integer_types(true) // Emit ONLY IddCx items (its types + the IddFunctions table enums + the DDI fn-pointer // typedefs) and DON'T recurse into referenced WDF/Win/DXGI types — those resolve to wdk-sys's // shared bindings via `use crate::types::*` in src/iddcx.rs (type-identity, no re-emission,