Sha256: c3b0c4f09993b07a85fda3dd2de9c80258aaadce6c0598eb25e55fab4c6bbf1c

Contents?: true

Size: 1.99 KB

Versions: 24

Compression:

Stored size: 1.99 KB

Contents

//! Support for reading Windows COFF files.
//!
//! Traits are used to abstract over the difference between COFF object files
//! and COFF bigobj files. The primary trait for this is [`CoffHeader`].
//!
//! ## High level API
//!
//! [`CoffFile`] implements the [`Object`](crate::read::Object) trait for
//! COFF files. [`CoffFile`] is parameterised by [`CoffHeader`].
//! The default parameter allows reading regular COFF object files,
//! while the type alias [`CoffBigFile`] allows reading COFF bigobj files.
//!
//! [`ImportFile`] allows reading COFF short imports that are used in import
//! libraries. Currently these are not integrated with the unified read API.
//!
//! ## Low level API
//!
//! The [`CoffHeader`] trait can be directly used to parse both COFF
//! object files (which start with [`pe::ImageFileHeader`]) and COFF bigobj
//! files (which start with [`pe::AnonObjectHeaderBigobj`]).
//!
//! ### Example for low level API
//!  ```no_run
//! use object::pe;
//! use object::read::coff::{CoffHeader, ImageSymbol as _};
//! use std::error::Error;
//! use std::fs;
//!
//! /// Reads a file and displays the name of each section and symbol.
//! fn main() -> Result<(), Box<dyn Error>> {
//! #   #[cfg(feature = "std")] {
//!     let data = fs::read("path/to/binary")?;
//!     let mut offset = 0;
//!     let header = pe::ImageFileHeader::parse(&*data, &mut offset)?;
//!     let sections = header.sections(&*data, offset)?;
//!     let symbols = header.symbols(&*data)?;
//!     for section in sections.iter() {
//!         println!("{}", String::from_utf8_lossy(section.name(symbols.strings())?));
//!     }
//!     for (_index, symbol) in symbols.iter() {
//!         println!("{}", String::from_utf8_lossy(symbol.name(symbols.strings())?));
//!     }
//! #   }
//!     Ok(())
//! }
//! ```
#[cfg(doc)]
use crate::pe;

mod file;
pub use file::*;

mod section;
pub use section::*;

mod symbol;
pub use symbol::*;

mod relocation;
pub use relocation::*;

mod comdat;
pub use comdat::*;

mod import;
pub use import::*;

Version data entries

24 entries across 19 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/object-0.36.7/src/read/coff/mod.rs
wasmtime-28.0.0 ./ext/cargo-vendor/object-0.36.7/src/read/coff/mod.rs
wasmtime-27.0.0 ./ext/cargo-vendor/object-0.36.5/src/read/coff/mod.rs
wasmtime-26.0.0 ./ext/cargo-vendor/object-0.36.5/src/read/coff/mod.rs
wasmtime-25.0.2 ./ext/cargo-vendor/object-0.36.3/src/read/coff/mod.rs
wasmtime-25.0.1 ./ext/cargo-vendor/object-0.36.3/src/read/coff/mod.rs
wasmtime-25.0.0 ./ext/cargo-vendor/object-0.36.3/src/read/coff/mod.rs
wasmtime-24.0.0 ./ext/cargo-vendor/object-0.36.3/src/read/coff/mod.rs
wasmtime-23.0.2 ./ext/cargo-vendor/object-0.36.3/src/read/coff/mod.rs
wasmtime-23.0.2 ./ext/cargo-vendor/object-0.32.2/src/read/coff/mod.rs
wasmtime-22.0.0 ./ext/cargo-vendor/object-0.32.2/src/read/coff/mod.rs
wasmtime-22.0.0 ./ext/cargo-vendor/object-0.36.3/src/read/coff/mod.rs
wasmtime-21.0.1 ./ext/cargo-vendor/object-0.32.2/src/read/coff/mod.rs
wasmtime-21.0.1 ./ext/cargo-vendor/object-0.33.0/src/read/coff/mod.rs
wasmtime-20.0.2 ./ext/cargo-vendor/object-0.33.0/src/read/coff/mod.rs
wasmtime-20.0.2 ./ext/cargo-vendor/object-0.32.2/src/read/coff/mod.rs
wasmtime-20.0.0 ./ext/cargo-vendor/object-0.32.2/src/read/coff/mod.rs
wasmtime-20.0.0 ./ext/cargo-vendor/object-0.33.0/src/read/coff/mod.rs
wasmtime-18.0.3 ./ext/cargo-vendor/object-0.32.2/src/read/coff/mod.rs
wasmtime-17.0.1 ./ext/cargo-vendor/object-0.32.2/src/read/coff/mod.rs