Module pelite::pe64::imports[][src]

Import Directory and the IAT.

The import directory lists all the module dependencies and their imported symbols by this module.

The Import Address Table (IAT) lists all the imported symbols for all the modules in one big list. When the imports are resolved the IAT is overwritten with pointers to the resolved functions.

Examples

use pelite::pe64::{Pe, PeFile};

fn example(file: PeFile<'_>) -> pelite::Result<()> {
    // Access the import directory
    let imports = file.imports()?;

    // Iterate over the import descriptors
    for desc in imports {
        // DLL being imported from
        let dll_name = desc.dll_name()?;

        // Import Address Table and Import Name Table for this imported DLL
        let iat = desc.iat()?;
        let int = desc.int()?;

        // Iterate over the imported functions from this DLL
        for (va, import) in Iterator::zip(iat, int) {}
    }

    // Iterate over the IAT
    for (va, import) in file.iat()?.iter() {
        // The IAT may contains Null entries where the IAT of imported modules join
        if let Ok(import) = import {}
    }

    Ok(())
}

Structs

Desc

Import library descriptor.

IAT

Import Address Table.

Imports

Import directory.

Iter

Enums

Import

Imported symbol.