コード例 #1
0
ファイル: enumeration.py プロジェクト: arizvisa/idascripts
 def by_value(cls, enum, value):
     '''Return the member identifier for the member of the enumeration `enum` with the specified `value`.'''
     eid = by(enum)
     bmask = idaapi.BADADDR & mask(eid)
     res, _ = idaapi.get_first_serial_enum_member(eid, value, bmask)
     if res == idaapi.BADADDR:
         raise E.MemberNotFoundError(u"{:s}.by_value({:#x}, {:d}) : Unable to locate member by value.".format('.'.join((__name__, cls.__name__)), eid, value))
     return res
コード例 #2
0
 def by_value(cls, enum, value):
     '''Return the member identifier for the member of the enumeration `enum` with the specified `value`.'''
     eid = by(enum)
     bmask = idaapi.BADADDR & mask(eid)
     res, _ = idaapi.get_first_serial_enum_member(eid, value, bmask)
     if res == idaapi.BADADDR:
         raise E.MemberNotFoundError(u"{:s}.by_value({:#x}, {:d}) : Unable to locate member by value.".format('.'.join((__name__, cls.__name__)), eid, value))
     return res
コード例 #3
0
ファイル: enum.py プロジェクト: stevemk14ebr/idascripts-2
 def each(cls, enum):
     '''Given an enum id, yield each id of it's members'''
     bmask = -1&mask(enum)
     for v in cls._each(enum):
         res,_ = idaapi.get_first_serial_enum_member(enum, v, bmask)
         # XXX: what does get_next_serial_enum_member and the rest do?
         yield res
     return
コード例 #4
0
 def iterate(cls, enum):
     '''Iterate through all ids of each member associated with the enumeration `enum`.'''
     eid = by(enum)
     bmask = idaapi.BADADDR & mask(eid)
     for value in cls.__iterate__(eid):
         res, _ = idaapi.get_first_serial_enum_member(eid, value, bmask)
         # XXX: what does get_next_serial_enum_member and the rest do?
         yield res
     return
コード例 #5
0
ファイル: enumeration.py プロジェクト: arizvisa/idascripts
 def iterate(cls, enum):
     '''Iterate through all ids of each member associated with the enumeration `enum`.'''
     eid = by(enum)
     bmask = idaapi.BADADDR & mask(eid)
     for value in cls.__iterate__(eid):
         res, _ = idaapi.get_first_serial_enum_member(eid, value, bmask)
         # XXX: what does get_next_serial_enum_member and the rest do?
         yield res
     return
コード例 #6
0
ファイル: enum.py プロジェクト: k273811702/idascripts
 def iterate(cls, enum):
     '''Iterate through all the member ids associated with the enumeration ``enum``.'''
     eid = by(enum)
     bmask = -1 & mask(eid)
     for v in cls.__iterate__(eid):
         res, _ = idaapi.get_first_serial_enum_member(eid, v, bmask)
         # XXX: what does get_next_serial_enum_member and the rest do?
         yield res
     return
コード例 #7
0
ファイル: enum.py プロジェクト: boogie1337/Sark
def _iter_serial_enum_member(eid, value, bitmask):
    """Iterate serial and CID of enum members with given value and bitmask.

    Here only valid values are returned, as `idaapi.BADNODE` always indicates
    an invalid member.
    """
    cid, serial = idaapi.get_first_serial_enum_member(eid, value, bitmask)
    while cid != idaapi.BADNODE:
        yield cid, serial
        cid, serial = idaapi.get_next_serial_enum_member(cid, serial)
コード例 #8
0
ファイル: enum.py プロジェクト: k273811702/idascripts
 def by_value(cls, enum, value):
     '''Return the member id for the member of the enumeration ``enum`` with the specified ``value``.'''
     eid = by(enum)
     bmask = -1 & mask(eid)
     res, _ = idaapi.get_first_serial_enum_member(eid, value, bmask)
     if res == idaapi.BADADDR:
         raise LookupError(
             "{:s}.by_value({:x}, {:d}) : Unable to locate member by value."
             .format('.'.join((__name__, cls.__name__)), eid, value))
     return res
コード例 #9
0
ファイル: enum.py プロジェクト: stevemk14ebr/idascripts-2
 def byValue(enum, value):
     '''Given an enum id, return the member id with the specified /value/'''
     bmask = -1&mask(enum)
     res,_ = idaapi.get_first_serial_enum_member(enum, value, bmask)
     return res