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

Class that is used to rebuild a raw PE binary from a PE::Binary object. More...

#include <Builder.hpp>

Public Member Functions

 Builder (Binary &binary)
 
ok_error_t build ()
 Perform the build process.
 
Builderbuild_imports (bool flag=true)
 Rebuild the import table in new section.
 
Builderpatch_imports (bool flag=true)
 Patch the original import table in order to redirect functions to the new import table.
 
Builderbuild_relocations (bool flag=true)
 Rebuild the relocation table in another section.
 
Builderbuild_tls (bool flag=true)
 Rebuild TLS object in another section.
 
Builderbuild_resources (bool flag)
 Rebuid the resources in another section.
 
Builderbuild_overlay (bool flag)
 Rebuild the binary's overlay.
 
Builderbuild_dos_stub (bool flag)
 Rebuild the DOS stub content.
 
const std::vector< uint8_t > & get_build ()
 Return the build result.
 
void write (const std::string &filename) const
 Write the build result into the output file.
 
void write (std::ostream &os) const
 Write the build result into the os stream.
 
ok_error_t build (const DosHeader &dos_header)
 
ok_error_t build (const Header &bHeader)
 
ok_error_t build (const OptionalHeader &optional_header)
 
ok_error_t build (const DataDirectory &data_directory)
 
ok_error_t build (const Section &section)
 

Static Public Member Functions

template<typename PE_T >
static std::vector< uint8_t > build_jmp (uint64_t from, uint64_t address)
 Construct a jmp [address] @ from.
 
template<typename PE_T >
static std::vector< uint8_t > build_jmp_hook (uint64_t from, uint64_t address)
 Construct a jmp far address @ from.
 

Detailed Description

Class that is used to rebuild a raw PE binary from a PE::Binary object.

Member Function Documentation

◆ build_jmp()

template<typename PE_T >
static std::vector< uint8_t > LIEF::PE::Builder::build_jmp ( uint64_t from,
uint64_t address )
static

Construct a jmp [address] @ from.

It is used when patching import table

◆ build_jmp_hook()

template<typename PE_T >
static std::vector< uint8_t > LIEF::PE::Builder::build_jmp_hook ( uint64_t from,
uint64_t address )
static

Construct a jmp far address @ from.

It is used for hooking

◆ patch_imports()

Builder & LIEF::PE::Builder::patch_imports ( bool flag = true)

Patch the original import table in order to redirect functions to the new import table.

This setting should be used with LIEF::PE::Builder::build_imports set to true


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