From 1c9ed05fd356a1cc0aafa06963fcd9172a1cc208 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Wed, 25 Sep 2024 10:04:46 -0400 Subject: Respect resource settings for network.pdbAutoDownload --- rust/examples/pdb-ng/src/lib.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'rust/examples') diff --git a/rust/examples/pdb-ng/src/lib.rs b/rust/examples/pdb-ng/src/lib.rs index cd457d06..e6a97be5 100644 --- a/rust/examples/pdb-ng/src/lib.rs +++ b/rust/examples/pdb-ng/src/lib.rs @@ -168,15 +168,15 @@ fn parse_sym_srv( Ok(Box::new(sym_srv_results.into_iter())) } -fn read_from_sym_store(path: &String) -> Result<(bool, Vec)> { - info!("Read file: {}", path); +fn read_from_sym_store(bv: &BinaryView, path: &String) -> Result<(bool, Vec)> { if !path.contains("://") { // Local file + info!("Read local file: {}", path); let conts = fs::read(path)?; return Ok((false, conts)); } - if !Settings::new("").get_bool("network.pdbAutoDownload", None, None) { + if !Settings::new("").get_bool("network.pdbAutoDownload", Some(bv), None) { return Err(anyhow!("Auto download disabled")); } @@ -238,7 +238,7 @@ fn read_from_sym_store(path: &String) -> Result<(bool, Vec)> { Ok((true, data)) } -fn search_sym_store(store_path: &String, pdb_info: &PDBInfo) -> Result>> { +fn search_sym_store(bv: &BinaryView, store_path: &String, pdb_info: &PDBInfo) -> Result>> { // https://www.technlg.net/windows/symbol-server-path-windbg-debugging/ // For symbol servers, to identify the files path easily, Windbg uses the format // binaryname.pdb/GUID @@ -261,16 +261,16 @@ fn search_sym_store(store_path: &String, pdb_info: &PDBInfo) -> Result { match self .load_from_file(&conts, debug_info, view, &progress, true, true) @@ -639,7 +639,7 @@ impl CustomDebugInfoParser for PDBParser { // Check the local symbol store if let Ok(local_store_path) = active_local_cache(Some(view)) { - match search_sym_store(&local_store_path, &info) { + match search_sym_store(view, &local_store_path, &info) { Ok(Some(conts)) => { match self.load_from_file(&conts, debug_info, view, &progress, true, false) { @@ -661,7 +661,7 @@ impl CustomDebugInfoParser for PDBParser { Settings::new("").get_string_list("pdb.files.symbolServerList", Some(view), None); for server in server_list.iter() { - match search_sym_store(&server.to_string(), &info) { + match search_sym_store(view, &server.to_string(), &info) { Ok(Some(conts)) => { match self.load_from_file(&conts, debug_info, view, &progress, true, true) { Ok(_) => return true, -- cgit v1.3.1