From c2d90f2e5a010546d0e1f1deeb1a6d8531ea4d4f Mon Sep 17 00:00:00 2001 From: rbran Date: Wed, 23 Apr 2025 19:24:45 +0000 Subject: [Rust] Implement custom interactive handler --- rust/src/binary_view.rs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'rust/src/binary_view.rs') diff --git a/rust/src/binary_view.rs b/rust/src/binary_view.rs index 55b0d4db..65bab463 100644 --- a/rust/src/binary_view.rs +++ b/rust/src/binary_view.rs @@ -1103,6 +1103,46 @@ pub trait BinaryViewExt: BinaryViewBase { unsafe { BNApplyDebugInfo(self.as_ref().handle, debug_info.handle) } } + fn show_plaintext_report(&self, title: &str, plaintext: &str) { + let title = title.to_cstr(); + let plaintext = plaintext.to_cstr(); + unsafe { + BNShowPlainTextReport( + self.as_ref().handle, + title.as_ref().as_ptr() as *mut _, + plaintext.as_ref().as_ptr() as *mut _, + ) + } + } + + fn show_markdown_report(&self, title: &str, contents: &str, plaintext: &str) { + let title = title.to_cstr(); + let contents = contents.to_cstr(); + let plaintext = plaintext.to_cstr(); + unsafe { + BNShowMarkdownReport( + self.as_ref().handle, + title.as_ref().as_ptr() as *mut _, + contents.as_ref().as_ptr() as *mut _, + plaintext.as_ref().as_ptr() as *mut _, + ) + } + } + + fn show_html_report(&self, title: &str, contents: &str, plaintext: &str) { + let title = title.to_cstr(); + let contents = contents.to_cstr(); + let plaintext = plaintext.to_cstr(); + unsafe { + BNShowHTMLReport( + self.as_ref().handle, + title.as_ref().as_ptr() as *mut _, + contents.as_ref().as_ptr() as *mut _, + plaintext.as_ref().as_ptr() as *mut _, + ) + } + } + fn show_graph_report(&self, raw_name: &str, graph: &FlowGraph) { let raw_name = raw_name.to_cstr(); unsafe { -- cgit v1.3.1