diff options
| author | KyleMiles <krm504@nyu.edu> | 2021-05-03 18:45:19 -0400 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2021-05-11 16:49:24 -0400 |
| commit | eb7a52bf4bd3b19c22f2eadda444ab045c674fe3 (patch) | |
| tree | 2395d577d410908b5d0291682660dac2017c7e97 /rust/src/command.rs | |
| parent | 5731e612900bed0d542421e00e64324dbac9367e (diff) | |
Rust API : Better headless support; Introducing `binaryninja::open_view` and `binaryninja::open_view_with_options`, updated init/shutdown, script example, more setting support, and misc fixes
Diffstat (limited to 'rust/src/command.rs')
| -rw-r--r-- | rust/src/command.rs | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/rust/src/command.rs b/rust/src/command.rs index 7dbc7436..3251e6b0 100644 --- a/rust/src/command.rs +++ b/rust/src/command.rs @@ -53,7 +53,9 @@ where { ffi_wrap!("Command::action", unsafe { let cmd = &*(ctxt as *const C); - let view = BinaryView::from_raw(view); + + debug_assert!(!view.is_null()); + let view = BinaryView { handle: view }; cmd.action(&view); }) @@ -65,7 +67,9 @@ where { ffi_wrap!("Command::valid", unsafe { let cmd = &*(ctxt as *const C); - let view = BinaryView::from_raw(view); + + debug_assert!(!view.is_null()); + let view = BinaryView { handle: view }; cmd.valid(&view) }) @@ -119,7 +123,9 @@ where { ffi_wrap!("AddressCommand::action", unsafe { let cmd = &*(ctxt as *const C); - let view = BinaryView::from_raw(view); + + debug_assert!(!view.is_null()); + let view = BinaryView { handle: view }; cmd.action(&view, addr); }) @@ -131,7 +137,9 @@ where { ffi_wrap!("AddressCommand::valid", unsafe { let cmd = &*(ctxt as *const C); - let view = BinaryView::from_raw(view); + + debug_assert!(!view.is_null()); + let view = BinaryView { handle: view }; cmd.valid(&view, addr) }) @@ -185,7 +193,9 @@ where { ffi_wrap!("RangeCommand::action", unsafe { let cmd = &*(ctxt as *const C); - let view = BinaryView::from_raw(view); + + debug_assert!(!view.is_null()); + let view = BinaryView { handle: view }; cmd.action(&view, addr..addr.wrapping_add(len)); }) @@ -202,7 +212,9 @@ where { ffi_wrap!("RangeCommand::valid", unsafe { let cmd = &*(ctxt as *const C); - let view = BinaryView::from_raw(view); + + debug_assert!(!view.is_null()); + let view = BinaryView { handle: view }; cmd.valid(&view, addr..addr.wrapping_add(len)) }) @@ -256,8 +268,12 @@ where { ffi_wrap!("FunctionCommand::action", unsafe { let cmd = &*(ctxt as *const C); - let view = BinaryView::from_raw(view); - let func = Function::from_raw(func); + + debug_assert!(!view.is_null()); + let view = BinaryView { handle: view }; + + debug_assert!(!func.is_null()); + let func = Function { handle: func }; cmd.action(&view, &func); }) @@ -273,8 +289,12 @@ where { ffi_wrap!("FunctionCommand::valid", unsafe { let cmd = &*(ctxt as *const C); - let view = BinaryView::from_raw(view); - let func = Function::from_raw(func); + + debug_assert!(!view.is_null()); + let view = BinaryView { handle: view }; + + debug_assert!(!func.is_null()); + let func = Function { handle: func }; cmd.valid(&view, &func) }) |
