From 7977801957364139464406602038722124434273 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 15 Mar 2023 20:51:48 -0400 Subject: BinaryView::LookupImportedType* --- binaryview.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index eeef5a74..67fe011c 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -3731,6 +3731,21 @@ void BinaryView::RegisterPlatformTypes(Platform* platform) } +std::optional, QualifiedName>> BinaryView::LookupImportedTypePlatform(const QualifiedName& name) +{ + BNPlatform* resultLib; + BNQualifiedName resultName; + BNQualifiedName sourceName = name.GetAPIObject(); + bool result = BNLookupImportedTypePlatform(m_object, &sourceName, &resultLib, &resultName); + QualifiedName::FreeAPIObject(&sourceName); + if (!result) + return std::nullopt; + QualifiedName targetName = QualifiedName::FromAPIObject(&resultName); + BNFreeQualifiedName(&resultName); + return std::make_pair(new Platform(resultLib), targetName); +} + + void BinaryView::AddTypeLibrary(TypeLibrary* lib) { BNAddBinaryViewTypeLibrary(m_object, lib->GetObject()); @@ -3824,6 +3839,21 @@ std::optional, QualifiedName>> BinaryView::LookupImpo } +std::optional, QualifiedName>> BinaryView::LookupImportedTypeLibrary(const QualifiedName& name) +{ + BNTypeLibrary* resultLib; + BNQualifiedName resultName; + BNQualifiedName sourceName = name.GetAPIObject(); + bool result = BNBinaryViewLookupImportedTypeLibrary(m_object, &sourceName, &resultLib, &resultName); + QualifiedName::FreeAPIObject(&sourceName); + if (!result) + return std::nullopt; + QualifiedName targetName = QualifiedName::FromAPIObject(&resultName); + BNFreeQualifiedName(&resultName); + return std::make_pair(new TypeLibrary(resultLib), targetName); +} + + bool BinaryView::FindNextData(uint64_t start, const DataBuffer& data, uint64_t& result, BNFindFlag flags) { return BNFindNextData(m_object, start, data.GetBufferObject(), &result, flags); -- cgit v1.3.1