diff --git a/crates/libs/bindgen/src/rust/extensions/mod.rs b/crates/libs/bindgen/src/rust/extensions/mod.rs index 997aba0481..f5bdc92d87 100644 --- a/crates/libs/bindgen/src/rust/extensions/mod.rs +++ b/crates/libs/bindgen/src/rust/extensions/mod.rs @@ -2,10 +2,8 @@ use super::*; /// Helper function for `gen_mod` and `gen_impl`. /// -/// This function generates an `include!(...)` that points into the -/// `src/includes` directory for the `windows` and `windows-sys` -/// crates. This is no longer needed, but is preserved in case it is -/// needed again in the future. +/// This function generates an `include!(...)` that points into the `src/includes` directory for +/// the `windows` and `windows-sys` crates. This makes it easy to inject code into WinMD namespaces. #[allow(dead_code)] fn include_ext(relative_path: &str) -> TokenStream { quote! { @@ -20,19 +18,17 @@ fn include_ext(relative_path: &str) -> TokenStream { } /// Generates extension code for a specific namespace -/// -/// This function allows us to inject code into modules generated by bindgen. -/// This feature is no longer needed but is preserved in case it is needed -/// again in the future. -pub fn gen_mod(_writer: &Writer, _namespace: &str) -> TokenStream { - TokenStream::new() +pub fn gen_mod(_writer: &Writer, namespace: &str) -> TokenStream { + match namespace { + "Windows.Win32.UI.WindowsAndMessaging" => { + include_ext("Win32/UI/WindowsAndMessaging/WindowLong.rs") + } + + _ => quote!(), + } } -/// Generates implementation extension code for a specific namespace -/// -/// This function allows us to inject code into modules generated by bindgen. -/// This feature is no longer needed but is preserved in case it is needed -/// again in the future. +/// Generates extension code that is subject to the `implement` feature for a specific namespace pub fn gen_impl(_namespace: &str) -> TokenStream { TokenStream::new() } diff --git a/crates/libs/sys/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs b/crates/libs/sys/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs index 2e7b089f75..8271e63984 100644 --- a/crates/libs/sys/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs +++ b/crates/libs/sys/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs @@ -3752,3 +3752,4 @@ pub type SENDASYNCPROC = Option; pub type WNDENUMPROC = Option super::super::Foundation::BOOL>; pub type WNDPROC = Option super::super::Foundation::LRESULT>; +core::include!(core::concat!(core::env!("CARGO_MANIFEST_DIR"), "/src/includes/", "Win32/UI/WindowsAndMessaging/WindowLong.rs")); diff --git a/crates/libs/windows/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs b/crates/libs/windows/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs index c8900118b1..f56e256e79 100644 --- a/crates/libs/windows/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/UI/WindowsAndMessaging/mod.rs @@ -9426,3 +9426,4 @@ pub type SENDASYNCPROC = Option; pub type WNDENUMPROC = Option super::super::Foundation::BOOL>; pub type WNDPROC = Option super::super::Foundation::LRESULT>; +core::include!(core::concat!(core::env!("CARGO_MANIFEST_DIR"), "/src/includes/", "Win32/UI/WindowsAndMessaging/WindowLong.rs")); diff --git a/crates/libs/windows/src/extensions/Win32/UI/WindowsAndMessaging/WindowLong.rs b/crates/libs/windows/src/includes/Win32/UI/WindowsAndMessaging/WindowLong.rs similarity index 100% rename from crates/libs/windows/src/extensions/Win32/UI/WindowsAndMessaging/WindowLong.rs rename to crates/libs/windows/src/includes/Win32/UI/WindowsAndMessaging/WindowLong.rs