Line data Source code
1 : //! Module for the COFF file format support in LIEF.
2 : //!
3 : //! The [`Binary`] structure exposes the main API to inspect a COFF file. It can be instantiated,
4 : //! using either: [`crate::coff::parse`], [`crate::coff::Binary::parse`] or [`crate::Binary::parse`]
5 : //!
6 : //! ```
7 : //! let coff = lief::coff::parse("demo.obj").unwrap();
8 : //! for section in coff.sections() {
9 : //! println!("section: {}", section.name());
10 : //! }
11 : //! ```
12 :
13 : pub mod string;
14 : pub mod symbol;
15 : pub mod binary;
16 : pub mod header;
17 : pub mod section;
18 : pub mod relocation;
19 :
20 : #[doc(inline)]
21 : pub use symbol::Symbol;
22 :
23 : #[doc(inline)]
24 : pub use string::String;
25 :
26 : #[doc(inline)]
27 : pub use binary::Binary;
28 :
29 : #[doc(inline)]
30 : pub use section::Section;
31 :
32 : #[doc(inline)]
33 : pub use relocation::Relocation;
34 :
35 : #[doc(inline)]
36 : pub use header::{Header, RegularHeader, BigObjHeader};
37 :
38 : /// Parse a COFF file from the given file path
39 0 : pub fn parse(path: &str) -> Option<Binary> {
40 0 : Binary::parse(path)
41 0 : }
42 :
43 0 : pub fn is_coff(path: &str) -> bool {
44 0 : lief_ffi::COFF_Utils::is_coff(path)
45 0 : }
|