33 if (!
bin || !
bin->nt_headers) {
37 sym_tbl_off =
bin->nt_headers->file_header.PointerToSymbolTable;
38 num =
bin->nt_headers->file_header.NumberOfSymbols;
39 shsz = bufsz =
num * srsz;
40 if (bufsz < 1 || bufsz >
bin->size) {
47 exports_sz = export_t_sz *
num;
51 new_exports =
realloc(exports, sz + export_t_sz);
56 exports = new_exports;
61 exports =
malloc(sz + export_t_sz);
66 for (
i = 0;
i <
bin->num_sections;
i++) {
76 for (
i = 0;
i < shsz;
i += srsz) {
78 if (
i +
sizeof(sr) >= bufsz) {
91 char *longname,
name[128];
98 sprintf((
char *)exp[symctr].
name,
"unk_%d", symctr);
107 exp[symctr].
last = 0;
113 exp[symctr].
last = 1;
123 ut8 buf[
sizeof(
PE_(image_export_directory))];
137 return sizeof(
PE_(image_export_directory));
143 if (!export_dir_paddr) {
150 if (!(
bin->export_directory =
malloc(
sizeof(
PE_(image_export_directory))))) {
166 PE_VWord functions_paddr, names_paddr, ordinals_paddr, function_rva, name_vaddr, name_paddr;
169 PE_(image_data_directory) * data_dir_export;
171 int n,
i, export_dir_size;
174 if (!
bin->data_directory) {
178 export_dir_rva = data_dir_export->VirtualAddress;
179 export_dir_size = data_dir_export->Size;
182 if (
bin->export_directory) {
183 if (
bin->export_directory->NumberOfFunctions + 1 <
184 bin->export_directory->NumberOfFunctions) {
191 if (exports_sz < 0 || bin->export_directory->NumberOfFunctions + 1 > 0xffff) {
194 if (!(exports =
malloc(exports_sz))) {
206 const size_t names_sz =
bin->export_directory->NumberOfNames *
sizeof(
PE_Word);
207 const size_t funcs_sz =
bin->export_directory->NumberOfFunctions *
sizeof(
PE_VWord);
208 ordinals =
malloc(names_sz);
209 func_rvas =
malloc(funcs_sz);
210 if (!ordinals || !func_rvas) {
221 for (
i = 0;
i <
bin->export_directory->NumberOfFunctions;
i++) {
225 if (
bin->export_directory->NumberOfNames > 0) {
228 for (
n = 0;
n <
bin->export_directory->NumberOfNames;
n++) {
232 function_ordinal = fo;
250 function_ordinal =
i;
257 if (function_rva >= export_dir_rva && function_rva < (export_dir_rva + export_dir_size)) {
270 exports[
i].
ordinal = function_ordinal +
bin->export_directory->Base;
RzList * sections(RzBinFile *bf)
RZ_API void Ht_() free(HtName_(Ht) *ht)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
PE_DWord PE_() bin_pe_rva_to_paddr(RzBinPEObj *bin, PE_DWord rva)
PE_DWord PE_() bin_pe_rva_to_va(RzBinPEObj *bin, PE_DWord rva)
#define PE_READ_STRUCT_FIELD(var, struct_type, field, size)
struct rz_bin_pe_export_t *PE_() rz_bin_pe_get_exports(RzBinPEObj *bin)
static int read_image_export_directory(RzBuffer *b, ut64 addr, PE_(image_export_directory) *export_dir)
int PE_() bin_pe_init_exports(RzBinPEObj *bin)
static struct rz_bin_pe_export_t * parse_symbol_table(RzBinPEObj *bin, struct rz_bin_pe_export_t *exports, int sz)
#define PE_IMAGE_DIRECTORY_ENTRY_EXPORT
#define rz_return_val_if_fail(expr, val)
RZ_API st64 rz_buf_seek(RZ_NONNULL RzBuffer *b, st64 addr, int whence)
Modify the current cursor position in the buffer.
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
#define rz_buf_read_le32_at(b, addr, result)
RZ_API st64 rz_buf_read(RZ_NONNULL RzBuffer *b, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
static ut32 rz_read_le32(const void *src)
static ut16 rz_read_at_ble16(const void *src, size_t offset, bool big_endian)
static ut32 rz_read_at_ble32(const void *src, size_t offset, bool big_endian)
#define RZ_LOG_INFO(fmtstr,...)
ut8 forwarder[PE_NAME_LENGTH+1]
ut8 name[PE_NAME_LENGTH+1]
ut8 libname[PE_NAME_LENGTH+1]
ut64(WINAPI *w32_GetEnabledXStateFeatures)()