MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / parse_sym_srv

Function parse_sym_srv

plugins/pdb-ng/src/lib.rs:122–163  ·  view source on GitHub ↗
(symbol_path: &str, default_store: String)

Source from the content-addressed store, hash-verified

120}
121
122fn parse_sym_srv(symbol_path: &str, default_store: String) -> Result<impl Iterator<Item = String>> {
123 // https://docs.microsoft.com/en-us/windows/win32/debug/using-symsrv
124 // Why
125
126 // ... the symbol path (_NT_SYMBOL_PATH environment variable) can be made up of several path
127 // elements separated by semicolons. If any one or more of these path elements begins with
128 // the text "srv*", then the element is a symbol server and will use SymSrv to locate
129 // symbol files.
130
131 // If the "srv*" text is not specified but the actual path element is a symbol server store,
132 // then the symbol handler will act as if "srv*" were specified. The symbol handler makes
133 // this determination by searching for the existence of a file called "pingme.txt" in
134 // the root directory of the specified path.
135
136 // ... symbol servers are made up of symbol store elements separated by asterisks. There can
137 // be up to 10 symbol stores after the "srv*" prefix.
138
139 let mut sym_srv_results: Vec<String> = vec![];
140
141 // 'path elements separated by semicolons'
142 for path_element in symbol_path.split(';') {
143 // 'begins with the text "srv*"'
144 if path_element.to_lowercase().starts_with("srv*") {
145 // 'symbol store elements separated by asterisks'
146 for store_element in path_element[4..].split('*') {
147 if store_element.is_empty() {
148 sym_srv_results.push(default_store.clone());
149 } else {
150 sym_srv_results.push(store_element.to_string());
151 }
152 }
153 } else if PathBuf::from(path_element).exists() {
154 // 'searching for the existence of a file called "pingme.txt" in the root directory'
155 let pingme_txt = path_element.to_string() + "/" + "pingme.txt";
156 if PathBuf::from(pingme_txt).exists() {
157 sym_srv_results.push(path_element.to_string());
158 }
159 }
160 }
161
162 Ok(sym_srv_results.into_iter())
163}
164
165fn read_from_sym_store(bv: &BinaryView, path: &str) -> Result<(bool, Vec<u8>)> {
166 if !path.contains("://") {

Callers 1

parse_infoMethod · 0.85

Calls 5

splitMethod · 0.45
is_emptyMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected