From c4ba6d79ae3b96d56cc6b3744e7c64e004ecd161 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 21 Apr 2026 18:10:51 -0700 Subject: [Rust] Refactor `binary_view` module - Remove the "viral" `BinaryViewExt` trait and its blanket impl - Split up the binary view type from the custom trait impl - Simplify and fix bugs regarding custom binary view initialization - Rewrite Minidump binary view example, parses the PE headers to create proper sections now - Add some extra documentation - Add unit test for custom binary view --- view/minidump/src/command.rs | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 view/minidump/src/command.rs (limited to 'view/minidump/src/command.rs') diff --git a/view/minidump/src/command.rs b/view/minidump/src/command.rs deleted file mode 100644 index ca7ce4c5..00000000 --- a/view/minidump/src/command.rs +++ /dev/null @@ -1,40 +0,0 @@ -use std::str; - -use minidump::{Minidump, MinidumpMemoryInfoList}; - -use binaryninja::binary_view::{BinaryView, BinaryViewBase, BinaryViewExt}; - -pub fn print_memory_information(bv: &BinaryView) { - tracing::debug!("Printing memory information"); - if let Some(minidump_bv) = bv.parent_view() { - if let Some(read_buffer) = minidump_bv.read_buffer(0, minidump_bv.len() as usize) { - if let Ok(minidump_obj) = Minidump::read(read_buffer.get_data()) { - if let Ok(memory_info_list) = minidump_obj.get_stream::() { - let mut memory_info_list_writer = Vec::new(); - match memory_info_list.print(&mut memory_info_list_writer) { - Ok(_) => { - if let Ok(memory_info_str) = str::from_utf8(&memory_info_list_writer) { - tracing::info!("{memory_info_str}"); - } else { - tracing::error!("Could not convert the memory information description from minidump into a valid string"); - } - } - Err(_) => { - tracing::error!("Could not get memory information from minidump"); - } - } - } else { - tracing::error!( - "Could not parse a valid MinidumpMemoryInfoList stream from the minidump" - ); - } - } else { - tracing::error!("Could not parse a valid minidump file from the parent binary view's data buffer"); - } - } else { - tracing::error!("Could not read data from parent binary view"); - } - } else { - tracing::error!("Could not get the parent binary view"); - } -} -- cgit v1.3.1