libPeConv
A library to load, manipulate, dump PE files.
Loading...
Searching...
No Matches
resource_util.cpp
Go to the documentation of this file.
2
3#ifdef _DEBUG
4#include <iostream>
5#endif
6
16
18{
19 if (hInstance == nullptr) {
21 }
23 if (!res) {
24#ifdef _DEBUG
25 std::cerr << "Cannot find resource" << std::endl;
26#endif
27 return nullptr;
28 }
30 if (res_handle == nullptr) {
31#ifdef _DEBUG
32 std::cerr << "Cannot get resource handle" << std::endl;
33#endif
34 return nullptr;
35 }
37 size_t r_size = static_cast<size_t>(SizeofResource(hInstance, res));
38 if (out_size != 0 && out_size <= r_size) {
40 }
41
43 if (out_buf != nullptr) {
46 } else {
47 out_size = 0;
48 }
50 return out_buf;
51}
52
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)
bool free_aligned(ALIGNED_BUF buffer, size_t buffer_size=0)
ALIGNED_BUF alloc_aligned(size_t buffer_size, DWORD protect, ULONGLONG desired_base=NULL)
PBYTE ALIGNED_BUF
Definition buffer_util.h:46
HMODULE get_current_module_handle()
void free_resource_data(peconv::ALIGNED_BUF buffer)
peconv::ALIGNED_BUF load_resource_data(OUT size_t &out_size, const int res_id, const LPSTR res_type=RT_RCDATA_A, HMODULE hInstance=nullptr)
Functions related to manual retrieving of PE resources.