Skip to content

Commit e3a3ac2

Browse files
committed
Some more changes to the data renderer API
1 parent 230a87b commit e3a3ac2

File tree

6 files changed

+307
-216
lines changed

6 files changed

+307
-216
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = [
88
"rust",
99
"arch/riscv",
1010
"arch/msp430",
11-
"rust/plugin_examples/*",
11+
"rust/plugin_examples/data_renderer",
1212
"view/minidump",
1313
"plugins/dwarf/dwarf_import",
1414
"plugins/dwarf/dwarf_export",

rust/plugin_examples/data_renderer/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
uuid = "1.18.1"
11-
binaryninjacore-sys = { path = "../../binaryninjacore-sys", default-features = false }
10+
binaryninjacore-sys = { path = "../../binaryninjacore-sys" }
1211
binaryninja = { path = "../.." }
12+
uuid = "1.18.1"
1313
log = "0.4.27"

rust/plugin_examples/data_renderer/src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use binaryninja::binary_view::{BinaryView, BinaryViewBase};
22
use binaryninja::data_renderer::{
3-
register_specific_data_renderer, CustomDataRenderer, TypeContext,
3+
register_data_renderer, CustomDataRenderer, RegistrationType, TypeContext,
44
};
55
use binaryninja::disassembly::{
66
DisassemblyTextLine, InstructionTextToken, InstructionTextTokenKind,
@@ -11,6 +11,8 @@ use uuid::Uuid;
1111
struct UuidDataRenderer {}
1212

1313
impl CustomDataRenderer for UuidDataRenderer {
14+
const REGISTRATION_TYPE: RegistrationType = RegistrationType::Specific;
15+
1416
fn is_valid_for_data(
1517
&self,
1618
_view: &BinaryView,
@@ -40,11 +42,11 @@ impl CustomDataRenderer for UuidDataRenderer {
4042

4143
// The array should be embedded in a named type reference with the id macho:["uuid"]
4244
for type_ctx in types {
43-
if type_ctx.type_().type_class() != TypeClass::NamedTypeReferenceClass {
45+
if type_ctx.ty().type_class() != TypeClass::NamedTypeReferenceClass {
4446
continue;
4547
}
4648

47-
let Some(name_ref) = type_ctx.type_().get_named_type_reference() else {
49+
let Some(name_ref) = type_ctx.ty().get_named_type_reference() else {
4850
continue;
4951
};
5052

@@ -103,7 +105,7 @@ pub unsafe extern "C" fn CorePluginInit() -> bool {
103105
.init();
104106

105107
// Register data renderer
106-
register_specific_data_renderer(UuidDataRenderer {});
108+
register_data_renderer(UuidDataRenderer {});
107109

108110
true
109111
}

0 commit comments

Comments
 (0)