joxeankoret icon

Untitled

joxeankoret | PRO | 04/02/20 09:00:26 AM UTC | 0 ⭐ | 506 👁️ | Never ⏰ | []
C++ |

830 B

|

None

|

0 👍

/

0 👎

//------------------------------------------------------------------------------
// Try to get a printable C version of the contents at the address, useful to 
// get printable C arrays for globals.
static PyObject *get_cdef(PyObject *, PyObject *args)
{
  unsigned PY_LONG_LONG ea;
  if (!PyArg_ParseTuple(args, "k", &ea))
    return NULL;
 
  qstring definition;
  if ( print_type(&definition, ea, 0) )
  {
    idc_value_t eaval;
    eaval.num = ea;
    format_data_info_t fdi;
    fdi.ptvf |= PTV_DEREF;
 
    qstring value;
    qstrvec_t outvec;
    if ( format_cdata(&outvec, eaval, NULL, NULL, &fdi) )
    {
      for ( qstrvec_t::iterator it = outvec.begin(); it != outvec.end(); ++it )
        value.append(*it);
    }
 
    return Py_BuildValue("ss", definition.c_str(), value.c_str());
  }
 
  Py_RETURN_NONE;
}

Comments