From f9a68f76f871449924b4fe32e6ade3d02a98249c Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Mon, 17 Jul 2023 13:43:16 -0400 Subject: Add CheckForStringAnnotationType API --- binaryview.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index 343dc322..2be28283 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -3185,6 +3185,22 @@ std::vector> BinaryView::GetDataVariableParentComponents(DataVari } +std::optional BinaryView::CheckForStringAnnotationType(uint64_t addr, string& value, bool allowShortStrings, bool allowLargeStrings, size_t childWidth) +{ + char* str = nullptr; + BNStringType type; + bool result = BNCheckForStringAnnotationType(m_object, addr, &str, &type, + allowShortStrings, allowLargeStrings, childWidth); + if (result) + { + value = string(str); + BNFreeString(str); + return type; + } + return std::nullopt; +} + + bool BinaryView::CanAssemble(Architecture* arch) { return BNCanAssemble(m_object, arch->GetObject()); @@ -3303,12 +3319,6 @@ Ref BinaryView::GetBackgroundAnalysisTask() } -size_t BinaryView::GetFullStringSize(uint64_t addr, BNStringType type) -{ - return BNGetFullStringSize(m_object, addr, type); -} - - uint64_t BinaryView::GetNextFunctionStartAfterAddress(uint64_t addr) { return BNGetNextFunctionStartAfterAddress(m_object, addr); -- cgit v1.3.1