//-------------------------------------------------------------------------- //lint -e{1764} could be declared const ref static int handle_symbol( reader_t &reader, int shndx, int _info, uint32 st_name, uval_t st_value, int namsec, symbol_visitor_t &sv) { if ( shndx == SHN_UNDEF || shndx == SHN_LOPROC || shndx == SHN_HIPROC || shndx == SHN_ABS ) { return 0; } int type = ELF_ST_TYPE(_info); if ( type != STT_OBJECT && type != STT_FUNC ) return 0; if ( st_name == 0 ) return 0; if ( imagebase != uval_t(-1) ) st_value -= imagebase; qstring name; reader.sections.get_name(&name, namsec, st_name); return sv.visit_symbol(st_value, name.c_str()); }
/* header: typeinf.hpp #<pydoc> def apply_type_to_stkarg(op, v, type, name): """ Apply type information to a stack variable @param op: reference to instruction operand @param v: immediate value in the operand (usually op.addr) @param type: type string. Retrieve from idc.ParseType("type string", flags)[1] @param name: stack variable name @return: Boolean """ pass #</pydoc> */ bool py_apply_type_to_stkarg( PyObject *py_op, PyObject *py_uv, PyObject *py_type, const char *name) { uint64 v; PYW_GIL_CHECK_LOCKED_SCOPE(); op_t *op = op_t_get_clink(py_op); if ( op == NULL || !PyW_GetNumber(py_uv, &v) || !PyString_Check(py_type)) { return false; } else { const type_t *t = (type_t *) PyString_AsString(py_type); tinfo_t tif; tif.deserialize(idati, &t); borref_t br(py_op); bool rc; Py_BEGIN_ALLOW_THREADS; rc = apply_tinfo_to_stkarg(*op, uval_t(v), tif, name); Py_END_ALLOW_THREADS; return rc; } }
//------------------------------------------------------------------------ inline int pe_loader_t::process_delayed_imports(linput_t *li, pe_import_visitor_t &il) { if ( pe.didtab.rva == 0 ) return 0; if ( transvec.empty() ) process_sections(li); int code = 0; uint32 ni = 0; bool ok = true; while ( true ) { uint32 table = pe.didtab.rva + ni*uint32(sizeof(dimpdir_t)); if ( !vseek(li, table) ) break; dimpdir_t &id = il.did; lread(li, &id, sizeof(id)); if ( !id.dllname ) break; il.withbase = (id.attrs & DIMP_NOBASE) == 0; uval_t base = il.withbase ? 0 : uval_t(get_imagebase()); ea_t atable = id.diat + base; ea_t ltable = id.dint; char dll[MAXSTR]; uint32 off = uint32(il.withbase ? id.dllname - (ea_t)pe.imagebase() : id.dllname); asciiz(li, off, dll, sizeof(dll), &ok); if ( !ok ) break; ansi2idb(dll); code = il.visit_module(dll, atable, ltable); if ( code != 0 ) break; code = process_import_table(li, pe, atable, ltable, il); if ( code != 0 ) break; ni++; } return ok || code != 0 ? code : -1; }