- Fixed idaapi.read_selection()

This commit is contained in:
elias.bachaalany@gmail.com 2014-04-08 00:11:43 +00:00
parent 866e631dc7
commit 1c6752de40
7 changed files with 66 additions and 13 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug64|Win32">
<Configuration>Debug64</Configuration>
@ -27,25 +27,25 @@
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug64|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v110</PlatformToolset>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">

View File

@ -658,10 +658,12 @@ def test_pck_bv():
return 1
# -----------------------------------------------------------------------
# Test work with local types
def test_local_types():
(type, fields) = GetLocalTinfo(1)
if not type:
return -1
decl = GetLocalType(1, PRTYPE_MULTI)
if decl != "enum\n"\
+ "{\n"\
@ -697,7 +699,10 @@ def test_local_types():
+ "} _tagINTERNETFEATURELIST\n":
print "decl = " + decl
return -2
return 1
# -----------------------------------------------------------------------
# various tests
def test1(stage):
# call a method that takes a string buffer and appends a dot to its end

View File

@ -5,6 +5,30 @@
//<inline(py_kernwin)>
//------------------------------------------------------------------------
//------------------------------------------------------------------------
/*
#<pydoc>
def read_selection():
"""
Returns selected area boundaries
@return: tuple(ok: bool, start_ea, end_ea)
"""
pass
#</pydoc>
*/
static PyObject *py_read_selection()
{
ea_t ea1, ea2;
bool b = read_selection(&ea1, &ea2);
PYW_GIL_CHECK_LOCKED_SCOPE();
return Py_BuildValue(
"(i" PY_FMT64 PY_FMT64 ")",
b ? 1 : 0,
pyul_t(ea1), pyul_t(ea2));
}
//------------------------------------------------------------------------
/*
#<pydoc>

View File

@ -936,4 +936,3 @@ class GraphViewer(CustomIDAMemo):
#</pydoc>
#</pycode(py_graph)>
%}

View File

@ -20,6 +20,7 @@ NO_PROCESS = 0xFFFFFFFF
NO_THREAD = 0
#</pycode(py_idd_2)>
%}
%{
//<code(py_idd)>

View File

@ -72,12 +72,18 @@
%rename (asktext) py_asktext;
%rename (str2ea) py_str2ea;
%rename (str2user) py_str2user;
%ignore process_ui_action;
%rename (process_ui_action) py_process_ui_action;
%ignore execute_sync;
%ignore exec_request_t;
%ignore execute_sync;
%rename (execute_sync) py_execute_sync;
%ignore read_selection;
%rename (read_selection) py_read_selection;
%ignore ui_request_t;
%ignore execute_ui_requests;
%rename (execute_ui_requests) py_execute_ui_requests;
@ -139,6 +145,30 @@ SWIG_DECLARE_PY_CLINKED_OBJECT(textctrl_info_t)
//<inline(py_kernwin)>
//------------------------------------------------------------------------
//------------------------------------------------------------------------
/*
#<pydoc>
def read_selection():
"""
Returns selected area boundaries
@return: tuple(ok: bool, start_ea, end_ea)
"""
pass
#</pydoc>
*/
static PyObject *py_read_selection()
{
ea_t ea1, ea2;
bool b = read_selection(&ea1, &ea2);
PYW_GIL_CHECK_LOCKED_SCOPE();
return Py_BuildValue(
"(i" PY_FMT64 PY_FMT64 ")",
b ? 1 : 0,
pyul_t(ea1), pyul_t(ea2));
}
//------------------------------------------------------------------------
/*
#<pydoc>
@ -1398,11 +1428,6 @@ static bool formchgcbfa_set_field_value(
static size_t py_get_AskUsingForm()
{
// Return a pointer to the function. Note that, although
// the C implementation of AskUsingForm_cv will do some
// Qt/txt widgets generation, the Python's ctypes
// implementation through which the call well go will first
// unblock other threads. No need to do it ourselves.
return (size_t)AskUsingForm_c;
}

View File

@ -127,7 +127,6 @@ public:
const char *c_str() const { return self->c_str(); }
};
class qtype {
public:
const uchar *c_str() const { return self->c_str(); }