mirror of
https://github.com/cemu-project/idapython.git
synced 2025-06-16 18:58:22 +02:00
Added IDA Pro 6.1 SP1 changes (thanks to Arnaud from Hex-Rays)
This commit is contained in:
@ -330,7 +330,7 @@ def Structs():
|
||||
|
||||
def StructMembers(sid):
|
||||
"""
|
||||
Get a list of structure members information.
|
||||
Get a list of structure members information (or stack vars if given a frame).
|
||||
|
||||
@param sid: ID of the structure.
|
||||
|
||||
@ -338,14 +338,17 @@ def StructMembers(sid):
|
||||
|
||||
@note: If 'sid' does not refer to a valid structure,
|
||||
an exception will be raised.
|
||||
@note: This will not return 'holes' in structures/stack frames;
|
||||
it only returns defined structure members.
|
||||
"""
|
||||
off = idc.GetFirstMember(sid)
|
||||
if off == idaapi.BADNODE:
|
||||
m = idc.GetFirstMember(sid)
|
||||
if m == -1:
|
||||
raise Exception("No structure with ID: 0x%x" % sid)
|
||||
members = idc.GetMemberQty(sid)
|
||||
for idx in range(0, members):
|
||||
yield (off, idc.GetMemberName(sid, off), idc.GetMemberSize(sid, off))
|
||||
off = idc.GetStrucNextOff(sid, off)
|
||||
while (m != idaapi.BADADDR):
|
||||
name = idc.GetMemberName(sid, m)
|
||||
if name:
|
||||
yield (m, name, idc.GetMemberSize(sid, m))
|
||||
m = idc.GetStrucNextOff(sid, m)
|
||||
|
||||
|
||||
def DecodePrecedingInstruction(ea):
|
||||
|
@ -4943,7 +4943,7 @@ def GetStrucName(sid):
|
||||
|
||||
@param sid: structure type ID
|
||||
|
||||
@return: -1 if bad structure type ID is passed
|
||||
@return: None if bad structure type ID is passed
|
||||
otherwise returns structure type name.
|
||||
"""
|
||||
return idaapi.get_struc_name(sid)
|
||||
@ -5023,8 +5023,8 @@ def GetStrucPrevOff(sid, offset):
|
||||
@param sid: structure type ID
|
||||
@param offset: current offset
|
||||
|
||||
@return: -1 if bad structure type ID is passed
|
||||
or no (more) offsets in the structure
|
||||
@return: -1 if bad structure type ID is passed,
|
||||
idaapi.BADADDR if no (more) offsets in the structure,
|
||||
otherwise returns previous offset in a structure.
|
||||
|
||||
@note: IDA allows 'holes' between members of a
|
||||
@ -5052,8 +5052,8 @@ def GetStrucNextOff(sid, offset):
|
||||
@param sid: structure type ID
|
||||
@param offset: current offset
|
||||
|
||||
@return: -1 if bad structure type ID is passed
|
||||
or no (more) offsets in the structure
|
||||
@return: -1 if bad structure type ID is passed,
|
||||
idaapi.BADADDR if no (more) offsets in the structure,
|
||||
otherwise returns next offset in a structure.
|
||||
|
||||
@note: IDA allows 'holes' between members of a
|
||||
@ -5077,8 +5077,8 @@ def GetFirstMember(sid):
|
||||
|
||||
@param sid: structure type ID
|
||||
|
||||
@return: -1 if bad structure type ID is passed
|
||||
or structure has no members
|
||||
@return: -1 if bad structure type ID is passed,
|
||||
idaapi.BADADDR if structure has no members,
|
||||
otherwise returns offset of the first member.
|
||||
|
||||
@note: IDA allows 'holes' between members of a
|
||||
@ -5102,8 +5102,8 @@ def GetLastMember(sid):
|
||||
|
||||
@param sid: structure type ID
|
||||
|
||||
@return: -1 if bad structure type ID is passed
|
||||
or structure has no members
|
||||
@return: -1 if bad structure type ID is passed,
|
||||
idaapi.BADADDR if structure has no members,
|
||||
otherwise returns offset of the last member.
|
||||
|
||||
@note: IDA allows 'holes' between members of a
|
||||
@ -5212,7 +5212,7 @@ def GetMemberSize(sid, member_offset):
|
||||
at offset 2, then 2,3,4,5 denote
|
||||
the same structure member.
|
||||
|
||||
@return: -1 if bad structure type ID is passed
|
||||
@return: None if bad structure type ID is passed,
|
||||
or no such member in the structure
|
||||
otherwise returns size of the specified
|
||||
member in bytes.
|
||||
|
@ -72,6 +72,15 @@ _orig_stdout = sys.stdout;
|
||||
_orig_stderr = sys.stderr;
|
||||
sys.stdout = sys.stderr = IDAPythonStdOut()
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Initialize the help, with our own stdin wrapper, that'll query the user
|
||||
# -----------------------------------------------------------------------
|
||||
import pydoc
|
||||
class IDAPythonHelpPrompter:
|
||||
def readline(self):
|
||||
return idaapi.askstr(0, '', 'Help topic?')
|
||||
help = pydoc.Helper(input = IDAPythonHelpPrompter(), output = sys.stdout)
|
||||
|
||||
# Assign a default sys.argv
|
||||
sys.argv = [""]
|
||||
|
||||
|
Reference in New Issue
Block a user