From 7e5a77a6a410c2a7910d8eb128b0ea11131c8977 Mon Sep 17 00:00:00 2001 From: Melvin Wang Date: Thu, 23 Jan 2025 16:11:44 -0800 Subject: [PATCH] fix!: explicitly mark `_KGDTENTRY64` and `_KIDTENTRY64`as opaque types in bindgen BREAKING CHANGE: defintions for `_KGDTENTRY64` and `_KIDTENTRY64` have been removed --- crates/wdk-build/src/bindgen.rs | 2 ++ crates/wdk-build/src/lib.rs | 58 --------------------------------- 2 files changed, 2 insertions(+), 58 deletions(-) diff --git a/crates/wdk-build/src/bindgen.rs b/crates/wdk-build/src/bindgen.rs index 63b417de..071f7e6a 100644 --- a/crates/wdk-build/src/bindgen.rs +++ b/crates/wdk-build/src/bindgen.rs @@ -71,6 +71,8 @@ impl BuilderExt for Builder { .blocklist_item("ExAllocatePoolWithQuotaTag") // Deprecated .blocklist_item("ExAllocatePoolWithTagPriority") // Deprecated .blocklist_item("ExAllocatePool") // Deprecated + .opaque_type("_KGDTENTRY64") // No definition in WDK + .opaque_type("_KIDTENTRY64") // No definition in WDK // FIXME: bitfield generated with non-1byte alignment in _MCG_CAP .blocklist_item(".*MCG_CAP(?:__bindgen.*)?") .blocklist_item(".*WHEA_XPF_MCA_SECTION") diff --git a/crates/wdk-build/src/lib.rs b/crates/wdk-build/src/lib.rs index 3d4c1b74..dc146ab8 100644 --- a/crates/wdk-build/src/lib.rs +++ b/crates/wdk-build/src/lib.rs @@ -719,64 +719,6 @@ impl Config { DriverConfig::Wdm | DriverConfig::Kmdf(_) ) { - // TODO: Why is there no definition for this struct? Maybe blocklist this struct - // in bindgen. - acc.push_str( - r" -typedef union _KGDTENTRY64 -{ - struct - { - unsigned short LimitLow; - unsigned short BaseLow; - union - { - struct - { - unsigned char BaseMiddle; - unsigned char Flags1; - unsigned char Flags2; - unsigned char BaseHigh; - } Bytes; - struct - { - unsigned long BaseMiddle : 8; - unsigned long Type : 5; - unsigned long Dpl : 2; - unsigned long Present : 1; - unsigned long LimitHigh : 4; - unsigned long System : 1; - unsigned long LongMode : 1; - unsigned long DefaultBig : 1; - unsigned long Granularity : 1; - unsigned long BaseHigh : 8; - } Bits; - }; - unsigned long BaseUpper; - unsigned long MustBeZero; - }; - unsigned __int64 Alignment; -} KGDTENTRY64, *PKGDTENTRY64; - -typedef union _KIDTENTRY64 -{ - struct - { - unsigned short OffsetLow; - unsigned short Selector; - unsigned short IstIndex : 3; - unsigned short Reserved0 : 5; - unsigned short Type : 5; - unsigned short Dpl : 2; - unsigned short Present : 1; - unsigned short OffsetMiddle; - unsigned long OffsetHigh; - unsigned long Reserved1; - }; - unsigned __int64 Alignment; -} KIDTENTRY64, *PKIDTENTRY64; -", - ); } acc })