From 6b1c3ff357f292265422709429d29ab5ad1993e4 Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Tue, 16 Jan 2024 12:59:09 -0600 Subject: [PATCH] Limit `AssociatedEnum` attribute to input parameters (#2797) --- crates/libs/bindgen/src/metadata.rs | 4 ++++ crates/libs/windows/src/Windows/Win32/System/Com/impl.rs | 2 +- crates/libs/windows/src/Windows/Win32/System/Com/mod.rs | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/libs/bindgen/src/metadata.rs b/crates/libs/bindgen/src/metadata.rs index ffe4b93e06..5b084ccd62 100644 --- a/crates/libs/bindgen/src/metadata.rs +++ b/crates/libs/bindgen/src/metadata.rs @@ -343,6 +343,10 @@ fn param_kind(row: Param) -> SignatureParamKind { // TODO: this is a terribly broken Win32 metadata attribute - need to get rid of it. fn param_or_enum(row: Param) -> Option { + if row.flags().contains(ParamAttributes::Out) { + return None; + } + row.find_attribute("AssociatedEnumAttribute").and_then(|attribute| { for (_, arg) in attribute.args() { if let Value::String(name) = arg { diff --git a/crates/libs/windows/src/Windows/Win32/System/Com/impl.rs b/crates/libs/windows/src/Windows/Win32/System/Com/impl.rs index de3398e75f..acd51ac0dc 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Com/impl.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Com/impl.rs @@ -1198,7 +1198,7 @@ impl IClassFactory_Vtbl { } } pub trait IClientSecurity_Impl: Sized { - fn QueryBlanket(&self, pproxy: ::core::option::Option<&::windows_core::IUnknown>, pauthnsvc: *mut u32, pauthzsvc: *mut u32, pserverprincname: *mut *mut u16, pauthnlevel: *mut RPC_C_AUTHN_LEVEL, pimplevel: *mut RPC_C_IMP_LEVEL, pauthinfo: *mut *mut ::core::ffi::c_void, pcapabilites: EOLE_AUTHENTICATION_CAPABILITIES) -> ::windows_core::Result<()>; + fn QueryBlanket(&self, pproxy: ::core::option::Option<&::windows_core::IUnknown>, pauthnsvc: *mut u32, pauthzsvc: *mut u32, pserverprincname: *mut *mut u16, pauthnlevel: *mut RPC_C_AUTHN_LEVEL, pimplevel: *mut RPC_C_IMP_LEVEL, pauthinfo: *mut *mut ::core::ffi::c_void, pcapabilites: *mut u32) -> ::windows_core::Result<()>; fn SetBlanket(&self, pproxy: ::core::option::Option<&::windows_core::IUnknown>, dwauthnsvc: u32, dwauthzsvc: u32, pserverprincname: &::windows_core::PCWSTR, dwauthnlevel: RPC_C_AUTHN_LEVEL, dwimplevel: RPC_C_IMP_LEVEL, pauthinfo: *const ::core::ffi::c_void, dwcapabilities: &EOLE_AUTHENTICATION_CAPABILITIES) -> ::windows_core::Result<()>; fn CopyProxy(&self, pproxy: ::core::option::Option<&::windows_core::IUnknown>) -> ::windows_core::Result<::windows_core::IUnknown>; } diff --git a/crates/libs/windows/src/Windows/Win32/System/Com/mod.rs b/crates/libs/windows/src/Windows/Win32/System/Com/mod.rs index 63567859db..b7d390f5c6 100644 --- a/crates/libs/windows/src/Windows/Win32/System/Com/mod.rs +++ b/crates/libs/windows/src/Windows/Win32/System/Com/mod.rs @@ -1746,11 +1746,11 @@ pub struct IClassFactory_Vtbl { ::windows_core::imp::com_interface!(IClientSecurity, IClientSecurity_Vtbl, 0x0000013d_0000_0000_c000_000000000046); ::windows_core::imp::interface_hierarchy!(IClientSecurity, ::windows_core::IUnknown); impl IClientSecurity { - pub unsafe fn QueryBlanket(&self, pproxy: P0, pauthnsvc: *mut u32, pauthzsvc: ::core::option::Option<*mut u32>, pserverprincname: *mut *mut u16, pauthnlevel: ::core::option::Option<*mut RPC_C_AUTHN_LEVEL>, pimplevel: ::core::option::Option<*mut RPC_C_IMP_LEVEL>, pauthinfo: *mut *mut ::core::ffi::c_void, pcapabilites: EOLE_AUTHENTICATION_CAPABILITIES) -> ::windows_core::Result<()> + pub unsafe fn QueryBlanket(&self, pproxy: P0, pauthnsvc: *mut u32, pauthzsvc: ::core::option::Option<*mut u32>, pserverprincname: *mut *mut u16, pauthnlevel: ::core::option::Option<*mut RPC_C_AUTHN_LEVEL>, pimplevel: ::core::option::Option<*mut RPC_C_IMP_LEVEL>, pauthinfo: *mut *mut ::core::ffi::c_void, pcapabilites: ::core::option::Option<*mut u32>) -> ::windows_core::Result<()> where P0: ::windows_core::IntoParam<::windows_core::IUnknown>, { - (::windows_core::Interface::vtable(self).QueryBlanket)(::windows_core::Interface::as_raw(self), pproxy.into_param().abi(), pauthnsvc, ::core::mem::transmute(pauthzsvc.unwrap_or(::std::ptr::null_mut())), pserverprincname, ::core::mem::transmute(pauthnlevel.unwrap_or(::std::ptr::null_mut())), ::core::mem::transmute(pimplevel.unwrap_or(::std::ptr::null_mut())), pauthinfo, pcapabilites.0 as _).ok() + (::windows_core::Interface::vtable(self).QueryBlanket)(::windows_core::Interface::as_raw(self), pproxy.into_param().abi(), pauthnsvc, ::core::mem::transmute(pauthzsvc.unwrap_or(::std::ptr::null_mut())), pserverprincname, ::core::mem::transmute(pauthnlevel.unwrap_or(::std::ptr::null_mut())), ::core::mem::transmute(pimplevel.unwrap_or(::std::ptr::null_mut())), pauthinfo, ::core::mem::transmute(pcapabilites.unwrap_or(::std::ptr::null_mut()))).ok() } pub unsafe fn SetBlanket(&self, pproxy: P0, dwauthnsvc: u32, dwauthzsvc: u32, pserverprincname: P1, dwauthnlevel: RPC_C_AUTHN_LEVEL, dwimplevel: RPC_C_IMP_LEVEL, pauthinfo: ::core::option::Option<*const ::core::ffi::c_void>, dwcapabilities: EOLE_AUTHENTICATION_CAPABILITIES) -> ::windows_core::Result<()> where