18 for (
size_t i = 0;
i < obj->
hdr.f_nscns;
i++) {
19 struct coff_scn_hdr *hdr = &obj->
scn_hdrs[
i];
42 for (
size_t i = 0;
i <
bin->hdr.f_nscns;
i++) {
43 if (!
bin->scn_hdrs[
i].s_nreloc) {
54 if (
bin->scn_hdrs[
i].s_relptr >
bin->size ||
60 bool read_success =
false;
61 for (
size_t j = 0; j <
bin->scn_hdrs[
i].s_nreloc; j++) {
74 for (
size_t j = 0; j <
bin->scn_hdrs[
i].s_nreloc; j++) {
99 switch (
bin->hdr.f_magic) {
115 data += sym_vaddr - reloc.
vaddr - 4;
131 data += sym_vaddr - reloc.
vaddr - 4;
154 loword |= (
ut16)(
dst >> 1) & 0x7ff;
155 hiword |= (
ut16)(
dst >> 12) & 0x7ff;
171 data |= (
ut32)((
dst >> 2) & 0x3ffffffULL);
179 cb(&reloc, plen ? patch_buf :
NULL, plen, user);
191 memcpy(reloc_copy, reloc,
sizeof(*reloc_copy));
221 if (
bin->buf_patched) {
222 return bin->buf_patched;
225 if (!
bin->buf_patched) {
230 return bin->buf_patched;
#define RZ_COFF_RELOC_TARGET_SIZE
static void patch_reloc_cb(RZ_BORROW RzBinReloc *reloc, ut8 *patch_buf, size_t patch_buf_sz, void *user)
RZ_API ut64 rz_coff_get_reloc_targets_vfile_size(struct rz_bin_coff_obj *obj)
size of the artificial reloc target vfile
RZ_API ut64 rz_coff_get_reloc_targets_map_base(struct rz_bin_coff_obj *obj)
base vaddr where to map the artificial reloc target vfile
static void relocs_foreach(struct rz_bin_coff_obj *bin, RelocsForeachCb cb, void *user)
RZ_API RZ_BORROW RzBuffer * rz_coff_get_patched_buf(struct rz_bin_coff_obj *bin)
void(* RelocsForeachCb)(RZ_BORROW RzBinReloc *reloc, ut8 *patch_buf, size_t patch_buf_sz, void *user)
RZ_API RzList * rz_coff_get_relocs(struct rz_bin_coff_obj *bin)
void get_relocs_list_cb(RZ_BORROW RzBinReloc *reloc, ut8 *patch_buf, size_t patch_buf_sz, void *user)
RZ_API ut64 rz_coff_import_index_addr(struct rz_bin_coff_obj *obj, ut64 imp_index)
#define COFF_REL_I386_REL32
#define COFF_REL_ARM64_BRANCH26
#define COFF_FILE_MACHINE_ARM64
#define COFF_REL_I386_DIR32
#define COFF_FILE_MACHINE_AMD64
#define COFF_REL_ARM_BRANCH24T
#define COFF_REL_ARM_BLX23T
#define COFF_FILE_MACHINE_I386
#define COFF_FILE_MACHINE_ARMNT
#define COFF_REL_AMD64_REL32
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
RZ_API void Ht_() free(HtName_(Ht) *ht)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_BORROW RzListIter * rz_list_push(RZ_NONNULL RzList *list, void *item)
Alias for rz_list_append.
void * calloc(size_t number, size_t size)
#define rz_return_val_if_fail(expr, val)
#define rz_buf_read_le16_at(b, addr, result)
RZ_API void rz_buf_sparse_set_write_mode(RzBuffer *b, RzBufferSparseWriteMode mode)
Only for sparse RzBuffers.
RZ_API st64 rz_buf_write_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL const ut8 *buf, ut64 len)
Write len bytes of the buffer at the specified address.
#define rz_buf_read_le16_offset(b, offset, result)
#define rz_buf_read_le32_at(b, addr, result)
@ RZ_BUF_SPARSE_WRITE_MODE_SPARSE
all writes are performed in the sparse overlay
@ RZ_BUF_SPARSE_WRITE_MODE_THROUGH
all writes are performed in the underlying base buffer
#define rz_buf_read_le32_offset(b, offset, result)
RZ_API RZ_OWN RzBuffer * rz_buf_new_sparse_overlay(RzBuffer *b, RzBufferSparseWriteMode write_mode)
Creates a sparse buffer from a already populated buffer.
static void rz_write_le32(void *dest, ut32 val)
static void rz_write_le16(void *dest, ut16 val)
static ut64 rz_num_align_delta(ut64 v, ut64 alignment)
Padding to align v to the next alignment-boundary.
ut64 reloc_targets_map_base
struct coff_scn_hdr * scn_hdrs
HtUU * imp_index
locally-generated indices for imports, in particular for deterministically assigning reloc targets
bool reloc_targets_map_base_calculated
ut64 paddr
the paddr where the value should be patched into
ut64 vaddr
the vaddr where the value should be patched into
ut64 target_vaddr
the target address that the patched reloc points to
ut64(WINAPI *w32_GetEnabledXStateFeatures)()