summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--binaryninjaapi.h5
-rw-r--r--binaryninjacore.h8
-rw-r--r--project.cpp14
3 files changed, 18 insertions, 9 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index 4dc1ac07..79295b6e 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -2635,6 +2635,7 @@ namespace BinaryNinja {
Ref<ProjectFolder> GetFolder() const;
void SetFolder(Ref<ProjectFolder> folder);
bool Export(const std::string& destination) const;
+ int64_t GetCreationTimestamp() const;
};
@@ -2675,9 +2676,9 @@ namespace BinaryNinja {
void DeleteFolder(Ref<ProjectFolder> folder, const std::function<bool(size_t progress, size_t total)>& progressCallback = {});
Ref<ProjectFile> CreateFileFromPath(const std::string& path, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::function<bool(size_t progress, size_t total)>& progressCallback = {});
- Ref<ProjectFile> CreateFileFromPathUnsafe(const std::string& path, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::string& id, const std::function<bool(size_t progress, size_t total)>& progressCallback = {});
+ Ref<ProjectFile> CreateFileFromPathUnsafe(const std::string& path, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::string& id, int64_t creationTimestamp, const std::function<bool(size_t progress, size_t total)>& progressCallback = {});
Ref<ProjectFile> CreateFile(const std::vector<uint8_t>& contents, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::function<bool(size_t progress, size_t total)>& progressCallback = {});
- Ref<ProjectFile> CreateFileUnsafe(const std::vector<uint8_t>& contents, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::string& id, const std::function<bool(size_t progress, size_t total)>& progressCallback = {});
+ Ref<ProjectFile> CreateFileUnsafe(const std::vector<uint8_t>& contents, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::string& id, int64_t creationTimestamp, const std::function<bool(size_t progress, size_t total)>& progressCallback = {});
std::vector<Ref<ProjectFile>> GetFiles() const;
Ref<ProjectFile> GetFileById(const std::string& id) const;
Ref<ProjectFile> GetFileByPathOnDisk(const std::string& path);
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 9d4294b4..204390ec 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 47
+#define BN_CURRENT_CORE_ABI_VERSION 48
// 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
@@ -3334,11 +3334,11 @@ extern "C"
BINARYNINJACOREAPI BNProjectFile* BNProjectCreateFileFromPath(BNProject* project, const char* path, BNProjectFolder* folder, const char* name, const char* description, void* ctxt,
bool (*progress)(void* ctxt, size_t progress, size_t total));
- BINARYNINJACOREAPI BNProjectFile* BNProjectCreateFileFromPathUnsafe(BNProject* project, const char* path, BNProjectFolder* folder, const char* name, const char* description, const char* id, void* ctxt,
+ BINARYNINJACOREAPI BNProjectFile* BNProjectCreateFileFromPathUnsafe(BNProject* project, const char* path, BNProjectFolder* folder, const char* name, const char* description, const char* id, int64_t creationTimestamp, void* ctxt,
bool (*progress)(void* ctxt, size_t progress, size_t total));
BINARYNINJACOREAPI BNProjectFile* BNProjectCreateFile(BNProject* project, const uint8_t* contents, size_t contentsSize, BNProjectFolder* folder, const char* name, const char* description, void* ctxt,
bool (*progress)(void* ctxt, size_t progress, size_t total));
- BINARYNINJACOREAPI BNProjectFile* BNProjectCreateFileUnsafe(BNProject* project, const uint8_t* contents, size_t contentsSize, BNProjectFolder* folder, const char* name, const char* description, const char* id, void* ctxt,
+ BINARYNINJACOREAPI BNProjectFile* BNProjectCreateFileUnsafe(BNProject* project, const uint8_t* contents, size_t contentsSize, BNProjectFolder* folder, const char* name, const char* description, const char* id, int64_t creationTimestamp, void* ctxt,
bool (*progress)(void* ctxt, size_t progress, size_t total));
BINARYNINJACOREAPI BNProjectFile** BNProjectGetFiles(BNProject* project, size_t* count);
BINARYNINJACOREAPI BNProjectFile* BNProjectGetFileById(BNProject* project, const char* id);
@@ -3375,6 +3375,8 @@ extern "C"
BINARYNINJACOREAPI void BNProjectFileSetFolder(BNProjectFile* file, BNProjectFolder* folder);
BINARYNINJACOREAPI BNProject* BNProjectFileGetProject(BNProjectFile* file);
BINARYNINJACOREAPI bool BNProjectFileExport(BNProjectFile* file, const char* destination);
+ BINARYNINJACOREAPI int64_t BNProjectFileGetCreationTimestamp(BNProjectFile* file);
+
// ProjectFolder object
BINARYNINJACOREAPI BNProjectFolder* BNNewProjectFolderReference(BNProjectFolder* folder);
diff --git a/project.cpp b/project.cpp
index b456d66c..f6e6b49c 100644
--- a/project.cpp
+++ b/project.cpp
@@ -418,11 +418,11 @@ Ref<ProjectFile> Project::CreateFileFromPath(const std::string& path, Ref<Projec
}
-Ref<ProjectFile> Project::CreateFileFromPathUnsafe(const std::string& path, Ref<ProjectFolder> folder, const std::string& name, const std::string& description,const std::string& id, const std::function<bool(size_t progress, size_t total)>& progressCallback)
+Ref<ProjectFile> Project::CreateFileFromPathUnsafe(const std::string& path, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::string& id, int64_t creationTimestamp, const std::function<bool(size_t progress, size_t total)>& progressCallback)
{
ProgressContext cb;
cb.callback = progressCallback;
- BNProjectFile* file = BNProjectCreateFileFromPathUnsafe(m_object, path.c_str(), folder ? folder->m_object : nullptr, name.c_str(), description.c_str(), id.c_str(), &cb, ProgressCallback);
+ BNProjectFile* file = BNProjectCreateFileFromPathUnsafe(m_object, path.c_str(), folder ? folder->m_object : nullptr, name.c_str(), description.c_str(), id.c_str(), creationTimestamp, &cb, ProgressCallback);
if (file == nullptr)
return nullptr;
return new ProjectFile(file);
@@ -440,11 +440,11 @@ Ref<ProjectFile> Project::CreateFile(const std::vector<uint8_t>& contents, Ref<P
}
-Ref<ProjectFile> Project::CreateFileUnsafe(const std::vector<uint8_t>& contents, Ref<ProjectFolder> folder, const std::string& name, const std::string& description,const std::string& id, const std::function<bool(size_t progress, size_t total)>& progressCallback)
+Ref<ProjectFile> Project::CreateFileUnsafe(const std::vector<uint8_t>& contents, Ref<ProjectFolder> folder, const std::string& name, const std::string& description, const std::string& id, int64_t creationTimestamp, const std::function<bool(size_t progress, size_t total)>& progressCallback)
{
ProgressContext cb;
cb.callback = progressCallback;
- BNProjectFile* file = BNProjectCreateFileUnsafe(m_object, contents.data(), contents.size(), folder ? folder->m_object : nullptr, name.c_str(), description.c_str(), id.c_str(), &cb, ProgressCallback);
+ BNProjectFile* file = BNProjectCreateFileUnsafe(m_object, contents.data(), contents.size(), folder ? folder->m_object : nullptr, name.c_str(), description.c_str(), id.c_str(), creationTimestamp, &cb, ProgressCallback);
if (file == nullptr)
return nullptr;
return new ProjectFile(file);
@@ -609,6 +609,12 @@ bool ProjectFile::Export(const std::string& destination) const
}
+int64_t ProjectFile::GetCreationTimestamp() const
+{
+ return BNProjectFileGetCreationTimestamp(m_object);
+}
+
+
ProjectFolder::ProjectFolder(BNProjectFolder* folder)
{
m_object = folder;