// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_Management_Policies_H #define WINRT_Windows_Management_Policies_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.250303.1" #include "winrt/Windows.Management.h" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Storage.Streams.2.h" #include "winrt/impl/Windows.System.2.h" #include "winrt/impl/Windows.Management.Policies.2.h" namespace winrt::impl { template auto consume_Windows_Management_Policies_INamedPolicyData::Area() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Area(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Area(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Management_Policies_INamedPolicyData::Name() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Name(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Name(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Management_Policies_INamedPolicyData::Kind() const { winrt::Windows::Management::Policies::NamedPolicyKind value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_Kind(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_Kind(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Management_Policies_INamedPolicyData::IsManaged() const { bool value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_IsManaged(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_IsManaged(&value)); } return value; } template auto consume_Windows_Management_Policies_INamedPolicyData::IsUserPolicy() const { bool value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_IsUserPolicy(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_IsUserPolicy(&value)); } return value; } template auto consume_Windows_Management_Policies_INamedPolicyData::User() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_User(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_User(&value)); } return winrt::Windows::System::User{ value, take_ownership_from_abi }; } template auto consume_Windows_Management_Policies_INamedPolicyData::GetBoolean() const { bool result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetBoolean(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetBoolean(&result)); } return result; } template auto consume_Windows_Management_Policies_INamedPolicyData::GetBinary() const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetBinary(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetBinary(&result)); } return winrt::Windows::Storage::Streams::IBuffer{ result, take_ownership_from_abi }; } template auto consume_Windows_Management_Policies_INamedPolicyData::GetInt32() const { int32_t result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetInt32(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetInt32(&result)); } return result; } template auto consume_Windows_Management_Policies_INamedPolicyData::GetInt64() const { int64_t result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetInt64(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetInt64(&result)); } return result; } template auto consume_Windows_Management_Policies_INamedPolicyData::GetString() const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetString(&result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetString(&result)); } return hstring{ result, take_ownership_from_abi }; } template auto consume_Windows_Management_Policies_INamedPolicyData::Changed(winrt::Windows::Foundation::TypedEventHandler const& changedHandler) const { winrt::event_token cookie{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->add_Changed(*(void**)(&changedHandler), put_abi(cookie))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->add_Changed(*(void**)(&changedHandler), put_abi(cookie))); } return cookie; } template auto consume_Windows_Management_Policies_INamedPolicyData::Changed(auto_revoke_t, winrt::Windows::Foundation::TypedEventHandler const& changedHandler) const { return impl::make_event_revoker(this, Changed(changedHandler)); } template auto consume_Windows_Management_Policies_INamedPolicyData::Changed(winrt::event_token const& cookie) const noexcept { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; _winrt_abi_type->remove_Changed(impl::bind_in(cookie)); } else { auto const _winrt_abi_type = *(abi_t**)this; _winrt_abi_type->remove_Changed(impl::bind_in(cookie)); } } template auto consume_Windows_Management_Policies_INamedPolicyStatics::GetPolicyFromPath(param::hstring const& area, param::hstring const& name) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetPolicyFromPath(*(void**)(&area), *(void**)(&name), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetPolicyFromPath(*(void**)(&area), *(void**)(&name), &result)); } return winrt::Windows::Management::Policies::NamedPolicyData{ result, take_ownership_from_abi }; } template auto consume_Windows_Management_Policies_INamedPolicyStatics::GetPolicyFromPathForUser(winrt::Windows::System::User const& user, param::hstring const& area, param::hstring const& name) const { void* result{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetPolicyFromPathForUser(*(void**)(&user), *(void**)(&area), *(void**)(&name), &result)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetPolicyFromPathForUser(*(void**)(&user), *(void**)(&area), *(void**)(&name), &result)); } return winrt::Windows::Management::Policies::NamedPolicyData{ result, take_ownership_from_abi }; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_Area(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Area()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Name(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Name()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_Kind(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().Kind()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_IsManaged(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsManaged()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_IsUserPolicy(bool* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().IsUserPolicy()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_User(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().User()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetBoolean(bool* result) noexcept final try { typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetBoolean()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetBinary(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetBinary()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetInt32(int32_t* result) noexcept final try { typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetInt32()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetInt64(int64_t* result) noexcept final try { typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetInt64()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetString(void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetString()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall add_Changed(void* changedHandler, winrt::event_token* cookie) noexcept final try { zero_abi(cookie); typename D::abi_guard guard(this->shim()); *cookie = detach_from(this->shim().Changed(*reinterpret_cast const*>(&changedHandler))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall remove_Changed(winrt::event_token cookie) noexcept final { typename D::abi_guard guard(this->shim()); this->shim().Changed(*reinterpret_cast(&cookie)); return 0; } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall GetPolicyFromPath(void* area, void* name, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetPolicyFromPath(*reinterpret_cast(&area), *reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetPolicyFromPathForUser(void* user, void* area, void* name, void** result) noexcept final try { clear_abi(result); typename D::abi_guard guard(this->shim()); *result = detach_from(this->shim().GetPolicyFromPathForUser(*reinterpret_cast(&user), *reinterpret_cast(&area), *reinterpret_cast(&name))); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::Management::Policies { inline auto NamedPolicy::GetPolicyFromPath(param::hstring const& area, param::hstring const& name) { return impl::call_factory([&](INamedPolicyStatics const& f) { return f.GetPolicyFromPath(area, name); }); } inline auto NamedPolicy::GetPolicyFromPathForUser(winrt::Windows::System::User const& user, param::hstring const& area, param::hstring const& name) { return impl::call_factory([&](INamedPolicyStatics const& f) { return f.GetPolicyFromPathForUser(user, area, name); }); } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif