diff options
| author | Mason Reed <mason@vector35.com> | 2026-04-21 18:10:51 -0700 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2026-05-10 17:13:08 -0700 |
| commit | c4ba6d79ae3b96d56cc6b3744e7c64e004ecd161 (patch) | |
| tree | 5762fc3ff58b57caec5f42176faf6635c464b4f3 /plugins/pdb-ng/src/lib.rs | |
| parent | 8269a8ac29e59c7949af753dac5c1f36bb700903 (diff) | |
[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
Diffstat (limited to 'plugins/pdb-ng/src/lib.rs')
| -rw-r--r-- | plugins/pdb-ng/src/lib.rs | 19 |
1 files changed, 5 insertions, 14 deletions
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<PDBInfo> { match view.get_metadata::<u64>("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::<String>("PDB_FILENAME") { - Some(Ok(md)) => md, - _ => return None, - }; - let mut guid = match view.get_metadata::<Vec<u8>>("PDB_GUID") { - Some(Ok(md)) => md, - _ => return None, - }; - let age = match view.get_metadata::<u64>("PDB_AGE") { - Some(Ok(md)) => md as u32, - _ => return None, - }; + let file_path = view.get_metadata::<String>("PDB_FILENAME")?; + let mut guid = view.get_metadata::<Vec<u8>>("PDB_GUID")?; + let age = view.get_metadata::<u64>("PDB_AGE")? as u32; if guid.len() != 16 { return None; |
