Skip to content

Commit 78cb3a4

Browse files
committed
fix rust plugin command LLIL definition
1 parent 2cfeffd commit 78cb3a4

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

rust/src/plugin_command.rs

+16-12
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ use std::ffi::CStr;
44
use binaryninjacore_sys::*;
55

66
use crate::architecture::CoreArchitecture;
7-
use crate::binary_view::BinaryViewExt;
87
use crate::high_level_il::HighLevelILFunction;
9-
use crate::low_level_il::function::{Finalized, LowLevelILFunction, NonSSA, RegularNonSSA};
8+
use crate::low_level_il::RegularLowLevelILFunction;
109
use crate::medium_level_il::MediumLevelILFunction;
11-
use crate::rc::{Array, CoreArrayProvider, CoreArrayProviderInner};
10+
use crate::rc::{Array, CoreArrayProvider, CoreArrayProviderInner, Ref};
1211
use crate::string::BnStrCompatible;
1312
use crate::{BinaryView, Function};
1413

@@ -217,20 +216,19 @@ define_enum! {
217216
},
218217
BNGetValidPluginCommandsForLowLevelILFunction, BNRegisterPluginCommandForLowLevelILFunction, LowLevelILFunctionPluginCommand, CustomLowLevelILFunctionPluginCommand {
219218
lowLevelILFunctionCommand::lowLevelILFunctionIsValid(
220-
// TODO I don't know what Generics should be used here
221-
func: *mut BNLowLevelILFunction: &LowLevelILFunction<CoreArchitecture, Finalized, NonSSA<RegularNonSSA>> =
222-
func.handle => &LowLevelILFunction::from_raw(
223-
BinaryView::from_raw(view).default_arch().unwrap(),
224-
func,
219+
llil: *mut BNLowLevelILFunction: &RegularLowLevelILFunction<CoreArchitecture> =
220+
llil.handle => &RegularLowLevelILFunction::from_raw(
221+
get_function_from_llil(llil).arch(),
222+
llil,
225223
),
226224
),
227225
},
228226
BNGetValidPluginCommandsForLowLevelILInstruction, BNRegisterPluginCommandForLowLevelILInstruction, LowLevelILInstructionPluginCommand, CustomLowLevelILInstructionPluginCommand {
229227
lowLevelILInstructionCommand::lowLevelILInstructionIsValid(
230-
func: *mut BNLowLevelILFunction: &LowLevelILFunction<CoreArchitecture, Finalized, NonSSA<RegularNonSSA>> =
231-
func.handle => &LowLevelILFunction::from_raw(
232-
BinaryView::from_raw(view).default_arch().unwrap(),
233-
func,
228+
llil: *mut BNLowLevelILFunction: &RegularLowLevelILFunction<CoreArchitecture> =
229+
llil.handle => &RegularLowLevelILFunction::from_raw(
230+
get_function_from_llil(llil).arch(),
231+
llil,
234232
),
235233
instr: usize: usize = instr => instr,
236234
),
@@ -259,3 +257,9 @@ define_enum! {
259257
),
260258
},
261259
}
260+
261+
// TODO merge this into the low_level_il module
262+
unsafe fn get_function_from_llil(llil: *mut BNLowLevelILFunction) -> Ref<Function> {
263+
let func = BNGetLowLevelILOwnerFunction(llil);
264+
Function::ref_from_raw(func)
265+
}

0 commit comments

Comments
 (0)