Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.

Commit 1c6752d

Browse files
author
elias.bachaalany@gmail.com
committed
- Fixed idaapi.read_selection()
1 parent 866e631 commit 1c6752d

7 files changed

Lines changed: 66 additions & 13 deletions

File tree

idapython.vcxproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug64|Win32">
55
<Configuration>Debug64</Configuration>
@@ -27,25 +27,25 @@
2727
<ConfigurationType>DynamicLibrary</ConfigurationType>
2828
<UseOfMfc>false</UseOfMfc>
2929
<CharacterSet>MultiByte</CharacterSet>
30-
<PlatformToolset>v110</PlatformToolset>
30+
<PlatformToolset>v120</PlatformToolset>
3131
</PropertyGroup>
3232
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
3333
<ConfigurationType>DynamicLibrary</ConfigurationType>
3434
<UseOfMfc>false</UseOfMfc>
3535
<CharacterSet>MultiByte</CharacterSet>
36-
<PlatformToolset>v110</PlatformToolset>
36+
<PlatformToolset>v120</PlatformToolset>
3737
</PropertyGroup>
3838
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
3939
<ConfigurationType>DynamicLibrary</ConfigurationType>
4040
<UseOfMfc>false</UseOfMfc>
4141
<CharacterSet>MultiByte</CharacterSet>
42-
<PlatformToolset>v110</PlatformToolset>
42+
<PlatformToolset>v120</PlatformToolset>
4343
</PropertyGroup>
4444
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug64|Win32'" Label="Configuration">
4545
<ConfigurationType>DynamicLibrary</ConfigurationType>
4646
<UseOfMfc>false</UseOfMfc>
4747
<CharacterSet>MultiByte</CharacterSet>
48-
<PlatformToolset>v110</PlatformToolset>
48+
<PlatformToolset>v120</PlatformToolset>
4949
</PropertyGroup>
5050
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
5151
<ImportGroup Label="ExtensionSettings">

pywraps/py_appcall.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,10 +658,12 @@ def test_pck_bv():
658658
return 1
659659

660660
# -----------------------------------------------------------------------
661+
# Test work with local types
661662
def test_local_types():
662663
(type, fields) = GetLocalTinfo(1)
663664
if not type:
664665
return -1
666+
665667
decl = GetLocalType(1, PRTYPE_MULTI)
666668
if decl != "enum\n"\
667669
+ "{\n"\
@@ -697,7 +699,10 @@ def test_local_types():
697699
+ "} _tagINTERNETFEATURELIST\n":
698700
print "decl = " + decl
699701
return -2
702+
700703
return 1
704+
705+
# -----------------------------------------------------------------------
701706
# various tests
702707
def test1(stage):
703708
# call a method that takes a string buffer and appends a dot to its end

pywraps/py_kernwin.hpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,30 @@
55
//<inline(py_kernwin)>
66
//------------------------------------------------------------------------
77

8+
//------------------------------------------------------------------------
9+
/*
10+
#<pydoc>
11+
def read_selection():
12+
"""
13+
Returns selected area boundaries
14+
15+
@return: tuple(ok: bool, start_ea, end_ea)
16+
"""
17+
pass
18+
#</pydoc>
19+
*/
20+
static PyObject *py_read_selection()
21+
{
22+
ea_t ea1, ea2;
23+
bool b = read_selection(&ea1, &ea2);
24+
25+
PYW_GIL_CHECK_LOCKED_SCOPE();
26+
return Py_BuildValue(
27+
"(i" PY_FMT64 PY_FMT64 ")",
28+
b ? 1 : 0,
29+
pyul_t(ea1), pyul_t(ea2));
30+
}
31+
832
//------------------------------------------------------------------------
933
/*
1034
#<pydoc>

swig/graph.i

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,4 +936,3 @@ class GraphViewer(CustomIDAMemo):
936936
#</pydoc>
937937
#</pycode(py_graph)>
938938
%}
939-

swig/idd.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ NO_PROCESS = 0xFFFFFFFF
2020
NO_THREAD = 0
2121
#</pycode(py_idd_2)>
2222
%}
23+
2324
%{
2425
//<code(py_idd)>
2526

swig/kernwin.i

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,18 @@
7272
%rename (asktext) py_asktext;
7373
%rename (str2ea) py_str2ea;
7474
%rename (str2user) py_str2user;
75+
7576
%ignore process_ui_action;
7677
%rename (process_ui_action) py_process_ui_action;
77-
%ignore execute_sync;
78+
7879
%ignore exec_request_t;
80+
81+
%ignore execute_sync;
7982
%rename (execute_sync) py_execute_sync;
8083

84+
%ignore read_selection;
85+
%rename (read_selection) py_read_selection;
86+
8187
%ignore ui_request_t;
8288
%ignore execute_ui_requests;
8389
%rename (execute_ui_requests) py_execute_ui_requests;
@@ -139,6 +145,30 @@ SWIG_DECLARE_PY_CLINKED_OBJECT(textctrl_info_t)
139145
//<inline(py_kernwin)>
140146
//------------------------------------------------------------------------
141147

148+
//------------------------------------------------------------------------
149+
/*
150+
#<pydoc>
151+
def read_selection():
152+
"""
153+
Returns selected area boundaries
154+
155+
@return: tuple(ok: bool, start_ea, end_ea)
156+
"""
157+
pass
158+
#</pydoc>
159+
*/
160+
static PyObject *py_read_selection()
161+
{
162+
ea_t ea1, ea2;
163+
bool b = read_selection(&ea1, &ea2);
164+
165+
PYW_GIL_CHECK_LOCKED_SCOPE();
166+
return Py_BuildValue(
167+
"(i" PY_FMT64 PY_FMT64 ")",
168+
b ? 1 : 0,
169+
pyul_t(ea1), pyul_t(ea2));
170+
}
171+
142172
//------------------------------------------------------------------------
143173
/*
144174
#<pydoc>
@@ -1398,11 +1428,6 @@ static bool formchgcbfa_set_field_value(
13981428

13991429
static size_t py_get_AskUsingForm()
14001430
{
1401-
// Return a pointer to the function. Note that, although
1402-
// the C implementation of AskUsingForm_cv will do some
1403-
// Qt/txt widgets generation, the Python's ctypes
1404-
// implementation through which the call well go will first
1405-
// unblock other threads. No need to do it ourselves.
14061431
return (size_t)AskUsingForm_c;
14071432
}
14081433

swig/pro.i

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ public:
127127
const char *c_str() const { return self->c_str(); }
128128
};
129129

130-
131130
class qtype {
132131
public:
133132
const uchar *c_str() const { return self->c_str(); }

0 commit comments

Comments
 (0)