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

Class which represents the PE Thread Local Storage. More...

#include <TLS.hpp>

Inheritance diagram for LIEF::PE::TLS:
Collaboration diagram for LIEF::PE::TLS:

Public Member Functions

 TLS ()=default
 
 TLS (const details::pe32_tls &header)
 
 TLS (const details::pe64_tls &header)
 
 ~TLS () override=default
 
 TLS (const TLS &copy)=default
 
TLSoperator= (const TLS &copy)=default
 
 TLS (TLS &&other) noexcept=default
 
TLSoperator= (TLS &&other) noexcept=default
 
const std::vector< uint64_t > & callbacks () const
 List of the callback associated with the current TLS.
 
const std::pair< uint64_t, uint64_t > & addressof_raw_data () const
 Pair (start address, end address) of the TLS template. The template is a block of data that is used to initialize TLS data. The system copies all of this data each time a thread is created, so it must not be corrupted.
 
uint64_t addressof_index () const
 The location to receive the TLS index assigned by the loader. This location should be located in a writable section like .data
 
uint64_t addressof_callbacks () const
 Pointer to an array of TLS callback functions.
 
uint32_t sizeof_zero_fill () const
 Size in bytes of the zero to be padded after the data specified by data_template.
 
uint32_t characteristics () const
 The four bits [23:20] describe alignment info. Possible values are those defined as IMAGE_SCN_ALIGN_*, which are also used to describe alignment of section in object files. The other 28 bits are reserved for future use.
 
span< const uint8_t > data_template () const
 The initial content used to initialize TLS data.
 
bool has_data_directory () const
 True if there is a data directory associated with this entry.
 
DataDirectorydirectory ()
 Return the DataDirectory associated with this object or a nullptr If it exists, its type should be DataDirectory::TYPES::TLS_TABLE.
 
const DataDirectorydirectory () const
 
bool has_section () const
 Check if there is a section associated with this entry.
 
Sectionsection ()
 The section associated with the entry (or a nullptr)
 
const Sectionsection () const
 
void callbacks (std::vector< uint64_t > callbacks)
 
void addressof_raw_data (std::pair< uint64_t, uint64_t > addresses)
 
void addressof_index (uint64_t addr_idx)
 
void addressof_callbacks (uint64_t addr)
 
void sizeof_zero_fill (uint32_t size)
 
void characteristics (uint32_t characteristics)
 
void data_template (std::vector< uint8_t > data_template)
 
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 ()
 

Additional Inherited Members

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

Detailed Description

Class which represents the PE Thread Local Storage.

This PE structure is also used to implement binary/library constructors.

Constructor & Destructor Documentation

◆ TLS() [1/5]

LIEF::PE::TLS::TLS ( )
default

◆ TLS() [2/5]

LIEF::PE::TLS::TLS ( const details::pe32_tls & header)

◆ TLS() [3/5]

LIEF::PE::TLS::TLS ( const details::pe64_tls & header)

◆ ~TLS()

LIEF::PE::TLS::~TLS ( )
overridedefault

◆ TLS() [4/5]

LIEF::PE::TLS::TLS ( const TLS & copy)
default

◆ TLS() [5/5]

LIEF::PE::TLS::TLS ( TLS && other)
defaultnoexcept

Member Function Documentation

◆ accept()

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

Implements LIEF::Object.

◆ addressof_callbacks() [1/2]

uint64_t LIEF::PE::TLS::addressof_callbacks ( ) const
inline

Pointer to an array of TLS callback functions.

The array is null-terminated, so if there is no callback function this field points to 4 bytes set to zero.

◆ addressof_callbacks() [2/2]

void LIEF::PE::TLS::addressof_callbacks ( uint64_t addr)
inline

◆ addressof_index() [1/2]

uint64_t LIEF::PE::TLS::addressof_index ( ) const
inline

The location to receive the TLS index assigned by the loader. This location should be located in a writable section like .data

◆ addressof_index() [2/2]

void LIEF::PE::TLS::addressof_index ( uint64_t addr_idx)
inline

◆ addressof_raw_data() [1/2]

const std::pair< uint64_t, uint64_t > & LIEF::PE::TLS::addressof_raw_data ( ) const
inline

Pair (start address, end address) of the TLS template. The template is a block of data that is used to initialize TLS data. The system copies all of this data each time a thread is created, so it must not be corrupted.

Note
These addresses are not RVA. It is addresses for which there should be a rebase relocation in the .reloc section.

◆ addressof_raw_data() [2/2]

void LIEF::PE::TLS::addressof_raw_data ( std::pair< uint64_t, uint64_t > addresses)
inline

◆ callbacks() [1/2]

const std::vector< uint64_t > & LIEF::PE::TLS::callbacks ( ) const
inline

List of the callback associated with the current TLS.

These functions are called before any other functions .

◆ callbacks() [2/2]

void LIEF::PE::TLS::callbacks ( std::vector< uint64_t > callbacks)
inline

◆ characteristics() [1/2]

uint32_t LIEF::PE::TLS::characteristics ( ) const
inline

The four bits [23:20] describe alignment info. Possible values are those defined as IMAGE_SCN_ALIGN_*, which are also used to describe alignment of section in object files. The other 28 bits are reserved for future use.

◆ characteristics() [2/2]

void LIEF::PE::TLS::characteristics ( uint32_t characteristics)
inline

◆ data_template() [1/2]

span< const uint8_t > LIEF::PE::TLS::data_template ( ) const
inline

The initial content used to initialize TLS data.

◆ data_template() [2/2]

void LIEF::PE::TLS::data_template ( std::vector< uint8_t > data_template)
inline

◆ directory() [1/2]

DataDirectory * LIEF::PE::TLS::directory ( )
inline

Return the DataDirectory associated with this object or a nullptr If it exists, its type should be DataDirectory::TYPES::TLS_TABLE.

◆ directory() [2/2]

const DataDirectory * LIEF::PE::TLS::directory ( ) const
inline

◆ has_data_directory()

bool LIEF::PE::TLS::has_data_directory ( ) const
inline

True if there is a data directory associated with this entry.

◆ has_section()

bool LIEF::PE::TLS::has_section ( ) const
inline

Check if there is a section associated with this entry.

◆ operator=() [1/2]

TLS & LIEF::PE::TLS::operator= ( const TLS & copy)
default

◆ operator=() [2/2]

TLS & LIEF::PE::TLS::operator= ( TLS && other)
defaultnoexcept

◆ section() [1/2]

Section * LIEF::PE::TLS::section ( )
inline

The section associated with the entry (or a nullptr)

◆ section() [2/2]

const Section * LIEF::PE::TLS::section ( ) const
inline

◆ sizeof_zero_fill() [1/2]

uint32_t LIEF::PE::TLS::sizeof_zero_fill ( ) const
inline

Size in bytes of the zero to be padded after the data specified by data_template.

◆ sizeof_zero_fill() [2/2]

void LIEF::PE::TLS::sizeof_zero_fill ( uint32_t size)
inline

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