summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.h1
-rw-r--r--binaryninjacore.h1
-rw-r--r--database.cpp11
3 files changed, 13 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 5f4f6d16..63293812 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -1909,6 +1909,7 @@ namespace BinaryNinja {
std::vector<Ref<Snapshot>> GetChildren();
DataBuffer GetFileContents();
DataBuffer GetFileContentsHash();
+ DataBuffer GetUndoData();
std::vector<UndoEntry> GetUndoEntries();
std::vector<UndoEntry> GetUndoEntries(const std::function<bool(size_t, size_t)>& progress);
Ref<KeyValueStore> ReadData();
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 210a4322..e1e9a830 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -3244,6 +3244,7 @@ extern "C"
BINARYNINJACOREAPI BNKeyValueStore* BNReadSnapshotData(BNSnapshot* snapshot);
BINARYNINJACOREAPI BNKeyValueStore* BNReadSnapshotDataWithProgress(
BNSnapshot* snapshot, void* ctxt, bool (*progress)(void* ctxt, size_t progress, size_t total));
+ BINARYNINJACOREAPI BNDataBuffer* BNGetSnapshotUndoData(BNSnapshot* snapshot);
BINARYNINJACOREAPI BNUndoEntry* BNGetSnapshotUndoEntries(BNSnapshot* snapshot, size_t* count);
BINARYNINJACOREAPI BNUndoEntry* BNGetSnapshotUndoEntriesWithProgress(
BNSnapshot* snapshot, void* ctxt, bool (*progress)(void* ctxt, size_t progress, size_t total), size_t* count);
diff --git a/database.cpp b/database.cpp
index 887cdea7..dd258967 100644
--- a/database.cpp
+++ b/database.cpp
@@ -276,6 +276,17 @@ DataBuffer Snapshot::GetFileContentsHash()
}
+DataBuffer Snapshot::GetUndoData()
+{
+ BNDataBuffer* buffer = BNGetSnapshotUndoData(m_object);
+ if (buffer == nullptr)
+ {
+ throw DatabaseException("BNGetSnapshotUndoData");
+ }
+ return DataBuffer(buffer);
+}
+
+
vector<UndoEntry> Snapshot::GetUndoEntries()
{
return GetUndoEntries([](size_t, size_t) { return true; });