27 IN OUT BYTE *buffer, IN
size_t mod_size,
28 IN
const ULONGLONG start_addr,
34 if (exportsMap !=
nullptr) {
36 std::cerr <<
"[-] Unable to fix imports!" << std::endl;
43 BYTE* dump_data = buffer;
44 size_t dump_size = mod_size;
46 BYTE* unmapped_module =
nullptr;
57 ULONGLONG target_base = start_addr;
60 target_base = hdr_base;
64 unmapped_module =
pe_virtual_to_raw(buffer, mod_size, (ULONGLONG)target_base, out_size,
false);
70 if (unmapped_module) {
71 dump_data = unmapped_module;
76 const bool is_dumped =
dump_to_file(out_path, dump_data, dump_size);
Functions related to operations on files. Wrappers for read/write.
bool fix_dot_net_ep(BYTE *pe_buffer, size_t pe_buffer_size)
Functions and classes responsible for fixing Import Table. A definition of ImportedDllCoverage class.
bool dump_to_file(IN LPCTSTR path, IN PBYTE dump_data, IN size_t dump_size)
bool has_relocations(IN const BYTE *pe_buffer)
bool is_dot_net(BYTE *pe_buffer, size_t pe_buffer_size)
bool is_pe_raw(IN const BYTE *pe_buffer, IN size_t pe_size)
bool update_image_base(IN OUT BYTE *payload, IN ULONGLONG destImageBase)
bool fix_imports(IN OUT PVOID modulePtr, IN size_t moduleSize, IN const peconv::ExportsMapper &exportsMap, OUT OPTIONAL peconv::ImpsNotCovered *notCovered)
ULONGLONG get_image_base(IN const BYTE *pe_buffer)
BYTE * pe_virtual_to_raw(IN BYTE *payload, IN size_t in_size, IN ULONGLONG loadBase, OUT size_t &outputSize, IN OPTIONAL bool rebuffer=true)
bool free_pe_buffer(ALIGNED_BUF buffer, size_t buffer_size=0)
t_pe_dump_mode detect_dump_mode(IN const BYTE *buffer, IN size_t buffer_size)
bool is_pe_expanded(IN const BYTE *pe_buffer, IN size_t pe_size)
bool dump_pe(IN LPCTSTR outputFilePath, IN OUT BYTE *buffer, IN size_t buffer_size, IN const ULONGLONG module_base, IN OUT t_pe_dump_mode &dump_mode, IN OPTIONAL const peconv::ExportsMapper *exportsMap=nullptr)
BYTE * pe_realign_raw_to_virtual(IN const BYTE *payload, IN size_t in_size, IN ULONGLONG loadBase, OUT size_t &outputSize)
Dumping PE from the memory buffer into a file.
Wrappers over various fields in the PE header. Read, write, parse PE headers.
Detecting in which mode is the PE in the supplied buffer (i.e. raw, virtual). Analyzes PE features ty...
Converting PE from virtual to raw format.