dependency_runner/
lib.rs

1//! This library contains utilities to scan the dependencies of Windows executable files and DLLs.
2//!
3//! # Quick Start
4//!
5//! You can use this library to implement ldd for Windows: this repository indeed includes such a
6//! binary, called wldd. The following snippet shows how to recursively scan the dependencies of a
7//! target executable in a DLL lookup path built using sensible defaults.
8//! You can refer to that file for a usage example of more advanced functionalities.
9//!
10//! The basic workflow is to first create a LookupQuery, which contains the path to the root
11//! executable whose dependencies should be found, a reference to the Windows root partition to use
12//! as reference for the scan, and various parameters for performing the scan.
13//!
14//! Then the LookupPath can be computed given the query. The path contains a list of entries, which
15//! will be probed for a DLL with the name registered in the import table as dependency for the
16//! target executable. This search is performed recursively. The path can be freely manipulated
17//! after deduction for advanced use cases. It can also be built from a DependencyRunner dwp file,
18//! or from a Visual Studio vcxproj or vcxproj.user file.
19//!
20//! Once all information is available, the recursive DLL lookup can be performed to obtain a
21//! list of interdependent executables. This list represents a directed acyclic graph through the
22//! dependency list for each node and can be visited according to various strategies.
23//!
24//! Sanity checks can be run on the list of executables to find missing DLL dependencies or
25//! symbols therein.  
26//!
27//! ```
28//!
29//! let exe_path = "path/to/some/executable.exe";
30//! # let d = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
31//! # let relative_path =
32//! #     "test_data/test_project1/DepRunTest/build-same-output/bin/Debug/DepRunTest.exe";
33//! # let exe_path = d.join(relative_path);
34//! let mut query = dependency_runner::query::LookupQuery::deduce_from_executable_location(exe_path).unwrap();
35//! query.parameters.extract_symbols = true;
36//! let lookup_path = dependency_runner::path::LookupPath::deduce(&query);
37//! let executables = dependency_runner::runner::run(&query, &lookup_path).unwrap();
38//! let sym_check = executables.check(true);
39//! ```
40
41extern crate thiserror;
42
43pub mod apiset;
44pub mod common;
45pub mod executable;
46#[cfg(windows)]
47pub mod knowndlls;
48pub mod path;
49pub mod pe;
50pub mod query;
51pub mod runner;
52#[cfg(not(windows))]
53pub mod skim;
54pub mod system;
55pub mod vcx;