DoxigAlpha

getDataDirectories

Function parameters

Parameters

#
self:*const Coff

Type definitions in this namespace

Types

#
ImportHintNameEntry
Every name ends with a NULL byte.

Error sets in this namespace

Error Sets

#

= 0x10b

Values

#

Source

Implementation

#
pub fn getDataDirectories(self: *const Coff) []align(1) const ImageDataDirectory {
    const hdr = self.getOptionalHeader();
    const size: usize = switch (hdr.magic) {
        IMAGE_NT_OPTIONAL_HDR32_MAGIC => @sizeOf(OptionalHeaderPE32),
        IMAGE_NT_OPTIONAL_HDR64_MAGIC => @sizeOf(OptionalHeaderPE64),
        else => unreachable, // We assume we have validated the header already
    };
    const offset = self.coff_header_offset + @sizeOf(CoffHeader) + size;
    return @as([*]align(1) const ImageDataDirectory, @ptrCast(self.data[offset..]))[0..self.getNumberOfDataDirectories()];
}