diff options
| author | Josh Ferrell <josh@vector35.com> | 2024-10-14 15:59:26 -0400 |
|---|---|---|
| committer | Josh Ferrell <josh@vector35.com> | 2024-10-14 16:03:03 -0400 |
| commit | f95056eacd7d6432805779773dc122ea7684df11 (patch) | |
| tree | 66f378f526644ffc35e71cb8f9763312db39da66 /rust/src | |
| parent | ab0e6e8628d5502290a8a00ce40bf0483ff7c397 (diff) | |
Implement FileMetadata::get_project_file in rust
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/filemetadata.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/rust/src/filemetadata.rs b/rust/src/filemetadata.rs index 7d385a4c..3dd9ed1b 100644 --- a/rust/src/filemetadata.rs +++ b/rust/src/filemetadata.rs @@ -22,12 +22,12 @@ use binaryninjacore_sys::{ BNFreeFileMetadata, BNGetCurrentOffset, BNGetCurrentView, + BNGetFileMetadataDatabase, BNGetFileViewOfType, BNGetFilename, + BNGetProjectFile, BNIsAnalysisChanged, BNIsBackedByDatabase, - //BNSetFileMetadataNavigationHandler, - BNGetFileMetadataDatabase, BNIsFileModified, BNMarkFileModified, BNMarkFileSaved, @@ -39,17 +39,18 @@ use binaryninjacore_sys::{ BNRevertUndoActions, BNSaveAutoSnapshot, BNSetFilename, - BNUndo, + BNUndo }; use binaryninjacore_sys::{BNCreateDatabaseWithProgress, BNOpenExistingDatabaseWithProgress}; use crate::binaryview::BinaryView; use crate::database::Database; +use crate::project::ProjectFile; use crate::rc::*; use crate::string::*; -use std::ptr; +use std::ptr::{self, NonNull}; #[derive(PartialEq, Eq, Hash)] pub struct FileMetadata { @@ -207,6 +208,13 @@ impl FileMetadata { } } + pub fn get_project_file(&self) -> Option<ProjectFile> { + unsafe { + let res = NonNull::new(BNGetProjectFile(self.handle))?; + Some(ProjectFile::from_raw(res)) + } + } + pub fn create_database<S: BnStrCompatible>( &self, filename: S, |
