Advertisement
joxeankoret

Untitled

Apr 2nd, 2020
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. //------------------------------------------------------------------------------
  2. // Try to get a printable C version of the contents at the address, useful to
  3. // get printable C arrays for globals.
  4. static PyObject *get_cdef(PyObject *, PyObject *args)
  5. {
  6.   unsigned PY_LONG_LONG ea;
  7.   if (!PyArg_ParseTuple(args, "k", &ea))
  8.     return NULL;
  9.  
  10.   qstring definition;
  11.   if ( print_type(&definition, ea, 0) )
  12.   {
  13.     idc_value_t eaval;
  14.     eaval.num = ea;
  15.     format_data_info_t fdi;
  16.     fdi.ptvf |= PTV_DEREF;
  17.  
  18.     qstring value;
  19.     qstrvec_t outvec;
  20.     if ( format_cdata(&outvec, eaval, NULL, NULL, &fdi) )
  21.     {
  22.       for ( qstrvec_t::iterator it = outvec.begin(); it != outvec.end(); ++it )
  23.         value.append(*it);
  24.     }
  25.  
  26.     return Py_BuildValue("ss", definition.c_str(), value.c_str());
  27.   }
  28.  
  29.   Py_RETURN_NONE;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement