201 lines
11 KiB
Rust
201 lines
11 KiB
Rust
windows_core::imp::define_interface!(INamedPolicyData, INamedPolicyData_Vtbl, 0x38dcb198_95ac_4077_a643_8078cae26400);
|
|
impl windows_core::RuntimeType for INamedPolicyData {
|
|
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::<Self>();
|
|
}
|
|
#[repr(C)]
|
|
pub struct INamedPolicyData_Vtbl {
|
|
pub base__: windows_core::IInspectable_Vtbl,
|
|
pub Area: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::mem::MaybeUninit<windows_core::HSTRING>) -> windows_core::HRESULT,
|
|
pub Name: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::mem::MaybeUninit<windows_core::HSTRING>) -> windows_core::HRESULT,
|
|
pub Kind: unsafe extern "system" fn(*mut core::ffi::c_void, *mut NamedPolicyKind) -> windows_core::HRESULT,
|
|
pub IsManaged: unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT,
|
|
pub IsUserPolicy: unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT,
|
|
#[cfg(feature = "System")]
|
|
pub User: unsafe extern "system" fn(*mut core::ffi::c_void, *mut *mut core::ffi::c_void) -> windows_core::HRESULT,
|
|
#[cfg(not(feature = "System"))]
|
|
User: usize,
|
|
pub GetBoolean: unsafe extern "system" fn(*mut core::ffi::c_void, *mut bool) -> windows_core::HRESULT,
|
|
#[cfg(feature = "Storage_Streams")]
|
|
pub GetBinary: unsafe extern "system" fn(*mut core::ffi::c_void, *mut *mut core::ffi::c_void) -> windows_core::HRESULT,
|
|
#[cfg(not(feature = "Storage_Streams"))]
|
|
GetBinary: usize,
|
|
pub GetInt32: unsafe extern "system" fn(*mut core::ffi::c_void, *mut i32) -> windows_core::HRESULT,
|
|
pub GetInt64: unsafe extern "system" fn(*mut core::ffi::c_void, *mut i64) -> windows_core::HRESULT,
|
|
pub GetString: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::mem::MaybeUninit<windows_core::HSTRING>) -> windows_core::HRESULT,
|
|
pub Changed: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, *mut super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
|
|
pub RemoveChanged: unsafe extern "system" fn(*mut core::ffi::c_void, super::super::Foundation::EventRegistrationToken) -> windows_core::HRESULT,
|
|
}
|
|
windows_core::imp::define_interface!(INamedPolicyStatics, INamedPolicyStatics_Vtbl, 0x7f793be7_76c4_4058_8cad_67662cd05f0d);
|
|
impl windows_core::RuntimeType for INamedPolicyStatics {
|
|
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_interface::<Self>();
|
|
}
|
|
#[repr(C)]
|
|
pub struct INamedPolicyStatics_Vtbl {
|
|
pub base__: windows_core::IInspectable_Vtbl,
|
|
pub GetPolicyFromPath: unsafe extern "system" fn(*mut core::ffi::c_void, core::mem::MaybeUninit<windows_core::HSTRING>, core::mem::MaybeUninit<windows_core::HSTRING>, *mut *mut core::ffi::c_void) -> windows_core::HRESULT,
|
|
#[cfg(feature = "System")]
|
|
pub GetPolicyFromPathForUser: unsafe extern "system" fn(*mut core::ffi::c_void, *mut core::ffi::c_void, core::mem::MaybeUninit<windows_core::HSTRING>, core::mem::MaybeUninit<windows_core::HSTRING>, *mut *mut core::ffi::c_void) -> windows_core::HRESULT,
|
|
#[cfg(not(feature = "System"))]
|
|
GetPolicyFromPathForUser: usize,
|
|
}
|
|
pub struct NamedPolicy;
|
|
impl NamedPolicy {
|
|
pub fn GetPolicyFromPath(area: &windows_core::HSTRING, name: &windows_core::HSTRING) -> windows_core::Result<NamedPolicyData> {
|
|
Self::INamedPolicyStatics(|this| unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).GetPolicyFromPath)(windows_core::Interface::as_raw(this), core::mem::transmute_copy(area), core::mem::transmute_copy(name), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
|
|
})
|
|
}
|
|
#[cfg(feature = "System")]
|
|
pub fn GetPolicyFromPathForUser<P0>(user: P0, area: &windows_core::HSTRING, name: &windows_core::HSTRING) -> windows_core::Result<NamedPolicyData>
|
|
where
|
|
P0: windows_core::Param<super::super::System::User>,
|
|
{
|
|
Self::INamedPolicyStatics(|this| unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).GetPolicyFromPathForUser)(windows_core::Interface::as_raw(this), user.param().abi(), core::mem::transmute_copy(area), core::mem::transmute_copy(name), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
|
|
})
|
|
}
|
|
#[doc(hidden)]
|
|
pub fn INamedPolicyStatics<R, F: FnOnce(&INamedPolicyStatics) -> windows_core::Result<R>>(callback: F) -> windows_core::Result<R> {
|
|
static SHARED: windows_core::imp::FactoryCache<NamedPolicy, INamedPolicyStatics> = windows_core::imp::FactoryCache::new();
|
|
SHARED.call(callback)
|
|
}
|
|
}
|
|
impl windows_core::RuntimeName for NamedPolicy {
|
|
const NAME: &'static str = "Windows.Management.Policies.NamedPolicy";
|
|
}
|
|
#[repr(transparent)]
|
|
#[derive(PartialEq, Eq, core::fmt::Debug, Clone)]
|
|
pub struct NamedPolicyData(windows_core::IUnknown);
|
|
windows_core::imp::interface_hierarchy!(NamedPolicyData, windows_core::IUnknown, windows_core::IInspectable);
|
|
impl NamedPolicyData {
|
|
pub fn Area(&self) -> windows_core::Result<windows_core::HSTRING> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).Area)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
|
|
}
|
|
}
|
|
pub fn Name(&self) -> windows_core::Result<windows_core::HSTRING> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).Name)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
|
|
}
|
|
}
|
|
pub fn Kind(&self) -> windows_core::Result<NamedPolicyKind> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).Kind)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
|
|
}
|
|
}
|
|
pub fn IsManaged(&self) -> windows_core::Result<bool> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).IsManaged)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
|
|
}
|
|
}
|
|
pub fn IsUserPolicy(&self) -> windows_core::Result<bool> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).IsUserPolicy)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
|
|
}
|
|
}
|
|
#[cfg(feature = "System")]
|
|
pub fn User(&self) -> windows_core::Result<super::super::System::User> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).User)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
|
|
}
|
|
}
|
|
pub fn GetBoolean(&self) -> windows_core::Result<bool> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).GetBoolean)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
|
|
}
|
|
}
|
|
#[cfg(feature = "Storage_Streams")]
|
|
pub fn GetBinary(&self) -> windows_core::Result<super::super::Storage::Streams::IBuffer> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).GetBinary)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
|
|
}
|
|
}
|
|
pub fn GetInt32(&self) -> windows_core::Result<i32> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).GetInt32)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
|
|
}
|
|
}
|
|
pub fn GetInt64(&self) -> windows_core::Result<i64> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).GetInt64)(windows_core::Interface::as_raw(this), &mut result__).map(|| result__)
|
|
}
|
|
}
|
|
pub fn GetString(&self) -> windows_core::Result<windows_core::HSTRING> {
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).GetString)(windows_core::Interface::as_raw(this), &mut result__).and_then(|| windows_core::Type::from_abi(result__))
|
|
}
|
|
}
|
|
pub fn Changed<P0>(&self, changedhandler: P0) -> windows_core::Result<super::super::Foundation::EventRegistrationToken>
|
|
where
|
|
P0: windows_core::Param<super::super::Foundation::TypedEventHandler<NamedPolicyData, windows_core::IInspectable>>,
|
|
{
|
|
let this = self;
|
|
unsafe {
|
|
let mut result__ = core::mem::zeroed();
|
|
(windows_core::Interface::vtable(this).Changed)(windows_core::Interface::as_raw(this), changedhandler.param().abi(), &mut result__).map(|| result__)
|
|
}
|
|
}
|
|
pub fn RemoveChanged(&self, cookie: super::super::Foundation::EventRegistrationToken) -> windows_core::Result<()> {
|
|
let this = self;
|
|
unsafe { (windows_core::Interface::vtable(this).RemoveChanged)(windows_core::Interface::as_raw(this), cookie).ok() }
|
|
}
|
|
}
|
|
impl windows_core::RuntimeType for NamedPolicyData {
|
|
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::for_class::<Self, INamedPolicyData>();
|
|
}
|
|
unsafe impl windows_core::Interface for NamedPolicyData {
|
|
type Vtable = INamedPolicyData_Vtbl;
|
|
const IID: windows_core::GUID = <INamedPolicyData as windows_core::Interface>::IID;
|
|
}
|
|
impl windows_core::RuntimeName for NamedPolicyData {
|
|
const NAME: &'static str = "Windows.Management.Policies.NamedPolicyData";
|
|
}
|
|
unsafe impl Send for NamedPolicyData {}
|
|
unsafe impl Sync for NamedPolicyData {}
|
|
#[repr(transparent)]
|
|
#[derive(PartialEq, Eq, Copy, Clone, Default)]
|
|
pub struct NamedPolicyKind(pub i32);
|
|
impl NamedPolicyKind {
|
|
pub const Invalid: Self = Self(0i32);
|
|
pub const Binary: Self = Self(1i32);
|
|
pub const Boolean: Self = Self(2i32);
|
|
pub const Int32: Self = Self(3i32);
|
|
pub const Int64: Self = Self(4i32);
|
|
pub const String: Self = Self(5i32);
|
|
}
|
|
impl windows_core::TypeKind for NamedPolicyKind {
|
|
type TypeKind = windows_core::CopyType;
|
|
}
|
|
impl core::fmt::Debug for NamedPolicyKind {
|
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
|
f.debug_tuple("NamedPolicyKind").field(&self.0).finish()
|
|
}
|
|
}
|
|
impl windows_core::RuntimeType for NamedPolicyKind {
|
|
const SIGNATURE: windows_core::imp::ConstBuffer = windows_core::imp::ConstBuffer::from_slice(b"enum(Windows.Management.Policies.NamedPolicyKind;i4)");
|
|
}
|