diff options
| -rw-r--r-- | binaryninjaapi.h | 11 | ||||
| -rw-r--r-- | binaryninjacore.h | 12 | ||||
| -rw-r--r-- | collaboration.cpp | 29 |
3 files changed, 49 insertions, 3 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 72e803b5..a243f974 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -21603,6 +21603,16 @@ namespace BinaryNinja::Collaboration */ std::vector<std::pair<std::string, std::string>> SearchUsers(const std::string& prefix); + struct FileSearchMatch + { + std::string projectId; + std::string projectName; + std::string fileId; + std::string fileName; + }; + + std::vector<FileSearchMatch> FindFiles(const std::string& name); + /*! Pull list of users from the remote. Necessary before calling GetUsers() @@ -22487,4 +22497,3 @@ template<> struct fmt::formatter<BinaryNinja::Type> return it; } }; - diff --git a/binaryninjacore.h b/binaryninjacore.h index 146de0aa..9f544b9f 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -37,7 +37,7 @@ // Current ABI version for linking to the core. This is incremented any time // there are changes to the API that affect linking, including new functions, // new types, or modifications to existing functions or types. -#define BN_CURRENT_CORE_ABI_VERSION 136 +#define BN_CURRENT_CORE_ABI_VERSION 137 // Minimum ABI version that is supported for loading of plugins. Plugins that // are linked to an ABI version less than this will not be able to load and @@ -312,6 +312,14 @@ extern "C" typedef struct BNIndirectBranchInfo BNIndirectBranchInfo; typedef struct BNArchitectureAndAddress BNArchitectureAndAddress; + typedef struct BNRemoteFileSearchMatch + { + char* projectId; + char* projectName; + char* fileId; + char* fileName; + } BNRemoteFileSearchMatch; + typedef bool(*BNProgressFunction)(void*, size_t, size_t); //! Console log levels @@ -8240,6 +8248,8 @@ extern "C" BINARYNINJACOREAPI BNCollaborationUser* BNRemoteGetUserByUsername(BNRemote* remote, const char* username); BINARYNINJACOREAPI BNCollaborationUser* BNRemoteGetCurrentUser(BNRemote* remote); BINARYNINJACOREAPI bool BNRemoteSearchUsers(BNRemote* remote, const char* prefix, char*** userIds, char*** usernames, size_t* count); + BINARYNINJACOREAPI BNRemoteFileSearchMatch* BNRemoteFindFiles(BNRemote* remote, const char* name, size_t* count); + BINARYNINJACOREAPI void BNFreeRemoteFileSearchMatchList(BNRemoteFileSearchMatch* matches, size_t count); BINARYNINJACOREAPI bool BNRemotePullUsers(BNRemote* remote, BNProgressFunction progress, void* progressContext); BINARYNINJACOREAPI BNCollaborationUser* BNRemoteCreateUser(BNRemote* remote, const char* username, const char* email, bool isActive, const char* password, const uint64_t* groupIds, size_t groupIdCount, const uint64_t* userPermissionIds, size_t userPermissionIdCount); BINARYNINJACOREAPI bool BNRemotePushUser(BNRemote* remote, BNCollaborationUser* user, const char** extraFieldKeys, const char** extraFieldValues, size_t extraFieldCount); diff --git a/collaboration.cpp b/collaboration.cpp index b07cd845..d7d5d6e2 100644 --- a/collaboration.cpp +++ b/collaboration.cpp @@ -977,6 +977,34 @@ std::vector<std::pair<std::string, std::string>> Remote::SearchUsers(const std:: } +std::vector<Remote::FileSearchMatch> Remote::FindFiles(const std::string& name) +{ + size_t count = 0; + BNRemoteFileSearchMatch* matches = BNRemoteFindFiles(m_object, name.c_str(), &count); + std::vector<FileSearchMatch> results; + if (!matches) + return results; + + results.reserve(count); + for (size_t i = 0; i < count; i++) + { + FileSearchMatch match; + if (matches[i].projectId) + match.projectId = matches[i].projectId; + if (matches[i].projectName) + match.projectName = matches[i].projectName; + if (matches[i].fileId) + match.fileId = matches[i].fileId; + if (matches[i].fileName) + match.fileName = matches[i].fileName; + results.push_back(std::move(match)); + } + + BNFreeRemoteFileSearchMatchList(matches, count); + return results; +} + + void Remote::PullUsers(ProgressFunction progress) { ProgressContext pctxt; @@ -2677,4 +2705,3 @@ CollabUndoEntry::CollabUndoEntry(BNCollaborationUndoEntry* entry) { m_object = entry; } - |
