From 13491e5eb8d50c242cf6858b111e404ea9f79239 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 22 Jul 2016 03:00:52 -0400 Subject: Add API to set type of function --- binaryview.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'binaryview.cpp') diff --git a/binaryview.cpp b/binaryview.cpp index ab519297..ee5bda8e 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -1338,6 +1338,26 @@ vector BinaryView::GetNextLinearDisassemblyLines(LinearDi } +bool BinaryView::ParseTypeString(const string& text, NameAndType& result, string& errors) +{ + BNNameAndType nt; + char* errorStr; + + if (!BNParseTypeString(m_object, text.c_str(), &nt, &errorStr)) + { + errors = errorStr; + BNFreeString(errorStr); + return false; + } + + result.name = nt.name; + result.type = new Type(nt.type); + errors = ""; + BNFreeString(nt.name); + return true; +} + + BinaryData::BinaryData(FileMetadata* file): BinaryView(BNCreateBinaryDataView(file->GetObject())) { } -- cgit v1.3.1