Skip to content

Commit

Permalink
Remove dead code related to Windows 7 support (#1390)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Feb 8, 2024
1 parent 91f485f commit e69ff22
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 152 deletions.
55 changes: 0 additions & 55 deletions strings/base_agile_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,61 +71,6 @@ namespace winrt::impl

using update_module_lock = module_lock_updater<true>;

struct agile_ref_fallback final : IAgileReference, update_module_lock
{
agile_ref_fallback(com_ptr<IGlobalInterfaceTable>&& git, uint32_t cookie) noexcept :
m_git(std::move(git)),
m_cookie(cookie)
{
}

~agile_ref_fallback() noexcept
{
m_git->RevokeInterfaceFromGlobal(m_cookie);
}

int32_t __stdcall QueryInterface(guid const& id, void** object) noexcept final
{
if (is_guid_of<IAgileReference>(id) || is_guid_of<Windows::Foundation::IUnknown>(id) || is_guid_of<IAgileObject>(id))
{
*object = static_cast<IAgileReference*>(this);
AddRef();
return 0;
}

*object = nullptr;
return error_no_interface;
}

uint32_t __stdcall AddRef() noexcept final
{
return ++m_references;
}

uint32_t __stdcall Release() noexcept final
{
auto const remaining = --m_references;

if (remaining == 0)
{
delete this;
}

return remaining;
}

int32_t __stdcall Resolve(guid const& id, void** object) noexcept final
{
return m_git->GetInterfaceFromGlobal(m_cookie, id, object);
}

private:

com_ptr<IGlobalInterfaceTable> m_git;
uint32_t m_cookie{};
atomic_ref_count m_references{ 1 };
};

inline void* load_library(wchar_t const* library) noexcept
{
return WINRT_IMPL_LoadLibraryExW(library, nullptr, 0x00001000 /* LOAD_LIBRARY_SEARCH_DEFAULT_DIRS */);
Expand Down
97 changes: 0 additions & 97 deletions strings/base_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,103 +78,6 @@ namespace winrt::impl
{
return ((int32_t)((x) | 0x10000000));
}

struct error_info_fallback final : IErrorInfo, IRestrictedErrorInfo, update_module_lock
{
error_info_fallback(int32_t code, void* message) noexcept :
m_code(code),
m_message(message ? *reinterpret_cast<winrt::hstring*>(&message) : message_from_hresult(code))
{
}

int32_t __stdcall QueryInterface(guid const& id, void** object) noexcept final
{
if (is_guid_of<IRestrictedErrorInfo>(id) || is_guid_of<Windows::Foundation::IUnknown>(id) || is_guid_of<IAgileObject>(id))
{
*object = static_cast<IRestrictedErrorInfo*>(this);
AddRef();
return 0;
}

if (is_guid_of<IErrorInfo>(id))
{
*object = static_cast<IErrorInfo*>(this);
AddRef();
return 0;
}

*object = nullptr;
return error_no_interface;
}

uint32_t __stdcall AddRef() noexcept final
{
return ++m_references;
}

uint32_t __stdcall Release() noexcept final
{
auto const remaining = --m_references;

if (remaining == 0)
{
delete this;
}

return remaining;
}

int32_t __stdcall GetGUID(guid* value) noexcept final
{
*value = {};
return 0;
}

int32_t __stdcall GetSource(bstr* value) noexcept final
{
*value = nullptr;
return 0;
}

int32_t __stdcall GetDescription(bstr* value) noexcept final
{
*value = WINRT_IMPL_SysAllocString(m_message.c_str());
return *value ? error_ok : error_bad_alloc;
}

int32_t __stdcall GetHelpFile(bstr* value) noexcept final
{
*value = nullptr;
return 0;
}

int32_t __stdcall GetHelpContext(uint32_t* value) noexcept final
{
*value = 0;
return 0;
}

int32_t __stdcall GetErrorDetails(bstr* fallback, int32_t* error, bstr* message, bstr* capability) noexcept final
{
*fallback = nullptr;
*error = m_code;
*capability = nullptr;
*message = WINRT_IMPL_SysAllocString(m_message.c_str());
return *message ? error_ok : error_bad_alloc;
}

int32_t __stdcall GetReference(bstr* value) noexcept final
{
*value = nullptr;
return 0;
}

private:

hresult const m_code;
hstring const m_message;
atomic_ref_count m_references{ 1 };
};
}

WINRT_EXPORT namespace winrt
Expand Down

0 comments on commit e69ff22

Please sign in to comment.