def createEnum(self, enum): eid = idc.add_enum(-1, enum[0], 0x1100000) #what is this flag? idaapi.set_enum_bf(eid, 1) val = 0 mask = 0x1f idaapi.set_enum_width(eid, 1) for i in enum[1]: idc.add_enum_member(eid, i, val, mask) val += 1
def size(identifier, width=None): '''Given an enum id, get/set it's size''' if width is None: res = idaapi.get_enum_width(identifier) return 2**(res-1) if res > 0 else 0 res = int(math.log(width, 2)) return idaapi.set_enum_width(identifier, int(res)+1)
def size(enum, width): '''Set the number of bytes for the enumeration `enum` to `width`.''' eid = by(enum) return idaapi.set_enum_width(eid, width)
def size(enum, width): '''Set the number of bits for the enumeration `enum` to `width`.''' eid = by(enum) res = math.trunc(math.ceil(width / 8.0)) return idaapi.set_enum_width(eid, int(res))
def size(enum, width): '''Set the size of the enumeration identified by ``enum`` to ``width``.''' eid = by(enum) res = int(math.log(width, 2)) return idaapi.set_enum_width(eid, int(res) + 1)