From 565a80c62e9d8fa40f72f823363110c222e4a829 Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Sun, 31 Aug 2008 17:36:41 +0000 Subject: [PATCH] idc.py: Fixed AskSelector() and FindSelector() --- python/idc.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/python/idc.py b/python/idc.py index 8762d11..e6b580b 100644 --- a/python/idc.py +++ b/python/idc.py @@ -2700,17 +2700,19 @@ def AskSelector(sel): @param sel: the selector number - @return: selector value if found - otherwise the input value (sel) + @return: selector value if found + 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 else: - return sel.base + return base.value() def FindSelector(val): @@ -2719,17 +2721,12 @@ def FindSelector(val): @param val: value to search for - @return: the selector number if found, - otherwise the input value (val & 0xFFFF) + @return: the selector number if found, + 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) - - if not sel: - return val & 0xffff - else: - return sel.n + return idaapi.find_selector(val) & 0xFFFF def SetSelector(sel, value):