summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.h2
-rw-r--r--binaryninjacore.h2
-rw-r--r--filemetadata.cpp6
-rw-r--r--python/filemetadata.py4
m---------suite/binaries0
-rw-r--r--suite/testcommon.py13
6 files changed, 27 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 6f39b8d5..6009aa20 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -910,6 +910,8 @@ __attribute__ ((format (printf, 1, 2)))
void MarkFileModified();
void MarkFileSaved();
+ bool IsSnapshotDataAppliedWithoutError() const;
+
bool IsBackedByDatabase() const;
bool CreateDatabase(const std::string& name, BinaryView* data, Ref<SaveSettings> settings);
bool CreateDatabase(const std::string& name, BinaryView* data,
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 6bdc68f4..c48b93ac 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -2637,6 +2637,8 @@ __attribute__ ((format (printf, 1, 2)))
BINARYNINJACOREAPI char** BNGetExistingViews(BNFileMetadata* file, size_t* count);
+ BINARYNINJACOREAPI bool BNIsSnapshotDataAppliedWithoutError(BNFileMetadata* view);
+
// Binary view access
BINARYNINJACOREAPI BNBinaryView* BNNewViewReference(BNBinaryView* view);
BINARYNINJACOREAPI void BNFreeBinaryView(BNBinaryView* view);
diff --git a/filemetadata.cpp b/filemetadata.cpp
index 3af4cf6e..9559b041 100644
--- a/filemetadata.cpp
+++ b/filemetadata.cpp
@@ -363,6 +363,12 @@ std::vector<std::string> FileMetadata::GetExistingViews() const
return result;
}
+bool FileMetadata::IsSnapshotDataAppliedWithoutError() const
+{
+ return BNIsSnapshotDataAppliedWithoutError(m_object);
+}
+
+
SaveSettings::SaveSettings()
{
m_object = BNCreateSaveSettings();
diff --git a/python/filemetadata.py b/python/filemetadata.py
index bfcfff90..e8c72775 100644
--- a/python/filemetadata.py
+++ b/python/filemetadata.py
@@ -263,6 +263,10 @@ class FileMetadata(object):
else:
return FileMetadata._associated_data[handle.value]
+ @property
+ def snapshot_data_applied_without_error(self):
+ return core.BNIsSnapshotDataAppliedWithoutError(self.handle)
+
def close(self):
"""
Closes the underlying file handle. It is recommended that this is done in a
diff --git a/suite/binaries b/suite/binaries
-Subproject 5712e66fa4aad7fc0bba541b012abbb877ea576
+Subproject fd6fb188a1b8830a168ac8234495ae21f019eb8
diff --git a/suite/testcommon.py b/suite/testcommon.py
index 992a7961..c5bf4895 100644
--- a/suite/testcommon.py
+++ b/suite/testcommon.py
@@ -1541,3 +1541,16 @@ class VerifyBuilder(Builder):
self.delete_package("helloworld")
callback_should_run = False
+ def test_load_old_database(self):
+ """Load a database produced by Binary Ninja v1.2.1921"""
+ file_name = os.path.join(os.path.dirname(__file__), self.test_store, "..", "binja_v1.2.1921_bin_ls.bndb")
+ if not os.path.exists(file_name):
+ return False
+
+ with BinaryViewType.get_view_of_file(file_name) as bv:
+ if bv is None:
+ return False
+ if bv.file.snapshot_data_applied_without_error:
+ return True
+
+ return False