55 std::cerr <<
"[!] Could not relocate the module!\n";
60 std::cerr <<
"[!] Could not allocate memory at the desired base!\n";
71 std::cerr <<
"Cannot load the file: " <<
filename << std::endl;
84 std::cerr <<
"[-] Loading failed!\n";
92 printf(
"[-] Loading imports failed!");
98 printf(
"[-] PE doesn't have a valid Import Table!\n");
111 printf(
"[-] Loading failed!\n");
118 printf(
"[-] Loading imports failed!");
Definitions of the used buffer types. Functions for their allocation and deallocation.
bool parse_delayed_desc(BYTE *modulePtr, const size_t moduleSize, const ULONGLONG img_base, LPSTR lib_name, const T_FIELD ordinal_flag, IMAGE_DELAYLOAD_DESCRIPTOR *desc, peconv::t_function_resolver *func_resolver)
Searching specific functions in PE's Exports Table.
Definitions of basic Imports Resolver classes. They can be used for filling imports when the PE is lo...
Parsing and filling the Import Table.
bool has_relocations(IN const BYTE *pe_buffer)
bool has_valid_import_table(const PBYTE modulePtr, size_t moduleSize)
BYTE * load_pe_executable(BYTE *payload_raw, size_t r_size, OUT size_t &v_size, t_function_resolver *import_resolver=NULL)
peconv::UNALIGNED_BUF load_file(IN LPCTSTR filename, OUT size_t &r_size)
BYTE * load_no_sec_pe(BYTE *dllRawData, size_t r_size, OUT size_t &v_size, bool executable)
ULONGLONG get_image_base(IN const BYTE *pe_buffer)
BYTE * load_pe_module(BYTE *payload_raw, size_t r_size, OUT size_t &v_size, bool executable, bool relocate)
DWORD get_image_size(IN const BYTE *payload)
bool free_pe_buffer(ALIGNED_BUF buffer, size_t buffer_size=0)
ALIGNED_BUF alloc_pe_buffer(size_t buffer_size, DWORD protect, ULONGLONG desired_base=NULL)
BYTE * pe_raw_to_virtual(IN const BYTE *rawPeBuffer, IN size_t rawPeSize, OUT size_t &outputSize, IN OPTIONAL bool executable=true, IN OPTIONAL ULONGLONG desired_base=0)
size_t get_sections_count(IN const BYTE *buffer, IN const size_t buffer_size)
bool relocate_module(IN BYTE *modulePtr, IN SIZE_T moduleSize, IN ULONGLONG newBase, IN ULONGLONG oldBase=0)
void free_file(IN peconv::UNALIGNED_BUF buffer)
BYTE * get_nt_hdrs(IN const BYTE *pe_buffer, IN OPTIONAL size_t buffer_size=0)
bool load_imports(BYTE *modulePtr, t_function_resolver *func_resolver=nullptr)
Loading PE from a file with the help of the custom loader.
Operating on PE file's relocations table.