From cb87ea835ed3d4f01f91a9e67c2fc61cab18bd2c Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Thu, 15 Oct 2015 20:57:04 -0400 Subject: Add API to get list of valid channels and latest version for active license --- update.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 update.cpp (limited to 'update.cpp') diff --git a/update.cpp b/update.cpp new file mode 100644 index 00000000..9dcf66cb --- /dev/null +++ b/update.cpp @@ -0,0 +1,32 @@ +#include "binaryninjaapi.h" + +using namespace BinaryNinja; +using namespace std; + + +vector UpdateChannel::GetList() +{ + size_t count; + char* errors; + BNUpdateChannel* channels = BNGetUpdateChannels(&count, &errors); + + if (errors) + { + string errorStr = errors; + BNFreeString(errors); + throw UpdateException(errorStr); + } + + vector result; + for (size_t i = 0; i < count; i++) + { + UpdateChannel channel; + channel.name = channels[i].name; + channel.description = channels[i].description; + channel.latestVersion = channels[i].latestVersion; + result.push_back(channel); + } + + BNFreeUpdateChannelList(channels, count); + return result; +} -- cgit v1.3.1