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 --- plugins/pdb-ng/src/lib.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'plugins/pdb-ng/src/lib.rs') diff --git a/plugins/pdb-ng/src/lib.rs b/plugins/pdb-ng/src/lib.rs index d6678a17..c3bbdf5e 100644 --- a/plugins/pdb-ng/src/lib.rs +++ b/plugins/pdb-ng/src/lib.rs @@ -23,7 +23,7 @@ use std::{env, fs}; use anyhow::{anyhow, Result}; use pdb::PDB; -use binaryninja::binary_view::{BinaryView, BinaryViewBase, BinaryViewExt}; +use binaryninja::binary_view::{BinaryView, BinaryViewBase}; use binaryninja::debuginfo::{CustomDebugInfoParser, DebugInfo, DebugInfoParser}; use binaryninja::download::{DownloadInstanceInputOutputCallbacks, DownloadProvider}; use binaryninja::interaction::{MessageBoxButtonResult, MessageBoxButtonSet}; @@ -275,23 +275,14 @@ fn search_sym_store( fn parse_pdb_info(view: &BinaryView) -> Option { match view.get_metadata::("DEBUG_INFO_TYPE") { - Some(Ok(0x53445352 /* 'SDSR' */)) => {} + Some(0x53445352 /* 'SDSR' */) => {} _ => return None, } // This is stored in the BV by the PE loader - let file_path = match view.get_metadata::("PDB_FILENAME") { - Some(Ok(md)) => md, - _ => return None, - }; - let mut guid = match view.get_metadata::>("PDB_GUID") { - Some(Ok(md)) => md, - _ => return None, - }; - let age = match view.get_metadata::("PDB_AGE") { - Some(Ok(md)) => md as u32, - _ => return None, - }; + let file_path = view.get_metadata::("PDB_FILENAME")?; + let mut guid = view.get_metadata::>("PDB_GUID")?; + let age = view.get_metadata::("PDB_AGE")? as u32; if guid.len() != 16 { return None; -- cgit v1.3.1