LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
LIEF::PE::RichHeader Class Reference

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

#include <RichHeader.hpp>

Inheritance diagram for LIEF::PE::RichHeader:
Inheritance graph
[legend]
Collaboration diagram for LIEF::PE::RichHeader:
Collaboration graph
[legend]

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 (const RichHeader &)
 
RichHeaderoperator= (const RichHeader &)
 
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 (const 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 (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
 

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 Function Documentation

◆ accept()

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

Implements LIEF::Object.

◆ 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: