diff options
| author | Mason Reed <mason@vector35.com> | 2026-02-22 22:42:35 -0800 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-02-23 00:09:44 -0800 |
| commit | d0eec62d6df0edbbb76dfeac58879797e90a8594 (patch) | |
| tree | 03cf8d04eb7d33ac0785f2eede92ecbd552a48b0 /plugins/warp/src/plugin/create.rs | |
| parent | f3e0bf4ab35d50b11b2dbde41a699ab7497208d1 (diff) | |
Add global plugin command type
Register plugins which are available outside the context of a binary view
Diffstat (limited to 'plugins/warp/src/plugin/create.rs')
| -rw-r--r-- | plugins/warp/src/plugin/create.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/plugins/warp/src/plugin/create.rs b/plugins/warp/src/plugin/create.rs index 2a748819..5f5527a7 100644 --- a/plugins/warp/src/plugin/create.rs +++ b/plugins/warp/src/plugin/create.rs @@ -6,7 +6,8 @@ use crate::report::{ReportGenerator, ReportKindField}; use crate::{user_signature_dir, INCLUDE_TAG_NAME}; use binaryninja::background_task::BackgroundTask; use binaryninja::binary_view::{BinaryView, BinaryViewExt}; -use binaryninja::command::Command; +use binaryninja::command::{Command, GlobalCommand}; +use binaryninja::file_metadata::FileMetadata; use binaryninja::interaction::form::{Form, FormInputField}; use binaryninja::interaction::{MessageBoxButtonResult, MessageBoxButtonSet, MessageBoxIcon}; use binaryninja::rc::Ref; @@ -248,15 +249,17 @@ impl Command for CreateFromCurrentView { pub struct CreateFromFiles; -impl Command for CreateFromFiles { - fn action(&self, view: &BinaryView) { - let view = view.to_owned(); +impl GlobalCommand for CreateFromFiles { + fn action(&self) { + let empty_file_metadata = FileMetadata::new(); + let empty_bv = BinaryView::from_data(&empty_file_metadata, &[]); thread::spawn(move || { - CreateFromCurrentView::execute(view, true); + CreateFromCurrentView::execute(empty_bv.to_owned(), true); + empty_bv.file().close(); }); } - fn valid(&self, _view: &BinaryView) -> bool { + fn valid(&self) -> bool { true } } |
