Ejemplo n.º 1
0
def test_choose2_embedded():
    global c
    c = MyChoose2("Choose2 - embedded", nb=12, embedded = True, width=123, height=222)
    r = c.Embedded()
    if r == 1:
        try:
            if test_embedded:
                o, sel = _idaapi.choose2_get_embedded(c)
                print("o=%s, type(o)=%s" % (str(o), type(o)))
                test_embedded(o)
        finally:
            c.Close()
Ejemplo n.º 2
0
def test_choose2_embedded():
    global c
    c = MyChoose2("Choose2 - embedded",
                  nb=12,
                  embedded=True,
                  width=123,
                  height=222)
    r = c.Embedded()
    if r == 1:
        try:
            if test_embedded:
                o, sel = _idaapi.choose2_get_embedded(c)
                print("o=%s, type(o)=%s" % (str(o), type(o)))
                test_embedded(o)
        finally:
            c.Close()
Ejemplo n.º 3
0
        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