idc.py: Fixed AskSelector() and FindSelector()

This commit is contained in:
gergely.erdelyi 2008-08-31 17:36:41 +00:00
parent 187f75d329
commit 565a80c62e

View File

@ -2700,17 +2700,19 @@ def AskSelector(sel):
@param sel: the selector number @param sel: the selector number
@return: selector value if found @return: selector value if found
otherwise the input value (sel) otherwise the input value (sel)
@note: selector values are always in paragraphs @note: selector values are always in paragraphs
""" """
sel = idaapi.getn_selector(sel) s = idaapi.sel_pointer()
base = idaapi.ea_pointer()
res,tmp = idaapi.getn_selector(sel, s.cast(), base.cast())
if not sel: if not res:
return sel return sel
else: else:
return sel.base return base.value()
def FindSelector(val): def FindSelector(val):
@ -2719,17 +2721,12 @@ def FindSelector(val):
@param val: value to search for @param val: value to search for
@return: the selector number if found, @return: the selector number if found,
otherwise the input value (val & 0xFFFF) otherwise the input value (val & 0xFFFF)
@note: selector values are always in paragraphs @note: selector values are always in paragraphs
""" """
sel = idaapi.find_selector(val) return idaapi.find_selector(val) & 0xFFFF
if not sel:
return val & 0xffff
else:
return sel.n
def SetSelector(sel, value): def SetSelector(sel, value):