libPeConv
A library to load, manipulate, dump PE files.
Loading...
Searching...
No Matches
pe_hdrs_helper.h File Reference

Wrappers over various fields in the PE header. Read, write, parse PE headers. More...

#include <windows.h>
#include "buffer_util.h"

Go to the source code of this file.

Namespaces

namespace  peconv
 

Macros

#define PAGE_SIZE   0x1000
 

Functions

template<typename INT_TYPE >
INT_TYPE peconv::round_up_to_unit (const INT_TYPE size, const INT_TYPE unit)
 
DWORD peconv::get_image_size (IN const BYTE *payload)
 
bool peconv::update_image_size (IN OUT BYTE *payload, IN DWORD new_img_size)
 
WORD peconv::get_nt_hdr_architecture (IN const BYTE *pe_buffer)
 
bool peconv::is64bit (IN const BYTE *pe_buffer)
 
BYTE * peconv::get_nt_hdrs (IN const BYTE *pe_buffer, IN OPTIONAL size_t buffer_size=0)
 
IMAGE_NT_HEADERS32 * peconv::get_nt_hdrs32 (IN const BYTE *pe_buffer)
 
IMAGE_NT_HEADERS64 * peconv::get_nt_hdrs64 (IN const BYTE *pe_buffer)
 
LPVOID peconv::get_optional_hdr (IN const BYTE *payload, IN const size_t buffer_size)
 
const IMAGE_FILE_HEADER * peconv::get_file_hdr (IN const BYTE *payload, IN const size_t buffer_size)
 
DWORD peconv::get_hdrs_size (IN const BYTE *pe_buffer)
 
IMAGE_DATA_DIRECTORY * peconv::get_directory_entry (IN const BYTE *pe_buffer, IN DWORD dir_id, IN bool allow_empty=false)
 
template<typename IMAGE_TYPE_DIRECTORY >
IMAGE_TYPE_DIRECTORY * peconv::get_type_directory (IN HMODULE modulePtr, IN DWORD dir_id)
 
IMAGE_EXPORT_DIRECTORY * peconv::get_export_directory (IN HMODULE modulePtr)
 
ULONGLONG peconv::get_image_base (IN const BYTE *pe_buffer)
 
bool peconv::update_image_base (IN OUT BYTE *payload, IN ULONGLONG destImageBase)
 
DWORD peconv::get_entry_point_rva (IN const BYTE *pe_buffer)
 
bool peconv::update_entry_point_rva (IN OUT BYTE *pe_buffer, IN DWORD ep)
 
size_t peconv::get_sections_count (IN const BYTE *buffer, IN const size_t buffer_size)
 
bool peconv::is_valid_sections_hdr_offset (IN const BYTE *buffer, IN const size_t buffer_size)
 
PIMAGE_SECTION_HEADER peconv::get_section_hdr (IN const BYTE *pe_buffer, IN const size_t buffer_size, IN size_t section_num)
 
WORD peconv::get_file_characteristics (IN const BYTE *payload)
 
bool peconv::is_module_dll (IN const BYTE *payload)
 
bool peconv::is_dot_net (BYTE *pe_buffer, size_t pe_buffer_size)
 
WORD peconv::get_dll_characteristics (IN const BYTE *payload)
 
bool peconv::set_subsystem (IN OUT BYTE *payload, IN WORD subsystem)
 
WORD peconv::get_subsystem (IN const BYTE *payload)
 
bool peconv::has_relocations (IN const BYTE *pe_buffer)
 
IMAGE_COR20_HEADER * peconv::get_dotnet_hdr (IN const BYTE *pe_buffer, IN size_t const buffer_size, IN const IMAGE_DATA_DIRECTORY *dotNetDir)
 
DWORD peconv::get_sec_alignment (IN const BYTE *modulePtr, IN bool is_raw)
 
bool peconv::set_sec_alignment (IN OUT BYTE *pe_buffer, IN bool is_raw, IN DWORD new_alignment)
 
DWORD peconv::get_virtual_sec_size (IN const BYTE *pe_hdr, IN const PIMAGE_SECTION_HEADER sec_hdr, IN bool rounded)
 
PIMAGE_SECTION_HEADER peconv::get_last_section (IN const PBYTE pe_buffer, IN size_t pe_size, IN bool is_raw)
 
DWORD peconv::calc_pe_size (IN const PBYTE pe_buffer, IN size_t pe_size, IN bool is_raw)
 
bool peconv::is_valid_sectons_alignment (IN const BYTE *buffer, IN const SIZE_T buffer_size, IN bool is_raw)
 

Variables

const ULONGLONG peconv::MAX_HEADER_SIZE = PAGE_SIZE
 

Detailed Description

Wrappers over various fields in the PE header. Read, write, parse PE headers.

Definition in file pe_hdrs_helper.h.

Macro Definition Documentation

◆ PAGE_SIZE

#define PAGE_SIZE   0x1000

Definition at line 12 of file pe_hdrs_helper.h.