// WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.240405.15 #pragma once #ifndef WINRT_Windows_Security_Cryptography_H #define WINRT_Windows_Security_Cryptography_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.240405.15"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.240405.15" #include "winrt/impl/Windows.Storage.Streams.2.h" #include "winrt/impl/Windows.Security.Cryptography.2.h" namespace winrt::impl { template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::Compare(winrt::Windows::Storage::Streams::IBuffer const& object1, winrt::Windows::Storage::Streams::IBuffer const& object2) const { bool isEqual{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->Compare(*(void**)(&object1), *(void**)(&object2), &isEqual)); return isEqual; } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::GenerateRandom(uint32_t length) const { void* buffer{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->GenerateRandom(length, &buffer)); return winrt::Windows::Storage::Streams::IBuffer{ buffer, take_ownership_from_abi }; } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::GenerateRandomNumber() const { uint32_t value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->GenerateRandomNumber(&value)); return value; } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::CreateFromByteArray(array_view value) const { void* buffer{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->CreateFromByteArray(value.size(), get_abi(value), &buffer)); return winrt::Windows::Storage::Streams::IBuffer{ buffer, take_ownership_from_abi }; } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::CopyToByteArray(winrt::Windows::Storage::Streams::IBuffer const& buffer, com_array& value) const { check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->CopyToByteArray(*(void**)(&buffer), impl::put_size_abi(value), put_abi(value))); } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::DecodeFromHexString(param::hstring const& value) const { void* buffer{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->DecodeFromHexString(*(void**)(&value), &buffer)); return winrt::Windows::Storage::Streams::IBuffer{ buffer, take_ownership_from_abi }; } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::EncodeToHexString(winrt::Windows::Storage::Streams::IBuffer const& buffer) const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->EncodeToHexString(*(void**)(&buffer), &value)); return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::DecodeFromBase64String(param::hstring const& value) const { void* buffer{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->DecodeFromBase64String(*(void**)(&value), &buffer)); return winrt::Windows::Storage::Streams::IBuffer{ buffer, take_ownership_from_abi }; } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::EncodeToBase64String(winrt::Windows::Storage::Streams::IBuffer const& buffer) const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->EncodeToBase64String(*(void**)(&buffer), &value)); return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::ConvertStringToBinary(param::hstring const& value, winrt::Windows::Security::Cryptography::BinaryStringEncoding const& encoding) const { void* buffer{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->ConvertStringToBinary(*(void**)(&value), static_cast(encoding), &buffer)); return winrt::Windows::Storage::Streams::IBuffer{ buffer, take_ownership_from_abi }; } template auto consume_Windows_Security_Cryptography_ICryptographicBufferStatics::ConvertBinaryToString(winrt::Windows::Security::Cryptography::BinaryStringEncoding const& encoding, winrt::Windows::Storage::Streams::IBuffer const& buffer) const { void* value{}; check_hresult(WINRT_IMPL_SHIM(winrt::Windows::Security::Cryptography::ICryptographicBufferStatics)->ConvertBinaryToString(static_cast(encoding), *(void**)(&buffer), &value)); return hstring{ value, take_ownership_from_abi }; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall Compare(void* object1, void* object2, bool* isEqual) noexcept final try { typename D::abi_guard guard(this->shim()); *isEqual = detach_from(this->shim().Compare(*reinterpret_cast(&object1), *reinterpret_cast(&object2))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GenerateRandom(uint32_t length, void** buffer) noexcept final try { clear_abi(buffer); typename D::abi_guard guard(this->shim()); *buffer = detach_from(this->shim().GenerateRandom(length)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GenerateRandomNumber(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().GenerateRandomNumber()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CreateFromByteArray(uint32_t __valueSize, uint8_t* value, void** buffer) noexcept final try { clear_abi(buffer); typename D::abi_guard guard(this->shim()); *buffer = detach_from(this->shim().CreateFromByteArray(array_view(reinterpret_cast(value), reinterpret_cast(value) + __valueSize))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall CopyToByteArray(void* buffer, uint32_t* __valueSize, uint8_t** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); this->shim().CopyToByteArray(*reinterpret_cast(&buffer), detach_abi(__valueSize, value)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall DecodeFromHexString(void* value, void** buffer) noexcept final try { clear_abi(buffer); typename D::abi_guard guard(this->shim()); *buffer = detach_from(this->shim().DecodeFromHexString(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall EncodeToHexString(void* buffer, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().EncodeToHexString(*reinterpret_cast(&buffer))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall DecodeFromBase64String(void* value, void** buffer) noexcept final try { clear_abi(buffer); typename D::abi_guard guard(this->shim()); *buffer = detach_from(this->shim().DecodeFromBase64String(*reinterpret_cast(&value))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall EncodeToBase64String(void* buffer, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().EncodeToBase64String(*reinterpret_cast(&buffer))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ConvertStringToBinary(void* value, int32_t encoding, void** buffer) noexcept final try { clear_abi(buffer); typename D::abi_guard guard(this->shim()); *buffer = detach_from(this->shim().ConvertStringToBinary(*reinterpret_cast(&value), *reinterpret_cast(&encoding))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall ConvertBinaryToString(int32_t encoding, void* buffer, void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ConvertBinaryToString(*reinterpret_cast(&encoding), *reinterpret_cast(&buffer))); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::Security::Cryptography { inline auto CryptographicBuffer::Compare(winrt::Windows::Storage::Streams::IBuffer const& object1, winrt::Windows::Storage::Streams::IBuffer const& object2) { return impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.Compare(object1, object2); }); } inline auto CryptographicBuffer::GenerateRandom(uint32_t length) { return impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.GenerateRandom(length); }); } inline auto CryptographicBuffer::GenerateRandomNumber() { return impl::call_factory_cast([](ICryptographicBufferStatics const& f) { return f.GenerateRandomNumber(); }); } inline auto CryptographicBuffer::CreateFromByteArray(array_view value) { return impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.CreateFromByteArray(value); }); } inline auto CryptographicBuffer::CopyToByteArray(winrt::Windows::Storage::Streams::IBuffer const& buffer, com_array& value) { impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.CopyToByteArray(buffer, value); }); } inline auto CryptographicBuffer::DecodeFromHexString(param::hstring const& value) { return impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.DecodeFromHexString(value); }); } inline auto CryptographicBuffer::EncodeToHexString(winrt::Windows::Storage::Streams::IBuffer const& buffer) { return impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.EncodeToHexString(buffer); }); } inline auto CryptographicBuffer::DecodeFromBase64String(param::hstring const& value) { return impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.DecodeFromBase64String(value); }); } inline auto CryptographicBuffer::EncodeToBase64String(winrt::Windows::Storage::Streams::IBuffer const& buffer) { return impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.EncodeToBase64String(buffer); }); } inline auto CryptographicBuffer::ConvertStringToBinary(param::hstring const& value, winrt::Windows::Security::Cryptography::BinaryStringEncoding const& encoding) { return impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.ConvertStringToBinary(value, encoding); }); } inline auto CryptographicBuffer::ConvertBinaryToString(winrt::Windows::Security::Cryptography::BinaryStringEncoding const& encoding, winrt::Windows::Storage::Streams::IBuffer const& buffer) { return impl::call_factory([&](ICryptographicBufferStatics const& f) { return f.ConvertBinaryToString(encoding, buffer); }); } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif