From 1364a9bc7b3887441540cd27685c1addb028afb3 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Mon, 19 Sep 2016 22:26:56 -0400 Subject: Adding APIs to store arbitrary data on a per-view, per-file, or per-function basis --- binaryninjacore.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'binaryninjacore.h') diff --git a/binaryninjacore.h b/binaryninjacore.h index 34806b6c..084fd34d 100644 --- a/binaryninjacore.h +++ b/binaryninjacore.h @@ -1070,6 +1070,17 @@ extern "C" bool (*getDirectoryNameInput)(void* ctxt, char** result, const char* prompt, const char* defaultName); }; + struct BNObjectDestructionCallbacks + { + void* context; + // The provided pointers have a reference count of zero. Do not add additional references, doing so + // can lead to a double free. These are provided only for freeing additional state related to the + // objects passed. + void (*destructBinaryView)(void* ctxt, BNBinaryView* view); + void (*destructFileMetadata)(void* ctxt, BNFileMetadata* file); + void (*destructFunction)(void* ctxt, BNFunction* func); + }; + BINARYNINJACOREAPI char* BNAllocString(const char* contents); BINARYNINJACOREAPI void BNFreeString(char* str); @@ -1080,6 +1091,9 @@ extern "C" BINARYNINJACOREAPI bool BNIsLicenseValidated(void); + BINARYNINJACOREAPI void BNRegisterObjectDestructionCallbacks(BNObjectDestructionCallbacks* callbacks); + BINARYNINJACOREAPI void BNUnregisterObjectDestructionCallbacks(BNObjectDestructionCallbacks* callbacks); + // Plugin initialization BINARYNINJACOREAPI void BNInitCorePlugins(void); BINARYNINJACOREAPI void BNInitUserPlugins(void); -- cgit v1.3.1