idaapi.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:DecLLVM 作者: F8LEFT 项目源码 文件源码
def __init__(self,
                     chooser=None,
                     swidth=40,
                     hlp=None):
            """
            Embedded chooser control

            @param chooser: A chooser2 instance (must be constructed with 'embedded=True')
            """

            # !! Make sure a chooser instance is passed !!
            if chooser is None or not isinstance(chooser, Choose2):
                raise ValueError("Invalid chooser passed.")

            # Create an embedded chooser structure from the Choose2 instance
            if chooser.Embedded() != 1:
                raise ValueError("Failed to create embedded chooser instance.")

            # Construct input control
            Form.InputControl.__init__(self, Form.FT_ECHOOSER, "", swidth)

            # Get a pointer to the chooser_info_t and the selection vector
            # (These two parameters are the needed arguments for the AskUsingForm())
            emb, sel = _idaapi.choose2_get_embedded(chooser)

            # Get a pointer to a c_void_p constructed from an address
            p_embedded = pointer(c_void_p.from_address(emb))
            p_sel      = pointer(c_void_p.from_address(sel))

            # - Create the embedded chooser info on control creation
            # - Do not free the embeded chooser because after we get the args
            #   via Compile() the user can still call Execute() which relies
            #   on the already computed args
            self.arg   = (p_embedded, p_sel)

            # Save chooser instance
            self.chooser = chooser

            # Add a bogus 'size' attribute
            self.size = 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号