Function binaryninja::command::register

source ·
pub fn register<S, C>(name: S, desc: S, command: C)
where S: BnStrCompatible, C: Command,
Expand description

The function call required for generic commands; commands added in this way will be in the Plugins submenu of the menu bar.

§Example

struct MyCommand;

impl Command for MyCommand {
    fn action(&self, view: &BinaryView) {
        // Your code here
    }

    fn valid(&self, view: &BinaryView) -> bool {
        // Your code here
        true
    }
}

#[no_mangle]
pub extern "C" fn CorePluginInit() -> bool {
    register(
        "My Plugin Command",
        "A description of my command",
        MyCommand {},
    );
    true
}