LIEF: Library to Instrument Executable Formats Version 0.15.1
Loading...
Searching...
No Matches
LIEF::PE::RichHeader Class Reference

Class which represents the not-so-documented rich header. More...

#include <RichHeader.hpp>

Inheritance diagram for LIEF::PE::RichHeader:
Collaboration diagram for LIEF::PE::RichHeader:

Public Types

using entries_t = std::vector<RichEntry>
 
using it_entries = ref_iterator<entries_t&>
 
using it_const_entries = const_ref_iterator<const entries_t&>
 
- Public Types inherited from LIEF::Object
template<class T >
using output_t = add_pointer_t<decay_t<T>>
 
template<class T >
using output_const_t = add_pointer_t<add_const_t<decay_t<T>>>
 

Public Member Functions

 RichHeader ()=default
 
 RichHeader (const RichHeader &)=default
 
RichHeaderoperator= (const RichHeader &)=default
 
 ~RichHeader () override=default
 
uint32_t key () const
 Key used to encode the header (xor operation)
 
it_entries entries ()
 Return an iterator over the PE::RichEntry within the header.
 
it_const_entries entries () const
 
void key (uint32_t key)
 
void add_entry (RichEntry entry)
 Add a new PE::RichEntry.
 
void add_entry (uint16_t id, uint16_t build_id, uint32_t count)
 Add a new entry given the id, build_id and count.
 
std::vector< uint8_t > raw () const
 The raw structure of the Rich header without xor-encoding.
 
std::vector< uint8_t > raw (uint32_t xor_key) const
 Given this rich header, this function re-computes the raw bytes of the structure with the provided xor-key.
 
std::vector< uint8_t > hash (ALGORITHMS algo) const
 Compute the hash of the decoded rich header structure with the given hash algorithm.
 
std::vector< uint8_t > hash (ALGORITHMS algo, uint32_t xor_key) const
 Compute the hash of the rich header structure encoded with the provided key.
 
void accept (Visitor &visitor) const override
 
- Public Member Functions inherited from LIEF::Object
 Object ()
 
 Object (const Object &other)
 
Objectoperator= (const Object &other)
 
template<class T >
output_t< T > as ()
 
template<class T >
output_const_t< T > as () const
 
virtual bool operator== (const Object &other) const
 
virtual bool operator!= (const Object &other) const
 
virtual ~Object ()
 

Detailed Description

Class which represents the not-so-documented rich header.

This structure is usually located at the end of the Binary::dos_stub and contains information about the build environment. It is generated by the Microsoft linker link.exe and there are no options to disable or remove this information.

Member Typedef Documentation

◆ entries_t

◆ it_const_entries

◆ it_entries

Constructor & Destructor Documentation

◆ RichHeader() [1/2]

LIEF::PE::RichHeader::RichHeader ( )
default

◆ RichHeader() [2/2]

LIEF::PE::RichHeader::RichHeader ( const RichHeader & )
default

◆ ~RichHeader()

LIEF::PE::RichHeader::~RichHeader ( )
overridedefault

Member Function Documentation

◆ accept()

void LIEF::PE::RichHeader::accept ( Visitor & visitor) const
overridevirtual

Implements LIEF::Object.

◆ add_entry() [1/2]

void LIEF::PE::RichHeader::add_entry ( RichEntry entry)
inline

Add a new PE::RichEntry.

◆ add_entry() [2/2]

void LIEF::PE::RichHeader::add_entry ( uint16_t id,
uint16_t build_id,
uint32_t count )
inline

Add a new entry given the id, build_id and count.

◆ entries() [1/2]

it_entries LIEF::PE::RichHeader::entries ( )
inline

Return an iterator over the PE::RichEntry within the header.

◆ entries() [2/2]

it_const_entries LIEF::PE::RichHeader::entries ( ) const
inline

◆ hash() [1/2]

std::vector< uint8_t > LIEF::PE::RichHeader::hash ( ALGORITHMS algo) const
inline

Compute the hash of the decoded rich header structure with the given hash algorithm.

References LIEF::hash().

◆ hash() [2/2]

std::vector< uint8_t > LIEF::PE::RichHeader::hash ( ALGORITHMS algo,
uint32_t xor_key ) const

Compute the hash of the rich header structure encoded with the provided key.

◆ key() [1/2]

uint32_t LIEF::PE::RichHeader::key ( ) const
inline

Key used to encode the header (xor operation)

◆ key() [2/2]

void LIEF::PE::RichHeader::key ( uint32_t key)
inline

◆ operator=()

RichHeader & LIEF::PE::RichHeader::operator= ( const RichHeader & )
default

◆ raw() [1/2]

std::vector< uint8_t > LIEF::PE::RichHeader::raw ( ) const
inline

The raw structure of the Rich header without xor-encoding.

This function is equivalent as calling RichHeader::raw(uint32_t) with a xor_key set to 0

◆ raw() [2/2]

std::vector< uint8_t > LIEF::PE::RichHeader::raw ( uint32_t xor_key) const

Given this rich header, this function re-computes the raw bytes of the structure with the provided xor-key.

You can access the decoded data's structure with the xor_key set to 0

Parameters
[in]xor_keyThe key to use for the xor-encoding (can be 0)

The documentation for this class was generated from the following file: