Hmm.
It looks like Microsoft wanted DEV_BROADCAST_HDR to be a discriminated union, but with the different variants having different sizes, presumably so that they could introduce new variants later without breaking existing code.
This is the correct way to accomplish that.
#Rust does something similar for trait object downcasting: check if the desired type is the same as the actual type, and if so, cast the pointer.
Check: https://doc.rust-lang.org/1.85.0/src/core/any.rs.html#225
Cast: https://doc.rust-lang.org/1.85.0/src/core/any.rs.html#294
Source of the Rust file `library/core/src/any.rs`.
doc.rust-lang.org