idapython / src

IDAPython project for Hex-Ray's IDA Pro
http://www.hex-rays.com/
Other
1.42k stars 287 forks source link

how to supply a 'struc_t **' var to ctree_item_t.get_memptr function while using idapython? #68

Closed Byzero512 closed 2 weeks ago

Byzero512 commented 2 months ago

The proto type for ctree_item_t.get_memptr in cpp is:

inline member_t *ctree_item_t::get_memptr(struc_t **p_sptr) const
{
  return (member_t *)HEXDSP(hx_ctree_item_t_get_memptr, this, p_sptr);
}

So I call it from idapython with these code:

import ida_hexrays
import idaapi
class tester(ida_hexrays.Hexrays_Hooks):
    def __init__(self):
        ida_hexrays.Hexrays_Hooks.__init__(self)

    def keyboard(self, vu, key_code, shift_state):
        vu.get_current_item(0)
        st = idaapi.struc_t()
        a = vu.item.get_memptr(x, st)
        return 0
x = tester()
x.hook()

But I will get the error below:

raise AttributeError("No constructor defined").

How can I set the p_sptr argument correctly?

Thank you for reply!