IDAPython for IDA 7.7

This commit is contained in:
Arnaud Diederen
2022-01-17 11:28:09 +01:00
parent 839d93ac96
commit 3ce5b7f06d
167 changed files with 206524 additions and 134608 deletions
+208 -81
View File
@@ -101,9 +101,12 @@
'IDB_Hooks_enum_cmt_changed',
'IDB_Hooks_enum_created',
'IDB_Hooks_enum_deleted',
'IDB_Hooks_enum_flag_changed',
'IDB_Hooks_enum_member_created',
'IDB_Hooks_enum_member_deleted',
'IDB_Hooks_enum_ordinal_changed',
'IDB_Hooks_enum_renamed',
'IDB_Hooks_enum_width_changed',
'IDB_Hooks_expanding_struc',
'IDB_Hooks_extlang_changed',
'IDB_Hooks_extra_cmt_changed',
@@ -226,7 +229,7 @@
'IDP_Hooks_ev_get_reg_info',
'IDP_Hooks_ev_get_reg_name',
'IDP_Hooks_ev_get_simd_types',
'IDP_Hooks_ev_get_stkarg_offset',
'IDP_Hooks_ev_get_stkarg_area_info',
'IDP_Hooks_ev_get_stkvar_scale_factor',
'IDP_Hooks_ev_getreg',
'IDP_Hooks_ev_init',
@@ -269,6 +272,7 @@
'IDP_Hooks_ev_out_segend',
'IDP_Hooks_ev_out_segstart',
'IDP_Hooks_ev_out_special_item',
'IDP_Hooks_ev_privrange_changed',
'IDP_Hooks_ev_realcvt',
'IDP_Hooks_ev_rename',
'IDP_Hooks_ev_replaying_undo',
@@ -276,7 +280,6 @@
'IDP_Hooks_ev_set_idp_options',
'IDP_Hooks_ev_set_proc_options',
'IDP_Hooks_ev_setup_til',
'IDP_Hooks_ev_shadow_args_size',
'IDP_Hooks_ev_str2reg',
'IDP_Hooks_ev_term',
'IDP_Hooks_ev_treat_hindering_item',
@@ -399,9 +402,6 @@
'action_ctx_base_source_t_chooser_get',
'action_ctx_base_source_t_chooser_set',
'action_ctx_base_source_t_reset',
'action_ctx_base_t__get_form',
'action_ctx_base_t__get_form_title',
'action_ctx_base_t__get_form_type',
'action_ctx_base_t_action_get',
'action_ctx_base_t_action_set',
'action_ctx_base_t_chooser_selection_get',
@@ -565,6 +565,8 @@
'argloc_t__set_reg2',
'argloc_t__set_stkoff',
'argloc_t_advance',
'argloc_t_align_reg_high',
'argloc_t_align_stkoff_high',
'argloc_t_atype',
'argloc_t_calc_offset',
'argloc_t_compare',
@@ -591,8 +593,6 @@
'argloc_t_is_rrel',
'argloc_t_is_scattered',
'argloc_t_is_stkoff',
'argloc_t_justify_reg_high',
'argloc_t_justify_stkoff_right',
'argloc_t_reg1',
'argloc_t_reg2',
'argloc_t_regoff',
@@ -870,6 +870,8 @@
'asm_t_a_xor_set',
'asm_t_a_yword_get',
'asm_t_a_yword_set',
'asm_t_a_zword_get',
'asm_t_a_zword_set',
'asm_t_accsep_get',
'asm_t_accsep_set',
'asm_t_ascsep_get',
@@ -942,6 +944,7 @@
'begin_type_updating',
'bin_flag',
'bin_search',
'bin_search3',
'bin_search__SWIG_0',
'bin_search__SWIG_1',
'bit_bound_t_nbits_get',
@@ -1179,6 +1182,8 @@
'bpt_location_t_symbol',
'bpt_location_t_type',
'bpt_t_badbpt',
'bpt_t_bptid_get',
'bpt_t_bptid_set',
'bpt_t_cb_get',
'bpt_t_cb_set',
'bpt_t_cndidx_get',
@@ -1264,6 +1269,8 @@
'bptaddr_t_hea_set',
'bptaddr_t_kea_get',
'bptaddr_t_kea_set',
'bptaddrs_t_bpt_get',
'bptaddrs_t_bpt_set',
'bring_debugger_to_front',
'build_snapshot_tree',
'build_stkvar_name',
@@ -1894,6 +1901,7 @@
'chooser_base_t_header_get',
'chooser_base_t_height_get',
'chooser_base_t_icon_get',
'chooser_base_t_is_dirtree_persisted',
'chooser_base_t_is_force_default',
'chooser_base_t_is_modal',
'chooser_base_t_is_multi',
@@ -1932,6 +1940,44 @@
'cif_t_ielse_set',
'cif_t_ithen_get',
'cif_t_ithen_set',
'cinsn_list_t___eq__',
'cinsn_list_t___getitem__',
'cinsn_list_t___len__',
'cinsn_list_t___ne__',
'cinsn_list_t___setitem__',
'cinsn_list_t_back',
'cinsn_list_t_back__SWIG_0',
'cinsn_list_t_back__SWIG_1',
'cinsn_list_t_begin',
'cinsn_list_t_clear',
'cinsn_list_t_empty',
'cinsn_list_t_end',
'cinsn_list_t_erase',
'cinsn_list_t_front',
'cinsn_list_t_front__SWIG_0',
'cinsn_list_t_front__SWIG_1',
'cinsn_list_t_insert',
'cinsn_list_t_insert__SWIG_1',
'cinsn_list_t_insert__SWIG_2',
'cinsn_list_t_iterator___eq__',
'cinsn_list_t_iterator___ne__',
'cinsn_list_t_iterator___next__',
'cinsn_list_t_iterator_cur_get',
'cinsn_list_t_pop_back',
'cinsn_list_t_pop_front',
'cinsn_list_t_push_back',
'cinsn_list_t_push_back__SWIG_0',
'cinsn_list_t_push_back__SWIG_1',
'cinsn_list_t_push_front',
'cinsn_list_t_rbegin',
'cinsn_list_t_rbegin__SWIG_0',
'cinsn_list_t_rbegin__SWIG_1',
'cinsn_list_t_remove',
'cinsn_list_t_rend',
'cinsn_list_t_rend__SWIG_0',
'cinsn_list_t_rend__SWIG_1',
'cinsn_list_t_size',
'cinsn_list_t_swap',
'cinsn_t___eq__',
'cinsn_t___ge__',
'cinsn_t___gt__',
@@ -2320,11 +2366,21 @@
'ctree_item_t__get_l',
'ctree_item_t_citype_get',
'ctree_item_t_citype_set',
'ctree_item_t_e_get',
'ctree_item_t_e_set',
'ctree_item_t_f_get',
'ctree_item_t_f_set',
'ctree_item_t_get_ea',
'ctree_item_t_get_label_num',
'ctree_item_t_get_lvar',
'ctree_item_t_get_memptr',
'ctree_item_t_i_get',
'ctree_item_t_i_set',
'ctree_item_t_is_citem',
'ctree_item_t_it_get',
'ctree_item_t_it_set',
'ctree_item_t_l_get',
'ctree_item_t_l_set',
'ctree_item_t_loc_get',
'ctree_items_t___eq__',
'ctree_items_t___getitem__',
@@ -2365,6 +2421,7 @@
'ctree_items_t_size',
'ctree_items_t_swap',
'ctree_items_t_truncate',
'ctree_parentee_t_get_block',
'ctree_parentee_t_recalc_parent_types',
'ctree_visitor_t_apply_to',
'ctree_visitor_t_apply_to_exprs',
@@ -2400,6 +2457,7 @@
'custom_data_type_ids_t_dtid_set',
'custom_data_type_ids_t_fids_get',
'custom_data_type_ids_t_fids_set',
'custom_data_type_ids_t_get_dtid',
'custom_data_type_ids_t_set',
'custom_viewer_jump',
'cwhile_t___eq__',
@@ -2610,6 +2668,7 @@
'delete_bpt_t',
'delete_bpt_vec_t',
'delete_bptaddr_t',
'delete_bptaddrs_t',
'delete_call_stack_info_t',
'delete_call_stack_info_vec_t',
'delete_call_stack_t',
@@ -2641,6 +2700,8 @@
'delete_choose_ioport_parser_t',
'delete_chooser_item_attrs_t',
'delete_cif_t',
'delete_cinsn_list_t',
'delete_cinsn_list_t_iterator',
'delete_cinsn_t',
'delete_cinsnptrvec_t',
'delete_citem_cmt_t',
@@ -2676,6 +2737,7 @@
'delete_dirtree_iterator_t',
'delete_dirtree_selection_t',
'delete_dirtree_t',
'delete_dirtree_visitor_t',
'delete_disasm_line_t',
'delete_disasm_text_t',
'delete_dyn_ea_array',
@@ -2758,6 +2820,10 @@
'delete_idp_desc_t',
'delete_idp_name_t',
'delete_imports',
'delete_input_event_keyboard_data_t',
'delete_input_event_mouse_data_t',
'delete_input_event_shortcut_data_t',
'delete_input_event_t',
'delete_input_file_t',
'delete_insn_cmt_t',
'delete_insn_cmts_t',
@@ -2834,6 +2900,7 @@
'delete_node_iterator',
'delete_node_layout_t',
'delete_node_ordering_t',
'delete_num_range_t',
'delete_number_format_t',
'delete_op_parent_info_t',
'delete_op_t',
@@ -2843,6 +2910,7 @@
'delete_oprepr_t',
'delete_optblock_t',
'delete_optinsn_t',
'delete_params_t',
'delete_pattern_id_t',
'delete_pkt_get_pop_result_t',
'delete_pkt_get_pop_t',
@@ -2870,8 +2938,6 @@
'delete_qbasic_block_t',
'delete_qfile_t',
'delete_qflow_chart_t',
'delete_qlist_cinsn_t',
'delete_qlist_cinsn_t_iterator',
'delete_qmutex_locker_t',
'delete_qrefcnt_obj_t',
'delete_qvector_carg_t',
@@ -2930,6 +2996,7 @@
'delete_skipped_funcs_t',
'delete_snapshot_t',
'delete_sreg_range_t',
'delete_stkarg_area_info_t',
'delete_stkpnt_t',
'delete_stkpnts_t',
'delete_stkvar_ref_t',
@@ -3090,8 +3157,8 @@
'dirspec_t_get_attrs',
'dirspec_t_get_inode',
'dirspec_t_get_name',
'dirspec_t_nodename_get',
'dirspec_t_nodename_set',
'dirspec_t_id_get',
'dirspec_t_id_set',
'dirspec_t_rename_inode',
'dirspec_t_unlink_inode',
'dirtree_cursor_t___eq__',
@@ -3156,6 +3223,7 @@
'dirtree_t_change_rank',
'dirtree_t_chdir',
'dirtree_t_errstr',
'dirtree_t_find_entry',
'dirtree_t_findfirst',
'dirtree_t_findnext',
'dirtree_t_get_abspath',
@@ -3164,7 +3232,7 @@
'dirtree_t_get_dir_size',
'dirtree_t_get_entry_attrs',
'dirtree_t_get_entry_name',
'dirtree_t_get_nodename',
'dirtree_t_get_id',
'dirtree_t_get_parent_cursor',
'dirtree_t_get_rank',
'dirtree_t_getcwd',
@@ -3185,10 +3253,12 @@
'dirtree_t_resolve_path',
'dirtree_t_rmdir',
'dirtree_t_save',
'dirtree_t_set_nodename',
'dirtree_t_set_id',
'dirtree_t_traverse',
'dirtree_t_unlink',
'dirtree_t_unlink__SWIG_0',
'dirtree_t_unlink__SWIG_1',
'dirtree_visitor_t_visit',
'disable_bblk_trace',
'disable_bpt',
'disable_bpt__SWIG_0',
@@ -3257,6 +3327,7 @@
'disown_ctree_parentee_t',
'disown_ctree_visitor_t',
'disown_dirspec_t',
'disown_dirtree_visitor_t',
'disown_enum_member_visitor_t',
'disown_file_enumerator_t',
'disown_func_md_diff_handler_t',
@@ -3437,6 +3508,7 @@
'enable_bpt',
'enable_bpt__SWIG_0',
'enable_bpt__SWIG_1',
'enable_bptgrp',
'enable_chooser_item_attrs',
'enable_extlang_python',
'enable_flags',
@@ -4034,10 +4106,6 @@
'func_info_vec_t_size',
'func_info_vec_t_swap',
'func_info_vec_t_truncate',
'func_item_iterator_decode_preceding_insn',
'func_item_iterator_decode_prev_insn',
'func_item_iterator_next',
'func_item_iterator_prev',
'func_item_iterator_t___next__',
'func_item_iterator_t_chunk',
'func_item_iterator_t_current',
@@ -4058,6 +4126,8 @@
'func_item_iterator_t_prev_not_tail',
'func_item_iterator_t_set',
'func_item_iterator_t_set_range',
'func_item_iterator_t_succ',
'func_item_iterator_t_succ_code',
'func_md_diff_handler_t_on_comment_changed',
'func_md_diff_handler_t_on_extra_comment_changed',
'func_md_diff_handler_t_on_frame_member_changed',
@@ -4220,8 +4290,12 @@
'gco_info_t_is_use',
'gco_info_t_name_get',
'gco_info_t_name_set',
'gco_info_t_regnum_get',
'gco_info_t_regnum_set',
'gco_info_t_size_get',
'gco_info_t_size_set',
'gco_info_t_stkoff_get',
'gco_info_t_stkoff_set',
'gdl_graph_t_begin',
'gdl_graph_t_edge',
'gdl_graph_t_empty',
@@ -4260,7 +4334,6 @@
'gen_use_arg_tinfos2',
'generate_disasm_line',
'generate_disassembly',
'generate_til_with_parser',
'generic_linput_t_blocksize_get',
'generic_linput_t_blocksize_set',
'generic_linput_t_filesize_get',
@@ -4341,6 +4414,7 @@
'get_custom_viewer_curline',
'get_custom_viewer_location',
'get_custom_viewer_place',
'get_custom_viewer_place_xcoord',
'get_data_elsize',
'get_data_value',
'get_db_byte',
@@ -4371,6 +4445,7 @@
'get_elapsed_secs',
'get_elf_debug_file_directory',
'get_encoding_bpu',
'get_encoding_bpu_by_name',
'get_encoding_name',
'get_encoding_qty',
'get_entry',
@@ -4498,8 +4573,7 @@
'get_ind_purged',
'get_inf_structure',
'get_initial_ida_version',
'get_initial_ida_version__SWIG_0',
'get_initial_ida_version__SWIG_1',
'get_initial_idb_version',
'get_innermost_member',
'get_input_file_path',
'get_insn_tev_reg_mem',
@@ -4750,6 +4824,7 @@
'get_unk_type',
'get_unsigned_mcode',
'get_user_idadir',
'get_user_input_event',
'get_user_strlist_options',
'get_vftable_ea',
'get_vftable_ordinal',
@@ -4972,8 +5047,8 @@
'idainfo_bin_prefix_size_set',
'idainfo_cc_get',
'idainfo_cc_set',
'idainfo_comment_get',
'idainfo_comment_set',
'idainfo_cmt_indent_get',
'idainfo_cmt_indent_set',
'idainfo_database_change_count_get',
'idainfo_database_change_count_set',
'idainfo_datatypes_get',
@@ -4983,9 +5058,6 @@
'idainfo_filetype_get',
'idainfo_filetype_set',
'idainfo_get_abiname',
'idainfo_get_maxEA',
'idainfo_get_minEA',
'idainfo_get_procName',
'idainfo_highoff_get',
'idainfo_highoff_set',
'idainfo_indent_get',
@@ -5036,8 +5108,6 @@
'idainfo_s_prefflag_set',
'idainfo_s_xrefflag_get',
'idainfo_s_xrefflag_set',
'idainfo_set_maxEA',
'idainfo_set_minEA',
'idainfo_short_demnames_get',
'idainfo_short_demnames_set',
'idainfo_specsegs_get',
@@ -5185,6 +5255,9 @@
'inf_allow_sigmulti',
'inf_append_sigcmt',
'inf_big_arg_align',
'inf_big_arg_align',
'inf_big_arg_align__SWIG_1',
'inf_big_arg_align__SWIG_1',
'inf_check_manual_ops',
'inf_check_unicode_strlits',
'inf_coagulate_code',
@@ -5232,8 +5305,8 @@
'inf_get_cc_size_ldbl',
'inf_get_cc_size_ll',
'inf_get_cc_size_s',
'inf_get_cmt_indent',
'inf_get_cmtflg',
'inf_get_comment',
'inf_get_database_change_count',
'inf_get_datatypes',
'inf_get_demname_form',
@@ -5322,6 +5395,9 @@
'inf_op_offset',
'inf_pack_idb',
'inf_pack_stkargs',
'inf_pack_stkargs',
'inf_pack_stkargs__SWIG_1',
'inf_pack_stkargs__SWIG_1',
'inf_postinc_strlit_sernum',
'inf_prefix_show_funcoff',
'inf_prefix_show_segaddr',
@@ -5365,10 +5441,10 @@
'inf_set_cc_size_s',
'inf_set_check_manual_ops',
'inf_set_check_unicode_strlits',
'inf_set_cmt_indent',
'inf_set_cmtflg',
'inf_set_coagulate_code',
'inf_set_coagulate_data',
'inf_set_comment',
'inf_set_compress_idb',
'inf_set_create_all_xrefs',
'inf_set_create_func_from_call',
@@ -5535,6 +5611,36 @@
'info',
'info__varargs__',
'init_hexrays_plugin',
'input_event_keyboard_data_t_key_get',
'input_event_keyboard_data_t_key_set',
'input_event_keyboard_data_t_text_get',
'input_event_keyboard_data_t_text_set',
'input_event_mouse_data_t_button_get',
'input_event_mouse_data_t_button_set',
'input_event_mouse_data_t_x_get',
'input_event_mouse_data_t_x_set',
'input_event_mouse_data_t_y_get',
'input_event_mouse_data_t_y_set',
'input_event_shortcut_data_t_action_name_get',
'input_event_shortcut_data_t_action_name_set',
'input_event_t__source_as_size',
'input_event_t__target_as_size',
'input_event_t_cb_get',
'input_event_t_cb_set',
'input_event_t_keyboard_get',
'input_event_t_keyboard_set',
'input_event_t_kind_get',
'input_event_t_kind_set',
'input_event_t_modifiers_get',
'input_event_t_modifiers_set',
'input_event_t_mouse_get',
'input_event_t_mouse_set',
'input_event_t_shortcut_get',
'input_event_t_shortcut_set',
'input_event_t_source_get',
'input_event_t_source_set',
'input_event_t_target_get',
'input_event_t_target_set',
'input_file_t_md5_get',
'input_file_t_md5_set',
'input_file_t_path_get',
@@ -5629,6 +5735,12 @@
'insn_t_add_dref',
'insn_t_add_off_drefs',
'insn_t_assign',
'insn_t_auxpref_get',
'insn_t_auxpref_set',
'insn_t_auxpref_u16_get',
'insn_t_auxpref_u16_set',
'insn_t_auxpref_u8_get',
'insn_t_auxpref_u8_set',
'insn_t_create_op_data',
'insn_t_create_op_data__SWIG_0',
'insn_t_create_op_data__SWIG_1',
@@ -5829,6 +5941,7 @@
'is_double',
'is_dummy_member_name',
'is_dword',
'is_ea_tryblks',
'is_enum',
'is_enum0',
'is_enum1',
@@ -6585,6 +6698,7 @@
'make_name_user',
'make_name_weak',
'make_pointer',
'make_str_type',
'map_code_ea',
'map_code_ea__SWIG_0',
'map_code_ea__SWIG_1',
@@ -7042,6 +7156,7 @@
'member_t_eoff_set',
'member_t_flag_get',
'member_t_flag_set',
'member_t_get_size',
'member_t_get_soff',
'member_t_has_ti',
'member_t_has_union',
@@ -7523,7 +7638,6 @@
'mopvec_t_size',
'mopvec_t_swap',
'mopvec_t_truncate',
'move_bpt_to_grp',
'move_idcv',
'move_segm',
'move_segm_start',
@@ -7792,6 +7906,7 @@
'new_bpt_vec_t__SWIG_0',
'new_bpt_vec_t__SWIG_1',
'new_bptaddr_t',
'new_bptaddrs_t',
'new_call_stack_info_t',
'new_call_stack_info_vec_t',
'new_call_stack_info_vec_t__SWIG_0',
@@ -7848,6 +7963,10 @@
'new_cif_t',
'new_cif_t__SWIG_0',
'new_cif_t__SWIG_1',
'new_cinsn_list_t',
'new_cinsn_list_t__SWIG_0',
'new_cinsn_list_t__SWIG_1',
'new_cinsn_list_t_iterator',
'new_cinsn_t',
'new_cinsn_t__SWIG_0',
'new_cinsn_t__SWIG_1',
@@ -7861,8 +7980,6 @@
'new_citem_locator_t__SWIG_0',
'new_citem_locator_t__SWIG_1',
'new_citem_t',
'new_citem_t__SWIG_0',
'new_citem_t__SWIG_1',
'new_cloop_t',
'new_cloop_t__SWIG_0',
'new_cloop_t__SWIG_1',
@@ -7905,6 +8022,7 @@
'new_dirtree_iterator_t',
'new_dirtree_selection_t',
'new_dirtree_t',
'new_dirtree_visitor_t',
'new_disasm_line_t',
'new_disasm_line_t__SWIG_0',
'new_disasm_line_t__SWIG_1',
@@ -8039,6 +8157,10 @@
'new_idc_values_t__SWIG_1',
'new_idp_desc_t',
'new_idp_name_t',
'new_input_event_keyboard_data_t',
'new_input_event_mouse_data_t',
'new_input_event_shortcut_data_t',
'new_input_event_t',
'new_input_file_t',
'new_insn_cmt_t',
'new_insn_cmts_t',
@@ -8162,6 +8284,7 @@
'new_node_layout_t__SWIG_0',
'new_node_layout_t__SWIG_1',
'new_node_ordering_t',
'new_num_range_t',
'new_number_format_t',
'new_op_parent_info_t',
'new_op_t',
@@ -8172,6 +8295,7 @@
'new_optblock_t',
'new_optinsn_t',
'new_packet',
'new_params_t',
'new_pattern_id_t',
'new_pkt_get_pop_result_t',
'new_pkt_get_pop_t',
@@ -8208,10 +8332,6 @@
'new_qflow_chart_t',
'new_qflow_chart_t__SWIG_0',
'new_qflow_chart_t__SWIG_1',
'new_qlist_cinsn_t',
'new_qlist_cinsn_t__SWIG_0',
'new_qlist_cinsn_t__SWIG_1',
'new_qlist_cinsn_t_iterator',
'new_qmutex_locker_t',
'new_qstring_printer_t',
'new_qvector_carg_t',
@@ -8271,6 +8391,8 @@
'new_regvar_t__SWIG_1',
'new_renderer_info_pos_t',
'new_renderer_info_t',
'new_renderer_info_t__SWIG_0',
'new_renderer_info_t__SWIG_1',
'new_renderer_pos_info_t',
'new_rlist_t',
'new_rlist_t__SWIG_0',
@@ -8321,13 +8443,12 @@
'new_skipped_funcs_t__SWIG_1',
'new_snapshot_t',
'new_sreg_range_t',
'new_stkarg_area_info_t',
'new_stkpnt_t',
'new_stkpnts_t',
'new_stkvar_ref_t',
'new_strarray_t',
'new_string_info_t',
'new_string_info_t__SWIG_0',
'new_string_info_t__SWIG_1',
'new_strpath_ids_array',
'new_strpath_t',
'new_struct_field_visitor_t',
@@ -8548,6 +8669,10 @@
'nomem',
'nomem__varargs__',
'num_flag',
'num_range_t_maxval_get',
'num_range_t_maxval_set',
'num_range_t_minval_get',
'num_range_t_minval_set',
'number_format_t_flags_get',
'number_format_t_flags_set',
'number_format_t_get_radix',
@@ -8606,6 +8731,8 @@
'op_t___set_specval__',
'op_t___set_value__',
'op_t__from_ptrval__',
'op_t_addr_get',
'op_t_addr_set',
'op_t_assign',
'op_t_clr_shown',
'op_t_dtype_get',
@@ -8620,6 +8747,10 @@
'op_t_offb_set',
'op_t_offo_get',
'op_t_offo_set',
'op_t_phrase_get',
'op_t_phrase_set',
'op_t_reg_get',
'op_t_reg_set',
'op_t_set_shown',
'op_t_shown',
'op_t_specflag1_get',
@@ -8630,8 +8761,12 @@
'op_t_specflag3_set',
'op_t_specflag4_get',
'op_t_specflag4_set',
'op_t_specval_get',
'op_t_specval_set',
'op_t_type_get',
'op_t_type_set',
'op_t_value_get',
'op_t_value_set',
'op_uses_x',
'op_uses_y',
'op_uses_z',
@@ -8809,6 +8944,10 @@
'pack_object_to_bv',
'pack_object_to_idb',
'packreal_flag',
'params_t_p1_get',
'params_t_p1_set',
'params_t_p2_get',
'params_t_p2_set',
'parse_binpat_str',
'parse_command_line3',
'parse_dbgopts',
@@ -9211,49 +9350,6 @@
'qflow_chart_t_title_get',
'qflow_chart_t_title_set',
'qlgetz',
'qlist_cinsn_t___eq__',
'qlist_cinsn_t___getitem__',
'qlist_cinsn_t___len__',
'qlist_cinsn_t___ne__',
'qlist_cinsn_t___setitem__',
'qlist_cinsn_t_back',
'qlist_cinsn_t_back__SWIG_0',
'qlist_cinsn_t_back__SWIG_1',
'qlist_cinsn_t_begin',
'qlist_cinsn_t_clear',
'qlist_cinsn_t_empty',
'qlist_cinsn_t_end',
'qlist_cinsn_t_erase',
'qlist_cinsn_t_erase__SWIG_0',
'qlist_cinsn_t_erase__SWIG_1',
'qlist_cinsn_t_erase__SWIG_2',
'qlist_cinsn_t_front',
'qlist_cinsn_t_front__SWIG_0',
'qlist_cinsn_t_front__SWIG_1',
'qlist_cinsn_t_insert',
'qlist_cinsn_t_insert__SWIG_0',
'qlist_cinsn_t_insert__SWIG_1',
'qlist_cinsn_t_insert__SWIG_3',
'qlist_cinsn_t_insert__SWIG_4',
'qlist_cinsn_t_iterator___eq__',
'qlist_cinsn_t_iterator___ne__',
'qlist_cinsn_t_iterator___next__',
'qlist_cinsn_t_iterator_cur_get',
'qlist_cinsn_t_pop_back',
'qlist_cinsn_t_pop_front',
'qlist_cinsn_t_push_back',
'qlist_cinsn_t_push_back__SWIG_0',
'qlist_cinsn_t_push_back__SWIG_1',
'qlist_cinsn_t_push_front',
'qlist_cinsn_t_rbegin',
'qlist_cinsn_t_rbegin__SWIG_0',
'qlist_cinsn_t_rbegin__SWIG_1',
'qlist_cinsn_t_remove',
'qlist_cinsn_t_rend',
'qlist_cinsn_t_rend__SWIG_0',
'qlist_cinsn_t_rend__SWIG_1',
'qlist_cinsn_t_size',
'qlist_cinsn_t_swap',
'qrefcnt_obj_t_refcnt_get',
'qrefcnt_obj_t_refcnt_set',
'qrefcnt_obj_t_release',
@@ -9624,6 +9720,8 @@
'refinfo_t_flags_set',
'refinfo_t_init',
'refinfo_t_is_custom',
'refinfo_t_is_no_ones',
'refinfo_t_is_no_zeros',
'refinfo_t_is_pastend',
'refinfo_t_is_rvaoff',
'refinfo_t_is_signed',
@@ -10367,6 +10465,8 @@
'set_ids_modnode',
'set_imagebase',
'set_immd',
'set_import_name',
'set_import_ordinal',
'set_insn_trace_options',
'set_item_color',
'set_libitem',
@@ -10424,6 +10524,7 @@
'set_srcdbg_undesired_paths',
'set_sreg_at_next_code',
'set_step_trace_options',
'set_str_encoding_idx',
'set_str_type',
'set_struc_align',
'set_struc_cmt',
@@ -10616,6 +10717,14 @@
'step_into',
'step_over',
'step_until_ret',
'stkarg_area_info_t_cb_get',
'stkarg_area_info_t_cb_set',
'stkarg_area_info_t_linkage_area_get',
'stkarg_area_info_t_linkage_area_set',
'stkarg_area_info_t_shadow_size_get',
'stkarg_area_info_t_shadow_size_set',
'stkarg_area_info_t_stkarg_offset_get',
'stkarg_area_info_t_stkarg_offset_set',
'stkpnt_t___eq__',
'stkpnt_t___ge__',
'stkpnt_t___gt__',
@@ -10686,15 +10795,22 @@
'struc_t_age_set',
'struc_t_from_til',
'struc_t_get_alignment',
'struc_t_get_last_member',
'struc_t_get_last_member__SWIG_0',
'struc_t_get_last_member__SWIG_1',
'struc_t_has_union',
'struc_t_id_get',
'struc_t_id_set',
'struc_t_is_choosable',
'struc_t_is_copyof',
'struc_t_is_frame',
'struc_t_is_ghost',
'struc_t_is_hidden',
'struc_t_is_mappedto',
'struc_t_is_synced',
'struc_t_is_union',
'struc_t_is_varstr',
'struc_t_like_union',
'struc_t_members_get',
'struc_t_members_set',
'struc_t_memqty_get',
@@ -10705,6 +10821,7 @@
'struc_t_props_set',
'struc_t_set_alignment',
'struc_t_set_ghost',
'struc_t_unsync',
'struct_field_visitor_t_visit_field',
'structplace_t_idx_get',
'structplace_t_idx_set',
@@ -10798,6 +10915,8 @@
'switch_info_t_jcases_set',
'switch_info_t_jumps_get',
'switch_info_t_jumps_set',
'switch_info_t_lowcase_get',
'switch_info_t_lowcase_set',
'switch_info_t_marks_get',
'switch_info_t_marks_set',
'switch_info_t_ncases_get',
@@ -10815,6 +10934,8 @@
'switch_info_t_startea_get',
'switch_info_t_startea_set',
'switch_info_t_use_std_table',
'switch_info_t_values_get',
'switch_info_t_values_set',
'switch_to_golang',
'sync_source_t___eq__',
'sync_source_t___ne__',
@@ -11369,6 +11490,10 @@
'type_mods_t_type_set',
'typedef_type_data_t_is_ordref_get',
'typedef_type_data_t_is_ordref_set',
'typedef_type_data_t_name_get',
'typedef_type_data_t_name_set',
'typedef_type_data_t_ordinal_get',
'typedef_type_data_t_ordinal_set',
'typedef_type_data_t_resolve_get',
'typedef_type_data_t_resolve_set',
'typedef_type_data_t_swap',
@@ -11380,6 +11505,7 @@
'uchar_array_frompointer',
'udc_filter_t_apply',
'udc_filter_t_cleanup',
'udc_filter_t_empty',
'udc_filter_t_init',
'udc_filter_t_install',
'udc_filter_t_match',
@@ -11408,6 +11534,7 @@
'udcall_t___lt__',
'udcall_t___ne__',
'udcall_t_compare',
'udcall_t_empty',
'udcall_t_name_get',
'udcall_t_name_set',
'udcall_t_tif_get',
+262 -123
View File
@@ -101,9 +101,12 @@
'IDB_Hooks_enum_cmt_changed',
'IDB_Hooks_enum_created',
'IDB_Hooks_enum_deleted',
'IDB_Hooks_enum_flag_changed',
'IDB_Hooks_enum_member_created',
'IDB_Hooks_enum_member_deleted',
'IDB_Hooks_enum_ordinal_changed',
'IDB_Hooks_enum_renamed',
'IDB_Hooks_enum_width_changed',
'IDB_Hooks_expanding_struc',
'IDB_Hooks_extlang_changed',
'IDB_Hooks_extra_cmt_changed',
@@ -226,7 +229,7 @@
'IDP_Hooks_ev_get_reg_info',
'IDP_Hooks_ev_get_reg_name',
'IDP_Hooks_ev_get_simd_types',
'IDP_Hooks_ev_get_stkarg_offset',
'IDP_Hooks_ev_get_stkarg_area_info',
'IDP_Hooks_ev_get_stkvar_scale_factor',
'IDP_Hooks_ev_getreg',
'IDP_Hooks_ev_init',
@@ -269,6 +272,7 @@
'IDP_Hooks_ev_out_segend',
'IDP_Hooks_ev_out_segstart',
'IDP_Hooks_ev_out_special_item',
'IDP_Hooks_ev_privrange_changed',
'IDP_Hooks_ev_realcvt',
'IDP_Hooks_ev_rename',
'IDP_Hooks_ev_replaying_undo',
@@ -276,7 +280,6 @@
'IDP_Hooks_ev_set_idp_options',
'IDP_Hooks_ev_set_proc_options',
'IDP_Hooks_ev_setup_til',
'IDP_Hooks_ev_shadow_args_size',
'IDP_Hooks_ev_str2reg',
'IDP_Hooks_ev_term',
'IDP_Hooks_ev_treat_hindering_item',
@@ -399,9 +402,6 @@
'action_ctx_base_source_t_chooser_get',
'action_ctx_base_source_t_chooser_set',
'action_ctx_base_source_t_reset',
'action_ctx_base_t__get_form',
'action_ctx_base_t__get_form_title',
'action_ctx_base_t__get_form_type',
'action_ctx_base_t_action_get',
'action_ctx_base_t_action_set',
'action_ctx_base_t_chooser_selection_get',
@@ -565,6 +565,8 @@
'argloc_t__set_reg2',
'argloc_t__set_stkoff',
'argloc_t_advance',
'argloc_t_align_reg_high',
'argloc_t_align_stkoff_high',
'argloc_t_atype',
'argloc_t_calc_offset',
'argloc_t_compare',
@@ -591,8 +593,6 @@
'argloc_t_is_rrel',
'argloc_t_is_scattered',
'argloc_t_is_stkoff',
'argloc_t_justify_reg_high',
'argloc_t_justify_stkoff_right',
'argloc_t_reg1',
'argloc_t_reg2',
'argloc_t_regoff',
@@ -870,6 +870,8 @@
'asm_t_a_xor_set',
'asm_t_a_yword_get',
'asm_t_a_yword_set',
'asm_t_a_zword_get',
'asm_t_a_zword_set',
'asm_t_accsep_get',
'asm_t_accsep_set',
'asm_t_ascsep_get',
@@ -942,6 +944,7 @@
'begin_type_updating',
'bin_flag',
'bin_search',
'bin_search3',
'bin_search__SWIG_0',
'bin_search__SWIG_1',
'bit_bound_t_nbits_get',
@@ -1179,6 +1182,8 @@
'bpt_location_t_symbol',
'bpt_location_t_type',
'bpt_t_badbpt',
'bpt_t_bptid_get',
'bpt_t_bptid_set',
'bpt_t_cb_get',
'bpt_t_cb_set',
'bpt_t_cndidx_get',
@@ -1264,6 +1269,8 @@
'bptaddr_t_hea_set',
'bptaddr_t_kea_get',
'bptaddr_t_kea_set',
'bptaddrs_t_bpt_get',
'bptaddrs_t_bpt_set',
'bring_debugger_to_front',
'build_snapshot_tree',
'build_stkvar_name',
@@ -1894,6 +1901,7 @@
'chooser_base_t_header_get',
'chooser_base_t_height_get',
'chooser_base_t_icon_get',
'chooser_base_t_is_dirtree_persisted',
'chooser_base_t_is_force_default',
'chooser_base_t_is_modal',
'chooser_base_t_is_multi',
@@ -1932,6 +1940,44 @@
'cif_t_ielse_set',
'cif_t_ithen_get',
'cif_t_ithen_set',
'cinsn_list_t___eq__',
'cinsn_list_t___getitem__',
'cinsn_list_t___len__',
'cinsn_list_t___ne__',
'cinsn_list_t___setitem__',
'cinsn_list_t_back',
'cinsn_list_t_back__SWIG_0',
'cinsn_list_t_back__SWIG_1',
'cinsn_list_t_begin',
'cinsn_list_t_clear',
'cinsn_list_t_empty',
'cinsn_list_t_end',
'cinsn_list_t_erase',
'cinsn_list_t_front',
'cinsn_list_t_front__SWIG_0',
'cinsn_list_t_front__SWIG_1',
'cinsn_list_t_insert',
'cinsn_list_t_insert__SWIG_1',
'cinsn_list_t_insert__SWIG_2',
'cinsn_list_t_iterator___eq__',
'cinsn_list_t_iterator___ne__',
'cinsn_list_t_iterator___next__',
'cinsn_list_t_iterator_cur_get',
'cinsn_list_t_pop_back',
'cinsn_list_t_pop_front',
'cinsn_list_t_push_back',
'cinsn_list_t_push_back__SWIG_0',
'cinsn_list_t_push_back__SWIG_1',
'cinsn_list_t_push_front',
'cinsn_list_t_rbegin',
'cinsn_list_t_rbegin__SWIG_0',
'cinsn_list_t_rbegin__SWIG_1',
'cinsn_list_t_remove',
'cinsn_list_t_rend',
'cinsn_list_t_rend__SWIG_0',
'cinsn_list_t_rend__SWIG_1',
'cinsn_list_t_size',
'cinsn_list_t_swap',
'cinsn_t___eq__',
'cinsn_t___ge__',
'cinsn_t___gt__',
@@ -2320,11 +2366,21 @@
'ctree_item_t__get_l',
'ctree_item_t_citype_get',
'ctree_item_t_citype_set',
'ctree_item_t_e_get',
'ctree_item_t_e_set',
'ctree_item_t_f_get',
'ctree_item_t_f_set',
'ctree_item_t_get_ea',
'ctree_item_t_get_label_num',
'ctree_item_t_get_lvar',
'ctree_item_t_get_memptr',
'ctree_item_t_i_get',
'ctree_item_t_i_set',
'ctree_item_t_is_citem',
'ctree_item_t_it_get',
'ctree_item_t_it_set',
'ctree_item_t_l_get',
'ctree_item_t_l_set',
'ctree_item_t_loc_get',
'ctree_items_t___eq__',
'ctree_items_t___getitem__',
@@ -2365,6 +2421,7 @@
'ctree_items_t_size',
'ctree_items_t_swap',
'ctree_items_t_truncate',
'ctree_parentee_t_get_block',
'ctree_parentee_t_recalc_parent_types',
'ctree_visitor_t_apply_to',
'ctree_visitor_t_apply_to_exprs',
@@ -2400,6 +2457,7 @@
'custom_data_type_ids_t_dtid_set',
'custom_data_type_ids_t_fids_get',
'custom_data_type_ids_t_fids_set',
'custom_data_type_ids_t_get_dtid',
'custom_data_type_ids_t_set',
'custom_viewer_jump',
'cwhile_t___eq__',
@@ -2610,6 +2668,7 @@
'delete_bpt_t',
'delete_bpt_vec_t',
'delete_bptaddr_t',
'delete_bptaddrs_t',
'delete_call_stack_info_t',
'delete_call_stack_info_vec_t',
'delete_call_stack_t',
@@ -2641,6 +2700,8 @@
'delete_choose_ioport_parser_t',
'delete_chooser_item_attrs_t',
'delete_cif_t',
'delete_cinsn_list_t',
'delete_cinsn_list_t_iterator',
'delete_cinsn_t',
'delete_cinsnptrvec_t',
'delete_citem_cmt_t',
@@ -2676,6 +2737,7 @@
'delete_dirtree_iterator_t',
'delete_dirtree_selection_t',
'delete_dirtree_t',
'delete_dirtree_visitor_t',
'delete_disasm_line_t',
'delete_disasm_text_t',
'delete_dyn_ea_array',
@@ -2758,6 +2820,10 @@
'delete_idp_desc_t',
'delete_idp_name_t',
'delete_imports',
'delete_input_event_keyboard_data_t',
'delete_input_event_mouse_data_t',
'delete_input_event_shortcut_data_t',
'delete_input_event_t',
'delete_input_file_t',
'delete_insn_cmt_t',
'delete_insn_cmts_t',
@@ -2834,6 +2900,7 @@
'delete_node_iterator',
'delete_node_layout_t',
'delete_node_ordering_t',
'delete_num_range_t',
'delete_number_format_t',
'delete_op_parent_info_t',
'delete_op_t',
@@ -2843,6 +2910,7 @@
'delete_oprepr_t',
'delete_optblock_t',
'delete_optinsn_t',
'delete_params_t',
'delete_pattern_id_t',
'delete_pkt_get_pop_result_t',
'delete_pkt_get_pop_t',
@@ -2870,8 +2938,6 @@
'delete_qbasic_block_t',
'delete_qfile_t',
'delete_qflow_chart_t',
'delete_qlist_cinsn_t',
'delete_qlist_cinsn_t_iterator',
'delete_qmutex_locker_t',
'delete_qrefcnt_obj_t',
'delete_qvector_carg_t',
@@ -2930,6 +2996,7 @@
'delete_skipped_funcs_t',
'delete_snapshot_t',
'delete_sreg_range_t',
'delete_stkarg_area_info_t',
'delete_stkpnt_t',
'delete_stkpnts_t',
'delete_stkvar_ref_t',
@@ -2979,6 +3046,7 @@
'delete_udt_member_t',
'delete_udt_type_data_t',
'delete_udtmembervec_t',
'delete_udtmembervec_template_t',
'delete_ui_requests_t',
'delete_ui_stroff_applicator_t',
'delete_ui_stroff_op_t',
@@ -3089,8 +3157,8 @@
'dirspec_t_get_attrs',
'dirspec_t_get_inode',
'dirspec_t_get_name',
'dirspec_t_nodename_get',
'dirspec_t_nodename_set',
'dirspec_t_id_get',
'dirspec_t_id_set',
'dirspec_t_rename_inode',
'dirspec_t_unlink_inode',
'dirtree_cursor_t___eq__',
@@ -3155,6 +3223,7 @@
'dirtree_t_change_rank',
'dirtree_t_chdir',
'dirtree_t_errstr',
'dirtree_t_find_entry',
'dirtree_t_findfirst',
'dirtree_t_findnext',
'dirtree_t_get_abspath',
@@ -3163,7 +3232,7 @@
'dirtree_t_get_dir_size',
'dirtree_t_get_entry_attrs',
'dirtree_t_get_entry_name',
'dirtree_t_get_nodename',
'dirtree_t_get_id',
'dirtree_t_get_parent_cursor',
'dirtree_t_get_rank',
'dirtree_t_getcwd',
@@ -3184,10 +3253,12 @@
'dirtree_t_resolve_path',
'dirtree_t_rmdir',
'dirtree_t_save',
'dirtree_t_set_nodename',
'dirtree_t_set_id',
'dirtree_t_traverse',
'dirtree_t_unlink',
'dirtree_t_unlink__SWIG_0',
'dirtree_t_unlink__SWIG_1',
'dirtree_visitor_t_visit',
'disable_bblk_trace',
'disable_bpt',
'disable_bpt__SWIG_0',
@@ -3256,6 +3327,7 @@
'disown_ctree_parentee_t',
'disown_ctree_visitor_t',
'disown_dirspec_t',
'disown_dirtree_visitor_t',
'disown_enum_member_visitor_t',
'disown_file_enumerator_t',
'disown_func_md_diff_handler_t',
@@ -3436,6 +3508,7 @@
'enable_bpt',
'enable_bpt__SWIG_0',
'enable_bpt__SWIG_1',
'enable_bptgrp',
'enable_chooser_item_attrs',
'enable_extlang_python',
'enable_flags',
@@ -4033,10 +4106,6 @@
'func_info_vec_t_size',
'func_info_vec_t_swap',
'func_info_vec_t_truncate',
'func_item_iterator_decode_preceding_insn',
'func_item_iterator_decode_prev_insn',
'func_item_iterator_next',
'func_item_iterator_prev',
'func_item_iterator_t___next__',
'func_item_iterator_t_chunk',
'func_item_iterator_t_current',
@@ -4057,6 +4126,8 @@
'func_item_iterator_t_prev_not_tail',
'func_item_iterator_t_set',
'func_item_iterator_t_set_range',
'func_item_iterator_t_succ',
'func_item_iterator_t_succ_code',
'func_md_diff_handler_t_on_comment_changed',
'func_md_diff_handler_t_on_extra_comment_changed',
'func_md_diff_handler_t_on_frame_member_changed',
@@ -4138,11 +4209,16 @@
'func_type_data_t_flags_set',
'func_type_data_t_get_call_method',
'func_type_data_t_guess_cc',
'func_type_data_t_is_const',
'func_type_data_t_is_ctor',
'func_type_data_t_is_dtor',
'func_type_data_t_is_golang_cc',
'func_type_data_t_is_high',
'func_type_data_t_is_noret',
'func_type_data_t_is_pure',
'func_type_data_t_is_static',
'func_type_data_t_is_vararg_cc',
'func_type_data_t_is_virtual',
'func_type_data_t_retloc_get',
'func_type_data_t_retloc_set',
'func_type_data_t_rettype_get',
@@ -4214,8 +4290,12 @@
'gco_info_t_is_use',
'gco_info_t_name_get',
'gco_info_t_name_set',
'gco_info_t_regnum_get',
'gco_info_t_regnum_set',
'gco_info_t_size_get',
'gco_info_t_size_set',
'gco_info_t_stkoff_get',
'gco_info_t_stkoff_set',
'gdl_graph_t_begin',
'gdl_graph_t_edge',
'gdl_graph_t_empty',
@@ -4254,7 +4334,6 @@
'gen_use_arg_tinfos2',
'generate_disasm_line',
'generate_disassembly',
'generate_til_with_parser',
'generic_linput_t_blocksize_get',
'generic_linput_t_blocksize_set',
'generic_linput_t_filesize_get',
@@ -4335,6 +4414,7 @@
'get_custom_viewer_curline',
'get_custom_viewer_location',
'get_custom_viewer_place',
'get_custom_viewer_place_xcoord',
'get_data_elsize',
'get_data_value',
'get_db_byte',
@@ -4365,6 +4445,7 @@
'get_elapsed_secs',
'get_elf_debug_file_directory',
'get_encoding_bpu',
'get_encoding_bpu_by_name',
'get_encoding_name',
'get_encoding_qty',
'get_entry',
@@ -4492,8 +4573,7 @@
'get_ind_purged',
'get_inf_structure',
'get_initial_ida_version',
'get_initial_ida_version__SWIG_0',
'get_initial_ida_version__SWIG_1',
'get_initial_idb_version',
'get_innermost_member',
'get_input_file_path',
'get_insn_tev_reg_mem',
@@ -4744,6 +4824,7 @@
'get_unk_type',
'get_unsigned_mcode',
'get_user_idadir',
'get_user_input_event',
'get_user_strlist_options',
'get_vftable_ea',
'get_vftable_ordinal',
@@ -4966,8 +5047,8 @@
'idainfo_bin_prefix_size_set',
'idainfo_cc_get',
'idainfo_cc_set',
'idainfo_comment_get',
'idainfo_comment_set',
'idainfo_cmt_indent_get',
'idainfo_cmt_indent_set',
'idainfo_database_change_count_get',
'idainfo_database_change_count_set',
'idainfo_datatypes_get',
@@ -4977,9 +5058,6 @@
'idainfo_filetype_get',
'idainfo_filetype_set',
'idainfo_get_abiname',
'idainfo_get_maxEA',
'idainfo_get_minEA',
'idainfo_get_procName',
'idainfo_highoff_get',
'idainfo_highoff_set',
'idainfo_indent_get',
@@ -5030,8 +5108,6 @@
'idainfo_s_prefflag_set',
'idainfo_s_xrefflag_get',
'idainfo_s_xrefflag_set',
'idainfo_set_maxEA',
'idainfo_set_minEA',
'idainfo_short_demnames_get',
'idainfo_short_demnames_set',
'idainfo_specsegs_get',
@@ -5179,6 +5255,9 @@
'inf_allow_sigmulti',
'inf_append_sigcmt',
'inf_big_arg_align',
'inf_big_arg_align',
'inf_big_arg_align__SWIG_1',
'inf_big_arg_align__SWIG_1',
'inf_check_manual_ops',
'inf_check_unicode_strlits',
'inf_coagulate_code',
@@ -5226,8 +5305,8 @@
'inf_get_cc_size_ldbl',
'inf_get_cc_size_ll',
'inf_get_cc_size_s',
'inf_get_cmt_indent',
'inf_get_cmtflg',
'inf_get_comment',
'inf_get_database_change_count',
'inf_get_datatypes',
'inf_get_demname_form',
@@ -5316,6 +5395,9 @@
'inf_op_offset',
'inf_pack_idb',
'inf_pack_stkargs',
'inf_pack_stkargs',
'inf_pack_stkargs__SWIG_1',
'inf_pack_stkargs__SWIG_1',
'inf_postinc_strlit_sernum',
'inf_prefix_show_funcoff',
'inf_prefix_show_segaddr',
@@ -5359,10 +5441,10 @@
'inf_set_cc_size_s',
'inf_set_check_manual_ops',
'inf_set_check_unicode_strlits',
'inf_set_cmt_indent',
'inf_set_cmtflg',
'inf_set_coagulate_code',
'inf_set_coagulate_data',
'inf_set_comment',
'inf_set_compress_idb',
'inf_set_create_all_xrefs',
'inf_set_create_func_from_call',
@@ -5529,6 +5611,36 @@
'info',
'info__varargs__',
'init_hexrays_plugin',
'input_event_keyboard_data_t_key_get',
'input_event_keyboard_data_t_key_set',
'input_event_keyboard_data_t_text_get',
'input_event_keyboard_data_t_text_set',
'input_event_mouse_data_t_button_get',
'input_event_mouse_data_t_button_set',
'input_event_mouse_data_t_x_get',
'input_event_mouse_data_t_x_set',
'input_event_mouse_data_t_y_get',
'input_event_mouse_data_t_y_set',
'input_event_shortcut_data_t_action_name_get',
'input_event_shortcut_data_t_action_name_set',
'input_event_t__source_as_size',
'input_event_t__target_as_size',
'input_event_t_cb_get',
'input_event_t_cb_set',
'input_event_t_keyboard_get',
'input_event_t_keyboard_set',
'input_event_t_kind_get',
'input_event_t_kind_set',
'input_event_t_modifiers_get',
'input_event_t_modifiers_set',
'input_event_t_mouse_get',
'input_event_t_mouse_set',
'input_event_t_shortcut_get',
'input_event_t_shortcut_set',
'input_event_t_source_get',
'input_event_t_source_set',
'input_event_t_target_get',
'input_event_t_target_set',
'input_file_t_md5_get',
'input_file_t_md5_set',
'input_file_t_path_get',
@@ -5623,6 +5735,12 @@
'insn_t_add_dref',
'insn_t_add_off_drefs',
'insn_t_assign',
'insn_t_auxpref_get',
'insn_t_auxpref_set',
'insn_t_auxpref_u16_get',
'insn_t_auxpref_u16_set',
'insn_t_auxpref_u8_get',
'insn_t_auxpref_u8_set',
'insn_t_create_op_data',
'insn_t_create_op_data__SWIG_0',
'insn_t_create_op_data__SWIG_1',
@@ -5823,6 +5941,7 @@
'is_double',
'is_dummy_member_name',
'is_dword',
'is_ea_tryblks',
'is_enum',
'is_enum0',
'is_enum1',
@@ -6579,6 +6698,7 @@
'make_name_user',
'make_name_weak',
'make_pointer',
'make_str_type',
'map_code_ea',
'map_code_ea__SWIG_0',
'map_code_ea__SWIG_1',
@@ -7036,6 +7156,7 @@
'member_t_eoff_set',
'member_t_flag_get',
'member_t_flag_set',
'member_t_get_size',
'member_t_get_soff',
'member_t_has_ti',
'member_t_has_union',
@@ -7517,7 +7638,6 @@
'mopvec_t_size',
'mopvec_t_swap',
'mopvec_t_truncate',
'move_bpt_to_grp',
'move_idcv',
'move_segm',
'move_segm_start',
@@ -7790,6 +7910,7 @@
'new_bpt_vec_t__SWIG_0',
'new_bpt_vec_t__SWIG_1',
'new_bptaddr_t',
'new_bptaddrs_t',
'new_call_stack_info_t',
'new_call_stack_info_vec_t',
'new_call_stack_info_vec_t__SWIG_0',
@@ -7846,6 +7967,10 @@
'new_cif_t',
'new_cif_t__SWIG_0',
'new_cif_t__SWIG_1',
'new_cinsn_list_t',
'new_cinsn_list_t__SWIG_0',
'new_cinsn_list_t__SWIG_1',
'new_cinsn_list_t_iterator',
'new_cinsn_t',
'new_cinsn_t__SWIG_0',
'new_cinsn_t__SWIG_1',
@@ -7859,8 +7984,6 @@
'new_citem_locator_t__SWIG_0',
'new_citem_locator_t__SWIG_1',
'new_citem_t',
'new_citem_t__SWIG_0',
'new_citem_t__SWIG_1',
'new_cloop_t',
'new_cloop_t__SWIG_0',
'new_cloop_t__SWIG_1',
@@ -7903,6 +8026,7 @@
'new_dirtree_iterator_t',
'new_dirtree_selection_t',
'new_dirtree_t',
'new_dirtree_visitor_t',
'new_disasm_line_t',
'new_disasm_line_t__SWIG_0',
'new_disasm_line_t__SWIG_1',
@@ -8037,6 +8161,10 @@
'new_idc_values_t__SWIG_1',
'new_idp_desc_t',
'new_idp_name_t',
'new_input_event_keyboard_data_t',
'new_input_event_mouse_data_t',
'new_input_event_shortcut_data_t',
'new_input_event_t',
'new_input_file_t',
'new_insn_cmt_t',
'new_insn_cmts_t',
@@ -8160,6 +8288,7 @@
'new_node_layout_t__SWIG_0',
'new_node_layout_t__SWIG_1',
'new_node_ordering_t',
'new_num_range_t',
'new_number_format_t',
'new_op_parent_info_t',
'new_op_t',
@@ -8170,6 +8299,7 @@
'new_optblock_t',
'new_optinsn_t',
'new_packet',
'new_params_t',
'new_pattern_id_t',
'new_pkt_get_pop_result_t',
'new_pkt_get_pop_t',
@@ -8206,10 +8336,6 @@
'new_qflow_chart_t',
'new_qflow_chart_t__SWIG_0',
'new_qflow_chart_t__SWIG_1',
'new_qlist_cinsn_t',
'new_qlist_cinsn_t__SWIG_0',
'new_qlist_cinsn_t__SWIG_1',
'new_qlist_cinsn_t_iterator',
'new_qmutex_locker_t',
'new_qstring_printer_t',
'new_qvector_carg_t',
@@ -8269,6 +8395,8 @@
'new_regvar_t__SWIG_1',
'new_renderer_info_pos_t',
'new_renderer_info_t',
'new_renderer_info_t__SWIG_0',
'new_renderer_info_t__SWIG_1',
'new_renderer_pos_info_t',
'new_rlist_t',
'new_rlist_t__SWIG_0',
@@ -8319,13 +8447,12 @@
'new_skipped_funcs_t__SWIG_1',
'new_snapshot_t',
'new_sreg_range_t',
'new_stkarg_area_info_t',
'new_stkpnt_t',
'new_stkpnts_t',
'new_stkvar_ref_t',
'new_strarray_t',
'new_string_info_t',
'new_string_info_t__SWIG_0',
'new_string_info_t__SWIG_1',
'new_strpath_ids_array',
'new_strpath_t',
'new_struct_field_visitor_t',
@@ -8395,8 +8522,9 @@
'new_udt_member_t',
'new_udt_type_data_t',
'new_udtmembervec_t',
'new_udtmembervec_t__SWIG_0',
'new_udtmembervec_t__SWIG_1',
'new_udtmembervec_template_t',
'new_udtmembervec_template_t__SWIG_0',
'new_udtmembervec_template_t__SWIG_1',
'new_ui_requests_t',
'new_ui_stroff_applicator_t',
'new_ui_stroff_op_t',
@@ -8545,6 +8673,10 @@
'nomem',
'nomem__varargs__',
'num_flag',
'num_range_t_maxval_get',
'num_range_t_maxval_set',
'num_range_t_minval_get',
'num_range_t_minval_set',
'number_format_t_flags_get',
'number_format_t_flags_set',
'number_format_t_get_radix',
@@ -8603,6 +8735,8 @@
'op_t___set_specval__',
'op_t___set_value__',
'op_t__from_ptrval__',
'op_t_addr_get',
'op_t_addr_set',
'op_t_assign',
'op_t_clr_shown',
'op_t_dtype_get',
@@ -8617,6 +8751,10 @@
'op_t_offb_set',
'op_t_offo_get',
'op_t_offo_set',
'op_t_phrase_get',
'op_t_phrase_set',
'op_t_reg_get',
'op_t_reg_set',
'op_t_set_shown',
'op_t_shown',
'op_t_specflag1_get',
@@ -8627,8 +8765,12 @@
'op_t_specflag3_set',
'op_t_specflag4_get',
'op_t_specflag4_set',
'op_t_specval_get',
'op_t_specval_set',
'op_t_type_get',
'op_t_type_set',
'op_t_value_get',
'op_t_value_set',
'op_uses_x',
'op_uses_y',
'op_uses_z',
@@ -8806,6 +8948,10 @@
'pack_object_to_bv',
'pack_object_to_idb',
'packreal_flag',
'params_t_p1_get',
'params_t_p1_set',
'params_t_p2_get',
'params_t_p2_set',
'parse_binpat_str',
'parse_command_line3',
'parse_dbgopts',
@@ -9208,49 +9354,6 @@
'qflow_chart_t_title_get',
'qflow_chart_t_title_set',
'qlgetz',
'qlist_cinsn_t___eq__',
'qlist_cinsn_t___getitem__',
'qlist_cinsn_t___len__',
'qlist_cinsn_t___ne__',
'qlist_cinsn_t___setitem__',
'qlist_cinsn_t_back',
'qlist_cinsn_t_back__SWIG_0',
'qlist_cinsn_t_back__SWIG_1',
'qlist_cinsn_t_begin',
'qlist_cinsn_t_clear',
'qlist_cinsn_t_empty',
'qlist_cinsn_t_end',
'qlist_cinsn_t_erase',
'qlist_cinsn_t_erase__SWIG_0',
'qlist_cinsn_t_erase__SWIG_1',
'qlist_cinsn_t_erase__SWIG_2',
'qlist_cinsn_t_front',
'qlist_cinsn_t_front__SWIG_0',
'qlist_cinsn_t_front__SWIG_1',
'qlist_cinsn_t_insert',
'qlist_cinsn_t_insert__SWIG_0',
'qlist_cinsn_t_insert__SWIG_1',
'qlist_cinsn_t_insert__SWIG_3',
'qlist_cinsn_t_insert__SWIG_4',
'qlist_cinsn_t_iterator___eq__',
'qlist_cinsn_t_iterator___ne__',
'qlist_cinsn_t_iterator___next__',
'qlist_cinsn_t_iterator_cur_get',
'qlist_cinsn_t_pop_back',
'qlist_cinsn_t_pop_front',
'qlist_cinsn_t_push_back',
'qlist_cinsn_t_push_back__SWIG_0',
'qlist_cinsn_t_push_back__SWIG_1',
'qlist_cinsn_t_push_front',
'qlist_cinsn_t_rbegin',
'qlist_cinsn_t_rbegin__SWIG_0',
'qlist_cinsn_t_rbegin__SWIG_1',
'qlist_cinsn_t_remove',
'qlist_cinsn_t_rend',
'qlist_cinsn_t_rend__SWIG_0',
'qlist_cinsn_t_rend__SWIG_1',
'qlist_cinsn_t_size',
'qlist_cinsn_t_swap',
'qrefcnt_obj_t_refcnt_get',
'qrefcnt_obj_t_refcnt_set',
'qrefcnt_obj_t_release',
@@ -9621,6 +9724,8 @@
'refinfo_t_flags_set',
'refinfo_t_init',
'refinfo_t_is_custom',
'refinfo_t_is_no_ones',
'refinfo_t_is_no_zeros',
'refinfo_t_is_pastend',
'refinfo_t_is_rvaoff',
'refinfo_t_is_signed',
@@ -10364,6 +10469,8 @@
'set_ids_modnode',
'set_imagebase',
'set_immd',
'set_import_name',
'set_import_ordinal',
'set_insn_trace_options',
'set_item_color',
'set_libitem',
@@ -10421,6 +10528,7 @@
'set_srcdbg_undesired_paths',
'set_sreg_at_next_code',
'set_step_trace_options',
'set_str_encoding_idx',
'set_str_type',
'set_struc_align',
'set_struc_cmt',
@@ -10613,6 +10721,14 @@
'step_into',
'step_over',
'step_until_ret',
'stkarg_area_info_t_cb_get',
'stkarg_area_info_t_cb_set',
'stkarg_area_info_t_linkage_area_get',
'stkarg_area_info_t_linkage_area_set',
'stkarg_area_info_t_shadow_size_get',
'stkarg_area_info_t_shadow_size_set',
'stkarg_area_info_t_stkarg_offset_get',
'stkarg_area_info_t_stkarg_offset_set',
'stkpnt_t___eq__',
'stkpnt_t___ge__',
'stkpnt_t___gt__',
@@ -10683,15 +10799,22 @@
'struc_t_age_set',
'struc_t_from_til',
'struc_t_get_alignment',
'struc_t_get_last_member',
'struc_t_get_last_member__SWIG_0',
'struc_t_get_last_member__SWIG_1',
'struc_t_has_union',
'struc_t_id_get',
'struc_t_id_set',
'struc_t_is_choosable',
'struc_t_is_copyof',
'struc_t_is_frame',
'struc_t_is_ghost',
'struc_t_is_hidden',
'struc_t_is_mappedto',
'struc_t_is_synced',
'struc_t_is_union',
'struc_t_is_varstr',
'struc_t_like_union',
'struc_t_members_get',
'struc_t_members_set',
'struc_t_memqty_get',
@@ -10702,6 +10825,7 @@
'struc_t_props_set',
'struc_t_set_alignment',
'struc_t_set_ghost',
'struc_t_unsync',
'struct_field_visitor_t_visit_field',
'structplace_t_idx_get',
'structplace_t_idx_set',
@@ -10795,6 +10919,8 @@
'switch_info_t_jcases_set',
'switch_info_t_jumps_get',
'switch_info_t_jumps_set',
'switch_info_t_lowcase_get',
'switch_info_t_lowcase_set',
'switch_info_t_marks_get',
'switch_info_t_marks_set',
'switch_info_t_ncases_get',
@@ -10812,6 +10938,8 @@
'switch_info_t_startea_get',
'switch_info_t_startea_set',
'switch_info_t_use_std_table',
'switch_info_t_values_get',
'switch_info_t_values_set',
'switch_to_golang',
'sync_source_t___eq__',
'sync_source_t___ne__',
@@ -11083,6 +11211,7 @@
'tinfo_t_get_final_ordinal',
'tinfo_t_get_final_type_name',
'tinfo_t_get_func_details',
'tinfo_t_get_methods',
'tinfo_t_get_modifiers',
'tinfo_t_get_named_type',
'tinfo_t_get_nargs',
@@ -11215,6 +11344,7 @@
'tinfo_t_set_attrs',
'tinfo_t_set_const',
'tinfo_t_set_declalign',
'tinfo_t_set_methods',
'tinfo_t_set_modifiers',
'tinfo_t_set_named_type',
'tinfo_t_set_numbered_type',
@@ -11364,6 +11494,10 @@
'type_mods_t_type_set',
'typedef_type_data_t_is_ordref_get',
'typedef_type_data_t_is_ordref_set',
'typedef_type_data_t_name_get',
'typedef_type_data_t_name_set',
'typedef_type_data_t_ordinal_get',
'typedef_type_data_t_ordinal_set',
'typedef_type_data_t_resolve_get',
'typedef_type_data_t_resolve_set',
'typedef_type_data_t_swap',
@@ -11375,6 +11509,7 @@
'uchar_array_frompointer',
'udc_filter_t_apply',
'udc_filter_t_cleanup',
'udc_filter_t_empty',
'udc_filter_t_init',
'udc_filter_t_install',
'udc_filter_t_match',
@@ -11403,6 +11538,7 @@
'udcall_t___lt__',
'udcall_t___ne__',
'udcall_t_compare',
'udcall_t_empty',
'udcall_t_name_get',
'udcall_t_name_set',
'udcall_t_tif_get',
@@ -11412,6 +11548,7 @@
'udt_member_t___ne__',
'udt_member_t_begin',
'udt_member_t_clr_baseclass',
'udt_member_t_clr_method',
'udt_member_t_clr_unaligned',
'udt_member_t_clr_vftable',
'udt_member_t_clr_virtbase',
@@ -11425,6 +11562,7 @@
'udt_member_t_is_anonymous_udm',
'udt_member_t_is_baseclass',
'udt_member_t_is_bitfield',
'udt_member_t_is_method',
'udt_member_t_is_unaligned',
'udt_member_t_is_vftable',
'udt_member_t_is_virtbase',
@@ -11434,6 +11572,7 @@
'udt_member_t_offset_get',
'udt_member_t_offset_set',
'udt_member_t_set_baseclass',
'udt_member_t_set_method',
'udt_member_t_set_unaligned',
'udt_member_t_set_vftable',
'udt_member_t_set_virtbase',
@@ -11465,46 +11604,46 @@
'udt_type_data_t_total_size_set',
'udt_type_data_t_unpadded_size_get',
'udt_type_data_t_unpadded_size_set',
'udtmembervec_t___eq__',
'udtmembervec_t___getitem__',
'udtmembervec_t___len__',
'udtmembervec_t___ne__',
'udtmembervec_t___setitem__',
'udtmembervec_t__del',
'udtmembervec_t_add_unique',
'udtmembervec_t_at',
'udtmembervec_t_begin',
'udtmembervec_t_begin__SWIG_0',
'udtmembervec_t_begin__SWIG_1',
'udtmembervec_t_capacity',
'udtmembervec_t_clear',
'udtmembervec_t_empty',
'udtmembervec_t_end',
'udtmembervec_t_end__SWIG_0',
'udtmembervec_t_end__SWIG_1',
'udtmembervec_t_erase',
'udtmembervec_t_erase__SWIG_0',
'udtmembervec_t_erase__SWIG_1',
'udtmembervec_t_extract',
'udtmembervec_t_find',
'udtmembervec_t_find__SWIG_0',
'udtmembervec_t_find__SWIG_1',
'udtmembervec_t_grow',
'udtmembervec_t_has',
'udtmembervec_t_inject',
'udtmembervec_t_insert',
'udtmembervec_t_pop_back',
'udtmembervec_t_push_back',
'udtmembervec_t_push_back__SWIG_0',
'udtmembervec_t_push_back__SWIG_1',
'udtmembervec_t_qclear',
'udtmembervec_t_reserve',
'udtmembervec_t_resize',
'udtmembervec_t_resize__SWIG_0',
'udtmembervec_t_resize__SWIG_1',
'udtmembervec_t_size',
'udtmembervec_t_swap',
'udtmembervec_t_truncate',
'udtmembervec_template_t___eq__',
'udtmembervec_template_t___getitem__',
'udtmembervec_template_t___len__',
'udtmembervec_template_t___ne__',
'udtmembervec_template_t___setitem__',
'udtmembervec_template_t__del',
'udtmembervec_template_t_add_unique',
'udtmembervec_template_t_at',
'udtmembervec_template_t_begin',
'udtmembervec_template_t_begin__SWIG_0',
'udtmembervec_template_t_begin__SWIG_1',
'udtmembervec_template_t_capacity',
'udtmembervec_template_t_clear',
'udtmembervec_template_t_empty',
'udtmembervec_template_t_end',
'udtmembervec_template_t_end__SWIG_0',
'udtmembervec_template_t_end__SWIG_1',
'udtmembervec_template_t_erase',
'udtmembervec_template_t_erase__SWIG_0',
'udtmembervec_template_t_erase__SWIG_1',
'udtmembervec_template_t_extract',
'udtmembervec_template_t_find',
'udtmembervec_template_t_find__SWIG_0',
'udtmembervec_template_t_find__SWIG_1',
'udtmembervec_template_t_grow',
'udtmembervec_template_t_has',
'udtmembervec_template_t_inject',
'udtmembervec_template_t_insert',
'udtmembervec_template_t_pop_back',
'udtmembervec_template_t_push_back',
'udtmembervec_template_t_push_back__SWIG_0',
'udtmembervec_template_t_push_back__SWIG_1',
'udtmembervec_template_t_qclear',
'udtmembervec_template_t_reserve',
'udtmembervec_template_t_resize',
'udtmembervec_template_t_resize__SWIG_0',
'udtmembervec_template_t_resize__SWIG_1',
'udtmembervec_template_t_size',
'udtmembervec_template_t_swap',
'udtmembervec_template_t_truncate',
'ui_load_new_file',
'ui_run_debugger',
'ui_stroff_applicator_t_apply',
-46
View File
@@ -1,46 +0,0 @@
IDAPython for IDA 7.00: backward-compatibility with 6.95 APIs
=============================================================
Availability of the backward-compatibility code
-----------------------------------------------
* Backward-compatibility is provided by python.cfg's
`AUTOIMPORT_COMPAT_IDA695` directive. This directive is
currently turned on by default, but in the future it will:
1. be turned off by default
1. eventually disappear, and all the corresponding code will be removed
* Consequently IDAPython script/plugin writers should try and port
their code, with the help of the porting guide XXX FIXME URL? XXX.
* Once you have done the porting, please check that your code works
with `AUTOIMPORT_COMPAT_IDA695` set to `NO`.
* If anything proves too hard or confusing, please let us know about
it on <support@hexrays.com>, and we will help you, either by fixing
IDAPython if needed, or by improving the documentation.
Coverage of the backward-compatibility code
-------------------------------------------
* We did what was reasonably feasible, to provide an IDAPython API
that's as backward-compatible as possible with the IDA 6.95 API
* However, we considered it unreasonable for some parts of the API
to be ported. Most notably:
* the "processor module" API: existing processor modules will
have to be ported to the new API. Please see the SDK's
`module/script/proctemplate.py` (or any other `*.py` file in
that directory) for examples how to use the new API.
* processor module-related notifications: some of those have either
been renamed, or have possibly changed signature
* Most (all?) of the renamed functions, properties, etc... should be
covered, in all modules: `idaapi`, `idc`, ...
If something doesn't work/isn't there anymore, it's likely an
omission from our side.
* Please let us know about any missing bits & pieces, that you
believe should be there and that we might have forgotten!
-11
View File
@@ -1,11 +0,0 @@
#!/bin/sh
TARGET_DIR=../../../../www/www.hex-rays.com/public_html/hex-rays/products/ida/7.0/docs
TARGET_FILE=$TARGET_DIR/idapython_backward_compat_695.html
p4 edit $TARGET_FILE
echo \<html\>\<head\> > $TARGET_FILE
echo \<link type="text/css" rel="stylesheet" href="../../../../style.css" /\> >> $TARGET_FILE
echo \<link type="text/css" rel="stylesheet" href="style.css" /\> >> $TARGET_FILE
echo \</head\>\<body\> >> $TARGET_FILE
markdown bc695.md >> $TARGET_FILE
echo \</body\>\</html\> >> $TARGET_FILE
p4 revert -a $TARGET_FILE
+75
View File
@@ -0,0 +1,75 @@
# inject_pydoc.py
This tool is in charge extracting information from the C++ SDK
headers, and inject it into IDAPython's documentation.
## Extracting the C++ SDK information/documentation
The IDAPython build system will run `doxygen` against the SDK headers,
asking it to output all the information it could extract, as `XML`
format for later use - by `inject_pydoc.py`, but not only…
## Applying the documentation
Then, we run `tools/inject_pydoc.py`, to process that `XML`
content and extract documentation about the functions, classes,
methods, variables, etc… that are present in the corresponding
IDAPython module.
## Fixing the input parameters
We cannot blindly apply the SDK documentation, however: some C++
function parameters will turn into output values when converted to
Python, and thus it makes no sense to have those parameters as part of
the IDAPython function documentation. For example, when wrapping
inline void get_registered_actions(qstrvec_t *out)
into `ida_kernwin.get_registered_actions`, the `out` parameter will
turn into a `list(str)`, so it makes no sense to see the corresponding
C++ header's documentation:
/// \param out the list of actions to be filled
into the IDAPython documentation.
Fortunately, we can rely on SWiG's help to do that, because even
though SWiG doesn't know how to import C++ header's documentation, it
*will* tell us what parameters are present in the wrapped prototype.
Therefore, we collect the SWiG-generated list of parameters from the
prototype, and simply remove the non-relevant bits from the C++
header's documentation before injecting that into IDAPython.
## Fixing the return values
Because all of that was too easy, IDAPython adds another layer of
complexity (craziness?) for fixing the return values.
When it comes to the input parameters, it's actually _fairly_ easy to
drop the irrelevant bits from the C++ SDK header's documentation: we
know what parameters SWiG will keep & wrap.
But for the return values, it's another story entirely: SWiG doesn't
know (and cannot always reliably know) what type a return value will
have.
In particular when it comes to custom code in `pywraps/` that returns
a `PyObject *`.
Therefore, we have put a mechanism into place, that lets us put a
"wrapper" around _all_ IDAPython functions/class methods, that will
trace/keep track of the types of the values that were passed in, and
the types of the values that were spit out by those functions.
We can then use that wrapper when running tests, collect information
from the tests that were run, process that information, and save it
into `tools/collected_traces.txt`, which will then be used by
`inject_pydoc.py`.
It's worth pointing out that that information is not, and could not
possibly, be generated at build-time: it must be done at another time
(e.g., after running tests), which is very different than the
mechanism used for fixing the parameters (that "simply" relies on the
`doxygen`-parsed `XML`-formatted documentation.)
+22
View File
@@ -0,0 +1,22 @@
# IDAPython runtime documentation
We define the "IDAPython runtime documentation" as the documentation
that's available through Python's `help()` system, while the user is
interacting with `IDAPython` during an IDA session.
That documentation is SWiG-generated + patched, or custom written.
## Custom-written documentation
Some functions have custom-written documentation (check for <pydoc>
tags in the `pywraps/` directory), but the general case is that the
documentation is automatically generated by SWiG, and then patched.
## SWiG-generated + patched documentation
Because SWiG doesn't know about the C++ SDK header's documentation, we
need a way to "import" that documentation into IDAPython.
That's done by `tools/inject_pydoc.py` which deserves
[its own documentation](inject_pydoc.md)
+6
View File
@@ -5,9 +5,15 @@ description:
This illustrates the setting/retrieval of background colours
using the IDC wrappers
In order to do so, we'll be assigning colors to specific ranges
(item, function, or segment). Those will be persisted in the
database.
category: disassembly
keywords: coloring, idc
see_also: colorize_disassembly_on_the_fly
"""
from __future__ import print_function
@@ -0,0 +1,136 @@
"""
summary: an easy-to-use way to colorize lines
description:
This builds upon the `ida_kernwin.UI_Hooks.get_lines_rendering_info`
feature, to provide a quick & easy way to colorize disassembly
lines.
Contrary to @colorize_disassembly, the coloring is not persisted in
the database, and will therefore be lost after the session.
By triggering the action multiple times, the user can "carousel"
across 4 predefined colors (and return to the "no color" state.)
keywords: coloring
see_also: colorize_disassembly
"""
import ida_kernwin
import ida_moves
class on_the_fly_coloring_hooks_t(ida_kernwin.UI_Hooks):
# We'll offer the users the ability to carousel around the
# following colors. Well, note that these are in fact not
# colors, but rather color "keys": each theme might have its
# own values for those.
AVAILABLE_COLORS = [
ida_kernwin.CK_EXTRA5,
ida_kernwin.CK_EXTRA6,
ida_kernwin.CK_EXTRA7,
ida_kernwin.CK_EXTRA8,
]
def __init__(self):
ida_kernwin.UI_Hooks.__init__(self)
# Each view can have on-the-fly coloring.
# We'll store the custom colors keyed on the widget's title
self.by_widget = {}
def get_lines_rendering_info(self, out, widget, rin):
"""
Called by IDA, at rendering-time.
We'll look in our set of marked lines, and for those that are
found, will produce additional rendering information for IDA
to use.
"""
title = ida_kernwin.get_widget_title(widget)
assigned = self.by_widget.get(title, None)
if assigned is not None:
for section_lines in rin.sections_lines:
for line in section_lines:
for loc, color in assigned:
if self._same_lines(widget, line.at, loc.place()):
e = ida_kernwin.line_rendering_output_entry_t(line)
e.bg_color = color
out.entries.push_back(e)
def _same_lines(self, viewer, p0, p1):
return ida_kernwin.get_custom_viewer_place_xcoord(viewer, p0, p1) != -1
def _find_loc_index(self, viewer, assigned, loc):
for idx, tpl in enumerate(assigned):
_loc = tpl[0]
if self._same_lines(viewer, loc.place(), _loc.place()):
return idx
return -1
def carousel_color(self, viewer, title):
"""
This performs the work of iterating across the available
colors (and the 'no-color' state.)
"""
loc = ida_moves.lochist_entry_t()
if ida_kernwin.get_custom_viewer_location(loc, viewer):
assigned = self.by_widget.get(title, [])
new_color = None
idx = self._find_loc_index(viewer, assigned, loc)
if idx > -1:
prev_color = assigned[idx][1]
prev_color_idx = self.AVAILABLE_COLORS.index(prev_color)
new_color = None \
if prev_color_idx >= (len(self.AVAILABLE_COLORS) - 1) \
else self.AVAILABLE_COLORS[prev_color_idx + 1]
else:
new_color = self.AVAILABLE_COLORS[0]
if idx > -1:
del assigned[idx]
if new_color is not None:
assigned.append((loc, new_color))
if assigned:
self.by_widget[title] = assigned
else:
if title in self.by_widget:
del self.by_widget[title]
class carousel_color_ah_t():
"""
The action that will be invoked by IDA when the user
activates its shortcut.
"""
def __init__(self, hooks):
self.hooks = hooks
def activate(self, ctx):
v = ida_kernwin.get_current_viewer()
if v:
self.hooks.carousel_color(v, ctx.widget_title)
return 1 # will cause the widget to redraw
def update(self, ctx):
return ida_kernwin.AST_ENABLE_FOR_WIDGET \
if ida_kernwin.get_current_viewer() \
else ida_kernwin.AST_DISABLE_FOR_WIDGET
ACTION_NAME = "example:colorize_disassembly_on_the_fly"
ACTION_LABEL = "Pick line color"
ACTION_SHORTCUT = "!"
ACTION_HELP = "Press %s to carousel around available colors (or remove a previously-set color)" % ACTION_SHORTCUT
otf_coloring = on_the_fly_coloring_hooks_t()
if ida_kernwin.register_action(ida_kernwin.action_desc_t(
ACTION_NAME,
ACTION_LABEL,
carousel_color_ah_t(otf_coloring),
ACTION_SHORTCUT)):
print("Registered action \"%s\". %s" % (ACTION_LABEL, ACTION_HELP))
otf_coloring.hook()
@@ -4,6 +4,8 @@ summary: programmatically create & populate a structure
description:
Usage of the API to create & populate a structure with
members of different types.
author: Gergely Erdelyi (gergely.erdelyi@d-dome.net)
"""
from __future__ import print_function
@@ -12,8 +14,6 @@ from __future__ import print_function
#
# This script demonstrates how to create structures and populate them
# with members of different types.
#
# Author: Gergely Erdelyi <gergely.erdelyi@d-dome.net>
#---------------------------------------------------------------------
import ida_struct
+26 -9
View File
@@ -14,7 +14,6 @@ from __future__ import print_function
import ida_lines
import ida_kernwin
# -----------------------------------------------------------------------
class dump_at_point_handler_t(ida_kernwin.action_handler_t):
def __init__(self, anchor):
@@ -41,25 +40,43 @@ class dump_at_point_handler_t(ida_kernwin.action_handler_t):
return "dump_extra_comments:%s" % v
# --------------------------------------------------------
# action variants
class action_previous_handler_t(dump_at_point_handler_t):
ACTION_LABEL = "previous"
ACTION_SHORTCUT = "Ctrl+Shift+Y"
def __init__(self):
super(action_previous_handler_t, self).__init__(ida_lines.E_PREV)
class action_next_handler_t(dump_at_point_handler_t):
ACTION_LABEL = "next"
ACTION_SHORTCUT = "Ctrl+Shift+Z"
def __init__(self):
super(action_next_handler_t, self).__init__(ida_lines.E_NEXT)
# -----------------------------------------------------------------------
# create actions (and attach them to IDA View-A's context menu if possible)
widget_title = "IDA View-A"
ida_view = ida_kernwin.find_widget(widget_title)
actions_variants = [
("previous", ida_lines.E_PREV, "Ctrl+Shift+Y"),
("next", ida_lines.E_NEXT, "Ctrl+Shift+Z"),
action_variants = [
action_previous_handler_t,
action_next_handler_t,
]
for label, anchor, shortcut in actions_variants:
actname = dump_at_point_handler_t.compose_action_name(label)
for variant in action_variants:
actname = dump_at_point_handler_t.compose_action_name(variant.ACTION_LABEL)
if ida_kernwin.unregister_action(actname):
print("Unregistered previously-registered action \"%s\"" % actname)
desc = ida_kernwin.action_desc_t(
actname,
"Dump %s extra comments" % label,
dump_at_point_handler_t(anchor),
shortcut)
"Dump %s extra comments" % variant.ACTION_LABEL,
variant(),
variant.ACTION_SHORTCUT)
if ida_kernwin.register_action(desc):
print("Registered action \"%s\"" % actname)
+102
View File
@@ -0,0 +1,102 @@
"""
summary: showcases (a few of) the iterators available on a function
description:
This demonstrates how to use some of the iterators available on the func_t type.
This example will focus on:
* `func_t[.__iter__]`: the default iterator; iterates on instructions
* `func_t.data_items`: iterate on data items contained within a function
* `func_t.head_items`: iterate on 'heads' (i.e., addresses containing
the start of an instruction, or a data item.
* `func_t.addresses`: iterate on all addresses within function (code
and data, beginning of an item or not)
Type `help(ida_funcs.func_t)` for a full list of iterators.
In addition, one can use:
* `func_tail_iterator_t`: iterate on all the chunks (including
the main one) of the function
* `func_parent_iterator_t`: iterate on all the parent functions,
that include this chunk
keywords: funcs iterator
"""
import ida_bytes
import ida_kernwin
import ida_funcs
import ida_ua
class logger_t(object):
class section_t(object):
def __init__(self, logger, header):
self.logger = logger
self.logger.log(header)
def __enter__(self):
self.logger.indent += 2
return self
def __exit__(self, tp, value, traceback):
self.logger.indent -= 2
if value:
return False # Re-raise
def __init__(self):
self.indent = 0
def log(self, *args):
print(" " * self.indent + "".join(args))
def log_ea(self, ea):
F = ida_bytes.get_flags(ea)
parts = ["0x%08x" % ea, ": "]
if ida_bytes.is_code(F):
parts.append("instruction (%s)" % ida_ua.print_insn_mnem(ea))
if ida_bytes.is_data(F):
parts.append("data")
if ida_bytes.is_tail(F):
parts.append("tail")
if ida_bytes.is_unknown(F):
parts.append("unknown")
if ida_funcs.get_func(ea) != ida_funcs.get_fchunk(ea):
parts.append(" (in function chunk)")
self.log(*parts)
def main():
# Get current ea
ea = ida_kernwin.get_screen_ea()
pfn = ida_funcs.get_func(ea)
if pfn is None:
print("No function defined at 0x%x" % ea)
return
func_name = ida_funcs.get_func_name(pfn.start_ea)
logger = logger_t()
logger.log("Function %s at 0x%x" % (func_name, ea))
with logger_t.section_t(logger, "Code items:"):
for item in pfn:
logger.log_ea(item)
with logger_t.section_t(logger, "'head' items:"):
for item in pfn.head_items():
logger.log_ea(item)
with logger_t.section_t(logger, "Addresses:"):
for item in pfn.addresses():
logger.log_ea(item)
with logger_t.section_t(logger, "Function chunks:"):
for chunk in ida_funcs.func_tail_iterator_t(pfn):
logger.log("%s chunk: 0x%08x..0x%08x" % (
"Main" if chunk.start_ea == pfn.start_ea else "Tail",
chunk.start_ea,
chunk.end_ea))
if __name__ == '__main__':
main()
+2 -4
View File
@@ -46,11 +46,9 @@ def main():
funcea = func.start_ea
print("Function %s at 0x%x" % (ida_funcs.get_func_name(funcea), funcea))
ref = ida_xref.get_first_cref_to(funcea)
while ref != ida_idaapi.BADADDR:
xb = ida_xref.xrefblk_t()
for ref in xb.crefs_to(funcea):
print(" called from %s(0x%x)" % (ida_funcs.get_func_name(ref), ref))
ref = ida_xref.get_next_cref_to(funcea, ref)
func = ida_funcs.get_next_func(funcea)
+1 -5
View File
@@ -33,10 +33,7 @@ class list_stkvar_xrefs_ah_t(ida_kernwin.action_handler_t):
sptr = ida_struct.get_struc(frame.id)
mptr = ida_struct.get_member_by_name(sptr, stkvar_name)
if mptr:
fii = ida_funcs.func_item_iterator_t()
ok = fii.set(pfn)
while ok:
ea = fii.current()
for ea in pfn:
F = ida_bytes.get_flags(ea)
for n in range(ida_ida.UA_MAXOP):
if not ida_bytes.is_stkvar(F, n):
@@ -47,7 +44,6 @@ class list_stkvar_xrefs_ah_t(ida_kernwin.action_handler_t):
v = ida_frame.calc_stkvar_struc_offset(pfn, insn, n)
if v >= mptr.soff and v < mptr.eoff:
print("Found xref at 0x%08x, operand #%d" % (ea, n))
ok = fii.next_code()
else:
print("No stack variable named \"%s\"" % stkvar_name)
else:
@@ -0,0 +1,59 @@
"""
summary: print call stack (on Linux)
description: print the return addresses from the call stack at a breakpoint.
(and print also the module and the debug name from debugger)
To use this example:
* run `ida64` on test program `simple_appcall_linux64`, or
`ida` on test program `simple_appcall_linux32`, and wait for
auto-analysis to finish
* put a breakpoint where you want to see the call stack
* select the 'linux debugger' (either local, or remote)
* start debugging
* Press Shift+C at the breakpoint
"""
import os
import ida_idaapi
import ida_idd
import ida_dbg
import ida_kernwin
import ida_name
def log(msg):
print(">>> %s" % msg)
class print_call_stack_ah_t():
def activate(self, ctx):
log("=== start of call stack impression ===")
tid = ida_dbg.get_current_thread()
trace = ida_idd.call_stack_t()
if ida_dbg.collect_stack_trace(tid, trace):
for frame in trace:
mi = ida_idd.modinfo_t()
if ida_dbg.get_module_info(frame.callea, mi):
module = os.path.basename(mi.name)
name = ida_name.get_nice_colored_name(
frame.callea,
ida_name.GNCN_NOCOLOR|ida_name.GNCN_NOLABEL|ida_name.GNCN_NOSEG|ida_name.GNCN_PREFDBG)
log("Return address: " + hex(frame.callea) + " from: " + module + " with debug name: " + name)
else:
log("Return address: " + hex(frame.callea))
log("=== end of call stack impression ===")
def update(self, ctx):
return ida_kernwin.AST_ENABLE_ALWAYS
ACTION_NAME = "example:print_call_stack"
ACTION_LABEL = "Print call stack"
ACTION_SHORTCUT = "Shift+C"
ACTION_HELP = "Press %s to dump the call stack" % ACTION_SHORTCUT
if ida_kernwin.register_action(ida_kernwin.action_desc_t(
ACTION_NAME,
ACTION_LABEL,
print_call_stack_ah_t(),
ACTION_SHORTCUT)):
print("Registered action \"%s\". %s" % (ACTION_LABEL, ACTION_HELP))
+90
View File
@@ -0,0 +1,90 @@
"""
summary: a focus on the 'curpos' hook, printing additional details about user input
description:
Shows how user input information can be retrieved during
processing of a notification triggered by that input
see_also: vds_hooks
"""
import ida_hexrays
import ida_kernwin
class curpos_details_t(ida_hexrays.Hexrays_Hooks):
def curpos(self, v):
parts = ["cpos={lnnum=%d, x=%d, y=%d}" % (v.cpos.lnnum, v.cpos.x, v.cpos.y)]
uie = ida_kernwin.input_event_t()
if ida_kernwin.get_user_input_event(uie):
kind_str = {
ida_kernwin.iek_shortcut : "shortcut",
ida_kernwin.iek_key_press : "key_press",
ida_kernwin.iek_key_release : "key_release",
ida_kernwin.iek_mouse_button_press : "mouse_button_press",
ida_kernwin.iek_mouse_button_release : "mouse_button_release",
ida_kernwin.iek_mouse_wheel : "mouse_wheel",
}[uie.kind]
#
# Retrieve input kind-specific information
#
if uie.kind == ida_kernwin.iek_shortcut:
payload_str = "shortcut={action_name=%s}" % uie.shortcut.action_name
elif uie.kind in [
ida_kernwin.iek_key_press,
ida_kernwin.iek_key_release]:
payload_str = "keyboard={key=%d, text=%s}" % (uie.keyboard.key, uie.keyboard.text)
else:
payload_str = "mouse={x=%d, y=%d, button=%d}" % (
uie.mouse.x,
uie.mouse.y,
uie.mouse.button)
#
# And while at it, retrieve a few extra bits from the
# source QEvent as well, why not
#
qevent = uie.get_source_QEvent()
qevent_str = str(qevent)
from PyQt5 import QtCore
if qevent.type() in [
QtCore.QEvent.KeyPress,
QtCore.QEvent.KeyRelease]:
qevent_str="{count=%d}" % qevent.count()
elif qevent.type() in [
QtCore.QEvent.MouseButtonPress,
QtCore.QEvent.MouseButtonRelease]:
qevent_str="{globalX=%d, globalY=%d, flags=%s}" % (
qevent.globalX(),
qevent.globalY(),
qevent.flags())
elif qevent.type() == QtCore.QEvent.Wheel:
qevent_str="{angleDelta={x=%s, y=%s}, phase=%s}" % (
qevent.angleDelta().x(),
qevent.angleDelta().y(),
qevent.phase())
#
# If the target QWidget is a scroll area's viewport,
# pick up the parent
#
from PyQt5 import QtWidgets
qwidget = uie.get_target_QWidget()
if qwidget:
parent = qwidget.parentWidget()
if parent and isinstance(parent, QtWidgets.QAbstractScrollArea):
qwidget = parent
parts.append("user_input_event={kind=%s, modifiers=0x%x, target={metaObject={className=%s}, windowTitle=%s}, source=%s, %s, source-as-qevent=%s}" % (
kind_str,
uie.modifiers,
qwidget.metaObject().className(),
qwidget.windowTitle(),
uie.source,
payload_str,
qevent_str))
print("### curpos: %s" % ", ".join(parts))
return 0
curpos_details = curpos_details_t()
curpos_details.hook()
+22 -11
View File
@@ -30,35 +30,46 @@ import ida_kernwin
import ida_typeinf
import ida_hexrays
testing = False # only for testing purposes
class callinfo_provider_t(ida_hexrays.Hexrays_Hooks):
# this callback will be called for all call instructions
# our plugin may provide the function prototype or even a complete new callinfo
# object. The callinfo object may be useful if the prototype is not enough
# to express all details of the call.
def build_callinfo(self, blk, type, callinfo):
def build_callinfo(self, blk, type):
# it is a good idea to skip direct calls.
# note that some indirect calls may be resolved and become direct calls,
# and will be filtered out here:
ida_kernwin.msg("%x: got called for: %s\n" % (blk.tail.ea, blk.tail.dstr()))
tail = blk.tail
if tail.opcode == ida_hexrays.m_call:
return 0
return
# also, if the type was specified by the user, do not interfere
call_ea = tail.ea
tif = ida_typeinf.tinfo_t()
if ida_nalt.get_op_tinfo(tif, call_ea, 0):
return 0
return
# ok, the decompiler really has to guess the type.
# just for the sake of an example, return a predefined prototype.
# in real life you will provide the prototype you discovered yourself,
# using your magic of yours :)
my_proto = "int f();"
ida_kernwin.msg("%x: providing prototype %s\n" % (call_ea, my_proto))
ida_typeinf.parse_decl(type, None, my_proto, 0)
return 0
global testing
if not testing:
# ok, the decompiler really has to guess the type.
# just for the sake of an example, return a predefined prototype.
# in real life you will provide the prototype you discovered yourself,
# using your magic of yours :)
my_proto = "int f();"
ida_kernwin.msg("%x: providing prototype %s\n" % (call_ea, my_proto))
ida_typeinf.parse_decl(type, None, my_proto, 0)
else:
# as an alternative to filling 'type', you can
# choose to return a mcallinfo_t instance.
mi = ida_hexrays.mcallinfo_t()
mi.cc = ida_typeinf.CM_CC_STDCALL | ida_typeinf.CM_N32_F48 # let's use stdcall to differentiate from the tinfo_t-filling version
mi.return_type = ida_typeinf.tinfo_t(ida_typeinf.BT_INT)
mi.return_argloc.set_reg1(0) # eax
return mi
# a plugin interface, boilerplate code
class my_plugin_t(ida_idaapi.plugin_t):
+16 -1
View File
@@ -30,7 +30,7 @@ description:
The modifications are persistent: the user can quit & restart
IDA, and the changes will be present.
author: EiNSTeiN_ <einstein@g3nius.org>
author: EiNSTeiN_ (einstein@g3nius.org)
"""
from __future__ import print_function
@@ -41,6 +41,7 @@ import ida_kernwin
import ida_hexrays
import ida_netnode
import ida_idaapi
import ida_idp
import traceback
@@ -215,6 +216,17 @@ class vds3_hooks_t(ida_hexrays.Hexrays_Hooks):
self.i.restore(cfunc)
return 0
class idp_hooks_t(ida_idp.IDP_Hooks):
def __init__(self, i):
ida_idp.IDP_Hooks.__init__(self)
self.i = i
# 'node' refers to index of the named node, this index became invalid after
# privrange moving, so we recreate the node here to update nodeidx
def ev_privrange_changed(self, old_privrange, delta):
i.node.create(NETNODE_NAME)
# a plugin interface, boilerplate code
class my_plugin_t(ida_idaapi.plugin_t):
flags = ida_idaapi.PLUGIN_HIDE
@@ -233,6 +245,9 @@ class my_plugin_t(ida_idaapi.plugin_t):
"I"))
self.vds3_hooks = vds3_hooks_t(i)
self.vds3_hooks.hook()
# we need this hook to react to privrange moving event
self.idp_hooks = idp_hooks_t(i)
self.idp_hooks.hook()
return ida_idaapi.PLUGIN_KEEP # keep us in the memory
def term(self):
self.vds3_hooks.unhook()
+14 -12
View File
@@ -10,7 +10,9 @@ description:
* user defined number formats
* user defined local variable names, types, comments
author: EiNSTeiN_ <einstein@g3nius.org>
This script loads information from the database without decompiling anything.
author: EiNSTeiN_ (einstein@g3nius.org)
"""
from __future__ import print_function
@@ -20,19 +22,17 @@ import ida_hexrays
import ida_bytes
def run():
cfunc = ida_hexrays.decompile(ida_kernwin.get_screen_ea())
if not cfunc:
print('Please move the cursor into a function.')
return
entry_ea = cfunc.entry_ea
print("Dump of user-defined information for function at %x" % (entry_ea, ))
f = ida_funcs.get_func(ida_kernwin.get_screen_ea());
if f is None:
print("Please position the cursor within a function")
return True
entry_ea = f.start_ea
print("Dump of user-defined information for function at %x" % entry_ea)
# Display user defined labels.
labels = ida_hexrays.restore_user_labels(entry_ea);
if labels is not None:
print("------- %u user defined labels" % (len(labels), ))
print("------- %u user defined labels" % len(labels))
for org_label, name in labels.items():
print("Label %d: %s" % (org_label, str(name)))
ida_hexrays.user_labels_free(labels)
@@ -58,8 +58,10 @@ def run():
if numforms is not None:
print("------- %u user defined number formats" % (len(numforms), ))
for ol, nf in numforms.items():
print("Number format at %a, operand %d: %s" % (ol.ea, ol.opnum, "negated " if (nf.props & NF_NEGATE) != 0 else ""))
print("Number format at %a, operand %d: %s" % \
(ol.ea,
ol.opnum,
"negated " if (ord(nf.props) & ida_hexrays.NF_NEGATE) != 0 else ""))
if nf.is_enum():
print("enum %s (serial %d)" % (str(nf.type_name), nf.serial))
+1 -1
View File
@@ -5,7 +5,7 @@ description:
Using a `ida_hexrays.ctree_visitor_t`, search for
`ida_hexrays.cit_block` instances and dump them.
author: EiNSTeiN_ <einstein@g3nius.org>
author: EiNSTeiN_ (einstein@g3nius.org)
"""
from __future__ import print_function
+76 -44
View File
@@ -7,21 +7,27 @@ description:
This plugin doesn't really accomplish anything: it just prints
the parameters.
Also, the list of notifications handled below, isn't exhaustive.
Please investigate `ida_hexrays.Hexrays_Hooks` for a full list.
The list of notifications handled below should be exhaustive,
and is there to hint at what is possible to accomplish by
subclassing `ida_hexrays.Hexrays_Hooks`
see_also: curpos_details
"""
from __future__ import print_function
import inspect
import ida_idaapi
import ida_typeinf
import ida_hexrays
class vds_hooks_t(ida_hexrays.Hexrays_Hooks):
def _shorten(self, cfunc):
raw = str(cfunc)
if len(raw) > 20:
raw = raw[0:20] + "[...snipped...]"
return raw
def __init__(self):
ida_hexrays.Hexrays_Hooks.__init__(self)
self.display_shortened_cfuncs = False
self.display_vdui_curpos = False
self.inhibit_log = 0;
def _format_lvar(self, v):
parts = []
@@ -35,106 +41,132 @@ class vds_hooks_t(ida_hexrays.Hexrays_Hooks):
parts.append("divisor=%s" % v.divisor)
return "{%s}" % ", ".join(parts)
def _log(self, msg):
print("### %s" % msg)
def _format_vdui_curpos(self, v):
return "cpos={lnnum=%d, x=%d, y=%d}" % (v.cpos.lnnum, v.cpos.x, v.cpos.y)
def _format_value(self, v):
if isinstance(v, ida_hexrays.lvar_t):
v = self._format_lvar(v)
elif isinstance(v, ida_hexrays.cfunc_t):
if self.display_shortened_cfuncs:
self.inhibit_log += 1
v = str(v)
if len(v) > 20:
v = v[0:20] + "[...snipped...]"
self.inhibit_log -= 1
else:
v = "<cfunc>" # cannot print contents: we'll end up being called recursively
elif isinstance(v, ida_hexrays.vdui_t) and self.display_vdui_curpos:
v = str(v) + " " + self._format_vdui_curpos(v)
return str(v)
def _log(self):
if self.inhibit_log <= 0:
stack = inspect.stack()
frame, _, _, _, _, _ = stack[1]
args, _, _, values = inspect.getargvalues(frame)
method_name = inspect.getframeinfo(frame)[2]
argstrs = []
for arg in args[1:]:
argstrs.append("%s=%s" % (arg, self._format_value(values[arg])))
print("### %s: %s" % (method_name, ", ".join(argstrs)))
return 0
def flowchart(self, fc):
return self._log("flowchart: fc=%s" % fc)
return self._log()
def stkpnts(self, mba, stkpnts):
return self._log("stkpnts: mba=%s, stkpnts=%s" % (mba, stkpnts))
return self._log()
def prolog(self, mba, fc, reachable_blocks, decomp_flags):
return self._log("prolog: mba=%s, fc=%s, reachable_blocks=%s, decomp_flags=%x" % (mba, fc, reachable_blocks, decomp_flags))
return self._log()
def microcode(self, mba):
return self._log("microcode: mba=%s" % (mba,))
return self._log()
def preoptimized(self, mba):
return self._log("preoptimized: mba=%s" % (mba,))
return self._log()
def locopt(self, mba):
return self._log("locopt: mba=%s" % (mba,))
return self._log()
def prealloc(self, mba):
return self._log("prealloc: mba=%s" % (mba,))
return self._log()
def glbopt(self, mba):
return self._log("glbopt: mba=%s" % (mba,))
return self._log()
def structural(self, ctrl_graph):
return self._log("structural: ctrl_graph: %s" % (ctrl_graph,))
return self._log()
def maturity(self, cfunc, maturity):
return self._log("maturity: cfunc=%s, maturity=%s" % (self._shorten(cfunc), maturity))
return self._log()
def interr(self, code):
return self._log("interr: code=%s" % (code,))
return self._log()
def combine(self, blk, insn):
return self._log("combine: blk=%s, insn=%s" % (blk, insn))
return self._log()
def print_func(self, cfunc, printer):
# Note: we can't print/str()-ify 'cfunc' here,
# because that'll call print_func() us recursively.
return self._log("print_func: cfunc=..., printer=%s" % (printer,))
return self._log()
def func_printed(self, cfunc):
return self._log("func_printed: cfunc=%s" % (cfunc,))
return self._log()
def resolve_stkaddrs(self, mba):
return self._log("resolve_stkaddrs: mba=%s" % (mba,))
return self._log()
def open_pseudocode(self, vu):
return self._log("open_pseudocode: vu=%s" % (vu,))
return self._log()
def switch_pseudocode(self, vu):
return self._log("switch_pseudocode: vu=%s" % (vu,))
return self._log()
def refresh_pseudocode(self, vu):
return self._log("refresh_pseudocode: vu=%s" % (vu,))
return self._log()
def close_pseudocode(self, vu):
return self._log("close_pseudocode: vu=%s" % (vu,))
return self._log()
def keyboard(self, vu, key_code, shift_state):
return self._log("keyboard: vu=%s, key_code=%s, shift_state=%s" % (vu, key_code, shift_state))
return self._log()
def right_click(self, vu):
return self._log("right_click: vu=%s" % (vu,))
return self._log()
def double_click(self, vu, shift_state):
return self._log("double_click: vu=%s, shift_state=%s" % (vu, shift_state))
return self._log()
def curpos(self, vu):
return self._log("curpos: vu=%s (vu.cpos.lnnum=%d, vu.cpos.x=%d, vu.cpos.y=%d)" % (
vu, vu.cpos.lnnum, vu.cpos.x, vu.cpos.y))
return self._log()
def create_hint(self, vu):
return self._log("create_hint: vu=%s: " % (vu,))
return self._log()
def text_ready(self, vu):
return self._log("text_ready: vu=%s" % (vu,))
return self._log()
def populating_popup(self, widget, popup, vu):
return self._log("populating_popup: widget=%s, popup=%s, vu=%s" % (widget, popup, vu))
return self._log()
def lvar_name_changed(self, vu, v, name, is_user_name):
return self._log("lvar_name_changed: vu=%s, v=%s, name=%s, is_user_name=%s" % (vu, self._format_lvar(v), name, is_user_name))
return self._log()
def lvar_type_changed(self, vu, v, tif):
return self._log("lvar_type_changed: vu=%s, v=%s, tinfo=%s" % (vu, self._format_lvar(v), tif._print()))
return self._log()
def lvar_cmt_changed(self, vu, v, cmt):
return self._log("lvar_cmt_changed: vu=%s, v=%s, cmt=%s" % (vu, self._format_lvar(v), cmt))
return self._log()
def lvar_mapping_changed(self, vu, _from, to):
return self._log("lvar_mapping_changed: vu=%s, from=%s, to=%s" % (vu, _from, to))
return self._log()
def cmt_changed(self, cfunc, loc, cmt):
return self._log("cmt_changed: cfunc=%s, loc=%s, cmt=%s" % (self._shorten(cfunc),loc, cmt))
return self._log()
def build_callinfo(self, *args):
return self._log()
vds_hooks = vds_hooks_t()
vds_hooks.hook()
+1 -1
View File
@@ -8,7 +8,7 @@ description:
* supports any global name: functions, strings, integers, ...
* supports structure member.
author: EiNSTeiN_ <einstein@g3nius.org>
author: EiNSTeiN_ (einstein@g3nius.org)
"""
from __future__ import print_function
+357
View File
@@ -0,0 +1,357 @@
"""
summary: logging IDB events
description:
these hooks will be notified about IDB events, and
dump their information to the "Output" window
"""
import inspect
import ida_idp
class idb_logger_hooks_t(ida_idp.IDB_Hooks):
def __init__(self):
ida_idp.IDB_Hooks.__init__(self)
self.inhibit_log = 0;
def _format_value(self, v):
return str(v)
def _log(self, msg=None):
if self.inhibit_log <= 0:
if msg:
print(">>> idb_logger_hooks_t: %s" % msg)
else:
stack = inspect.stack()
frame, _, _, _, _, _ = stack[1]
args, _, _, values = inspect.getargvalues(frame)
method_name = inspect.getframeinfo(frame)[2]
argstrs = []
for arg in args[1:]:
argstrs.append("%s=%s" % (arg, self._format_value(values[arg])))
print(">>> idb_logger_hooks_t.%s: %s" % (method_name, ", ".join(argstrs)))
return 0
def adding_segm(self, segment):
return self._log()
def allsegs_moved(self, info):
return self._log()
def auto_empty(self):
return self._log()
def auto_empty_finally(self):
return self._log()
def bookmark_changed(self, index, pos, desc, op):
return self._log()
def byte_patched(self, ea, old_value):
return self._log()
def callee_addr_changed(self, ea, callee):
return self._log()
def changing_cmt(self, ea, is_repeatable, new_comment):
return self._log()
def changing_enum_bf(self, tid, new_bf):
return self._log()
def changing_enum_cmt(self, tid, is_repeatable, new_comment):
return self._log()
def changing_op_ti(self, ea, n, new_type, new_fnames):
return self._log()
def changing_op_type(self, ea, n, opinfo):
return self._log()
def changing_range_cmt(self, kind, _range, comment, is_repeatable):
return self._log()
def changing_segm_class(self, segment):
return self._log()
def changing_segm_end(self, segment, new_end, flags):
return self._log()
def changing_segm_name(self, segment, old_name):
return self._log()
def changing_segm_start(self, segment, new_start, flags):
return self._log()
def changing_struc_align(self, sptr):
return self._log()
def changing_struc_cmt(self, tid, is_repeatable, comment):
return self._log()
def changing_struc_member(self, sptr, mptr, flags, ti, nbytes):
return self._log()
def changing_ti(self, ea, new_type, new_fnames):
return self._log()
def closebase(self):
return self._log()
def cmt_changed(self, ea, is_repeatable):
return self._log()
def compiler_changed(self, may_adjust_inf_fields):
return self._log()
def deleting_enum(self, tid):
return self._log()
def deleting_enum_member(self, tid, cid):
return self._log()
def deleting_func(self, pfn):
return self._log()
def deleting_func_tail(self, pfn, tail):
return self._log()
def deleting_segm(self, start_ea):
return self._log()
def deleting_struc(self, sptr):
return self._log()
def deleting_struc_member(self, sptr, mptr):
return self._log()
def deleting_tryblks(self, _range):
return self._log()
def destroyed_items(self, ea1, ea2, will_disable_range):
return self._log()
def determined_main(self, main):
return self._log()
def dirtree_link(self, dt, path, is_link):
return self._log()
def dirtree_mkdir(self, dt, path):
return self._log()
def dirtree_move(self, dt, _from, to):
return self._log()
def dirtree_rank(self, dt, path, rank):
return self._log()
def dirtree_rmdir(self, dt, path):
return self._log()
def dirtree_rminode(self, dt, inode):
return self._log()
def dirtree_segm_moved(self, dt):
return self._log()
def enum_bf_changed(self, tid):
return self._log()
def enum_cmt_changed(self, tid, is_repeatable):
return self._log()
def enum_created(self, tid):
return self._log()
def enum_deleted(self, tid):
return self._log()
def enum_member_created(self, tid, cid):
return self._log()
def enum_member_deleted(self, tid, cid):
return self._log()
def enum_renamed(self, tid):
return self._log()
def expanding_struc(self, sptr, offset, delta):
return self._log()
def extlang_changed(self, kind, el, idx):
return self._log()
def extra_cmt_changed(self, ea, line_idx, comment):
return self._log()
def flow_chart_created(self, fc):
return self._log()
def frame_deleted(self, pfn):
return self._log()
def func_added(self, pfn):
return self._log()
def func_deleted(self, func_ea):
return self._log()
def func_noret_changed(self, pfn):
return self._log()
def func_tail_appended(self, pfn, tail):
return self._log()
def func_tail_deleted(self, pfn, tail_ea):
return self._log()
def func_updated(self, pfn):
return self._log()
def idasgn_loaded(self, sig_name):
return self._log()
def item_color_changed(self, ea, color):
return self._log()
def kernel_config_loaded(self, pass_number):
return self._log()
def loader_finished(self, li, neflags, filetypename):
return self._log()
def local_types_changed(self):
return self._log()
def make_code(self, insn):
return self._log()
def make_data(self, ea, flags, tid, _len):
return self._log()
def op_ti_changed(self, ea, n, _type, fnames):
return self._log()
def op_type_changed(self, ea, n):
return self._log()
def range_cmt_changed(self, kind, _range, comment, is_repeatable):
return self._log()
def renamed(self, ea, new_name, is_local_name, old_name):
return self._log()
def renaming_enum(self, tid, is_enum, new_name):
return self._log()
def renaming_struc(self, tid, old_name, new_name):
return self._log()
def renaming_struc_member(self, sptr, mptr, new_name):
return self._log()
def savebase(self):
return self._log()
def segm_added(self, segment):
return self._log()
def segm_attrs_updated(self, segment):
return self._log()
def segm_class_changed(self, segment, sclass):
return self._log()
def segm_deleted(self, start_ea, end_ea, flags):
return self._log()
def segm_end_changed(self, segment, old_end):
return self._log()
def segm_moved(self, _from, to, size, changed_netmap):
return self._log()
def segm_name_changed(self, segment, name):
return self._log()
def segm_start_changed(self, segment, old_start):
return self._log()
def set_func_end(self, pfn, new_end):
return self._log()
def set_func_start(self, pfn, new_start):
return self._log()
def sgr_changed(self, start_ea, end_ea, regnum, value, old_value, tag):
return self._log()
def sgr_deleted(self, start_ea, end_ea, regnum):
return self._log()
def stkpnts_changed(self, pfn):
return self._log()
def struc_align_changed(self, sptr):
return self._log()
def struc_cmt_changed(self, tid, is_repeatable):
return self._log()
def struc_created(self, tid):
return self._log()
def struc_deleted(self, tid):
return self._log()
def struc_expanded(self, sptr):
return self._log()
def struc_member_changed(self, sptr, mptr):
return self._log()
def struc_member_created(self, sptr, mptr):
return self._log()
def struc_member_deleted(self, sptr, mid, offset):
return self._log()
def struc_member_renamed(self, sptr, mptr):
return self._log()
def struc_renamed(self, sptr):
return self._log()
def tail_owner_changed(self, tail, owner_func, old_owner):
return self._log()
def thunk_func_created(self, pfn):
return self._log()
def ti_changed(self, ea, _type, fnames):
return self._log()
def tryblks_updated(self, tbv):
return self._log()
def updating_tryblks(self, tbv):
return self._log()
def upgraded(self, _from):
return self._log()
def enum_width_changed(self, tid, width):
return self._log()
def enum_flag_changed(self, tid, flags):
return self._log()
def enum_ordinal_changed(self, tid, ordinal):
return self._log()
idb_hooks = idb_logger_hooks_t()
idb_hooks.hook()
@@ -4,7 +4,7 @@ summary: Record and replay changes in function prototypes
description:
This is a sample script, that will record (in memory) all changes in
functions prototypes, in order to re-apply them later.
.
To use this script:
- open an IDB (say, "test.idb")
- modify some functions prototypes (e.g., by triggering the 'Y'
@@ -12,7 +12,7 @@ description:
function)
- reload that IDB, *without saving it first*
- call rpc.replay(), to re-apply the modifications.
.
Note: 'ti_changed' is also called for changes to the function
frames, but we'll only record function prototypes changes.
"""
+1219 -704
View File
File diff suppressed because it is too large Load Diff
+9 -10
View File
@@ -1,18 +1,15 @@
function on_see_also(see_also)
{
if ( is_expanded() )
var idx = see_also.indexOf("#");
if ( idx > -1 )
see_also = see_also.substring(idx+1,see_also.length);
var entry = find_entry_el(document.getElementById('DIV_' + see_also));
if ( entry )
{
// likely it is, since I clicked on "see also";
// close it
expand_toggle(name_expanded);
set_entry_state(entry, true);
entry.scrollIntoView();
}
expand_toggle(see_also);
document.getElementById('IMG_' + see_also).scrollIntoView();
return true;
}
function find_parent_with_class(el, klass)
@@ -56,6 +53,8 @@ function handle_click(e)
set_entry_state(entry_el, false);
else if ( el.classList.contains("expander") )
set_entry_state(entry_el, true);
else if ( el.classList.contains("ex_link") ) // see also
on_see_also(el.href);
else
return;
e.stopPropagation();
+735 -304
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,5 +1,5 @@
"""
summary: injecting commands is the "Output" window
summary: injecting commands in the "Output" window
description:
This example illustrates how one can execute commands in the
+104 -2
View File
@@ -8,15 +8,33 @@ description:
from __future__ import print_function
import inspect
import ida_kernwin
class MyUiHook(ida_kernwin.UI_Hooks):
def __init__(self):
ida_kernwin.UI_Hooks.__init__(self)
self.cmdname = "<no command>"
self.inhibit_log = 0;
def _log(self, msg):
print(">>> MyUiHook: %s" % msg)
def _format_value(self, v):
return str(v)
def _log(self, msg=None):
if self.inhibit_log <= 0:
if msg:
print(">>> MyUiHook: %s" % msg)
else:
stack = inspect.stack()
frame, _, _, _, _, _ = stack[1]
args, _, _, values = inspect.getargvalues(frame)
method_name = inspect.getframeinfo(frame)[2]
argstrs = []
for arg in args[1:]:
argstrs.append("%s=%s" % (arg, self._format_value(values[arg])))
print(">>> MyUiHook.%s: %s" % (method_name, ", ".join(argstrs)))
return 0
def preprocess_action(self, name):
self._log("IDA preprocessing command: %s" % name)
@@ -75,6 +93,90 @@ class MyUiHook(ida_kernwin.UI_Hooks):
"""
self._log("finish_populating_widget_popup; title: %s" % (ctx.widget_title,))
def range(self):
self._log()
def idcstart(self):
self._log()
def idcstop(self):
self._log()
def suspend(self):
self._log()
def resume(self):
self._log()
def debugger_menu_change(self, enable):
self._log()
def widget_visible(self, widget):
self._log()
def widget_closing(self, widget):
self._log()
def widget_invisible(self, widget):
self._log()
def get_item_hint(self, ea, max_lines):
self._log()
def get_custom_viewer_hint(self, viewer, place):
self._log()
def database_inited(self, is_new_database, idc_script):
self._log()
def ready_to_run(self):
self._log()
def get_chooser_item_attrs(self, chooser, n, attrs):
self._log()
def updating_actions(self, ctx):
self._log()
def updated_actions(self):
self._log()
def plugin_loaded(self, plugin_info):
self._log()
def plugin_unloading(self, plugin_info):
self._log()
def current_widget_changed(self, widget, prev_widget):
self._log()
def screen_ea_changed(self, ea, prev_ea):
self._log()
def create_desktop_widget(self, title, cfg):
self._log()
def get_lines_rendering_info(self, out, widget, info):
self._log()
def get_widget_config(self, widget, cfg):
self._log()
def set_widget_config(self, widget, cfg):
self._log()
def initing_database(self):
self._log()
def destroying_procmod(self, procmod):
self._log()
def destroying_plugmod(self, plugmod, entry):
self._log()
def desktop_applied(self, name, from_idb, type):
self._log()
#---------------------------------------------------------------------
# Remove an existing hook on second run
@@ -137,8 +137,9 @@ def show_graph():
# Iterate through all function instructions and take only call instructions
result = []
tmp = ida_ua.insn_t()
for x in [x for x in idautils.FuncItems(f.start_ea) if (ida_ua.decode_insn(tmp, x) and ida_idp.is_call_insn(tmp))]:
for xref in idautils.XrefsFrom(x, ida_xref.XREF_FAR):
for x in [x for x in f if (ida_ua.decode_insn(tmp, x) and ida_idp.is_call_insn(tmp))]:
xb = ida_xref.xrefblk_t()
for xref in xb.refs_from(x, ida_xref.XREF_FAR):
if not xref.iscode: continue
t = ida_funcs.get_func_name(xref.to)
if not t:
@@ -37,14 +37,14 @@ class my_dirspec_t(ida_dirtree.dirspec_t):
args, _, _, values = inspect.getargvalues(frame)
print(">>> %s: args=%s" % (inspect.getframeinfo(frame)[2], [(i, values[i]) for i in args[1:]]))
def get_name(self, inode):
def get_name(self, inode, flags):
self.log_frame()
def find_inode(index, ordinal, _inode):
if inode == _inode:
return "inode #%d" % inode
return self.chooser._for_each_item(find_inode)
def get_inode(self, diridx, name):
def get_inode(self, dirpath, name):
self.log_frame()
if not name.startswith("inode #"):
return ida_dirtree.direntry_t.BADIDX
+7 -2
View File
@@ -42,12 +42,12 @@ bool ext_api_t::load(qstring *errbuf)
if ( lib_handle == nullptr )
return false;
#define BIND_SYMBOL(Name) \
#define BIND_SYMBOL_x(Name, fail) \
do \
{ \
* (FARPROC *) &Name ## _ptr = GetProcAddress( \
(HMODULE) lib_handle, TEXT(#Name)); \
if ( Name ## _ptr == nullptr ) \
if ( Name ## _ptr == nullptr && fail ) \
{ \
errbuf->sprnt("GetProcAddress(\"%s\") failed: %s", \
#Name, qstrerror(-1)); \
@@ -55,6 +55,9 @@ bool ext_api_t::load(qstring *errbuf)
} \
} while ( 0 )
#define BIND_SYMBOL(Name) BIND_SYMBOL_x(Name, true)
#define BIND_SYMBOL_WEAK(Name) BIND_SYMBOL_x(Name, false)
BIND_SYMBOL(PyEval_SetTrace);
BIND_SYMBOL(PyRun_SimpleStringFlags);
BIND_SYMBOL(PyRun_StringFlags);
@@ -66,6 +69,8 @@ bool ext_api_t::load(qstring *errbuf)
BIND_SYMBOL(PyFunction_New);
BIND_SYMBOL(PyFunction_GetCode);
BIND_SYMBOL(_PyLong_AsByteArray);
BIND_SYMBOL_WEAK(PyEval_ThreadsInitialized);
BIND_SYMBOL_WEAK(PyEval_InitThreads);
#undef BIND_SYMBOL
+5
View File
@@ -29,6 +29,9 @@ typedef PyObject *PyFunction_GetCode_t(PyObject *);
typedef int _PyLong_AsByteArray_t(PyObject *, unsigned char *, size_t, int, int);
typedef int PyEval_ThreadsInitialized_t(void);
typedef void PyEval_InitThreads_t(void);
struct ext_api_t
{
qstring lib_path;
@@ -46,6 +49,8 @@ struct ext_api_t
PyFunction_New_t *PyFunction_New_ptr;
PyFunction_GetCode_t *PyFunction_GetCode_ptr;
_PyLong_AsByteArray_t *_PyLong_AsByteArray_ptr;
PyEval_ThreadsInitialized_t *PyEval_ThreadsInitialized_ptr;
PyEval_InitThreads_t *PyEval_InitThreads_ptr;
ext_api_t() { memset(this, 0, sizeof(*this)); }
~ext_api_t() { clear(); }
+9 -4
View File
@@ -44,10 +44,10 @@ inline int IDAPyStr_Check(PyObject *obj)
inline bool IDAPyStr_AsUTF8(qstring *out, PyObject *obj)
{
PyObject *utf8 = PyUnicode_AsUTF8String(obj);
bool ok = utf8 != NULL;
bool ok = utf8 != nullptr;
if ( ok )
{
char *buffer = NULL;
char *buffer = nullptr;
Py_ssize_t length = 0;
ok = PyBytes_AsStringAndSize(utf8, &buffer, &length) >= 0;
if ( ok )
@@ -139,7 +139,7 @@ inline int IDAPyStr_Check(PyObject *obj)
inline bool IDAPyStr_AsUTF8(qstring *out, PyObject *obj)
{
char *buffer = NULL;
char *buffer = nullptr;
Py_ssize_t length = 0;
bool ok = PyString_AsStringAndSize(obj, &buffer, &length) >= 0;
if ( ok )
@@ -199,7 +199,7 @@ inline char *IDAPyBytes_AsString(PyObject *o)
inline bool IDAPyBytes_AsBytes(bytevec_t *out, PyObject *obj)
{
char *buffer = NULL;
char *buffer = nullptr;
Py_ssize_t length = 0;
bool ok = IDAPyBytes_AsMemAndSize(obj, &buffer, &length) >= 0;
if ( ok )
@@ -222,5 +222,10 @@ inline bool IDAPyBytes_as_qtype(qtype *out, PyObject *obj)
return ok;
}
inline PyObject *IDAPyStr_FromUTF8(const qstring &s)
{
return IDAPyStr_FromUTF8AndSize(s.c_str(), s.length());
}
#endif // IDAPY_HPP
+3 -3
View File
@@ -13,9 +13,6 @@ SCRIPT_TIMEOUT = 3
// 'idaapi' wrapper module?
AUTOIMPORT_COMPAT_IDAAPI = YES
// Should the plugin automatically load a 6.95 bw-compatibility layer?
AUTOIMPORT_COMPAT_IDA695 = NO
// Is IDAPython namespace-aware?
// If yes, then plugins, loaders & processor modules will each be loaded
// within their own namespace, preventing namespace pollution.
@@ -23,3 +20,6 @@ NAMESPACE_AWARE = YES
// Should results be printed by 'sys.displayhook'?
REPL_USE_SYS_DISPLAYHOOK = YES
// Should directories derived from $IDAUSR (e.g., ~/.idapro/python/3) be added to sys.path?
IDAPYTHON_IDAUSR_SYSPATH = YES
+118 -121
View File
@@ -78,12 +78,6 @@ idapython_plugin_t *ida_export get_plugin_instance()
return idapython_plugin_t::get_instance();
}
//-------------------------------------------------------------------------
bool ida_export is_api695_compat_enabled()
{
return get_plugin_instance()->config.autoimport_compat_ida695;
}
//-------------------------------------------------------------------------
// Allowing the user to interrupt a script is not entirely trivial.
// Imagine the following script, that is run in an IDB that uses
@@ -114,7 +108,7 @@ struct exec_entry_t
{
time_t etime;
exec_entry_t() { reset_start_time(); }
void reset_start_time() { etime = time(NULL); }
void reset_start_time() { etime = time(nullptr); }
};
DECLARE_TYPE_AS_MOVABLE(exec_entry_t);
typedef qvector<exec_entry_t> exec_entries_t;
@@ -217,7 +211,7 @@ void execution_t::reset_steps()
void execution_t::push()
{
if ( entries.empty() )
extapi.PyEval_SetTrace_ptr((Py_tracefunc) execution_t::on_trace, NULL); //lint !e611 cast between pointer to function type '' and pointer to object type 'void *'
extapi.PyEval_SetTrace_ptr((Py_tracefunc) execution_t::on_trace, nullptr); //lint !e611 cast between pointer to function type '' and pointer to object type 'void *'
entries.push_back();
LEXEC("push() (now: %d entries)\n", int(entries.size()));
}
@@ -234,14 +228,14 @@ void execution_t::pop()
//-------------------------------------------------------------------------
void execution_t::stop_tracking()
{
extapi.PyEval_SetTrace_ptr(NULL, NULL);
extapi.PyEval_SetTrace_ptr(nullptr, nullptr);
maybe_hide_wait_box();
}
//-------------------------------------------------------------------------
void execution_t::sync_to_present_time()
{
time_t now = time(NULL);
time_t now = time(nullptr);
LEXEC("execution_t (%p)::sync_to_present_time() now=%d\n", this, int(now));
for ( size_t i = 0, n = entries.size(); i < n; ++i )
entries[i].etime = now;
@@ -306,7 +300,7 @@ int execution_t::on_trace(PyObject *, PyFrameObject *, int, PyObject *)
return 0;
}
if ( get_active_modal_widget() != NULL )
if ( get_active_modal_widget() != nullptr )
{
LEXEC("on_trace()::a modal widget is active. Not showing our 'interrupt dialog'.\n");
@@ -328,7 +322,7 @@ int execution_t::on_trace(PyObject *, PyFrameObject *, int, PyObject *)
return 0;
}
time_t now = time(NULL);
time_t now = time(nullptr);
LEXEC("on_trace()::now: %d\n", int(now));
if ( execution.can_interrupt_current(now) )
{
@@ -340,7 +334,7 @@ int execution_t::on_trace(PyObject *, PyFrameObject *, int, PyObject *)
{
if ( user_clicked_cancel )
{
if ( PyErr_Occurred() == NULL )
if ( PyErr_Occurred() == nullptr )
{
LEXEC("on_trace()::INTERRUPTING (setting 'User interrupted' exception)\n");
PyErr_SetString(PyExc_KeyboardInterrupt, "User interrupted");
@@ -430,7 +424,7 @@ static void handle_python_error(
qstring *errbuf,
bool clear_error = true)
{
if ( errbuf != NULL )
if ( errbuf != nullptr )
errbuf->clear();
// No exception?
@@ -475,7 +469,7 @@ static const ext_idcfunc_t idc_runpythonstatement_desc =
S_IDC_EXEC_PYTHON,
idc_runpythonstatement,
idc_runpythonstatement_args,
NULL,
nullptr,
0,
0
};
@@ -500,7 +494,7 @@ static const ext_idcfunc_t idc_eval_python_desc =
S_IDC_EVAL_PYTHON,
idc_eval_python,
idc_eval_python_args,
NULL,
nullptr,
0,
0
};
@@ -512,7 +506,7 @@ static const cfgopt_t opts[] =
CFGOPT_B("ALERT_AUTO_SCRIPTS", idapython_plugin_config_t, alert_auto_scripts, true),
CFGOPT_B("REMOVE_CWD_SYS_PATH", idapython_plugin_config_t, remove_cwd_sys_path, true),
CFGOPT_B("AUTOIMPORT_COMPAT_IDAAPI", idapython_plugin_config_t, autoimport_compat_idaapi, true),
CFGOPT_B("AUTOIMPORT_COMPAT_IDA695", idapython_plugin_config_t, autoimport_compat_ida695, true),
CFGOPT_B("IDAPYTHON_IDAUSR_SYSPATH", idapython_plugin_config_t, idausr_syspath, true),
CFGOPT_B("NAMESPACE_AWARE", idapython_plugin_config_t, namespace_aware, true),
CFGOPT_B("REPL_USE_SYS_DISPLAYHOOK", idapython_plugin_config_t, repl_use_sys_displayhook, true),
};
@@ -525,21 +519,21 @@ static bool return_python_result(
const ref_t &py_result,
qstring *errbuf)
{
if ( errbuf != NULL )
if ( errbuf != nullptr )
errbuf->clear();
if ( py_result == NULL )
if ( py_result == nullptr )
{
handle_python_error(errbuf);
return false;
}
int cvt = CIP_OK;
if ( idc_result != NULL )
if ( idc_result != nullptr )
{
idc_result->clear();
cvt = pyvar_to_idcvar(py_result, idc_result);
if ( cvt < CIP_OK && errbuf != NULL )
if ( cvt < CIP_OK && errbuf != nullptr )
*errbuf = "ERROR: bad return value";
}
@@ -559,7 +553,7 @@ static bool parse_py_modname(
const char *defmod = S_IDA_IDAAPI_MODNAME)
{
const char *p = strrchr(full_name, '.');
if ( p == NULL )
if ( p == nullptr )
{
qstrncpy(modname, defmod, sz);
qstrncpy(attrname, full_name, sz);
@@ -569,7 +563,7 @@ static bool parse_py_modname(
qstrncpy(modname, full_name, p - full_name + 1);
qstrncpy(attrname, p + 1, sz);
}
return p != NULL;
return p != nullptr;
}
//-------------------------------------------------------------------------
@@ -584,8 +578,8 @@ static void wrap_in_function(qstring *out, const qstring &body, const char *name
char *ctx;
for ( char *p = qstrtok(buf.begin(), "\n", &ctx);
p != NULL;
p = qstrtok(NULL, "\n", &ctx) )
p != nullptr;
p = qstrtok(nullptr, "\n", &ctx) )
{
static const char FROM_FUTURE_IMPORT_STMT[] = "from __future__ import";
if ( strneq(p, FROM_FUTURE_IMPORT_STMT, sizeof(FROM_FUTURE_IMPORT_STMT)-1) )
@@ -668,7 +662,7 @@ idaman void ida_export enable_extlang_python(bool enable)
if ( enable )
select_extlang(&extlang_python);
else
select_extlang(NULL);
select_extlang(nullptr);
}
//-------------------------------------------------------------------------
@@ -680,8 +674,8 @@ static const cli_t cli_python =
"Python - IDAPython plugin",
"Enter any Python expression",
idapython_plugin_t::cli_execute_line,
NULL,
NULL,
nullptr,
nullptr,
idapython_plugin_t::cli_find_completions,
};
@@ -704,7 +698,7 @@ void convert_idc_args()
newref_t py_args(PyList_New(0));
idc_value_t *idc_args = find_idc_gvar(S_IDC_ARGS_VARNAME);
if ( idc_args != NULL )
if ( idc_args != nullptr )
{
idc_value_t attr;
char attr_name[20] = { "0" };
@@ -717,7 +711,7 @@ void convert_idc_args()
// Get reference to the IDC module (it is imported by init.py)
ref_t py_mod(PyW_TryImportModule(S_IDC_MODNAME));
if ( py_mod != NULL )
if ( py_mod != nullptr )
PyObject_SetAttrString(py_mod.o, S_IDC_ARGS_VARNAME, py_args.o);
}
@@ -854,7 +848,7 @@ AS_PRINTF(1, 2) static void lerror(const char *format, ...)
qvsnprintf(buf, sizeof(buf), format, va);
// use MB_SERVICE_NOTIFICATION to prevent UI message loop from running since ida.exe is mostly shut down at this point
// and can crash if messages get processed
MessageBox(NULL, buf, "IDA", MB_ICONERROR|MB_SERVICE_NOTIFICATION);
MessageBox(nullptr, buf, "IDA", MB_ICONERROR|MB_SERVICE_NOTIFICATION);
#else
qveprintf(format, va);
//qgetchar();
@@ -947,7 +941,7 @@ bool idapython_plugin_t::init()
char utf8_pyhomepath[MAXSTR];
qstrncpy(utf8_pyhomepath, extapi.lib_path.c_str(), sizeof(utf8_pyhomepath));
char *lastslash = strrchr(utf8_pyhomepath, '/');
if ( lastslash != NULL )
if ( lastslash != nullptr )
{
*lastslash = 0;
# ifdef PY3
@@ -997,9 +991,13 @@ bool idapython_plugin_t::init()
// remove current directory
_prepare_sys_path();
// Enable multi-threading support
if ( !PyEval_ThreadsInitialized() )
PyEval_InitThreads();
if ( extapi.PyEval_ThreadsInitialized_ptr != nullptr
&& extapi.PyEval_InitThreads_ptr != nullptr )
{
// Enable multi-threading support (before 3.9
if ( !extapi.PyEval_ThreadsInitialized_ptr() )
extapi.PyEval_InitThreads_ptr();
}
#ifdef Py_DEBUG
msg("HexraysPython: Python compiled with DEBUG enabled.\n");
@@ -1013,17 +1011,13 @@ bool idapython_plugin_t::init()
"IDAPYTHON_DYNLOAD_BASE = r\"%s\"\n"
"IDAPYTHON_DYNLOAD_RELPATH = \"ida_%" FMT_Z "\"\n"
"IDAPYTHON_COMPAT_AUTOIMPORT_MODULES = %s\n"
"IDAPYTHON_COMPAT_695_API = %s\n",
"IDAPYTHON_IDAUSR_SYSPATH = %s\n",
VER_MAJOR, VER_MINOR, VER_PATCH, VER_STATUS, VER_SERIAL,
config.remove_cwd_sys_path ? "True" : "False",
idadir(NULL),
idadir(nullptr),
sizeof(ea_t)*8,
config.autoimport_compat_idaapi ? "True" : "False",
#ifdef BC695
config.autoimport_compat_ida695 ? "True" : "False"
#else
"False"
#endif
config.idausr_syspath ? "True" : "False"
);
if ( extapi.PyRun_SimpleStringFlags_ptr(init_code.c_str(), nullptr) != 0 )
@@ -1093,17 +1087,17 @@ void idapython_plugin_t::parse_plugin_options()
{
// Get options from IDA
const char *options = get_plugin_options(S_IDAPYTHON);
if ( options == NULL || options[0] == '\0' )
if ( options == nullptr || options[0] == '\0' )
return;
qstring obuf(options);
char *ctx;
for ( char *p = qstrtok(obuf.begin(), ";", &ctx);
p != NULL;
p = qstrtok(NULL, ";", &ctx) )
p != nullptr;
p = qstrtok(nullptr, ";", &ctx) )
{
qstring opt(p);
char *sep = qstrchr(opt.begin(), '=');
bool ok = sep != NULL;
bool ok = sep != nullptr;
if ( ok )
{
*sep++ = '\0';
@@ -1127,15 +1121,15 @@ void idapython_plugin_t::parse_plugin_options()
"Valid values are: 'db_open', 'ui_ready' and 'init'",
when.c_str());
}
else if ( opt == "AUTOIMPORT_COMPAT_IDA695" )
else if ( opt == "IDAPYTHON_IDAUSR_SYSPATH" )
{
qstring imp(sep);
if ( imp == "YES" )
config.autoimport_compat_ida695 = true;
config.idausr_syspath = true;
else if ( imp == "NO" )
config.autoimport_compat_ida695 = false;
config.idausr_syspath = false;
else
warning("Unknown 'AUTOIMPORT_COMPAT_IDA695' directive: '%s'. "
warning("Unknown 'IDAPYTHON_IDAUSR_SYSPATH' directive: '%s'. "
" Expected 'YES' or 'NO'", imp.c_str());
}
else
@@ -1153,7 +1147,7 @@ ref_t idapython_plugin_t::get_sys_displayhook()
if ( config.repl_use_sys_displayhook )
{
ref_t py_sys(PyW_TryImportModule("sys"));
if ( py_sys != NULL )
if ( py_sys != nullptr )
h = PyW_TryGetAttrString(py_sys.o, "displayhook");
}
return h;
@@ -1325,7 +1319,7 @@ bool idapython_plugin_t::_extlang_compile_expr(
qstring qstr(expr);
PyObject *code = my_CompileString(insert_encoding_cookie(&qstr), "<string>", Py_eval_input);
if ( code == NULL )
if ( code == nullptr )
{
// try compiling as a list of statements
// wrap them into a function
@@ -1334,7 +1328,7 @@ bool idapython_plugin_t::_extlang_compile_expr(
wrap_in_function(&func, expr, name);
insert_encoding_cookie(&func);
code = my_CompileString(func.c_str(), "<string>", Py_file_input);
if ( code == NULL )
if ( code == nullptr )
{
handle_python_error(errbuf);
return false;
@@ -1345,7 +1339,7 @@ bool idapython_plugin_t::_extlang_compile_expr(
// Create a function out of code
PyObject *func = extapi.PyFunction_New_ptr(code, globals);
if ( func == NULL )
if ( func == nullptr )
{
ERR:
handle_python_error(errbuf);
@@ -1362,7 +1356,7 @@ ERR:
if ( isfunc )
{
idc_value_t result;
return _extlang_call_func(&result, name, NULL, 0, errbuf);
return _extlang_call_func(&result, name, nullptr, 0, errbuf);
}
return true;
@@ -1379,7 +1373,7 @@ bool idapython_plugin_t::_extlang_eval_expr(
{
PYW_GIL_GET;
PyObject *globals = _get_module_globals();
bool ok = globals != NULL;
bool ok = globals != nullptr;
ref_t result;
if ( ok )
{
@@ -1448,7 +1442,7 @@ bool idapython_plugin_t::_extlang_create_object(
// Get a reference to the module
ref_t py_mod(PyW_TryImportModule(modname));
if ( py_mod == NULL )
if ( py_mod == nullptr )
{
errbuf->sprnt("Could not import module '%s'!", modname);
break;
@@ -1458,7 +1452,7 @@ bool idapython_plugin_t::_extlang_create_object(
ref_t py_res;
if ( nargs == 1 && args[0].vtype == VT_PVOID )
py_res = try_create_swig_wrapper(py_mod, clsname, args[0].pvoid);
if ( py_res != NULL )
if ( py_res != nullptr )
{
#ifdef PY3
PyObject_SetAttrString(py_res.o, S_PY_IDCCVT_ID_ATTR, PyLong_FromLong(PY_ICID_OPAQUE));
@@ -1470,7 +1464,7 @@ bool idapython_plugin_t::_extlang_create_object(
{
// Get the class reference
ref_t py_cls(PyW_TryGetAttrString(py_mod.o, clsname));
if ( py_cls == NULL )
if ( py_cls == nullptr )
{
errbuf->sprnt("Could not find class type '%s'!", clsname);
break;
@@ -1482,7 +1476,7 @@ bool idapython_plugin_t::_extlang_create_object(
break;
// Call the constructor
py_res = newref_t(PyObject_CallObject(py_cls.o, pargs.empty() ? NULL : pargs[0].o));
py_res = newref_t(PyObject_CallObject(py_cls.o, pargs.empty() ? nullptr : pargs[0].o));
}
ok = return_python_result(result, py_res, errbuf);
} while ( false );
@@ -1499,7 +1493,7 @@ bool idapython_plugin_t::_extlang_eval_snippet(
PYW_GIL_GET;
PyObject *globals = _get_module_globals();
bool ok;
if ( globals == NULL )
if ( globals == nullptr )
{
ok = false;
}
@@ -1515,7 +1509,7 @@ bool idapython_plugin_t::_extlang_eval_snippet(
globals,
globals,
nullptr));
ok = result != NULL && !PyErr_Occurred();
ok = result != nullptr && !PyErr_Occurred();
if ( !ok )
handle_python_error(errbuf);
}
@@ -1541,7 +1535,7 @@ bool idapython_plugin_t::_extlang_call_func(
bool imported_module = parse_py_modname(name, modname, funcname, MAXSTR);
bool ok = true;
PyObject *module = NULL;
PyObject *module = nullptr;
ref_vec_t pargs;
do
{
@@ -1552,21 +1546,21 @@ bool idapython_plugin_t::_extlang_call_func(
const char *final_modname = imported_module ? modname : S_MAIN;
module = PyImport_ImportModule(final_modname);
if ( module == NULL )
if ( module == nullptr )
{
if ( errbuf != NULL )
if ( errbuf != nullptr )
errbuf->sprnt("couldn't import module %s", final_modname);
ok = false;
break;
}
PyObject *globals = PyModule_GetDict(module);
QASSERT(30157, globals != NULL);
QASSERT(30157, globals != nullptr);
PyObject *func = PyDict_GetItemString(globals, funcname);
if ( func == NULL )
if ( func == nullptr )
{
if ( errbuf != NULL )
if ( errbuf != nullptr )
errbuf->sprnt("undefined function %s", name);
ok = false;
break;
@@ -1578,17 +1572,17 @@ bool idapython_plugin_t::_extlang_call_func(
#ifdef PY3
newref_t py_res(PyEval_EvalCodeEx(
PYCODE_OBJECT_TO_PYEVAL_ARG(code.o),
globals, NULL,
globals, nullptr,
pargs_ptrs.begin(),
nargs,
NULL, 0, NULL, 0, NULL, NULL));
nullptr, 0, nullptr, 0, nullptr, nullptr));
#else
newref_t py_res(PyEval_EvalCodeEx(
PYCODE_OBJECT_TO_PYEVAL_ARG(code.o),
globals, NULL,
globals, nullptr,
pargs_ptrs.begin(),
nargs,
NULL, 0, NULL, 0, NULL));
nullptr, 0, nullptr, 0, nullptr));
#endif
ok = return_python_result(result, py_res, errbuf);
} while ( false );
@@ -1602,7 +1596,7 @@ bool idapython_plugin_t::_extlang_call_func(
static bool is_instance_of(PyObject *obj, PyObject *mod, const char *cls_name)
{
ref_t py_plugin_t_cls(PyW_TryGetAttrString(mod, cls_name));
return py_plugin_t_cls != NULL && PyObject_IsInstance(obj, py_plugin_t_cls.o);
return py_plugin_t_cls != nullptr && PyObject_IsInstance(obj, py_plugin_t_cls.o);
}
//-------------------------------------------------------------------------
@@ -1617,13 +1611,13 @@ bool idapython_plugin_t::_extlang_call_method(
PYW_GIL_GET;
// Check for unsupported usage of call_method.
// Mainly a method call requires an object and a method.
if ( method_name == NULL )
if ( method_name == nullptr )
{
*errbuf = "call_method does not support this operation";
return false;
}
// Behave like run()
else if ( idc_obj == NULL )
else if ( idc_obj == nullptr )
{
new_execution_t exec;
return _extlang_call_func(result, method_name, args, nargs, errbuf);
@@ -1645,7 +1639,7 @@ bool idapython_plugin_t::_extlang_call_method(
}
ref_t py_method(PyW_TryGetAttrString(py_obj.o, method_name));
if ( py_method == NULL || !PyCallable_Check(py_method.o) )
if ( py_method == nullptr || !PyCallable_Check(py_method.o) )
{
errbuf->sprnt("The input object does not have a callable method called '%s'", method_name);
break;
@@ -1658,7 +1652,7 @@ bool idapython_plugin_t::_extlang_call_method(
if ( streq(method_name, "run") )
{
ref_t py_ida_idaapi_mod(PyW_TryImportModule(S_IDA_IDAAPI_MODNAME));
if ( py_ida_idaapi_mod != NULL )
if ( py_ida_idaapi_mod != nullptr )
{
if ( is_instance_of(py_obj.o, py_ida_idaapi_mod.o, "plugin_t")
|| is_instance_of(py_obj.o, py_ida_idaapi_mod.o, "plugmod_t") )
@@ -1673,7 +1667,7 @@ bool idapython_plugin_t::_extlang_call_method(
{
new_execution_t exec;
newref_t py_res(PyObject_CallObject(py_method.o, pargs.empty() ? NULL : pargs[0].o));
newref_t py_res(PyObject_CallObject(py_method.o, pargs.empty() ? nullptr : pargs[0].o));
ok = return_python_result(result, py_res, errbuf);
}
} while ( false );
@@ -1685,7 +1679,7 @@ bool idapython_plugin_t::_extlang_call_method(
// Returns the attribute value of a given object from the global scope
bool idapython_plugin_t::_extlang_get_attr(
idc_value_t *result, // out: result
const idc_value_t *obj, // in: object (may be NULL)
const idc_value_t *obj, // in: object (may be nullptr)
const char *attr) // in: attribute name
{
PYW_GIL_GET;
@@ -1694,14 +1688,14 @@ bool idapython_plugin_t::_extlang_get_attr(
{
// Get a reference to the module
ref_t py_mod(PyW_TryImportModule(S_MAIN));
if ( py_mod == NULL )
if ( py_mod == nullptr )
break;
// Object specified:
// - (1) string contain attribute name in the main module
// - (2) opaque object (we use it as is)
ref_t py_obj;
if ( obj != NULL )
if ( obj != nullptr )
{
// (1) Get attribute from main module
if ( obj->vtype == VT_STR )
@@ -1721,7 +1715,7 @@ bool idapython_plugin_t::_extlang_get_attr(
}
}
// Get the attribute reference
if ( py_obj == NULL )
if ( py_obj == nullptr )
break;
}
// No object specified:
@@ -1732,22 +1726,22 @@ bool idapython_plugin_t::_extlang_get_attr(
}
// Special case: if attribute not passed then retrieve the class
// name associated associated with the passed object
if ( attr == NULL || attr[0] == '\0' )
if ( attr == nullptr || attr[0] == '\0' )
{
cvt = CIP_FAILED;
// Get the class
newref_t cls(PyObject_GetAttrString(py_obj.o, "__class__"));
if ( cls == NULL )
if ( cls == nullptr )
break;
// Get its name
newref_t name(PyObject_GetAttrString(cls.o, "__name__"));
if ( name == NULL )
if ( name == nullptr )
break;
// Convert name object to string object
newref_t string(PyObject_Str(name.o));
if ( string == NULL )
if ( string == nullptr )
break;
// Convert name python string to a C string
@@ -1755,20 +1749,20 @@ bool idapython_plugin_t::_extlang_get_attr(
if ( !IDAPyStr_AsUTF8(&clsname, string.o) )
break;
result->set_string(clsname);
result->set_string(clsname); //-V595 'result' was utilized before it was verified against nullptr
cvt = CIP_OK; //lint !e838
break;
}
ref_t py_attr(PyW_TryGetAttrString(py_obj.o, attr));
// No attribute?
if ( py_attr == NULL )
if ( py_attr == nullptr )
{
cvt = CIP_FAILED;
break;
}
// Don't store result
if ( result == NULL )
if ( result == nullptr )
{
cvt = CIP_OK;
// Decrement attribute (because of GetAttrString)
@@ -1796,7 +1790,7 @@ bool idapython_plugin_t::_extlang_get_attr(
// Returns the attribute value of a given object from the global scope
//lint -e{818}
bool idapython_plugin_t::_extlang_set_attr(
idc_value_t *obj, // in: object name (may be NULL)
idc_value_t *obj, // in: object name (may be nullptr)
const char *attr, // in: attribute name
const idc_value_t &value)
{
@@ -1806,10 +1800,10 @@ bool idapython_plugin_t::_extlang_set_attr(
{
// Get a reference to the module
ref_t py_mod(PyW_TryImportModule(S_MAIN));
if ( py_mod == NULL )
if ( py_mod == nullptr )
break;
ref_t py_obj;
if ( obj != NULL )
if ( obj != nullptr )
{
// Get the attribute reference (from just a name)
if ( obj->vtype == VT_STR )
@@ -1823,7 +1817,7 @@ bool idapython_plugin_t::_extlang_set_attr(
py_obj = ref_t();
}
// No object to set_attr on?
if ( py_obj == NULL )
if ( py_obj == nullptr )
break;
}
else
@@ -1855,7 +1849,7 @@ bool idapython_plugin_t::_cli_execute_line(const char *line)
return true;
const char *last_line = strrchr(line, '\n');
if ( last_line == NULL )
if ( last_line == nullptr )
last_line = line;
else
last_line += 1;
@@ -1893,7 +1887,7 @@ bool idapython_plugin_t::_cli_execute_line(const char *line)
// Compile as an expression
qstring qstr(line);
newref_t py_code(my_CompileString(insert_encoding_cookie(&qstr), "<string>", Py_eval_input));
if ( py_code == NULL || PyErr_Occurred() )
if ( py_code == nullptr || PyErr_Occurred() )
{
// Not an expression?
PyErr_Clear();
@@ -1910,17 +1904,17 @@ bool idapython_plugin_t::_cli_execute_line(const char *line)
py_globals,
py_globals));
if ( py_result == NULL || PyErr_Occurred() ) //-V560 is always false: PyErr_Occurred()
if ( py_result == nullptr || PyErr_Occurred() ) //-V560 is always false: PyErr_Occurred()
{
PyErr_Print();
}
else
{
ref_t sys_displayhook(idapython_plugin_t::get_instance()->get_sys_displayhook());
if ( sys_displayhook != NULL )
if ( sys_displayhook != nullptr )
{
//lint -esym(1788, res) is referenced only by its constructor or destructor
newref_t res(PyObject_CallFunctionObjArgs(sys_displayhook.o, py_result.o, NULL));
newref_t res(PyObject_CallFunctionObjArgs(sys_displayhook.o, py_result.o, nullptr));
}
else if ( py_result.o != Py_None )
{
@@ -1932,7 +1926,7 @@ bool idapython_plugin_t::_cli_execute_line(const char *line)
IDAPyStr_AsUTF8(&utf8, py_result.o);
#else
newref_t py_result_utf8(PyUnicode_AsUTF8String(py_result.o));
ok = py_result_utf8 != NULL;
ok = py_result_utf8 != nullptr;
if ( ok )
IDAPyStr_AsUTF8(&utf8, py_result_utf8.o);
#endif
@@ -1967,11 +1961,11 @@ bool idapython_plugin_t::_cli_find_completions(
PYW_GIL_GET;
ref_t py_fc(get_idaapi_attr(S_IDAAPI_FINDCOMPLETIONS));
if ( py_fc == NULL )
if ( py_fc == nullptr )
return false;
newref_t py_res(PyObject_CallFunction(py_fc.o, "si", line, x)); //lint !e605 !e1776
if ( PyErr_Occurred() != NULL )
if ( PyErr_Occurred() != nullptr )
return false;
return idapython_convert_cli_completions(
out_completions,
@@ -1996,7 +1990,7 @@ bool idapython_plugin_t::_handle_file(
{
PYW_GIL_CHECK_LOCKED_SCOPE();
ref_t py_executor_func(get_idaapi_attr(idaapi_executor_func_name));
if ( py_executor_func == NULL )
if ( py_executor_func == nullptr )
{
errbuf->sprnt("Could not find %s.%s ?!", S_IDA_IDAAPI_MODNAME, idaapi_executor_func_name);
return false;
@@ -2007,7 +2001,7 @@ bool idapython_plugin_t::_handle_file(
strrpl(script, '\\', '/');
newref_t py_script(IDAPyStr_FromUTF8(script));
if ( globals == NULL )
if ( globals == nullptr )
globals = _get_module_globals();
if ( globals != _get_module_globals() )
{
@@ -2025,11 +2019,11 @@ bool idapython_plugin_t::_handle_file(
py_script.o,
globals,
py_false.o,
NULL));
nullptr));
// Failure at this point means the script was interrupted
bool interrupted = false;
if ( PyW_GetError(errbuf) || py_ret == NULL )
if ( PyW_GetError(errbuf) || py_ret == nullptr )
{
PyErr_Clear();
if ( errbuf->empty() )
@@ -2043,7 +2037,7 @@ bool idapython_plugin_t::_handle_file(
PyObject *ret_o;
if ( want_tuple )
{
if ( second_res != NULL
if ( second_res != nullptr
&& PyTuple_Check(py_ret.o)
&& PyTuple_Size(py_ret.o) == 2 )
{
@@ -2092,7 +2086,7 @@ bool idapython_plugin_t::_run_user_script()
bool ok;
{
new_execution_t exec;
ok = _handle_file(path, /*globals*/ NULL, &errbuf);
ok = _handle_file(path, /*globals*/ nullptr, &errbuf);
}
if ( !ok )
warning("IDAPython: error executing '%s':\n%s", path, errbuf.c_str());
@@ -2114,7 +2108,7 @@ bool idapython_plugin_t::_check_python_dir()
char filepath[QMAXPATH];
for ( size_t i=0; i < qnumber(script_files); i++ )
{
qmakepath(filepath, sizeof(filepath), idapython_dir.c_str(), script_files[i], NULL);
qmakepath(filepath, sizeof(filepath), idapython_dir.c_str(), script_files[i], nullptr);
if ( !qfileexist(filepath) )
{
warning("IDAPython: Missing required file: '%s'", script_files[i]);
@@ -2172,7 +2166,7 @@ void idapython_plugin_t::_prepare_sys_path()
bool idapython_plugin_t::_run_init_py()
{
char path[QMAXPATH];
qmakepath(path, MAXSTR, idapython_dir.c_str(), S_INIT_PY, NULL);
qmakepath(path, MAXSTR, idapython_dir.c_str(), S_INIT_PY, nullptr);
#ifdef __NT__
// if the current disk has no space (sic, the current directory, not the one
@@ -2195,7 +2189,7 @@ bool idapython_plugin_t::_run_init_py()
//lint -esym(429, fp) custodial pointer not freed or returned
FILE *fp = qfopen(path, "rt");
if ( fp == NULL )
if ( fp == nullptr )
return false;
file_janitor_t fpj(fp);
qstring contents;
@@ -2203,27 +2197,30 @@ bool idapython_plugin_t::_run_init_py()
if ( fpsz == 0 )
return false;
contents.resize(fpsz);
qfread(fp, contents.begin(), fpsz);
ssize_t effsz = qfread(fp, contents.begin(), fpsz);
if ( effsz <= 0 )
return false;
contents.resize(effsz);
newref_t code(my_CompileString(contents.c_str(), path, Py_file_input));
if ( code == NULL )
if ( code == nullptr )
return false;
newref_t result(PyEval_EvalCode(
PYCODE_OBJECT_TO_PYEVAL_ARG(code.o),
__main__globals,
__main__globals));
return result != NULL && !PyErr_Occurred();
return result != nullptr && !PyErr_Occurred();
}
//------------------------------------------------------------------------
// Note: The references are borrowed. No need to free them.
PyObject *idapython_plugin_t::_get_module_globals(const char *modname)
{
if ( modname == NULL || modname[0] == '\0' )
if ( modname == nullptr || modname[0] == '\0' )
modname = S_MAIN;
PyObject *module = PyImport_AddModule(modname);
return module == NULL ? NULL : PyModule_GetDict(module);
return module == nullptr ? nullptr : PyModule_GetDict(module);
}
//-------------------------------------------------------------------------
@@ -2232,10 +2229,10 @@ PyObject *idapython_plugin_t::_get_module_globals_from_path_with_kind(
const char *kind)
{
const char *fname = qbasename(path);
if ( fname != NULL )
if ( fname != nullptr )
{
const char *ext = get_file_ext(fname);
if ( ext == NULL )
if ( ext == nullptr )
ext = tail(fname);
else
--ext;
@@ -2247,7 +2244,7 @@ PyObject *idapython_plugin_t::_get_module_globals_from_path_with_kind(
return _get_module_globals(modname.begin());
}
}
return NULL;
return nullptr;
}
//-------------------------------------------------------------------------
@@ -2271,7 +2268,7 @@ PyObject *idapython_plugin_t::_get_module_globals_from_path(
}
}
}
return NULL;
return nullptr;
}
//-------------------------------------------------------------------------
@@ -2293,7 +2290,7 @@ plugin_t PLUGIN =
IDP_INTERFACE_VERSION,
PLUGIN_FIX | PLUGIN_HIDE | PLUGIN_MULTI, // plugin flags
init, // initialize
nullptr, // terminate. this pointer may be NULL.
nullptr, // terminate. this pointer may be nullptr.
nullptr, // invoke plugin
S_IDAPYTHON, // long comment about the plugin
// it could appear in the status line
@@ -2303,5 +2300,5 @@ plugin_t PLUGIN =
// the preferred short name of the plugin
S_IDAPYTHON,
// the preferred hotkey to run the plugin
NULL
nullptr
};
-1
View File
@@ -28,7 +28,6 @@ global:
idapython_show_wait_box;
idapython_hide_wait_box;
idcvar_to_pyvar;
is_api695_compat_enabled;
get_plugin_instance;
lookup_info_t_commit;
lookup_info_t_del_by_py_view;
-1
View File
@@ -21,7 +21,6 @@ EXPORTS
disable_script_timeout
enable_extlang_python
enable_python_cli
is_api695_compat_enabled
get_plugin_instance
idcvar_to_pyvar
lookup_info_t_commit
+23 -47
View File
@@ -43,15 +43,6 @@ endif
BINS += $(IDAPYSWITCH_DEP)
bins: $(BINS)
#----------------------------------------------------------------------
# configurable variables for this makefile
BC695 = 1
ifdef BC695
BC695_CC_DEF = BC695
BC695_SWIGFLAGS = -DBC695
BC695_DEPLOYFLAGS = --bc695
endif
#----------------------------------------------------------------------
# Build system hacks
@@ -176,7 +167,6 @@ ifdef DO_IDAMAKE_SIMPLIFY
QGENHOOKS = @echo $(call qcolor,genhooks) $< && #
QGENIDAAPI = @echo $(call qcolor,genidaapi) $< && #
QGENSWIGHEADER = @echo $(call qcolor,genswigheader) $< && #
QGEN_IDC_BC695 = @echo $(call qcolor,gen_idc_bc695) $< && #
QINJECT_PYDOC = @echo $(call qcolor,inject_pydoc) $$< && #
QINJECT_BASE_HOOKS_FLAGS = @echo $(call qcolor,inject_base_hooks_flags) $< && #
QPATCH_CODEGEN = @echo $(call qcolor,patch_codegen) $$< && #
@@ -204,7 +194,6 @@ DEPLOY_PYDIR=$(R)python/$(PYTHON_VERSION_MAJOR)
DEPLOY_INIT_PY=$(DEPLOY_PYDIR)/init.py
DEPLOY_IDC_PY=$(DEPLOY_PYDIR)/idc.py
DEPLOY_IDAUTILS_PY=$(DEPLOY_PYDIR)/idautils.py
DEPLOY_IDC_BC695_PY=$(DEPLOY_PYDIR)/idc_bc695.py
DEPLOY_IDAAPI_PY=$(DEPLOY_PYDIR)/idaapi.py
DEPLOY_IDADEX_PY=$(DEPLOY_PYDIR)/idadex.py
ifdef TESTABLE_BUILD
@@ -212,23 +201,19 @@ ifdef TESTABLE_BUILD
endif
ifeq ($(OUT_OF_TREE_BUILD),)
TEST_IDC=test_idc
IDC_BC695_IDC_SOURCE?=$(DEPLOY_PYDIR)/../../idc/idc.idc
IDAT_PATH?=$(R)/idat
else
IDC_BC695_IDC_SOURCE?=$(IDA_INSTALL)/idc/idc.idc
IDAT_PATH?=$(IDA_INSTALL)/idat
endif
IDAT_CMD=TVHEADLESS=1 $(IDAT_PATH)$(SUFF64)
ifneq ($(OUT_OF_TREE_BUILD),)
# envvar HAS_HEXRAYS must have been set by build.py if needed
else
ifeq ($(BUILD_VD),1)
HAS_HEXRAYS=1 # force hexrays bindings
endif
# envvar HAS_HEXRAYS must have been set by build.py if needed
ifeq ($(OUT_OF_TREE_BUILD),)
HAS_HEXRAYS=1 # force hexrays bindings
endif
#
# determine SDK_SOURCES
ifeq ($(OUT_OF_TREE_BUILD),)
include ../../etc/sdk/sdk_files.mak
SDK_SOURCES=$(sort $(foreach v,$(SDK_FILES),$(if $(findstring include/,$(v)),$(addprefix $(IDA_INCLUDE)/,$(notdir $(v))))))
@@ -236,7 +221,6 @@ ifeq ($(OUT_OF_TREE_BUILD),)
SDK_SOURCES+=$(IDA_INCLUDE)/hexrays.hpp
endif
SDK_SOURCES+=$(IDA_INCLUDE)/lumina.hpp
SDK_SOURCES+=$(IDA_INCLUDE)/srclang.hpp
else
SDK_SOURCES=$(wildcard $(IDA_INCLUDE)/*.h) $(wildcard $(IDA_INCLUDE)/*.hpp)
endif
@@ -264,9 +248,7 @@ ifneq ($(HAS_HEXRAYS),)
WITH_HEXRAYS_DEF = WITH_HEXRAYS
WITH_HEXRAYS_CHKAPI=--with-hexrays
HEXRAYS_MODNAME=hexrays
ifdef BC695
CMP_API = 1
endif
CMP_API = 1
# Warning: adding an empty HEXRAYS_MODNAME will lead to idaapy trying to load
# a module called ida_.
MODULES_NAMES += $(HEXRAYS_MODNAME)
@@ -317,9 +299,7 @@ MODULES_NAMES += registry
MODULES_NAMES += search
MODULES_NAMES += segment
MODULES_NAMES += segregs
ifdef TESTABLE_BUILD
MODULES_NAMES += srclang
endif
MODULES_NAMES += srclang
MODULES_NAMES += strlist
MODULES_NAMES += struct
MODULES_NAMES += tryblks
@@ -364,11 +344,10 @@ endif
# three modules will share type information. But any other project's
# types will not interfere or clash with the types in your module.
DEF_TYPE_TABLE = SWIG_TYPE_TABLE=idaapi
SWIGFLAGS=$(_SWIGFLAGS) -Itools/typemaps-supplement $(SWIG_INCLUDES) $(addprefix -D,$(DEF_TYPE_TABLE)) $(BC695_SWIGFLAGS)
SWIGFLAGS=$(_SWIGFLAGS) -Itools/typemaps-supplement $(SWIG_INCLUDES) $(addprefix -D,$(DEF_TYPE_TABLE)) -DMISSED_BC695
pyfiles: $(DEPLOY_IDAUTILS_PY) \
$(DEPLOY_IDC_PY) \
$(DEPLOY_IDC_BC695_PY) \
$(DEPLOY_INIT_PY) \
$(DEPLOY_IDAAPI_PY) \
$(DEPLOY_IDADEX_PY) \
@@ -487,9 +466,6 @@ $(DEPLOY_IDC_PY): python/idc.py
$(DEPLOY_IDAUTILS_PY): python/idautils.py
$(CP) $? $@
$(DEPLOY_IDC_BC695_PY): $(IDC_BC695_IDC_SOURCE) python/idc.py tools/gen_idc_bc695.py
$(QGEN_IDC_BC695)$(PYTHON) tools/gen_idc_bc695.py --idc $(IDC_BC695_IDC_SOURCE) --output $@
$(DEPLOY_IDAAPI_PY): python/idaapi.py tools/genidaapi.py $(IDAPYTHON_MODULES)
$(QGENIDAAPI)$(PYTHON) tools/genidaapi.py -i $< -o $@ -m $(subst $(space),$(comma),$(MODULES_NAMES))
@@ -608,7 +584,7 @@ $(ST_PYW)/py_kernwin.hpp: pywraps/py_kernwin.hpp \
$(QGENHOOKS)$(PYTHON) $(GENHOOKS)genhooks.py -i $< -o $@ \
-c UI_Hooks \
-x $(ST_PARSED_HEADERS) \
-q "ui_notification_t::" \
-q "ui_notification_t::" \
-m hookgenUI
$(ST_PYW)/py_kernwin_viewhooks.hpp: pywraps/py_kernwin_viewhooks.hpp \
$(I)kernwin.hpp \
@@ -632,7 +608,7 @@ $(ST_PYW)/py_hexrays_hooks.hpp: pywraps/py_hexrays_hooks.hpp \
#----------------------------------------------------------------------
CFLAGS += $(PYTHON_CFLAGS)
CC_DEFS += $(BC695_CC_DEF)
CC_DEFS += MISSED_BC695
CC_DEFS += $(DEF_TYPE_TABLE)
CC_DEFS += $(WITH_HEXRAYS_DEF)
CC_DEFS += USE_STANDARD_FILE_FUNCTIONS
@@ -727,16 +703,17 @@ define make-module-rules
# files.
# ../../bin/x86_linux_gcc/python/ida_$(1).py (note: dep. on .cpp. See note above.)
$(DEPLOY_PYDIR)/ida_$(1).py: $(ST_WRAP)/$(1).cpp $(PARSED_HEADERS_MARKER) $(call find-pydoc-patches-deps,$(1)) $(call find-patch-codegen-deps,$(1)) | tools/inject_pydoc.py tools/wrapper_utils.py
$(DEPLOY_PYDIR)/ida_$(1).py: $(ST_WRAP)/$(1).cpp tools/inject_pydoc.py $(PARSED_HEADERS_MARKER) $(call find-pydoc-patches-deps,$(1)) $(call find-patch-codegen-deps,$(1))
$(QINJECT_PYDOC)$(PYTHON) tools/inject_pydoc.py \
--xml-doc-directory $(ST_PARSED_HEADERS) \
--module $(1) \
--input $(ST_WRAP)/ida_$(1).py \
--interface $(ST_SWIG)/$(1).i \
--cpp-wrapper $(ST_WRAP)/$(1).cpp \
--traces tools/collected_traces.txt \
--cases tools/inject_pydoc_cases.txt \
--output $$@ \
--epydoc-injections $(ST_WRAP)/ida_$(1).epydoc_injection \
--verbose > $(ST_WRAP)/ida_$(1).pydoc_injection 2>&1
--verbose > $(ST_WRAP)/ida_$(1).pydoc_injection
# obj/x86_linux_gcc/swig/X.i
$(ST_SWIG)/$(1).i: $(addprefix $(F),$(call find-pywraps-deps,$(1))) $(ADDITIONAL_PYWRAP_DEP_$(1)) swig/$(1).i $(ST_SWIG_HEADER) $(SWIG_IFACE_$(1):%=$(ST_SWIG)/%.i) $(ST_SWIG_HEADER) tools/deploy.py $(PARSED_HEADERS_MARKER)
@@ -746,7 +723,6 @@ define make-module-rules
--output $$@ \
--module $$(subst .i,,$$(notdir $$@)) \
$(MODULE_LIFECYCLE_$(1)) \
$(BC695_DEPLOYFLAGS) \
--interface-dependencies=$(subst $(space),$(comma),$(SWIG_IFACE_$(1))) \
--xml-doc-directory $(ST_PARSED_HEADERS)
@@ -877,7 +853,7 @@ else
DUMPDOC_IS_64:=False
endif
PYDOC_INJECTIONS_IDAT_CMD=$(USE_PYTHON2_ENVVAR) $(IDAT_CMD) $(BATCH_SWITCH) "-OIDAPython:AUTOIMPORT_COMPAT_IDA695=NO" -S"$< $@ $(ST_WRAP) $(DUMPDOC_IS_64)" -t -L$(F)dumpdoc.log >/dev/null
PYDOC_INJECTIONS_IDAT_CMD=$(USE_PYTHON2_ENVVAR) $(IDAT_CMD) $(BATCH_SWITCH) -S"$< $@ $(ST_WRAP) $(DUMPDOC_IS_64)" -t -L$(F)dumpdoc.log >/dev/null
pydoc_injections: $(ST_PYDOC_INJECTIONS)
$(ST_PYDOC_INJECTIONS): tools/dumpdoc.py $(IDAPYTHON_MODULES) $(PYTHON_BINARY_MODULES)
ifeq ($(or $(__CODE_CHECKER__),$(NO_CMP_API),$(__ASAN__),$(IDAHOME),$(DEMO_OR_FREE)),)
@@ -893,13 +869,11 @@ endif
#----------------------------------------------------------------------
DOCS_MODULES=$(foreach mod,$(MODULES_NAMES),ida_$(mod))
tools/docs/hrdoc.cfg: tools/docs/hrdoc.cfg.in
sed s/%IDA_MODULES%/"$(DOCS_MODULES)"/ < $^ > $@
# the html files are produced in docs\hr-html directory
docs: tools/docs/hrdoc.py tools/docs/hrdoc.cfg tools/docs/hrdoc.css
SORTED_DOCS_MODULES=$(sort $(DOCS_MODULES))
docs: tools/docs/hrdoc.py tools/docs/hrdoc.css
ifndef __NT__
$(IDAT_CMD) -Stools/docs/hrdoc.py -t > /dev/null
$(IDAT_CMD) $(BATCH_SWITCH) -S"tools/docs/hrdoc.py -o docs/hr-html -m $(subst $(space),$(comma),$(SORTED_DOCS_MODULES)),idc,idautils -s idc,idautils -x ida_allins" -t > /dev/null
# $(IDAT_CMD) $(BATCH_SWITCH) -S"tools/docs/hrdoc.py -o docs/hr-html -m ida_pro,ida_kernwin -s idc,idautils -x ida_allins" -t > /dev/null # use this one for testing (faster)
else
$(R)ida -Stools/docs/hrdoc.py -t
endif
@@ -980,6 +954,7 @@ ifdef __CODE_CHECKER__
else
EXAMPLES := $(wildcard examples/**/*.py)
GEN_EXAMPLES_TOOL := tools/gen_examples_index.py
GEN_EXAMPLES_CFG := tools/gen_examples_index.cfg
ST_EXAMPLES_INDEX_HTML := $(F)examples/index.html
ST_EXAMPLES_INDEX_MD := $(F)examples/index.md
@@ -992,13 +967,14 @@ else
.PRECIOUS: $(ST_EXAMPLES_INDEX)
$(eval EXAMPLES_INDEX_CMD := $(PYTHON) $(GEN_EXAMPLES_TOOL) \
$(eval EXAMPLES_INDEX_CMD := $(PYTHON) $(GEN_EXAMPLES_TOOL) write \
-t $(EXAMPLES_TEMPLATE) \
-e examples \
-o $(ST_EXAMPLES_INDEX) \
)
$(ST_EXAMPLES_INDEX): $(GEN_EXAMPLES_TOOL) $(EXAMPLES_TEMPLATE) $(EXAMPLES)
$(ST_EXAMPLES_INDEX): $(GEN_EXAMPLES_TOOL) $(GEN_EXAMPLES_CFG) \
$(EXAMPLES_TEMPLATE) $(EXAMPLES)
-$(Q)if [ ! -d "$(F)examples" ] ; then mkdir -p 2>/dev/null $(F)examples ; fi
$(QGEN_EXAMPLES_INDEX)$(EXAMPLES_INDEX_CMD) \
|| echo FAILED: $(EXAMPLES_INDEX_CMD)
Binary file not shown.
+44393 -32140
View File
File diff suppressed because it is too large Load Diff
+45160 -32850
View File
File diff suppressed because it is too large Load Diff
+25 -32
View File
@@ -35,6 +35,8 @@ import types
import os
import sys
# TO_REFACTOR_ON_PY2_REMOVAL
# this internal function can be dropped
def refs(ea, funcfirst, funcnext):
"""
Generic reference collector - INTERNAL USE ONLY.
@@ -60,6 +62,13 @@ def CodeRefsTo(ea, flow):
for ref in CodeRefsTo(get_screen_ea(), 1):
print(ref)
"""
# TO_REFACTOR_ON_PY2_REMOVAL
# we can use the new generators
# xref = ida_xref.xrefblk_t()
# if flow == 1:
# yield from xref.crefs_to(ea)
# else:
# yield from xref.fcrefs_to(ea)
if flow == 1:
return refs(ea, ida_xref.get_first_cref_to, ida_xref.get_next_cref_to)
else:
@@ -81,6 +90,7 @@ def CodeRefsFrom(ea, flow):
for ref in CodeRefsFrom(get_screen_ea(), 1):
print(ref)
"""
# TO_REFACTOR_ON_PY2_REMOVAL
if flow == 1:
return refs(ea, ida_xref.get_first_cref_from, ida_xref.get_next_cref_from)
else:
@@ -100,6 +110,7 @@ def DataRefsTo(ea):
for ref in DataRefsTo(get_screen_ea()):
print(ref)
"""
# TO_REFACTOR_ON_PY2_REMOVAL
return refs(ea, ida_xref.get_first_dref_to, ida_xref.get_next_dref_to)
@@ -116,6 +127,7 @@ def DataRefsFrom(ea):
for ref in DataRefsFrom(get_screen_ea()):
print(ref)
"""
# TO_REFACTOR_ON_PY2_REMOVAL
return refs(ea, ida_xref.get_first_dref_from, ida_xref.get_next_dref_from)
@@ -144,16 +156,6 @@ def XrefTypeName(typecode):
assert typecode in _ref_types, "unknown reference type %d" % typecode
return _ref_types[typecode]
def _copy_xref(xref):
""" Make a private copy of the xref class to preserve its contents """
class _xref(object):
pass
xr = _xref()
for attr in [ 'frm', 'to', 'iscode', 'type', 'user' ]:
setattr(xr, attr, getattr(xref, attr))
return xr
def XrefsFrom(ea, flags=0):
"""
@@ -168,10 +170,7 @@ def XrefsFrom(ea, flags=0):
'from', hex(xref.frm), 'to', hex(xref.to))
"""
xref = ida_xref.xrefblk_t()
if xref.first_from(ea, flags):
yield _copy_xref(xref)
while xref.next_from():
yield _copy_xref(xref)
return xref.refs_from(ea, flags)
def XrefsTo(ea, flags=0):
@@ -187,10 +186,7 @@ def XrefsTo(ea, flags=0):
'from', hex(xref.frm), 'to', hex(xref.to))
"""
xref = ida_xref.xrefblk_t()
if xref.first_to(ea, flags):
yield _copy_xref(xref)
while xref.next_to():
yield _copy_xref(xref)
return xref.refs_to(ea, flags)
def Threads():
@@ -253,18 +249,16 @@ def Functions(start=None, end=None):
def Chunks(start):
"""
Get a list of function chunks
See also ida_funcs.func_tail_iterator_t
@param start: address of the function
@return: list of funcion chunks (tuples of the form (start_ea, end_ea))
@return: list of function chunks (tuples of the form (start_ea, end_ea))
belonging to the function
"""
func_iter = ida_funcs.func_tail_iterator_t( ida_funcs.get_func( start ) )
status = func_iter.main()
while status:
chunk = func_iter.chunk()
for chunk in func_iter:
yield (chunk.start_ea, chunk.end_ea)
status = next(func_iter)
def Modules():
@@ -319,19 +313,13 @@ def Entries():
def FuncItems(start):
"""
Get a list of function items (instruction or data items inside function boundaries)
See also ida_funcs.func_item_iterator_t
@param start: address of the function
@return: ea of each item in the function
"""
func = ida_funcs.get_func(start)
if not func:
return
fii = ida_funcs.func_item_iterator_t()
ok = fii.set(func)
while ok:
yield fii.current()
ok = fii.next_code()
return ida_funcs.func_item_iterator_t(ida_funcs.get_func(start))
def Structs():
@@ -691,7 +679,12 @@ class _procregs(object):
class _cpu(object):
"Simple wrapper around get_reg_value/set_reg_value"
def __getattr__(self, name):
return idc.get_reg_value(name)
try:
return idc.get_reg_value(name)
except Exception as ex:
raise AttributeError("_cpu: \"{}\" is not a register;"
" inner exception: [{}] {}"
.format(name, type(ex).__name__, ex))
def __setattr__(self, name, value):
return idc.set_reg_value(value, name)
+14 -98
View File
@@ -70,7 +70,7 @@ import types
import sys
__EA64__ = ida_idaapi.BADADDR == 0xFFFFFFFFFFFFFFFF
WORDMASK = 0xFFFFFFFFFFFFFFFF if __EA64__ else 0xFFFFFFFF
WORDMASK = 0xFFFFFFFFFFFFFFFF if __EA64__ else 0xFFFFFFFF # just there for bw-compat purposes; please don't use
class DeprecatedIDCError(Exception):
"""
Exception for deprecated function calls
@@ -115,8 +115,13 @@ def _IDC_SetAttr(obj, attrmap, attroffs, value):
BADADDR = ida_idaapi.BADADDR # Not allowed address value
BADSEL = ida_idaapi.BADSEL # Not allowed selector value/number
MAXADDR = ida_ida.MAXADDR & WORDMASK
SIZE_MAX = _ida_idaapi.SIZE_MAX
ida_ida.__set_module_dynattrs(
__name__,
{
"MAXADDR" : (lambda: ida_ida.inf_get_privrange_start_ea(), None),
})
#
# Flag bit definitions (for get_full_flags())
#
@@ -1748,15 +1753,13 @@ SEARCH_NOBRK = ida_search.SEARCH_NOBRK # don't test ctrl-break
SEARCH_NOSHOW = ida_search.SEARCH_NOSHOW # don't display the search progress
def find_text(ea, flag, y, x, searchstr, from_bc695=False):
if not from_bc695:
__warn_once_deprecated_proto_confusion("find_text", "ida_search.find_text")
def find_text(ea, flag, y, x, searchstr):
__warn_once_deprecated_proto_confusion("find_text", "ida_search.find_text")
return ida_search.find_text(ea, y, x, searchstr, flag)
def find_binary(ea, flag, searchstr, radix=16, from_bc695=False):
if not from_bc695:
__warn_once_deprecated_proto_confusion("find_binary", "ida_search.find_binary")
def find_binary(ea, flag, searchstr, radix=16):
__warn_once_deprecated_proto_confusion("find_binary", "ida_search.find_binary")
endea = flag & 1 and ida_ida.cvar.inf.max_ea or ida_ida.cvar.inf.min_ea
return ida_search.find_binary(ea, endea, searchstr, radix, flag)
@@ -1918,7 +1921,8 @@ INF_LISTNAMES = 39 # uchar; What names should be included in the li
# DISASSEMBLY LISTING DETAILS
INF_INDENT = 40 # char; Indention for instructions
INF_COMMENT = 41 # char; Indention for comments
INF_CMT_INDENT = 41 # char; Indention for comments
INF_COMMENT = 41 # for compatibility
INF_MARGIN = 42 # ushort; max length of data lines
INF_LENXREF = 43 # ushort; max length of line with xrefs
INF_OUTFLAGS = 44 # uint32; output flags
@@ -1997,7 +2001,7 @@ _INF_attrs_accessors = {
INF_CC_SIZE_LL : (ida_ida.inf_get_cc_size_ll, ida_ida.inf_set_cc_size_ll),
INF_CC_SIZE_S : (ida_ida.inf_get_cc_size_s, ida_ida.inf_set_cc_size_s),
INF_CMTFLAG : (ida_ida.inf_get_cmtflg, ida_ida.inf_set_cmtflg),
INF_COMMENT : (ida_ida.inf_get_comment, ida_ida.inf_set_comment),
INF_CMT_INDENT : (ida_ida.inf_get_cmt_indent, ida_ida.inf_set_cmt_indent),
INF_DATABASE_CHANGE_COUNT : (ida_ida.inf_get_database_change_count, ida_ida.inf_set_database_change_count),
INF_DATATYPES : (ida_ida.inf_get_datatypes, ida_ida.inf_set_datatypes),
INF_DEMNAMES : (ida_ida.inf_get_demnames, ida_ida.inf_set_demnames),
@@ -5928,94 +5932,6 @@ def set_flag(off, bit, value):
v = v & ~bit
set_inf_attr(off, v)
#--------------------------------------------------------------------------
# Compatibility macros (auto-generated part. Comes first so
# that any re-definition below will override auto-generated part)
if sys.modules["__main__"].IDAPYTHON_COMPAT_695_API:
# see header.i.in
bc695redef = ida_idaapi.bc695redef
# although many things have changed in the 'inf' structure,
# let's still try and do the best we can here even though
# some INF_* accessor enumerators don't exist anymore
GetCharPrm=get_inf_attr
GetLongPrm=get_inf_attr
GetShortPrm=get_inf_attr
SetCharPrm=set_inf_attr
SetLongPrm=set_inf_attr
SetShortPrm=set_inf_attr
#--------------------------------------------------------------------------
# Compatibility macros (non-auto-generated part)
def CompileEx(inp, isfile): return compile_idc_file(inp) if isfile else compile_idc_text(inp)
def WriteMap(filepath):
return gen_file(OFILE_MAP, filepath, 0, BADADDR, GENFLG_MAPSEG|GENFLG_MAPNAME)
def WriteTxt(filepath, ea1, ea2):
return gen_file(OFILE_ASM, filepath, ea1, ea2, 0)
def WriteExe(filepath):
return gen_file(OFILE_EXE, filepath, 0, BADADDR, 0)
UTP_STRUCT = ida_typeinf.UTP_STRUCT
UTP_ENUM = ida_typeinf.UTP_ENUM
def begin_type_updating(utp):
"""
Begin type updating. Use this function if you
plan to call AddEnumConst or similar type modification functions
many times or from inside a loop
@param utp: one of UTP_xxxx consts
@return: None
"""
return ida_typeinf.begin_type_updating(utp)
def end_type_updating(utp):
"""
End type updating. Refreshes the type system
at the end of type modification operations
@param utp: one of ida_typeinf.UTP_xxxx consts
@return: None
"""
return ida_typeinf.end_type_updating(utp)
from idc_bc695 import *
SendDbgCommand=send_dbg_command
def MakeFunction(start, end=ida_idaapi.BADADDR):
return ida_funcs.add_func(start, end)
ApplyType = apply_type
GetManyBytes = get_bytes
GetString = get_strlit_contents
ClearTraceFile = clear_trace
def FindBinary(ea, flag, searchstr, radix=16):
return find_binary(ea, flag, searchstr, radix, from_bc695=True)
def FindText(ea, flag, y, x, text):
return find_text(ea, flag, y, x, text, from_bc695=True)
NextHead = next_head
ParseTypes = parse_decls
PrevHead = prev_head
ProcessUiAction = process_ui_action
SaveBase = save_database
Eval = eval_idc
def MakeStr(ea, endea):
return create_strlit(ea, endea)
def GetProcessorName():
return ida_ida.cvar.inf.procname
def SegStart(ea): return get_segm_start(ea)
def SegEnd(ea): return get_segm_end(ea)
def SetSegmentType(ea, type): return set_segm_type(ea, type)
# Convenience functions:
def here(): return get_screen_ea()
def is_mapped(ea): return (prev_addr(ea+1)==ea)
+8 -2
View File
@@ -129,11 +129,17 @@ if os.getcwd() in sys.path:
if not IDAPYTHON_REMOVE_CWD_SYS_PATH:
sys.path.append(os.getcwd())
# Additional $IDAUSR-derived paths
if IDAPYTHON_IDAUSR_SYSPATH:
idausr_python_list = ida_diskio.get_ida_subdirs("python")
for idausr_python in idausr_python_list:
one = os.path.join(idausr_python, str(sys.version_info.major))
if one not in sys.path:
sys.path.append(one)
if IDAPYTHON_COMPAT_AUTOIMPORT_MODULES:
# Import all the required modules
from idaapi import get_user_idadir, cvar, Appcall, Form
if IDAPYTHON_COMPAT_695_API:
from idaapi import Choose2
from idc import *
from idautils import *
import idaapi
+95 -95
View File
@@ -131,18 +131,18 @@ static Py_ssize_t pyvar_walk_list(
py_item = newref_t(PySequence_GetItem(o, i));
else
py_item = borref_t(PyList_GetItem(o, i));
bool ok = py_item != NULL && cb(py_item, i, ud) == CIP_OK;
bool ok = py_item != nullptr && cb(py_item, i, ud) == CIP_OK;
if ( ok )
{
// We cannot have, at the same time, a 'successful conversion', and
// the Python runtime raising an exception. It's up to the callback
// implementation to ensure that whatever it did, didn't cause an
// error to be set.
QASSERT(30604, PyErr_Occurred() == NULL);
QASSERT(30604, PyErr_Occurred() == nullptr);
}
else
{
if ( PyErr_Occurred() == NULL )
if ( PyErr_Occurred() == nullptr )
{
qstring m;
m.sprnt("Sequence item #%d cannot be converted", int(i));
@@ -198,7 +198,7 @@ Py_ssize_t ida_export PyW_PyListToEaVec(eavec_t *out, PyObject *py_list)
if ( PyLong_Check(py_item.o) )
{
unsigned long long ull = PyLong_AsUnsignedLongLong(py_item.o);
if ( ull == -1ULL && PyErr_Occurred() != NULL )
if ( ull == -1ULL && PyErr_Occurred() != nullptr )
return CIP_FAILED;
ea = ea_t(ull);
}
@@ -213,7 +213,7 @@ Py_ssize_t ida_export PyW_PyListToEaVec(eavec_t *out, PyObject *py_list)
ea = ea_t(PyLong_AsUnsignedLongLong(py_item.o));
else
return CIP_FAILED;
if ( PyErr_Occurred() != NULL )
if ( PyErr_Occurred() != nullptr )
return CIP_FAILED;
#endif
}
@@ -239,7 +239,7 @@ Py_ssize_t ida_export PyW_PyListToEa64Vec(ea64vec_t *out, PyObject *py_list)
if ( PyLong_Check(py_item.o) )
{
unsigned long long ull = PyLong_AsUnsignedLongLong(py_item.o);
if ( ull == -1ULL && PyErr_Occurred() != NULL )
if ( ull == -1ULL && PyErr_Occurred() != nullptr )
return CIP_FAILED;
v = uint64(ull);
}
@@ -254,7 +254,7 @@ Py_ssize_t ida_export PyW_PyListToEa64Vec(ea64vec_t *out, PyObject *py_list)
v = uint64(PyLong_AsUnsignedLongLong(py_item.o));
else
return CIP_FAILED;
if ( PyErr_Occurred() != NULL )
if ( PyErr_Occurred() != nullptr )
return CIP_FAILED;
#endif
}
@@ -353,7 +353,7 @@ static int get_pyidc_cvt_type(PyObject *py_var)
// Check if this our special by reference object
ref_t attr(PyW_TryGetAttrString(py_var, S_PY_IDCCVT_ID_ATTR));
if ( attr == NULL || !IDAPyIntOrLong_Check(attr.o) )
if ( attr == nullptr || !IDAPyIntOrLong_Check(attr.o) )
return -1;
return int(IDAPyIntOrLong_AsLong(attr.o));
}
@@ -439,7 +439,7 @@ static const ext_idcfunc_t opaque_dtor_desc =
S_PY_IDC_OPAQUE_T ".dtor_name",
py_idc_opaque_dtor,
py_idc_cvt_helper_dtor_args,
NULL,
nullptr,
0,
0
};
@@ -466,8 +466,8 @@ static int pyvar_to_idcvar2(
return CIP_OK;
}
// None / NULL
if ( py_var == NULL || py_var.o == Py_None )
// None / nullptr
if ( py_var == nullptr || py_var.o == Py_None )
{
idc_var->set_long(0);
}
@@ -623,7 +623,7 @@ static int pyvar_to_idcvar2(
{
// Get the value attribute
ref_t attr(PyW_TryGetAttrString(py_var.o, S_PY_IDCCVT_VALUE_ATTR));
if ( attr == NULL )
if ( attr == nullptr )
return false;
idc_var->set_int64(PyLong_AsLongLong(attr.o));
return CIP_OK;
@@ -634,12 +634,12 @@ static int pyvar_to_idcvar2(
case PY_ICID_BYREF:
{
// BYREF always require this parameter
if ( gvar_sn == NULL )
if ( gvar_sn == nullptr )
return CIP_FAILED;
// Get the value attribute
ref_t attr(PyW_TryGetAttrString(py_var.o, S_PY_IDCCVT_VALUE_ATTR));
if ( attr == NULL )
if ( attr == nullptr )
return CIP_FAILED;
// Create a global variable
@@ -671,7 +671,7 @@ static int pyvar_to_idcvar2(
{
newref_t py_dir(PyObject_Dir(py_var.o));
Py_ssize_t size = PyList_Size(py_dir.o);
if ( py_dir == NULL || !PyList_Check(py_dir.o) || size == 0 )
if ( py_dir == nullptr || !PyList_Check(py_dir.o) || size == 0 )
return CIP_FAILED;
// Create the IDC object
idcv_object(idc_var);
@@ -685,7 +685,7 @@ static int pyvar_to_idcvar2(
#else
const char *field_name = PyString_AsString(item.o);
#endif
if ( field_name == NULL )
if ( field_name == nullptr )
continue;
size_t len = strlen(field_name);
@@ -700,7 +700,7 @@ static int pyvar_to_idcvar2(
idc_value_t v;
newref_t attr(PyObject_GetAttrString(py_var.o, field_name));
if ( attr == NULL )
if ( attr == nullptr )
return CIP_FAILED;
else if ( pyvar_to_idcvar1(attr, &v, gvar_sn, visited) < CIP_OK )
return CIP_FAILED;
@@ -760,9 +760,9 @@ int ida_export idcvar_to_pyvar(
switch ( idc_var.vtype )
{
case VT_PVOID:
if ( *py_var == NULL )
if ( *py_var == nullptr )
{
newref_t nr(PyCapsule_New(idc_var.pvoid, VALID_CAPSULE_NAME, NULL));
newref_t nr(PyCapsule_New(idc_var.pvoid, VALID_CAPSULE_NAME, nullptr));
*py_var = nr;
}
else
@@ -776,14 +776,14 @@ int ida_export idcvar_to_pyvar(
bool as_pylong = (flags & PYWCVTF_INT64_AS_UNSIGNED_PYLONG) != 0;
if ( as_pylong )
{
QASSERT(30513, *py_var == NULL); // recycling not supported in this case
QASSERT(30513, *py_var == nullptr); // recycling not supported in this case
*py_var = newref_t(PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) idc_var.i64));
return CIP_OK;
}
else
{
// Recycle?
if ( *py_var != NULL )
if ( *py_var != nullptr )
{
// Recycling an int64 object?
if ( !is_pyidc_cvt_type_int64(py_var->o) )
@@ -793,17 +793,17 @@ int ida_export idcvar_to_pyvar(
return CIP_OK;
}
ref_t py_cls(get_idaapi_attr_by_id(PY_CLSID_CVT_INT64));
if ( py_cls == NULL )
if ( py_cls == nullptr )
return CIP_FAILED;
*py_var = newref_t(PyObject_CallFunctionObjArgs(py_cls.o, PyLong_FromLongLong(idc_var.i64), NULL));
if ( PyW_GetError() || *py_var == NULL )
*py_var = newref_t(PyObject_CallFunctionObjArgs(py_cls.o, PyLong_FromLongLong(idc_var.i64), nullptr));
if ( PyW_GetError() || *py_var == nullptr )
return CIP_FAILED;
}
break;
}
case VT_STR:
if ( *py_var == NULL )
if ( *py_var == nullptr )
{
const qstring &s = idc_var.qstr();
if ( (flags & PYWCVTF_STR_AS_BYTES) != 0 )
@@ -816,7 +816,7 @@ int ida_export idcvar_to_pyvar(
return CIP_IMMUTABLE; // Cannot recycle immutable object
case VT_LONG:
// Cannot recycle immutable objects
if ( *py_var != NULL )
if ( *py_var != nullptr )
{
// Recycling an int64 object?
if ( !is_pyidc_cvt_type_int64(py_var->o) )
@@ -828,7 +828,7 @@ int ida_export idcvar_to_pyvar(
*py_var = newref_t(cvt_to_pylong(idc_var.num));
break;
case VT_FLOAT:
if ( *py_var == NULL )
if ( *py_var == nullptr )
{
double x;
if ( processor_t::realcvt(&x, (fpvalue_t*)&idc_var.e, (sizeof(x)/2-1)|010) != 1 )
@@ -842,15 +842,15 @@ int ida_export idcvar_to_pyvar(
case VT_REF:
{
if ( *py_var == NULL )
if ( *py_var == nullptr )
{
ref_t py_cls(get_idaapi_attr_by_id(PY_CLSID_CVT_BYREF));
if ( py_cls == NULL )
if ( py_cls == nullptr )
return CIP_FAILED;
// Create a byref object with None value. We populate it later
*py_var = newref_t(PyObject_CallFunctionObjArgs(py_cls.o, Py_None, NULL));
if ( PyW_GetError() || *py_var == NULL )
*py_var = newref_t(PyObject_CallFunctionObjArgs(py_cls.o, Py_None, nullptr));
if ( PyW_GetError() || *py_var == nullptr )
return CIP_FAILED;
}
int t = get_pyidc_cvt_type(py_var->o);
@@ -860,12 +860,12 @@ int ida_export idcvar_to_pyvar(
// Dereference
// (Since we are not using VREF_COPY flag, we can safely const_cast)
idc_value_t *dref_v = deref_idcv(const_cast<idc_value_t *>(&idc_var), VREF_LOOP);
if ( dref_v == NULL )
if ( dref_v == nullptr )
return CIP_FAILED;
// Can we recycle the object?
ref_t new_py_val(PyW_TryGetAttrString(py_var->o, S_PY_IDCCVT_VALUE_ATTR));
if ( new_py_val != NULL )
if ( new_py_val != nullptr )
{
// Recycle
t = idcvar_to_pyvar(*dref_v, &new_py_val);
@@ -903,16 +903,16 @@ int ida_export idcvar_to_pyvar(
bool is_dict = false;
// Need to create a new object?
if ( *py_var == NULL )
if ( *py_var == nullptr )
{
// Get skeleton class reference
ref_t py_cls(get_idaapi_attr_by_id(PY_CLSID_APPCALL_SKEL_OBJ));
if ( py_cls == NULL )
if ( py_cls == nullptr )
return CIP_FAILED;
// Call constructor
obj = newref_t(PyObject_CallFunctionObjArgs(py_cls.o, NULL));
if ( PyW_GetError() || obj == NULL )
obj = newref_t(PyObject_CallFunctionObjArgs(py_cls.o, nullptr));
if ( PyW_GetError() || obj == nullptr )
return CIP_FAILED;
}
else
@@ -925,7 +925,7 @@ int ida_export idcvar_to_pyvar(
// Walk the IDC attributes and store into python
for ( const char *attr_name = first_idcv_attr(&idc_var);
attr_name != NULL;
attr_name != nullptr;
attr_name = next_idcv_attr(&idc_var, attr_name) )
{
// Get the attribute
@@ -955,7 +955,7 @@ int ida_export idcvar_to_pyvar(
//-------------------------------------------------------------------------
// Converts IDC arguments to Python argument list or just one tuple
// If 'decref' is NULL then 'pargs' will contain one element which is the tuple
// If 'decref' is nullptr then 'pargs' will contain one element which is the tuple
bool ida_export pyw_convert_idc_args(
const idc_value_t args[],
int nargs,
@@ -973,9 +973,9 @@ bool ida_export pyw_convert_idc_args(
if ( as_tuple )
{
py_tuple = newref_t(PyTuple_New(nargs));
if ( py_tuple == NULL )
if ( py_tuple == nullptr )
{
if ( errbuf != NULL )
if ( errbuf != nullptr )
*errbuf = "Failed to create a new tuple to store arguments!";
return false;
}
@@ -987,7 +987,7 @@ bool ida_export pyw_convert_idc_args(
int cvt = idcvar_to_pyvar(args[i], &py_obj, flags);
if ( cvt < CIP_OK )
{
if ( errbuf != NULL )
if ( errbuf != nullptr )
errbuf->sprnt("arg#%d has wrong type %d", i, args[i].vtype);
return false;
}
@@ -1083,7 +1083,7 @@ static error_t idaapi idc_py_invoke0(
{
PYW_GIL_GET;
PyObject *pyfunc = (PyObject *) argv[0].pvoid;
newref_t py_result(PyObject_CallFunctionObjArgs(pyfunc, NULL));
newref_t py_result(PyObject_CallFunctionObjArgs(pyfunc, nullptr));
// Report Python error as IDC exception
qstring err;
@@ -1095,7 +1095,7 @@ static error_t idaapi idc_py_invoke0(
static const char idc_py_invoke0_args[] = { VT_PVOID, 0 };
static const ext_idcfunc_t idc_py_invoke0_desc =
{
S_PYINVOKE0, idc_py_invoke0, idc_py_invoke0_args, NULL, 0, 0
S_PYINVOKE0, idc_py_invoke0, idc_py_invoke0_args, nullptr, 0, 0
};
//------------------------------------------------------------------------
@@ -1107,11 +1107,11 @@ static bool init_pywraps()
// Take a reference to the idaapi python module
// (We need it to create instances of certain classes)
if ( ida_idaapi_module == NULL )
if ( ida_idaapi_module == nullptr )
{
// Take a reference to the module so we can create the needed class instances
ida_idaapi_module = PyW_TryImportModule(S_PY_IDA_IDAAPI_MODNAME);
if ( ida_idaapi_module == NULL )
if ( ida_idaapi_module == nullptr )
return false;
}
@@ -1120,11 +1120,11 @@ static bool init_pywraps()
return false;
// IDC opaque class not registered?
if ( get_py_idc_cvt_opaque() == NULL )
if ( get_py_idc_cvt_opaque() == nullptr )
{
// Add the class
idc_class_t *idc_cvt_opaque = add_idc_class(S_PY_IDC_OPAQUE_T);
if ( idc_cvt_opaque == NULL )
if ( idc_cvt_opaque == nullptr )
return false;
// Register the dtor function
@@ -1167,14 +1167,14 @@ ref_t ida_export create_linked_class_instance(
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_module(PyImport_ImportModule(modname));
ref_t result;
if ( py_module != NULL )
if ( py_module != nullptr )
{
ref_t py_class = PyW_TryGetAttrString(py_module.o, clsname);
if ( py_class != NULL )
if ( py_class != nullptr )
{
newref_t py_lnk(PyCapsule_New(lnk, VALID_CAPSULE_NAME, NULL));
ref_t py_obj = newref_t(PyObject_CallFunctionObjArgs(py_class.o, py_lnk.o, NULL));
if ( !PyW_GetError() && py_obj != NULL )
newref_t py_lnk(PyCapsule_New(lnk, VALID_CAPSULE_NAME, nullptr));
ref_t py_obj = newref_t(PyObject_CallFunctionObjArgs(py_class.o, py_lnk.o, nullptr));
if ( !PyW_GetError() && py_obj != nullptr )
result = py_obj;
}
}
@@ -1187,7 +1187,7 @@ ref_t ida_export create_linked_class_instance(
// This function takes a reference to the idaapi module and keeps the reference
static ref_t get_idaapi_attr_by_id(const int class_id)
{
if ( class_id >= PY_CLSID_LAST || ida_idaapi_module == NULL )
if ( class_id >= PY_CLSID_LAST || ida_idaapi_module == nullptr )
return ref_t();
// Some class names. The array is parallel with the PY_CLSID_xxx consts
@@ -1206,7 +1206,7 @@ static ref_t get_idaapi_attr_by_id(const int class_id)
static ref_t get_idaapi_attr(const char *attrname)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
return ida_idaapi_module == NULL
return ida_idaapi_module == nullptr
? ref_t()
: PyW_TryGetAttrString(ida_idaapi_module.o, attrname);
}
@@ -1220,13 +1220,13 @@ bool ida_export PyW_GetStringAttr(
{
PYW_GIL_CHECK_LOCKED_SCOPE();
ref_t py_attr(PyW_TryGetAttrString(py_obj, attr_name));
if ( py_attr == NULL )
if ( py_attr == nullptr )
return false;
return IDAPyStr_Check(py_attr.o) != 0 && IDAPyStr_AsUTF8(str, py_attr.o);
}
//------------------------------------------------------------------------
// Returns an attribute or NULL
// Returns an attribute or nullptr
// No errors will be set if the attribute did not exist
ref_t ida_export PyW_TryGetAttrString(PyObject *py_obj, const char *attr)
{
@@ -1243,7 +1243,7 @@ ref_t ida_export PyW_TryImportModule(const char *name)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t result(PyImport_ImportModule(name));
if ( result == NULL && PyErr_Occurred() )
if ( result == nullptr && PyErr_Occurred() )
PyErr_Clear();
return result;
}
@@ -1274,9 +1274,9 @@ bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64)
#define SETNUM(numexpr, is64_expr) \
do \
{ \
if ( num != NULL ) \
if ( num != nullptr ) \
*num = numexpr; \
if ( is_64 != NULL ) \
if ( is_64 != nullptr ) \
*is_64 = is64_expr; \
} while ( false )
@@ -1330,7 +1330,7 @@ bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64)
// Try to parse as uint64
unsigned PY_LONG_LONG ull = PyLong_AsUnsignedLongLong(py_var);
PyObject *err = PyErr_Occurred();
if ( err == NULL ) //-V547 'err == 0' is always false
if ( err == nullptr ) //-V547 'err == 0' is always false
{
SETNUM(uint64(ull), true);
break;
@@ -1341,7 +1341,7 @@ bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64)
{
newref_t py_mask(Py_BuildValue("K", 0xFFFFFFFFFFFFFFFFull));
newref_t py_num(PyNumber_And(py_var, py_mask.o));
if ( py_num != NULL && py_mask != NULL )
if ( py_num != nullptr && py_mask != nullptr )
{
PyErr_Clear();
ull = PyLong_AsUnsignedLongLong(py_num.o);
@@ -1373,7 +1373,7 @@ bool ida_export PyW_IsSequenceType(PyObject *obj)
}
Py_ssize_t sz = PySequence_Size(obj);
if ( sz == -1 || PyErr_Occurred() != NULL )
if ( sz == -1 || PyErr_Occurred() != nullptr )
{
PyErr_Clear();
rc = false;
@@ -1389,7 +1389,7 @@ bool ida_export PyW_ObjectToString(PyObject *obj, qstring *out)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_str(PyObject_Str(obj));
bool ok = py_str != NULL;
bool ok = py_str != nullptr;
#ifdef PY3
if ( ok )
IDAPyStr_AsUTF8(out, py_str.o);
@@ -1409,10 +1409,10 @@ bool ida_export PyW_GetError(qstring *out, bool clear_err)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( PyErr_Occurred() == NULL )
if ( PyErr_Occurred() == nullptr )
return false;
if ( out != NULL )
if ( out != nullptr )
{
// Get the exception info (this also clears the exception)
PyObject *err_type, *err_value, *err_traceback;
@@ -1421,21 +1421,21 @@ bool ida_export PyW_GetError(qstring *out, bool clear_err)
// Try helper first
ref_t py_ret;
ref_t py_fmtexc(get_idaapi_attr(S_IDAAPI_FORMATEXC));
if ( py_fmtexc != NULL )
if ( py_fmtexc != nullptr )
{
py_ret = newref_t(PyObject_CallFunctionObjArgs(
py_fmtexc.o,
err_type,
err_value,
err_traceback,
NULL));
nullptr));
}
// and fallback to simple stringification if needed
if ( py_ret == NULL )
if ( py_ret == nullptr )
py_ret = newref_t(PyObject_Str(err_value));
if ( py_ret != NULL )
if ( py_ret != nullptr )
IDAPyStr_AsUTF8(out, py_ret.o);
else
*out = "IDAPython: unknown error";
@@ -1482,9 +1482,9 @@ void *ida_export pyobj_get_clink(PyObject *pyobj)
// Try to query the link attribute
ref_t attr(PyW_TryGetAttrString(pyobj, S_CLINK_NAME));
void *t = attr != NULL && PyCapsule_IsValid(attr.o, VALID_CAPSULE_NAME)
void *t = attr != nullptr && PyCapsule_IsValid(attr.o, VALID_CAPSULE_NAME)
? PyCapsule_GetPointer(attr.o, VALID_CAPSULE_NAME)
: NULL;
: nullptr;
return t;
}
@@ -1493,7 +1493,7 @@ void *ida_export pyobj_get_clink(PyObject *pyobj)
//-------------------------------------------------------------------------
lookup_entry_t &ida_export lookup_info_t_new_entry(lookup_info_t *_this, py_customidamemo_t *py_view)
{
QASSERT(30454, py_view != NULL && !_this->find_by_py_view(NULL, py_view));
QASSERT(30454, py_view != nullptr && !_this->find_by_py_view(nullptr, py_view));
lookup_entry_t &e = _this->entries.push_back();
e.py_view = py_view;
return e;
@@ -1503,9 +1503,9 @@ lookup_entry_t &ida_export lookup_info_t_new_entry(lookup_info_t *_this, py_cust
void ida_export lookup_info_t_commit(lookup_info_t *_this, lookup_entry_t &e, TWidget *view)
{
QASSERT(30455, &e >= _this->entries.begin() && &e < _this->entries.end());
QASSERT(30456, view != NULL && e.py_view != NULL
&& !_this->find_by_view(NULL, view)
&& _this->find_by_py_view(NULL, e.py_view));
QASSERT(30456, view != nullptr && e.py_view != nullptr
&& !_this->find_by_view(nullptr, view)
&& _this->find_by_py_view(nullptr, e.py_view));
e.view = view;
}
@@ -1516,7 +1516,7 @@ void ida_export lookup_info_t_commit(lookup_info_t *_this, lookup_entry_t &e, TW
const lookup_entry_t &e = *it; \
if ( e.crit == crit ) \
{ \
if ( out_##res != NULL ) \
if ( out_##res != nullptr ) \
*out_##res = e.res; \
return true; \
} \
@@ -1574,10 +1574,10 @@ PyObject *ida_export py_customidamemo_t_create_groups(
if ( !PyDict_Check(item.o) )
continue;
borref_t nodes(PyDict_GetItemString(item.o, "nodes"));
if ( nodes.o == NULL || !PySequence_Check(nodes.o) )
if ( nodes.o == nullptr || !PySequence_Check(nodes.o) )
continue;
borref_t text(PyDict_GetItemString(item.o, "text"));
if ( text.o == NULL || !IDAPyStr_Check(text.o) )
if ( text.o == nullptr || !IDAPyStr_Check(text.o) )
continue;
group_crinfo_t gi;
Py_ssize_t nodes_cnt = PySequence_Size(nodes.o);
@@ -1667,12 +1667,12 @@ PyObject *ida_export py_customidamemo_t_set_groups_visibility(
//-------------------------------------------------------------------------
bool ida_export py_customidamemo_t_bind(py_customidamemo_t *_this, PyObject *self, TWidget *view)
{
if ( _this->self != NULL || _this->view != NULL )
if ( _this->self != nullptr || _this->view != nullptr )
return false;
PYGLOG("%p: py_customidamemo_t::bind(self=%p, view=%p)\n", _this, _this->self.o, _this->view);
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_cobj(PyCapsule_New(_this, VALID_CAPSULE_NAME, NULL));
newref_t py_cobj(PyCapsule_New(_this, VALID_CAPSULE_NAME, nullptr));
PyObject_SetAttrString(self, S_M_THIS, py_cobj.o);
_this->self = borref_t(self);
@@ -1683,14 +1683,14 @@ bool ida_export py_customidamemo_t_bind(py_customidamemo_t *_this, PyObject *sel
//-------------------------------------------------------------------------
void ida_export py_customidamemo_t_unbind(py_customidamemo_t *_this, bool clear_view)
{
if ( _this->self == NULL )
if ( _this->self == nullptr )
return;
PYGLOG("%p: py_customidamemo_t::unbind(); self.o=%p, view=%p\n", _this, _this->self.o, _this->view);
PYW_GIL_CHECK_LOCKED_SCOPE();
PyObject_SetAttrString(_this->self.o, S_M_THIS, Py_None);
_this->self = newref_t(NULL);
_this->self = newref_t(nullptr);
if ( clear_view )
_this->view = NULL;
_this->view = nullptr;
}
//-------------------------------------------------------------------------
@@ -1715,13 +1715,13 @@ bool ida_export py_customidamemo_t_collect_pyobject_callbacks(
ref_t attr(PyW_TryGetAttrString(o, cbid.name.c_str()));
int have = cbid.have;
// Mandatory fields not present?
if ( (attr == NULL && have <= 0)
if ( (attr == nullptr && have <= 0)
// Mandatory callback fields present but not callable?
|| (attr != NULL && have >= 0 && PyCallable_Check(attr.o) == 0) )
|| (attr != nullptr && have >= 0 && PyCallable_Check(attr.o) == 0) )
{
return false;
}
if ( have > 0 && attr != NULL )
if ( have > 0 && attr != nullptr )
_this->cb_flags |= have;
}
@@ -1845,7 +1845,7 @@ ref_t ida_export try_create_swig_wrapper(ref_t mod, const char *clsname, void *c
wname.sprnt("%s__from_ptrval__", clsname);
ref_t res;
ref_t py_cls_wrapper_inst(PyW_TryGetAttrString(mod.o, wname.c_str()));
if ( py_cls_wrapper_inst != NULL )
if ( py_cls_wrapper_inst != nullptr )
{
uninterruptible_op_t op;
res = newref_t(PyObject_CallFunction(py_cls_wrapper_inst.o, "(K)", uint64(cobj)));
@@ -1859,20 +1859,20 @@ ssize_t ida_export get_callable_arg_count(ref_t callable)
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_module(PyImport_ImportModule("inspect"));
ssize_t cnt = -1;
if ( py_module != NULL )
if ( py_module != nullptr )
{
#ifdef PY3
ref_t py_fun = PyW_TryGetAttrString(py_module.o, "getfullargspec");
#else
ref_t py_fun = PyW_TryGetAttrString(py_module.o, "getargspec");
#endif
if ( py_fun != NULL )
if ( py_fun != nullptr )
{
newref_t py_tuple(PyObject_CallFunctionObjArgs(py_fun.o, callable.o, NULL));
if ( py_tuple != NULL && PyTuple_Check(py_tuple.o) )
newref_t py_tuple(PyObject_CallFunctionObjArgs(py_fun.o, callable.o, nullptr));
if ( py_tuple != nullptr && PyTuple_Check(py_tuple.o) )
{
borref_t py_args(PyTuple_GetItem(py_tuple.o, 0));
if ( py_args != NULL && PySequence_Check(py_args.o) )
if ( py_args != nullptr && PySequence_Check(py_args.o) )
cnt = PySequence_Length(py_args.o);
}
}
@@ -1956,7 +1956,7 @@ bool ida_export idapython_convert_cli_completions(
int *out_match_end,
ref_t py_res)
{
bool ok = py_res != NULL
bool ok = py_res != nullptr
&& PyTuple_Check(py_res.o)
&& PyTuple_Size(py_res.o) == 3;
if ( ok )
@@ -1972,7 +1972,7 @@ bool ida_export idapython_convert_cli_completions(
{
*out_match_start = IDAPyInt_AsLong(i1.o);
*out_match_end = IDAPyInt_AsLong(i2.o);
ok = PyErr_Occurred() == NULL;
ok = PyErr_Occurred() == nullptr;
}
else
{
+76 -75
View File
@@ -248,7 +248,7 @@ struct ref_t
{
PyObject *o;
ref_t() : o(NULL) {}
ref_t() : o(nullptr) {}
ref_t(const ref_t &other) : o(other.o) { incref(); }
~ref_t() { decref(); }
ref_t &operator=(const ref_t &other)
@@ -272,13 +272,13 @@ struct ref_t
PyObject *was = o;
o = other.o;
incref();
if ( was != NULL )
if ( was != nullptr )
Py_DECREF(was);
return *this;
}
void incref() const { if ( o != NULL ) Py_INCREF(o); }
void decref() const { if ( o != NULL ) { QASSERT(30469, o->ob_refcnt > 0); Py_DECREF(o); } }
void incref() const { if ( o != nullptr ) Py_INCREF(o); }
void decref() const { if ( o != nullptr ) { QASSERT(30469, o->ob_refcnt > 0); Py_DECREF(o); } }
bool operator==(PyObject *other) const { return o == other; }
bool operator!=(PyObject *other) const { return !((*this) == other); }
@@ -310,7 +310,7 @@ struct newref_t : public ref_t
newref_t(PyObject *_o)
{
#ifdef _DEBUG
QASSERT(30409, _o == NULL || _o->ob_refcnt >= 1);
QASSERT(30409, _o == nullptr || _o->ob_refcnt >= 1);
#endif
o = _o;
}
@@ -366,11 +366,11 @@ GCC_DIAG_OFF(return-type-c-linkage);
#endif
// Tries to import a module and swallows the exception if it fails and returns NULL
// Tries to import a module and swallows the exception if it fails and returns nullptr
// Return value: New reference.
idaman ref_t ida_export PyW_TryImportModule(const char *name);
// Tries to get an attribute and swallows the exception if it fails and returns NULL
// Tries to get an attribute and swallows the exception if it fails and returns nullptr
idaman ref_t ida_export PyW_TryGetAttrString(PyObject *py_var, const char *attr);
// Converts a Python number (LONGLONG or normal integer) to an IDC variable (VT_LONG or VT_INT64)
@@ -383,13 +383,13 @@ idaman bool ida_export PyW_GetStringAttr(
qstring *str);
// Deprecated. Please use specific functions instead.
idaman bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64 = NULL);
idaman bool ida_export PyW_GetNumber(PyObject *py_var, uint64 *num, bool *is_64 = nullptr);
// Checks if an Python object can be treated like a sequence
idaman bool ida_export PyW_IsSequenceType(PyObject *obj);
// Returns an error string from the last exception (and clears it)
idaman bool ida_export PyW_GetError(qstring *out = NULL, bool clear_err = true);
idaman bool ida_export PyW_GetError(qstring *out = nullptr, bool clear_err = true);
// If an error occurred (it calls PyGetError) it displays it and return TRUE
// This function is used when calling callbacks
@@ -421,7 +421,7 @@ idaman bool ida_export pyw_convert_idc_args(
int nargs,
ref_vec_t &pargs,
uint32 flags,
qstring *errbuf = NULL);
qstring *errbuf = nullptr);
// Converts from IDC to Python
// We support converting VT_REF IDC variable types
@@ -436,14 +436,14 @@ idaman int ida_export idcvar_to_pyvar(
idaman int ida_export pyvar_to_idcvar(
const ref_t &py_var,
idc_value_t *idc_var,
int *gvar_sn=NULL);
int *gvar_sn=nullptr);
//-------------------------------------------------------------------------
// Walks a Python list or Sequence and calls the callback
idaman Py_ssize_t ida_export pyvar_walk_list(
PyObject *py_list,
int (idaapi *cb)(const ref_t &py_item, Py_ssize_t index, void *ud)=NULL,
void *ud = NULL);
int (idaapi *cb)(const ref_t &py_item, Py_ssize_t index, void *ud)=nullptr,
void *ud = nullptr);
// Converts a vector to a Python list object
idaman ref_t ida_export PyW_SizeVecToPyList(const sizevec_t &vec);
@@ -499,7 +499,7 @@ struct pycall_res_t
PyErr_Print();
}
inline bool success() const { return result.o != NULL; }
inline bool success() const { return result.o != nullptr; }
newref_t result;
@@ -516,7 +516,7 @@ class lookup_info_t;
class py_customidamemo_t;
struct lookup_entry_t
{
lookup_entry_t() : view(NULL), py_view(NULL) {}
lookup_entry_t() : view(nullptr), py_view(nullptr) {}
TWidget *view;
py_customidamemo_t *py_view;
@@ -713,8 +713,8 @@ inline void *view_extract_this(PyObject *self)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
ref_t py_this(PyW_TryGetAttrString(self, S_M_THIS));
if ( py_this == NULL || !PyCapsule_IsValid(py_this.o, VALID_CAPSULE_NAME) )
return NULL;
if ( py_this == nullptr || !PyCapsule_IsValid(py_this.o, VALID_CAPSULE_NAME) )
return nullptr;
return PyCapsule_GetPointer(py_this.o, VALID_CAPSULE_NAME);
}
@@ -736,7 +736,7 @@ DECL_REG_UNREG_REFCOUNTED(udt_type_data_t);
// Context structure used by register/unregister timer
struct py_timer_ctx_t
{
py_timer_ctx_t() : timer_id(NULL) {}
py_timer_ctx_t() : timer_id(nullptr) {}
qtimer_t timer_id;
ref_t pyfunc;
};
@@ -791,22 +791,13 @@ struct idapython_plugin_config_t
run_script_t() : when(RSW_UNKNOWN) {}
};
run_script_t run_script;
uint32 execution_timeout;
bool alert_auto_scripts;
bool remove_cwd_sys_path;
bool autoimport_compat_idaapi;
bool autoimport_compat_ida695;
bool namespace_aware;
bool repl_use_sys_displayhook;
idapython_plugin_config_t()
: execution_timeout(0),
alert_auto_scripts(true),
remove_cwd_sys_path(false),
autoimport_compat_idaapi(true),
autoimport_compat_ida695(false),
namespace_aware(true),
repl_use_sys_displayhook(true) {}
uint32 execution_timeout = 0;
bool alert_auto_scripts = true;
bool remove_cwd_sys_path = false;
bool autoimport_compat_idaapi = true;
bool namespace_aware = true;
bool repl_use_sys_displayhook = true;
bool idausr_syspath = true;
};
//-------------------------------------------------------------------------
@@ -1022,7 +1013,7 @@ private:
PyObject *globals,
qstring *errbuf,
const char *idaapi_executor_func_name = S_IDAAPI_EXECSCRIPT,
idc_value_t *second_res = NULL,
idc_value_t *second_res = nullptr,
bool want_tuple = false);
bool _run_user_script();
@@ -1042,13 +1033,12 @@ private:
};
idaman idapython_plugin_t *ida_export get_plugin_instance();
idaman bool ida_export is_api695_compat_enabled();
//-------------------------------------------------------------------------
py_customidamemo_t::py_customidamemo_t()
: cb_flags(0),
self(newref_t(NULL)),
view(NULL)
self(newref_t(nullptr)),
view(nullptr)
{
PYGLOG("%p: py_customidamemo_t()\n", this);
}
@@ -1087,8 +1077,8 @@ struct hooks_base_t
typedef std::map<int,uchar> has_nondef_map_t;
has_nondef_map_t has_nondef;
bool hook() { return cb != NULL && idapython_hook_to_notification_point(type, cb, this, true); }
bool unhook() { return cb != NULL && idapython_unhook_from_notification_point(type, cb, this); }
bool hook() { return cb != nullptr && idapython_hook_to_notification_point(type, cb, this, true); }
bool unhook() { return cb != nullptr && idapython_unhook_from_notification_point(type, cb, this); }
bool call_requires_new_execution() const { return (flags & HBF_CALL_WITH_NEW_EXEC) != 0; }
bool has_fixed_method_set() const { return (flags & HBF_VOLATILE_METHOD_SET) == 0; }
@@ -1122,9 +1112,9 @@ protected:
ref_t py_id;
if ( PyObject_HasAttrString(self, "id") )
py_id = newref_t(PyObject_GetAttrString(self, "id"));
if ( py_id == NULL || !IDAPyStr_Check(py_id.o) )
if ( py_id == nullptr || !IDAPyStr_Check(py_id.o) )
py_id = newref_t(PyObject_Repr(self));
if ( py_id != NULL && IDAPyStr_Check(py_id.o) )
if ( py_id != nullptr && IDAPyStr_Check(py_id.o) )
IDAPyStr_AsUTF8(&identifier, py_id.o);
}
@@ -1133,20 +1123,20 @@ protected:
qstring buf(class_name);
QASSERT(30589, !buf.empty());
char *p = qstrchr(buf.begin(), '.');
QASSERT(30590, p != NULL);
QASSERT(30590, p != nullptr);
*p++ = '\0';
newref_t py_mod(PyImport_ImportModule(buf.c_str()));
#ifdef TESTABLE_BUILD
QASSERT(30591, py_mod != NULL);
QASSERT(30591, py_mod != nullptr);
#endif
if ( py_mod != NULL )
if ( py_mod != nullptr )
{
newref_t py_def_class(PyObject_GetAttrString(py_mod.o, p));
newref_t py_this_class(PyObject_GetAttrString(self, "__class__"));
#ifdef TESTABLE_BUILD
QASSERT(30592, py_def_class != NULL && py_this_class != NULL);
QASSERT(30592, py_def_class != nullptr && py_this_class != nullptr);
#endif
if ( py_def_class != NULL && py_this_class != NULL )
if ( py_def_class != nullptr && py_this_class != nullptr )
{
for ( size_t i = 0; i < count; ++i )
{
@@ -1155,30 +1145,21 @@ protected:
newref_t py_def_meth(PyObject_GetAttrString(py_def_class.o, cur.method_name));
newref_t py_this_meth(PyObject_GetAttrString(py_this_class.o, cur.method_name));
#ifdef TESTABLE_BUILD
QASSERT(30593, py_def_meth != NULL && py_this_meth != NULL);
QASSERT(30593, py_def_meth != nullptr && py_this_meth != nullptr);
#endif
if ( py_def_meth != NULL && py_this_meth != NULL )
if ( py_def_meth != nullptr && py_this_meth != nullptr )
{
#ifdef BC695
if ( PyObject_HasAttrString(py_def_meth.o, "bc695_trampoline") > 0 )
if ( PyObject_HasAttrString(py_def_meth.o, "__trampoline") > 0 )
{
_has_nondef = 3;
_has_nondef = 2;
}
else
#endif
{
if ( PyObject_HasAttrString(py_def_meth.o, "__trampoline") > 0 )
{
_has_nondef = 2;
}
else
{
#ifdef PY3
_has_nondef = PyObject_RichCompareBool(py_this_meth.o, py_def_meth.o, Py_EQ) == 0 ? 1 : 0;
_has_nondef = PyObject_RichCompareBool(py_this_meth.o, py_def_meth.o, Py_EQ) == 0 ? 1 : 0;
#else
_has_nondef = PyObject_Compare(py_this_meth.o, py_def_meth.o) != 0 ? 1 : 0;
_has_nondef = PyObject_Compare(py_this_meth.o, py_def_meth.o) != 0 ? 1 : 0;
#endif
}
}
}
has_nondef[cur.code] = _has_nondef;
@@ -1187,30 +1168,29 @@ protected:
}
}
void ensure_no_method_when_no_695_compat(
void ensure_no_method(
PyObject *self,
const char *forbidden_method_name,
const char *replacement_method_name)
{
if ( !is_api695_compat_enabled() )
if ( PyObject_HasAttrString(self, "__class__") )
{
if ( PyObject_HasAttrString(self, "__class__") )
newref_t py_this_class(PyObject_GetAttrString(self, "__class__"));
if ( py_this_class != nullptr
&& PyObject_HasAttrString(py_this_class.o, forbidden_method_name) )
{
newref_t py_this_class(PyObject_GetAttrString(self, "__class__"));
if ( py_this_class != NULL
&& PyObject_HasAttrString(py_this_class.o, forbidden_method_name) )
{
msg("WARNING: The method \"%s::%s\" won't be called (it has been replaced with \"%s::%s\")\n",
class_name, forbidden_method_name, class_name, replacement_method_name);
}
msg("WARNING: The method \"%s::%s\" won't be called (it has been replaced with \"%s::%s\")\n",
class_name, forbidden_method_name, class_name, replacement_method_name);
}
}
}
qstring dump_state(
PyObject *dump_state(
const event_code_to_method_name_t *mappings,
size_t mappings_size) const
size_t mappings_size,
bool assert_all_reimplemented) const
{
qstrvec_t missing_reimpls;
qstring buf;
#ifdef TESTABLE_BUILD
buf.sprnt("%s(this=%p) \"%s\" {type=%d, cb=%p, flags=%x}",
@@ -1230,6 +1210,27 @@ protected:
how = " (as 6.95 bw-compat)";
buf.cat_sprnt("\n\treimplements \"%s\"%s", m.method_name, how);
}
else
{
missing_reimpls.push_back(m.method_name);
}
}
const size_t nmr = missing_reimpls.size();
if ( assert_all_reimplemented && nmr > 0 )
{
qstring ebuf;
for ( size_t i = 0; i < nmr; ++i )
{
if ( !ebuf.empty() )
ebuf.append(", ", 2);
ebuf.append(missing_reimpls[i]);
}
PyErr_Format(PyExc_NotImplementedError,
"%s(this=%p) \"%s\" {type=%d, cb=%p, flags=%x} is "
"missing reimplementations for: \"%s\"",
class_name, this, identifier.c_str(), int(type), cb,
flags, ebuf.c_str());
return nullptr;
}
}
else
@@ -1243,7 +1244,7 @@ protected:
qnotused(mappings);
qnotused(mappings_size);
#endif
return buf;
return IDAPyStr_FromUTF8(buf);
}
};
-14
View File
@@ -1,14 +0,0 @@
#<pycode_BC695(py_auto)>
analyze_area = plan_and_wait
autoCancel = auto_cancel
autoIsOk = auto_is_ok
autoMark = auto_mark
autoUnmark = auto_unmark
autoWait = auto_wait
noUsed = plan_ea
setStat = set_ida_state
showAddr = show_addr
showAuto = show_auto
#</pycode_BC695(py_auto)>
+18 -66
View File
@@ -2,25 +2,6 @@
#define __PY_IDA_BYTES__
//<code(py_bytes)>
//------------------------------------------------------------------------
static bool idaapi py_testf_cb(flags_t flags, void *ud)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_flags(PyLong_FromUnsignedLong(flags));
newref_t result(PyObject_CallFunctionObjArgs((PyObject *) ud, py_flags.o, NULL));
return result != NULL && PyObject_IsTrue(result.o);
}
//------------------------------------------------------------------------
// Wraps the (next|prev)that()
static ea_t py_npthat(ea_t ea, ea_t bound, PyObject *py_callable, bool next)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( !PyCallable_Check(py_callable) )
return BADADDR;
else
return (next ? next_that : prev_that)(ea, bound, py_testf_cb, py_callable);
}
//---------------------------------------------------------------------------
static int idaapi py_visit_patched_bytes_cb(
@@ -40,7 +21,7 @@ static int idaapi py_visit_patched_bytes_cb(
o,
v));
PyW_ShowCbErr("visit_patched_bytes");
return (py_result != NULL && IDAPyInt_Check(py_result.o)) ? IDAPyInt_AsLong(py_result.o) : 0;
return (py_result != nullptr && IDAPyInt_Check(py_result.o)) ? IDAPyInt_AsLong(py_result.o) : 0;
}
//-------------------------------------------------------------------------
@@ -63,7 +44,7 @@ static bool py_do_get_bytes(
int gmb_flags)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
bool has_mask = out_py_mask != NULL;
bool has_mask = out_py_mask != nullptr;
do
{
if ( size <= 0 )
@@ -71,8 +52,8 @@ static bool py_do_get_bytes(
// Allocate memory via Python
newref_t py_bytes(IDAPyBytes_FromMemAndSize(NULL, Py_ssize_t(size)));
if ( py_bytes == NULL )
newref_t py_bytes(IDAPyBytes_FromMemAndSize(nullptr, Py_ssize_t(size)));
if ( py_bytes == nullptr )
break;
bytevec_t mask;
@@ -84,7 +65,7 @@ static bool py_do_get_bytes(
size,
ea,
gmb_flags,
has_mask ? mask.begin() : NULL);
has_mask ? mask.begin() : nullptr);
if ( code < 0 )
break;
@@ -94,7 +75,7 @@ static bool py_do_get_bytes(
newref_t py_mask(IDAPyBytes_FromMemAndSize(
(const char *) mask.begin(),
mask.size()));
if ( py_mask == NULL )
if ( py_mask == nullptr )
break;
py_mask.incref();
*out_py_mask = py_mask.o;
@@ -140,33 +121,6 @@ static int py_visit_patched_bytes(ea_t ea1, ea_t ea2, PyObject *py_callable)
return visit_patched_bytes(ea1, ea2, py_visit_patched_bytes_cb, py_callable);
}
//------------------------------------------------------------------------
/*
#<pydoc>
def next_that(ea, maxea, callable):
"""
Find next address with a flag satisfying the function 'testf'.
Start searching from address 'ea'+1 and inspect bytes up to 'maxea'.
maxea is not included in the search range.
@param callable: a Python callable with the following prototype:
callable(flags). Return True to stop enumeration.
@return: the found address or BADADDR.
"""
pass
#</pydoc>
*/
static ea_t py_next_that(ea_t ea, ea_t maxea, PyObject *callable)
{
return py_npthat(ea, maxea, callable, true);
}
//---------------------------------------------------------------------------
static ea_t py_prev_that(ea_t ea, ea_t minea, PyObject *callable)
{
return py_npthat(ea, minea, callable, false);
}
//------------------------------------------------------------------------
/*
#<pydoc>
@@ -182,8 +136,8 @@ def get_bytes(ea, size):
*/
static PyObject *py_get_bytes(ea_t ea, unsigned int size, int gmb_flags=GMB_READALL)
{
PyObject *py_bytes = NULL;
if ( py_do_get_bytes(&py_bytes, NULL, ea, size, gmb_flags) )
PyObject *py_bytes = nullptr;
if ( py_do_get_bytes(&py_bytes, nullptr, ea, size, gmb_flags) )
return py_bytes;
else
Py_RETURN_NONE;
@@ -206,8 +160,8 @@ def get_bytes_and_mask(ea, size, mask):
*/
static PyObject *py_get_bytes_and_mask(ea_t ea, unsigned int size, int gmb_flags=GMB_READALL)
{
PyObject *py_bytes = NULL;
PyObject *py_mask = NULL;
PyObject *py_bytes = nullptr;
PyObject *py_mask = nullptr;
if ( py_do_get_bytes(&py_bytes, &py_mask, ea, size, gmb_flags) )
return Py_BuildValue("(OO)", py_bytes, py_mask);
else
@@ -222,14 +176,12 @@ STRCONV_ESCAPE = 0x00000001 # convert non-printable characters to C escapes (\
def get_strlit_contents(ea, len, type, flags = 0):
"""
Get bytes contents at location, possibly converted.
Get contents of string literal, as UTF-8-encoded codepoints.
It works even if the string has not been created in the database yet.
Note that this will <b>always</b> return a simple string of bytes
(i.e., a 'str' instance), and not a string of unicode characters.
If you want auto-conversion to unicode strings (that is: real strings),
you should probably be using the idautils.Strings class.
Note that the returned value will be of type 'bytes'; if
you want auto-conversion to unicode strings (that is: real Python
strings), you should probably be using the idautils.Strings class.
@param ea: linear address of the string
@param len: length of the string in bytes (including terminating 0)
@@ -254,7 +206,7 @@ static PyObject *py_get_strlit_contents(
len = uint64(-1);
qstring buf;
if ( len != uint64(-1) && ea_t(ea + len) < ea
|| get_strlit_contents(&buf, ea, len, type, NULL, flags) < 0 )
|| get_strlit_contents(&buf, ea, len, type, nullptr, flags) < 0 )
{
Py_RETURN_NONE;
}
@@ -285,13 +237,13 @@ static ea_t py_bin_search(
const size_t len = image.size();
const uchar *mask = imask.begin();
bytevec_t lmask;
if ( mask != NULL )
if ( mask != nullptr )
{
if ( *mask == 0xFF )
{
// a value of '0xFF' in the first byte meant "all bytes defined". We
// can thus turn that into a NULL mask.
mask = NULL;
// can thus turn that into a nullptr mask.
mask = nullptr;
}
else
{
-230
View File
@@ -1,230 +0,0 @@
#<pycode(py_bytes)>
#</pycode(py_bytes)>
#<pycode_BC695(py_bytes)>
ACFOPT_ASCII=0
ACFOPT_CONVMASK=0
ACFOPT_ESCAPE=STRCONV_ESCAPE
ACFOPT_UTF16=0
ACFOPT_UTF8=0
DOUNK_DELNAMES=DELIT_DELNAMES
DOUNK_EXPAND=DELIT_EXPAND
DOUNK_NOTRUNC=DELIT_NOTRUNC
DOUNK_SIMPLE=DELIT_SIMPLE
FF_ASCI=FF_STRLIT
FF_DWRD=FF_DWORD
FF_OWRD=FF_OWORD
FF_QWRD=FF_QWORD
FF_STRU=FF_STRUCT
FF_TBYT=FF_TBYTE
FF_VAR=0
FF_YWRD=FF_YWORD
FF_ZWRD=FF_ZWORD
GFE_NOVALUE=0
add_hidden_area=add_hidden_range
asciflag=strlit_flag
delValue=del_value
del_hidden_area=del_hidden_range
do16bit=create_16bit_data
do32bit=create_32bit_data
doAlign=create_align
doByte=create_byte
doCustomData=create_custdata
doDouble=create_double
doDwrd=create_dword
doExtra=ida_idaapi._BC695.false_p
doFloat=create_float
doImmd=set_immd
doOwrd=create_oword
doPackReal=create_packed_real
doQwrd=create_qword
doStruct=create_struct
doTbyt=create_tbyte
doWord=create_word
doYwrd=create_yword
doZwrd=create_zword
do_data_ex=create_data
do_unknown=del_items
def do_unknown_range(ea, size, flags):
return del_items(ea, flags, size) # swap 2 last args
dwrdflag=dword_flag
f_hasRef=f_has_xref
f_isASCII=f_is_strlit
f_isAlign=f_is_align
f_isByte=f_is_byte
f_isCode=f_is_code
f_isCustom=f_is_custom
f_isData=f_is_data
f_isDouble=f_is_double
f_isDwrd=f_is_dword
f_isFloat=f_is_float
f_isHead=f_is_head
f_isNotTail=f_is_not_tail
f_isOwrd=f_is_oword
f_isPackReal=f_is_pack_real
f_isQwrd=f_is_qword
f_isStruct=f_is_struct
f_isTail=f_is_tail
f_isTbyt=f_is_tbyte
f_isWord=f_is_word
f_isYwrd=f_is_yword
getDefaultRadix=get_default_radix
getFlags=get_full_flags
get_long=get_dword
get_full_byte=get_wide_byte
get_full_word=get_wide_word
get_full_long=get_wide_dword
get_original_long=get_original_dword
put_long=put_dword
patch_long=patch_dword
add_long=add_dword
getRadix=get_radix
get_ascii_contents=get_strlit_contents
get_ascii_contents2=get_strlit_contents
get_flags_novalue=get_flags
get_hidden_area=get_hidden_range
get_hidden_area_num=get_hidden_range_num
get_hidden_area_qty=get_hidden_range_qty
def get_many_bytes(ea, size):
return get_bytes(ea, size)
def get_many_bytes_ex(ea, size):
return get_bytes_and_mask(ea, size)
get_max_ascii_length=get_max_strlit_length
get_next_hidden_area=get_next_hidden_range
get_prev_hidden_area=get_prev_hidden_range
get_zero_areas=get_zero_ranges
getn_hidden_area=getn_hidden_range
hasExtra=has_extra_cmts
hasRef=has_xref
hasValue=has_value
hidden_area_t=hidden_range_t
isASCII=is_strlit
isAlign=is_align
isByte=is_byte
isChar=is_char
isChar0=is_char0
isChar1=is_char1
isCode=is_code
isCustFmt=is_custfmt
isCustFmt0=is_custfmt0
isCustFmt1=is_custfmt1
isCustom=is_custom
isData=is_data
isDefArg=is_defarg
isDefArg0=is_defarg0
isDefArg1=is_defarg1
isDouble=is_double
isDwrd=is_dword
isEnabled=is_mapped
isEnum=is_enum
isEnum0=is_enum0
isEnum1=is_enum1
isFloat=is_float
isFloat0=is_float0
isFloat1=is_float1
isFlow=is_flow
isFltnum=is_fltnum
isFop=is_forced_operand
isFunc=is_func
isHead=is_head
isImmd=has_immd
isLoaded=is_loaded
isNotTail=is_not_tail
isNum=is_numop
isNum0=is_numop0
isNum1=is_numop1
isOff=is_off
isOff0=is_off0
isOff1=is_off1
isOwrd=is_oword
isPackReal=is_pack_real
isQwrd=is_qword
isSeg=is_seg
isSeg0=is_seg0
isSeg1=is_seg1
isStkvar=is_stkvar
isStkvar0=is_stkvar0
isStkvar1=is_stkvar1
isStroff=is_stroff
isStroff0=is_stroff0
isStroff1=is_stroff1
isStruct=is_struct
isTail=is_tail
isTbyt=is_tbyte
isUnknown=is_unknown
isVoid=is_suspop
isWord=is_word
isYwrd=is_yword
isZwrd=is_zword
make_ascii_string=create_strlit
noExtra=ida_idaapi._BC695.false_p
noType=clr_op_type
owrdflag=oword_flag
patch_many_bytes=patch_bytes
print_ascii_string_type=print_strlit_type
put_many_bytes=put_bytes
qwrdflag=qword_flag
tbytflag=tbyte_flag
update_hidden_area=update_hidden_range
ywrdflag=yword_flag
zwrdflag=zword_flag
def get_opinfo(*args):
import ida_nalt
if isinstance(args[3], ida_nalt.opinfo_t): # 6.95: ea, n, flags, buf
ea, n, flags, buf = args
else: # 7.00: buf, ea, n, flags
buf, ea, n, flags = args
return _ida_bytes.get_opinfo(buf, ea, n, flags)
def doASCI(ea, length):
import ida_netnode
return create_data(ea, FF_STRLIT, length, ida_netnode.BADNODE)
FF_3BYTE=FF_BYTE
chunksize=chunk_size
chunkstart=chunk_start
do3byte=ida_idaapi._BC695.false_p
f_is3byte=ida_idaapi._BC695.false_p
freechunk=free_chunk
get_3byte=ida_idaapi._BC695.false_p
is3byte=ida_idaapi._BC695.false_p
nextaddr=next_addr
nextchunk=next_chunk
nextthat=next_that
prevaddr=prev_addr
prevchunk=prev_chunk
prevthat=prev_that
tribyteflag=byte_flag
alignflag=align_flag
binflag=bin_flag
byteflag=byte_flag
charflag=char_flag
codeflag=code_flag
custflag=cust_flag
custfmtflag=custfmt_flag
decflag=dec_flag
doubleflag=double_flag
enumflag=enum_flag
floatflag=float_flag
fltflag=flt_flag
hexflag=hex_flag
numflag=num_flag
octflag=oct_flag
offflag=off_flag
packrealflag=packreal_flag
segflag=seg_flag
stkvarflag=stkvar_flag
stroffflag=stroff_flag
struflag=stru_flag
wordflag=word_flag
invalidate_visea_cache=ida_idaapi._BC695.false_p
@bc695redef
def op_stroff(*args):
insn, n, path, path_len, delta = args
import ida_ua
if not isinstance(insn, ida_ua.insn_t):
tmp = ida_ua.insn_t()
ida_ua.decode_insn(tmp, insn)
insn = tmp
return _ida_bytes.op_stroff(insn, n, path, path_len, delta)
#</pycode_BC695(py_bytes)>
+31 -31
View File
@@ -14,7 +14,7 @@ class py_custom_data_type_t : public data_type_t
int dtid; // The data format id
PyObject *py_self;
// may create data? NULL means always may
// may create data? nullptr means always may
static bool idaapi s_may_create_at(
void *ud, // user-defined data
ea_t ea, // address of the future item
@@ -31,10 +31,10 @@ class py_custom_data_type_t : public data_type_t
bvsz_t(nbytes)));
PyW_ShowCbErr(S_MAY_CREATE_AT);
return py_result != NULL && PyObject_IsTrue(py_result.o);
return py_result != nullptr && PyObject_IsTrue(py_result.o);
}
// !=NULL means variable size datatype
// !=nullptr means variable size datatype
static asize_t idaapi s_calc_item_size(
// This function is used to determine
// size of the (possible) item at 'ea'
@@ -54,7 +54,7 @@ class py_custom_data_type_t : public data_type_t
bvea_t(ea),
bvasize_t(maxsize)));
if ( PyW_ShowCbErr(S_CALC_ITEM_SIZE) || py_result == NULL )
if ( PyW_ShowCbErr(S_CALC_ITEM_SIZE) || py_result == nullptr )
return 0;
uint64 num = 0;
@@ -111,12 +111,12 @@ public:
// may_create_at
py_attr = PyW_TryGetAttrString(py_self, S_MAY_CREATE_AT);
if ( py_attr != NULL && PyCallable_Check(py_attr.o) )
if ( py_attr != nullptr && PyCallable_Check(py_attr.o) )
may_create_at = s_may_create_at;
// calc_item_size
py_attr = PyW_TryGetAttrString(py_self, S_CALC_ITEM_SIZE);
if ( py_attr != NULL && PyCallable_Check(py_attr.o) )
if ( py_attr != nullptr && PyCallable_Check(py_attr.o) )
calc_item_size = s_calc_item_size;
// Now try to register
@@ -148,7 +148,7 @@ py_custom_data_type_t *py_custom_data_type_cast(data_type_t *inst)
{
// The following code seems to not work with gcc. Compiler bug? Not sure, but no time ATM
// py_custom_data_type_t *py_inst = (py_custom_data_type_t *) inst;
// py_custom_data_types.has(py_inst) ? py_inst : NULL;
// py_custom_data_types.has(py_inst) ? py_inst : nullptr;
if ( py_custom_data_types.has((py_custom_data_type_t *) inst) )
return (py_custom_data_type_t *) inst;
else
@@ -159,7 +159,7 @@ py_custom_data_type_t *py_custom_data_type_cast(data_type_t *inst)
static int py_custom_data_type_t_get_id(data_type_t *_dt)
{
py_custom_data_type_t *dt = py_custom_data_type_cast(_dt);
return dt != NULL ? dt->get_dtid() : -1;
return dt != nullptr ? dt->get_dtid() : -1;
}
//-------------------------------------------------------------------------
@@ -178,8 +178,8 @@ private:
static bool idaapi s_print( // convert to colored string
void *ud, // user-defined data
qstring *out, // output buffer. may be NULL
const void *value, // value to print. may not be NULL
qstring *out, // output buffer. may be nullptr
const void *value, // value to print. may not be nullptr
asize_t size, // size of value in bytes
ea_t current_ea, // current address (BADADDR if unknown)
int operand_num, // current operand number
@@ -191,7 +191,7 @@ private:
newref_t py_value(IDAPyBytes_FromMemAndSize(
(const char *)value,
Py_ssize_t(size)));
if ( py_value == NULL )
if ( py_value == nullptr )
return false;
py_custom_data_format_t *_this = (py_custom_data_format_t *) ud;
@@ -205,13 +205,13 @@ private:
dtid));
// Error while calling the function?
if ( PyW_ShowCbErr(S_PRINTF) || py_result == NULL )
if ( PyW_ShowCbErr(S_PRINTF) || py_result == nullptr )
return false;
bool ok = false;
if ( IDAPyStr_Check(py_result.o) )
{
if ( out != NULL )
if ( out != nullptr )
IDAPyStr_AsUTF8(out, py_result.o);
ok = true;
}
@@ -220,8 +220,8 @@ private:
static bool idaapi s_scan( // convert from uncolored string
void *ud, // user-defined data
bytevec_t *value, // output buffer. may be NULL
const char *input, // input string. may not be NULL
bytevec_t *value, // output buffer. may be nullptr
const char *input, // input string. may not be nullptr
ea_t current_ea, // current address (BADADDR if unknown)
int operand_num, // current operand number (-1 if unknown)
qstring *errstr) // buffer for error message
@@ -239,7 +239,7 @@ private:
operand_num));
// Error while calling the function?
if ( PyW_ShowCbErr(S_SCAN) || py_result == NULL )
if ( PyW_ShowCbErr(S_SCAN) || py_result == nullptr )
return false;
bool ok = false;
@@ -259,7 +259,7 @@ private:
if ( ok )
{
// Probe-only? Then okay, no need to extract the 'value'
if ( value == NULL )
if ( value == nullptr )
break;
Py_ssize_t len;
@@ -354,17 +354,17 @@ public:
// print cb
py_attr = PyW_TryGetAttrString(py_self, S_PRINTF);
if ( py_attr != NULL && PyCallable_Check(py_attr.o) )
if ( py_attr != nullptr && PyCallable_Check(py_attr.o) )
print = s_print;
// scan cb
py_attr = PyW_TryGetAttrString(py_self, S_SCAN);
if ( py_attr != NULL && PyCallable_Check(py_attr.o) )
if ( py_attr != nullptr && PyCallable_Check(py_attr.o) )
scan = s_scan;
// analyze cb
py_attr = PyW_TryGetAttrString(py_self, S_ANALYZE);
if ( py_attr != NULL && PyCallable_Check(py_attr.o) )
if ( py_attr != nullptr && PyCallable_Check(py_attr.o) )
analyze = s_analyze;
// Now try to register
@@ -401,7 +401,7 @@ py_custom_data_format_t *py_custom_data_format_cast(data_format_t *inst)
static int py_custom_data_format_t_get_id(data_format_t *_df)
{
py_custom_data_format_t *df = py_custom_data_format_cast(_df);
return df != NULL ? df->get_dfid() : -1;
return df != nullptr ? df->get_dfid() : -1;
}
//-------------------------------------------------------------------------
@@ -436,12 +436,12 @@ def register_custom_data_type(dt):
static int py_register_custom_data_type(PyObject *py_dt)
{
ref_t py_attr = PyW_TryGetAttrString(py_dt, "this");
if ( py_attr == NULL )
if ( py_attr == nullptr )
return -1;
py_custom_data_type_t *inst = NULL;
py_custom_data_type_t *inst = nullptr;
int cvt = SWIG_ConvertPtr(py_attr.o, (void **) &inst, SWIGTYPE_p_data_type_t, 0);
if ( !SWIG_IsOK(cvt) || py_custom_data_type_cast(inst) == NULL )
if ( !SWIG_IsOK(cvt) || py_custom_data_type_cast(inst) == nullptr )
return -1;
return inst->do_register();
}
@@ -461,11 +461,11 @@ def unregister_custom_data_type(dtid):
static bool py_unregister_custom_data_type(int dtid)
{
const data_type_t *_dt = get_custom_data_type(dtid);
if ( _dt == NULL )
if ( _dt == nullptr )
return false;
py_custom_data_type_t *dt = py_custom_data_type_cast((data_type_t *) _dt);
bool ok = dt != NULL;
bool ok = dt != nullptr;
if ( ok )
ok = dt->do_unregister();
else
@@ -490,12 +490,12 @@ def register_custom_data_format(df):
static int py_register_custom_data_format(PyObject *py_df)
{
ref_t py_attr = PyW_TryGetAttrString(py_df, "this");
if ( py_attr == NULL )
if ( py_attr == nullptr )
return -1;
py_custom_data_format_t *inst = NULL;
py_custom_data_format_t *inst = nullptr;
int cvt = SWIG_ConvertPtr(py_attr.o, (void **) &inst, SWIGTYPE_p_data_format_t, 0);
if ( !SWIG_IsOK(cvt) || py_custom_data_format_cast(inst) == NULL )
if ( !SWIG_IsOK(cvt) || py_custom_data_format_cast(inst) == nullptr )
return -1;
return inst->do_register();
@@ -516,11 +516,11 @@ def unregister_custom_data_format(dfid):
static bool py_unregister_custom_data_format(int dfid)
{
const data_format_t *_df = get_custom_data_format(dfid);
if ( _df == NULL )
if ( _df == nullptr )
return false;
py_custom_data_format_t *df = py_custom_data_format_cast((data_format_t *) _df);
bool ok = df != NULL;
bool ok = df != nullptr;
if ( ok )
ok = df->do_unregister();
else
+18 -33
View File
@@ -18,14 +18,14 @@ struct _cvt_status_t
_cvt_status_t(PyObject *_def_err_class, const char *_def_err_string)
: def_err_class(_def_err_class),
def_err_string(_def_err_string),
err_class(NULL),
err_class(nullptr),
ok(true) {}
~_cvt_status_t()
{
if ( !ok )
{
if ( err_class == NULL )
if ( err_class == nullptr )
{
err_class = def_err_class;
err_string = def_err_string;
@@ -50,7 +50,7 @@ static bool _to_reg_val(regval_t **out, regval_t *buf, const char *name, PyObjec
return false;
int cvt = SWIG_ConvertPtr(o, (void **) out, SWIGTYPE_p_regval_t, 0);
if ( SWIG_IsOK(cvt) && *out != NULL )
if ( SWIG_IsOK(cvt) && *out != nullptr )
return true;
register_info_t ri;
@@ -98,7 +98,7 @@ static bool _to_reg_val(regval_t **out, regval_t *buf, const char *name, PyObjec
fpvalue_t fpval;
_cvt_status_t status(PyExc_TypeError, "Expected float value");
double dbl = PyFloat_AsDouble(in);
status.ok = PyErr_Occurred() == NULL;
status.ok = PyErr_Occurred() == nullptr;
if ( status.ok )
status.ok = ieee_realcvt(&dbl, &fpval, 003 /*load double*/) == REAL_ERROR_OK;
if ( !status.ok )
@@ -240,7 +240,7 @@ static PyObject *_from_reg_val(
if ( !get_dbg_reg_info(name, &ri) ) // see _to_reg_val()
ri.dtype = dt_dword;
PyObject *res = NULL;
PyObject *res = nullptr;
_cvt_status_t status(PyExc_ValueError, "Conversion failed");
switch ( ri.dtype )
{
@@ -309,7 +309,7 @@ def dbg_is_loaded():
*/
static bool dbg_is_loaded()
{
return dbg != NULL;
return dbg != nullptr;
}
//-------------------------------------------------------------------------
@@ -330,7 +330,7 @@ static PyObject *refresh_debugger_memory()
invalidate_dbgmem_contents(BADADDR, 0);
// Ask the debugger to populate debug names
if ( dbg != NULL )
if ( dbg != nullptr )
dbg->suspended(true);
// Invalidate the cache
@@ -351,7 +351,7 @@ struct DBG_Hooks : public hooks_base_t
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
#ifdef TESTABLE_BUILD
qstring dump_state() { return hooks_base_t::dump_state(mappings, mappings_size); }
PyObject *dump_state(bool assert_all_reimplemented=false) { return hooks_base_t::dump_state(mappings, mappings_size, assert_all_reimplemented); }
#endif
// hookgenDBG:methods
@@ -409,21 +409,6 @@ static PyObject *py_list_bptgrps()
}
//------------------------------------------------------------------------
/*
#<pydoc>
def move_bpt_to_grp():
"""
Sets new group for the breakpoint
"""
pass
#</pydoc>
*/
static void move_bpt_to_grp(bpt_t *bpt, const char *grp_name)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
set_bpt_group(*bpt, grp_name);
}
/*
#<pydoc>
def internal_get_sreg_base():
@@ -450,7 +435,7 @@ static ssize_t py_write_dbg_memory(ea_t ea, PyObject *py_buf, size_t size=size_t
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( !dbg_can_query(dbg) || !IDAPyBytes_Check(py_buf) )
return -1;
char *buf = NULL;
char *buf = nullptr;
Py_ssize_t sz;
if ( IDAPyBytes_AsMemAndSize(py_buf, &buf, &sz) < 0 )
return -1;
@@ -487,14 +472,14 @@ static PyObject *py_set_reg_val(const char *regname, PyObject *o)
regval_t buf;
regval_t *ptr;
if ( !_to_reg_val(&ptr, &buf, regname, o) )
return NULL;
return nullptr;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
bool ok = set_reg_val(regname, ptr);
SWIG_PYTHON_THREAD_END_ALLOW;
if ( !ok )
{
PyErr_SetString(PyExc_Exception, "Failed to set register value");
return NULL;
return nullptr;
}
Py_RETURN_TRUE;
}
@@ -502,23 +487,23 @@ static PyObject *py_set_reg_val(const char *regname, PyObject *o)
//-------------------------------------------------------------------------
static PyObject *py_set_reg_val(thid_t tid, int regidx, PyObject *o)
{
if ( dbg == NULL )
if ( dbg == nullptr )
{
PyErr_SetString(PyExc_Exception, "No debugger loaded");
return NULL;
return nullptr;
}
if ( regidx < 0 || regidx >= dbg->nregs )
{
qstring buf;
buf.sprnt("Bad register index: %d", regidx);
PyErr_SetString(PyExc_Exception, buf.c_str());
return NULL;
return nullptr;
}
const register_info_t &ri = dbg->regs(regidx);
regval_t buf;
regval_t *ptr;
if ( !_to_reg_val(&ptr, &buf, ri.name, o) )
return NULL;
return nullptr;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
bool ok = set_reg_val(tid, regidx, ptr) > 0;
SWIG_PYTHON_THREAD_END_ALLOW;
@@ -531,14 +516,14 @@ static PyObject *py_request_set_reg_val(const char *regname, PyObject *o)
regval_t buf;
regval_t *ptr;
if ( !_to_reg_val(&ptr, &buf, regname, o) )
return NULL;
return nullptr;
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
bool ok = request_set_reg_val(regname, ptr);
SWIG_PYTHON_THREAD_END_ALLOW;
if ( !ok )
{
PyErr_SetString(PyExc_Exception, "Failed to request set register value");
return NULL;
return nullptr;
}
Py_RETURN_TRUE;
}
@@ -553,7 +538,7 @@ static PyObject *py_get_reg_val(const char *regname)
if ( !ok )
{
PyErr_SetString(PyExc_Exception, "Failed to retrieve register value");
return NULL;
return nullptr;
}
return _from_reg_val(regname, buf);
}
+2 -15
View File
@@ -55,19 +55,6 @@ def send_dbg_command(command):
else:
return False, "eval_idc_expr(): wrong return type: %d" % vtype
#</pycode(py_dbg)>
move_bpt_to_grp = set_bpt_group
#<pycode_BC695(py_dbg)>
import ida_idd
def get_process_info(n, pi):
pis = ida_idd.procinfo_vec_t()
cnt = get_processes(pis)
if n >= cnt:
return ida_idd.NO_PROCESS
pi.name = pis[n].name
pi.pid = pis[n].pid
return pi.pid
def get_process_qty():
pis = ida_idd.procinfo_vec_t()
return get_processes(pis)
#</pycode_BC695(py_dbg)>
#</pycode(py_dbg)>
+3 -3
View File
@@ -14,8 +14,8 @@ int idaapi py_enumerate_files_cb(const char *file, void *ud)
PyObject_CallFunctionObjArgs(
(PyObject *)ud,
py_file.o,
NULL));
return (py_ret == NULL || !PyNumber_Check(py_ret.o)) ? 1 /* stop enum on failure */ : PyInt_AsLong(py_ret.o);
nullptr));
return (py_ret == nullptr || !PyNumber_Check(py_ret.o)) ? 1 /* stop enum on failure */ : PyInt_AsLong(py_ret.o);
}
//-------------------------------------------------------------------------
@@ -79,7 +79,7 @@ linput_t *py_create_bytearray_linput(const qstring &s)
{
qstring *bytes = new qstring(s);
linput_t *li = create_bytearray_linput((const uchar *) bytes->c_str(), bytes->length());
if ( li != NULL )
if ( li != nullptr )
{
bytearray_linput_data_t &ld = bytearray_linput_data_vec.push_back();
ld.bytes = bytes;
-4
View File
@@ -1,4 +0,0 @@
#<pycode_BC695(py_diskio)>
create_generic_linput64=create_generic_linput
generic_linput64_t=generic_linput_t
#</pycode_BC695(py_diskio)>
-37
View File
@@ -1,37 +0,0 @@
#<pycode_BC695(py_enum)>
CONST_ERROR_ENUM=ENUM_MEMBER_ERROR_NAME
CONST_ERROR_ILLV=ENUM_MEMBER_ERROR_VALUE
CONST_ERROR_MASK=ENUM_MEMBER_ERROR_ENUM
CONST_ERROR_NAME=ENUM_MEMBER_ERROR_MASK
CONST_ERROR_VALUE=ENUM_MEMBER_ERROR_ILLV
add_const=add_enum_member
del_const=del_enum_member
get_const=get_enum_member
get_const_bmask=get_enum_member_bmask
get_const_by_name=get_enum_member_by_name
get_const_cmt=get_enum_member_cmt
get_const_enum=get_enum_member_enum
get_const_name=get_enum_member_name
get_const_serial=get_enum_member_serial
get_const_value=get_enum_member_value
get_first_const=get_first_enum_member
get_first_serial_const=get_first_serial_enum_member
get_last_const=get_last_enum_member
get_last_serial_const=get_last_serial_enum_member
get_next_const=get_next_enum_member
get_next_serial_const=get_next_serial_enum_member
get_prev_const=get_prev_enum_member
get_prev_serial_const=get_prev_serial_enum_member
set_const_cmt=set_enum_member_cmt
set_const_name=set_enum_member_name
def get_next_serial_enum_member(*args):
serial, cid = args[0], args[1]
if serial > 0xFF:
serial, cid = cid, serial
return _ida_enum.get_next_serial_enum_member(serial, cid)
def get_prev_serial_enum_member(*args):
serial, cid = args[0], args[1]
if serial > 0xFF:
serial, cid = cid, serial
return _ida_enum.get_prev_serial_enum_member(serial, cid)
#</pycode_BC695(py_enum)>
+2 -2
View File
@@ -42,7 +42,7 @@ static error_t py_call_idc_func(
// Call the Python function
newref_t py_result = PyObject_CallObject(
ctx->py_func.o,
pargs.empty() ? NULL : pargs[0].o);
pargs.empty() ? nullptr : pargs[0].o);
int cvt;
error_t err;
@@ -113,7 +113,7 @@ static bool pyw_convert_defvals(idc_values_t *out, PyObject *py_seq)
{
newref_t py_var(PySequence_GetItem(py_seq, i));
idc_value_t &idc_var = out->push_back();
if ( pyvar_to_idcvar(py_var, &idc_var, NULL) != CIP_OK )
if ( pyvar_to_idcvar(py_var, &idc_var, nullptr) != CIP_OK )
return false;
}
return true;
-38
View File
@@ -129,41 +129,3 @@ def add_idc_func(name, fp, args, defvals=(), flags=0):
flags)
#</pycode(py_expr)>
#<pycode_BC695(py_expr)>
Compile=compile_idc_file
CompileEx=compile_idc_file
CompileLine=compile_idc_text
VT_STR2=VT_STR
VarCopy=copy_idcv
VarDelAttr=del_idcv_attr
VarDeref=deref_idcv
VarFirstAttr=first_idcv_attr
def VarGetAttr(obj, attr, res, may_use_getattr=False):
return get_idcv_attr(res, obj, attr, may_use_getattr)
VarGetClassName=get_idcv_class_name
VarGetSlice=get_idcv_slice
VarInt64=idcv_int64
VarLastAttr=last_idcv_attr
VarMove=move_idcv
VarNextAttr=next_idcv_attr
VarObject=idcv_object
VarPrevAttr=prev_idcv_attr
VarPrint=print_idcv
VarRef=create_idcv_ref
VarSetAttr=set_idcv_attr
VarSetSlice=set_idcv_slice
VarString2=idcv_string
VarSwap=swap_idcvs
def calc_idc_expr(where, expr, res):
return eval_idc_expr(res, where, expr)
def calcexpr(where, expr, res):
return eval_expr(res, where, expr)
def dosysfile(complain_if_no_file, fname):
return exec_system_script(fname, complain_if_no_file)
def execute(line):
return eval_idc_snippet(None, line)
py_set_idc_func_ex=py_add_idc_func
def set_idc_func_ex(name, fp=None, args=(), flags=0):
return add_idc_func(name, fp, args, (), flags)
#</pycode_BC695(py_expr)>
-6
View File
@@ -1,6 +0,0 @@
#<pycode_BC695(py_fixup)>
FIXUP_CREATED=FIXUPF_CREATED
FIXUP_EXTDEF=FIXUPF_EXTDEF
FIXUP_REL=FIXUPF_REL
#</pycode_BC695(py_fixup)>
+15 -15
View File
@@ -96,7 +96,7 @@ private:
//--------------------------------------------------------------------------
bool _from_fp(FILE *fp)
{
if ( fp == NULL )
if ( fp == nullptr )
return false;
own = false;
fn.sprnt("<FILE * %p>", fp);
@@ -117,16 +117,16 @@ public:
}
//--------------------------------------------------------------------------
qfile_t(PyObject *pycapsule = NULL)
qfile_t(PyObject *pycapsule = nullptr)
{
fp = NULL;
fp = nullptr;
own = true;
fn.qclear();
__idc_cvt_id__ = PY_ICID_OPAQUE;
bool ok;
{
PYW_GIL_CHECK_LOCKED_SCOPE();
ok = pycapsule != NULL && PyCapsule_IsValid(pycapsule, VALID_CAPSULE_NAME);
ok = pycapsule != nullptr && PyCapsule_IsValid(pycapsule, VALID_CAPSULE_NAME);
}
if ( ok )
_from_capsule(pycapsule);
@@ -135,13 +135,13 @@ public:
//--------------------------------------------------------------------------
bool opened()
{
return fp != NULL;
return fp != nullptr;
}
//--------------------------------------------------------------------------
void close()
{
if ( fp == NULL )
if ( fp == nullptr )
return;
if ( own )
{
@@ -149,7 +149,7 @@ public:
qfclose(fp);
Py_END_ALLOW_THREADS;
}
fp = NULL;
fp = nullptr;
own = true;
}
@@ -166,7 +166,7 @@ public:
Py_BEGIN_ALLOW_THREADS;
fp = qfopen(filename, mode);
Py_END_ALLOW_THREADS;
if ( fp == NULL )
if ( fp == nullptr )
return false;
// Save file name
fn = filename;
@@ -177,8 +177,8 @@ public:
//--------------------------------------------------------------------------
static qfile_t *from_fp(FILE *fp)
{
if ( fp == NULL )
return NULL;
if ( fp == nullptr )
return nullptr;
qfile_t *qf = new qfile_t();
qf->own = false;
qf->fn.sprnt("<FILE * %p>", fp);
@@ -192,7 +192,7 @@ public:
{
return PyCapsule_IsValid(pycapsule, VALID_CAPSULE_NAME)
? from_fp((FILE *) PyCapsule_GetPointer(pycapsule, VALID_CAPSULE_NAME))
: NULL;
: nullptr;
}
//--------------------------------------------------------------------------
@@ -237,7 +237,7 @@ public:
do
{
char *buf = (char *) malloc(size + 5);
if ( buf == NULL )
if ( buf == nullptr )
break;
PYW_GIL_CHECK_LOCKED_SCOPE();
int r;
@@ -263,7 +263,7 @@ public:
do
{
char *buf = (char *) malloc(size + 5);
if ( buf == NULL )
if ( buf == nullptr )
break;
PYW_GIL_CHECK_LOCKED_SCOPE();
int r;
@@ -288,14 +288,14 @@ public:
do
{
char *buf = (char *) malloc(size + 5);
if ( buf == NULL )
if ( buf == nullptr )
break;
PYW_GIL_CHECK_LOCKED_SCOPE();
char *p;
Py_BEGIN_ALLOW_THREADS;
p = qfgets(buf, size, fp);
Py_END_ALLOW_THREADS;
if ( p == NULL )
if ( p == nullptr )
{
free(buf);
break;
+1 -1
View File
@@ -21,7 +21,7 @@ PyObject *py_get_stkvar(const insn_t &insn, const op_t &op, sval_t v)
PYW_GIL_CHECK_LOCKED_SCOPE();
sval_t actval;
member_t *member = get_stkvar(&actval, insn, op, v);
if ( member == NULL )
if ( member == nullptr )
Py_RETURN_NONE;
return Py_BuildValue("(O" PY_BV_SVAL ")",
-24
View File
@@ -1,24 +0,0 @@
#<pycode_BC695(py_frame)>
add_auto_stkpnt2=add_auto_stkpnt
# in fact, we cannot simulate add_stkvar[23] here, because we simply
# don't have the insn_t object -- and no way of retrieving it, either,
# since cmd is gone
@bc695redef
def get_stkvar(*args):
if len(args) == 2:
import ida_ua
insn, op, v = ida_ua.cmd, args[0], args[1]
else:
insn, op, v = args
return _ida_frame.get_stkvar(insn, op, v)
@bc695redef
def get_frame_part(*args):
import ida_funcs
if isinstance(args[0], ida_funcs.func_t): # 6.95: pfn, part, range
rnge, pfn, part = args[2], args[0], args[1]
else: # 7.00: range, pfn, part
rnge, pfn, part = args
return _ida_frame.get_frame_part(rnge, pfn, part)
#</pycode_BC695(py_frame)>
+1 -1
View File
@@ -18,7 +18,7 @@ static ea_t get_fchunk_referer(ea_t ea, size_t idx)
if ( !is_func_tail(pfn) )
return BADADDR;
func_parent_iterator_t dummy(pfn); // read referer info
if ( idx >= pfn->refqty || pfn->referers == NULL )
if ( idx >= pfn->refqty || pfn->referers == nullptr )
return BADADDR;
else
return pfn->referers[idx];
-21
View File
@@ -11,24 +11,3 @@ def calc_thunk_func_target(*args):
else:
return calc_thunk_func_target.__dict__["orig"](*args)
#</pycode(py_funcs)>
#<pycode_BC695(py_funcs)>
FUNC_STATIC=FUNC_STATICDEF
add_regarg2=add_regarg
clear_func_struct=lambda *args: True
def del_func_cmt(pfn, rpt):
set_func_cmt(pfn, "", rpt)
func_parent_iterator_set2=func_parent_iterator_set
func_setend=set_func_end
func_setstart=set_func_start
func_tail_iterator_set2=func_tail_iterator_set
def get_func_limits(pfn, limits):
import ida_range
rs = ida_range.rangeset_t()
if get_func_ranges(rs, pfn) == ida_idaapi.BADADDR:
return False
limits.start_ea = rs.begin().start_ea
limits.end_ea = rs.begin().end_ea
return True
get_func_name2=get_func_name
#</pycode_BC695(py_funcs)>
+2 -9
View File
@@ -39,15 +39,8 @@ class BasicBlock(object):
for i in range(0, q.nsucc(self.id)):
yield self._fc[q.succ(self.id, i)]
try:
if _BC695:
startEA = property(lambda self: self.start_ea, lambda self, ea: setattr(self, "start_ea", ea))
endEA = property(lambda self: self.end_ea, lambda self, ea: setattr(self, "end_ea", ea))
else:
startEA = ida_idaapi._make_badattr_property("startEA", "start_ea")
endEA = ida_idaapi._make_badattr_property("endEA", "end_ea")
except:
pass # BC695 not defined at compile-time
startEA = ida_idaapi._make_badattr_property("startEA", "start_ea")
endEA = ida_idaapi._make_badattr_property("endEA", "end_ea")
# -----------------------------------------------------------------------
class FlowChart(object):
+41 -41
View File
@@ -38,7 +38,7 @@ private:
{
iterator it = find(node_id);
if ( it == end() )
return NULL;
return nullptr;
return &it->second;
}
nodetext_cache_t *add(const int node_id, const char *text, bgcolor_t bgcolor = DEFCOLOR)
@@ -59,7 +59,7 @@ private:
// don't perform sanity check for 'grcode_destroyed', since if we called
// Close() on this object, it'll have been marked for later deletion in the
// UI, and thus when we end up here, the view has already been destroyed.
bool found = get_plugin_instance()->pycim_lookup_info.find_by_py_view(NULL, (py_graph_t *) obj);
bool found = get_plugin_instance()->pycim_lookup_info.find_by_py_view(nullptr, (py_graph_t *) obj);
QASSERT(30453, found || code == grcode_destroyed);
if ( found )
{
@@ -88,7 +88,7 @@ private:
int _on_hint_epilog(char **hint, ref_t result);
// graph is being destroyed
void on_graph_destroyed(mutable_graph_t * /*g*/ = NULL)
void on_graph_destroyed(mutable_graph_t * /*g*/ = nullptr)
{
refresh_needed = true;
node_cache.clear();
@@ -120,7 +120,7 @@ private:
"i",
item2->n));
PyW_ShowCbErr(S_ON_CLICK);
return result == NULL || !PyObject_IsTrue(result.o);
return result == nullptr || !PyObject_IsTrue(result.o);
}
// a graph node has been double clicked
@@ -139,13 +139,13 @@ private:
"i",
item->node));
PyW_ShowCbErr(S_ON_DBL_CLICK);
return result == NULL || !PyObject_IsTrue(result.o);
return result == nullptr || !PyObject_IsTrue(result.o);
}
// a graph viewer got focus
void on_gotfocus(graph_viewer_t * /*view*/)
{
if ( self.o == NULL )
if ( self.o == nullptr )
return;
PYW_GIL_CHECK_LOCKED_SCOPE();
@@ -153,14 +153,14 @@ private:
PyObject_CallMethod(
self.o,
(char *)S_ON_ACTIVATE,
NULL));
nullptr));
PyW_ShowCbErr(S_ON_ACTIVATE);
}
// a graph viewer lost focus
void on_lostfocus(graph_viewer_t * /*view*/)
{
if ( self.o == NULL )
if ( self.o == nullptr )
return;
PYW_GIL_CHECK_LOCKED_SCOPE();
@@ -168,7 +168,7 @@ private:
PyObject_CallMethod(
self.o,
(char *)S_ON_DEACTIVATE,
NULL));
nullptr));
PyW_ShowCbErr(S_ON_DEACTIVATE);
}
@@ -188,7 +188,7 @@ private:
"O",
py_nodes.o));
PyW_ShowCbErr(S_ON_CREATING_GROUP);
return (py_result == NULL || !IDAPyInt_Check(py_result.o))
return (py_result == nullptr || !IDAPyInt_Check(py_result.o))
? 1
: IDAPyInt_AsLong(py_result.o);
}
@@ -228,7 +228,7 @@ private:
// will return a place only when a node was previously selected
place_t *old_pl = get_custom_viewer_place(view, false, &x, &y);
if ( old_pl != NULL )
if ( old_pl != nullptr )
{
user_graph_place_t *new_pl = (user_graph_place_t *) old_pl->clone();
new_pl->node = nid;
@@ -251,7 +251,7 @@ private:
return -1;
TWidget *widget = find_widget(title);
if ( widget == NULL ) // create new widget
if ( widget == nullptr ) // create new widget
{
lookup_entry_t &e = get_plugin_instance()->pycim_lookup_info.new_entry(this);
// get a unique graph id
@@ -264,8 +264,8 @@ private:
graph_viewer_t *pview = create_graph_viewer(title, id, s_callback, this, 0);
this->self = ref_t();
display_widget(pview, WOPN_DP_TAB);
newref_t ret(PyObject_CallMethod(self, "hook", NULL));
if ( pview != NULL )
newref_t ret(PyObject_CallMethod(self, "hook", nullptr));
if ( pview != nullptr )
viewer_fit_window(pview);
bind(self, pview);
get_plugin_instance()->pycim_lookup_info.commit(e, view);
@@ -282,7 +282,7 @@ private:
public:
py_graph_t()
{
// form = NULL;
// form = nullptr;
refresh_needed = true;
}
@@ -292,7 +292,7 @@ public:
return;
py_graph_t *_this = (py_graph_t *) view_extract_this(self);
if ( _this == NULL || !get_plugin_instance()->pycim_lookup_info.find_by_py_view(NULL, _this) )
if ( _this == nullptr || !get_plugin_instance()->pycim_lookup_info.find_by_py_view(nullptr, _this) )
return;
_this->jump_to_node(nid);
@@ -302,9 +302,9 @@ public:
{
TWidget *view;
py_graph_t *_this = (py_graph_t *) view_extract_this(self);
if ( _this == NULL || !get_plugin_instance()->pycim_lookup_info.find_by_py_view(&view, _this) )
return NULL;
newref_t ret(PyObject_CallMethod(self, "unhook", NULL));
if ( _this == nullptr || !get_plugin_instance()->pycim_lookup_info.find_by_py_view(&view, _this) )
return nullptr;
newref_t ret(PyObject_CallMethod(self, "unhook", nullptr));
close_widget(view, WCLS_CLOSE_LATER);
return _this;
}
@@ -316,19 +316,19 @@ public:
py_graph_t *py_graph = (py_graph_t *) view_extract_this(self);
// New instance?
if ( py_graph == NULL )
if ( py_graph == nullptr )
{
qstring title;
if ( !PyW_GetStringAttr(self, S_M_TITLE, &title) )
return NULL;
return nullptr;
// Form already created? try to get associated py_graph instance
// so that we reuse it
TWidget *existing = find_widget(title.c_str());
if ( existing != NULL )
if ( existing != nullptr )
get_plugin_instance()->pycim_lookup_info.find_by_view((py_customidamemo_t**) &py_graph, existing);
if ( py_graph == NULL )
if ( py_graph == nullptr )
{
py_graph = new py_graph_t();
}
@@ -341,7 +341,7 @@ public:
if ( py_graph->initialize(self, title.c_str()) < 0 )
{
delete py_graph;
py_graph = NULL;
py_graph = nullptr;
}
}
else
@@ -379,17 +379,17 @@ void py_graph_t::on_user_refresh(mutable_graph_t *g)
// Check return value to OnRefresh() call
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t ret(PyObject_CallMethod(self.o, (char *)S_ON_REFRESH, NULL));
newref_t ret(PyObject_CallMethod(self.o, (char *)S_ON_REFRESH, nullptr));
PyW_ShowCbErr(S_ON_REFRESH);
if ( ret != NULL && PyObject_IsTrue(ret.o) )
if ( ret != nullptr && PyObject_IsTrue(ret.o) )
{
// Refer to the nodes
ref_t nodes(PyW_TryGetAttrString(self.o, S_M_NODES));
if ( ret != NULL && PyList_Check(nodes.o) )
if ( ret != nullptr && PyList_Check(nodes.o) )
{
// Refer to the edges
ref_t edges(PyW_TryGetAttrString(self.o, S_M_EDGES));
if ( ret != NULL && PyList_Check(edges.o) )
if ( ret != nullptr && PyList_Check(edges.o) )
{
// Resize the nodes
int max_nodes = abs(int(PyList_Size(nodes.o)));
@@ -416,7 +416,7 @@ void py_graph_t::on_user_refresh(mutable_graph_t *g)
for ( j=0; j < qnumber(edge_ids); j++ )
{
newref_t id(PySequence_GetItem(item.o, j));
if ( id == NULL || !IDAPyInt_Check(id.o) )
if ( id == nullptr || !IDAPyInt_Check(id.o) )
break;
int v = int(IDAPyInt_AsLong(id.o));
if ( v > max_nodes )
@@ -429,7 +429,7 @@ void py_graph_t::on_user_refresh(mutable_graph_t *g)
break;
// Add the edge
g->add_edge(edge_ids[0], edge_ids[1], NULL);
g->add_edge(edge_ids[0], edge_ids[1], nullptr);
}
}
}
@@ -441,10 +441,10 @@ bool py_graph_t::on_user_text(mutable_graph_t * /*g*/, int node, const char **st
{
// If already cached then return the value
nodetext_cache_t *c = node_cache.get(node);
if ( c != NULL )
if ( c != nullptr )
{
*str = c->text.c_str();
if ( bg_color != NULL )
if ( bg_color != nullptr )
*bg_color = c->bgcolor;
return true;
}
@@ -453,10 +453,10 @@ bool py_graph_t::on_user_text(mutable_graph_t * /*g*/, int node, const char **st
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t result(PyObject_CallMethod(self.o, (char *)S_ON_GETTEXT, "i", node));
PyW_ShowCbErr(S_ON_GETTEXT);
if ( result == NULL )
if ( result == nullptr )
return false;
bgcolor_t cl = bg_color == NULL ? DEFCOLOR : *bg_color;
bgcolor_t cl = bg_color == nullptr ? DEFCOLOR : *bg_color;
qstring buf;
// User returned a string?
@@ -472,16 +472,16 @@ bool py_graph_t::on_user_text(mutable_graph_t * /*g*/, int node, const char **st
newref_t py_str(PySequence_GetItem(result.o, 0));
newref_t py_color(PySequence_GetItem(result.o, 1));
if ( py_str != NULL && IDAPyStr_Check(py_str.o) )
if ( py_str != nullptr && IDAPyStr_Check(py_str.o) )
IDAPyStr_AsUTF8(&buf, py_str.o);
if ( py_color != NULL && PyNumber_Check(py_color.o) )
if ( py_color != nullptr && PyNumber_Check(py_color.o) )
cl = bgcolor_t(PyLong_AsUnsignedLong(py_color.o));
c = node_cache.add(node, buf.c_str(), cl);
}
*str = c->text.c_str();
if ( bg_color != NULL )
if ( bg_color != nullptr )
*bg_color = c->bgcolor;
return true;
@@ -510,7 +510,7 @@ int py_graph_t::_on_hint_epilog(char **hint, ref_t result)
{
// 'hint' must be allocated by qalloc() or qstrdup()
// out: 0-use default hint, 1-use proposed hint
bool ok = result != NULL && IDAPyStr_Check(result.o);
bool ok = result != nullptr && IDAPyStr_Check(result.o);
if ( ok )
{
qstring buf;
@@ -565,7 +565,7 @@ ssize_t py_graph_t::gr_callback(int code, va_list va)
{
graph_viewer_t *view = va_arg(va, graph_viewer_t *);
selection_item_t *item = va_arg(va, selection_item_t *);
handled = item != NULL && item->is_node;
handled = item != nullptr && item->is_node;
if ( handled )
ret = on_dblclicked(view, item);
}
@@ -667,13 +667,13 @@ ssize_t py_graph_t::gr_callback(int code, va_list va)
//-------------------------------------------------------------------------
bool pyg_show(PyObject *self)
{
return py_graph_t::Show(self) != NULL;
return py_graph_t::Show(self) != nullptr;
}
void pyg_close(PyObject *self)
{
py_graph_t *pyg = py_graph_t::Close(self);
if ( pyg != NULL )
if ( pyg != nullptr )
delete pyg;
}
-8
View File
@@ -183,11 +183,3 @@ class GraphViewer(ida_kernwin.CustomIDAMemo):
# return True
#</pydoc>
#</pycode(py_graph)>
#<pycode_BC695(py_graph)>
clr_node_info2=clr_node_info
del_node_info2=del_node_info
get_node_info2=get_node_info
set_node_info2=set_node_info
GraphViewer.GetTForm = GraphViewer.GetWidget
#</pycode_BC695(py_graph)>
+21 -9
View File
@@ -1,6 +1,7 @@
//-------------------------------------------------------------------------
//<code(py_hexrays)>
static bool do_not_check_ctree = false;
static bool idapython_exiting = false;
#ifdef WITH_HEXRAYS
#define DCLVL_SIMPLE 1
#define DCLVL_FULL 2
@@ -54,6 +55,7 @@ static void *idaapi idapython_dummy_hexdsp(int code, ...)
case hx_mop_t_erase:
case hx_mba_t_term:
case hx_valrng_t_clear:
case hx_udc_filter_t_cleanup:
{
#ifdef TESTABLE_BUILD
va_list va;
@@ -63,15 +65,18 @@ static void *idaapi idapython_dummy_hexdsp(int code, ...)
if ( code == hx_remitem )
QASSERT(30529, ((cinsn_t *)item)->op == cot_empty || ((cinsn_t *)item)->op == cit_empty);
else if ( code == hx_cexpr_t_cleanup )
QASSERT(30497, ((cexpr_t *)item)->op == cot_empty && ((cexpr_t *)item)->n == NULL);
QASSERT(30497, ((cexpr_t *)item)->op == cot_empty && ((cexpr_t *)item)->n == nullptr);
else if ( code == hx_cinsn_t_cleanup )
QASSERT(30498, ((cinsn_t *)item)->op == cit_empty && ((cinsn_t *)item)->cblock == NULL);
QASSERT(30498, ((cinsn_t *)item)->op == cit_empty && ((cinsn_t *)item)->cblock == nullptr);
else if ( code == hx_mop_t_erase )
QASSERT(30595, ((mop_t *)item)->t == mop_z && ((mop_t *)item)->nnn == NULL);
QASSERT(30595, ((mop_t *)item)->t == mop_z && ((mop_t *)item)->nnn == nullptr);
else if ( code == hx_mba_t_term )
QASSERT(30596, ((mba_t *)item)->blocks == NULL);
QASSERT(30596, ((mba_t *)item)->blocks == nullptr);
else if ( code == hx_valrng_t_clear )
QASSERT(30601, ((valrng_t *)item)->empty());
else if ( code == hx_udc_filter_t_cleanup )
QASSERT(30633, ((udc_filter_t *)item)->empty()
&& !install_microcode_filter((udc_filter_t *)item, false));
else
INTERR(30597);
va_end(va);
@@ -131,6 +136,12 @@ static void *idaapi idapython_dummy_hexdsp(int code, ...)
#endif
}
break;
case hx_hexrays_free:
#ifdef TESTABLE_BUILD
if ( !idapython_exiting )
goto BAD_CODE;
#endif
break;
default:
BAD_CODE:
#ifdef _DEBUG
@@ -140,7 +151,7 @@ BAD_CODE:
warning("Hex-Rays Decompiler got called from Python without being loaded");
break;
}
return NULL;
return nullptr;
}
hexdsp_t *get_idapython_hexdsp()
@@ -267,7 +278,7 @@ void hexrays_register_python_clearable_instance(
void *ptr,
hx_clearable_type_t type)
{
if ( ptr == NULL )
if ( ptr == nullptr )
return;
for ( size_t i = 0, n = python_clearables.size(); i < n; ++i )
if ( python_clearables[i].ptr == ptr )
@@ -378,8 +389,9 @@ static void ida_hexrays_init(void) {}
//-------------------------------------------------------------------------
static void ida_hexrays_term(void)
{
idapython_exiting = true;
idapython_unhook_from_notification_point(
HT_UI, ida_hexrays_ui_notification, NULL);
HT_UI, ida_hexrays_ui_notification, nullptr);
}
//-------------------------------------------------------------------------
@@ -424,7 +436,7 @@ bool py_init_hexrays_plugin(int flags=0)
// the idapython_hr-decompile test.)
vdui_t *py_get_widget_vdui(TWidget *f)
{
return hexdsp_inited() ? get_widget_vdui(f) : NULL;
return hexdsp_inited() ? get_widget_vdui(f) : nullptr;
}
//-------------------------------------------------------------------------
@@ -449,5 +461,5 @@ void py_term_hexrays_plugin(void) {}
//</inline(py_hexrays)>
//<init(py_hexrays)>
idapython_hook_to_notification_point(HT_UI, ida_hexrays_ui_notification, NULL, /*is_hooks_base=*/ false);
idapython_hook_to_notification_point(HT_UI, ida_hexrays_ui_notification, nullptr, /*is_hooks_base=*/ false);
//</init(py_hexrays)>
-7
View File
@@ -465,10 +465,3 @@ def remove_hexrays_callback(callback):
return 0
#</pycode(py_hexrays)>
#<pycode_BC695(py_hexrays)>
get_tform_vdui=get_widget_vdui
hx_get_tform_vdui=hx_get_widget_vdui
HEXRAYS_API_MAGIC1=(HEXRAYS_API_MAGIC>>32)
HEXRAYS_API_MAGIC2=(HEXRAYS_API_MAGIC&0xFFFFFFFF)
#</pycode_BC695(py_hexrays)>
+24 -4
View File
@@ -18,7 +18,7 @@ static void hexrays_unloading__unhook_hooks(void)
//-------------------------------------------------------------------------
Hexrays_Hooks::Hexrays_Hooks(uint32 _flags)
: hooks_base_t("ida_hexrays.Hexrays_Hooks", NULL, hook_type_t(-1), _flags),
: hooks_base_t("ida_hexrays.Hexrays_Hooks", nullptr, hook_type_t(-1), _flags),
hooked(false)
{
hexrays_hooks_instances.push_back(this);
@@ -66,7 +66,7 @@ struct Hexrays_Hooks : public hooks_base_t
return !hooked;
}
#ifdef TESTABLE_BUILD
qstring dump_state() { return hooks_base_t::dump_state(mappings, mappings_size); }
PyObject *dump_state(bool assert_all_reimplemented=false) { return hooks_base_t::dump_state(mappings, mappings_size, assert_all_reimplemented); }
#endif
// hookgenHEXRAYS:methods
@@ -82,10 +82,14 @@ struct Hexrays_Hooks : public hooks_base_t
}
private:
static ssize_t handle_create_hint_output(PyObject *o, vdui_t *, qstring *out_hint, int *out_implines)
static ssize_t handle_create_hint_output(
PyObject *o,
vdui_t *,
qstring *out_hint,
int *out_implines)
{
ssize_t rc = 0;
if ( o != NULL && PySequence_Check(o) && PySequence_Size(o) == 3 )
if ( o != nullptr && PySequence_Check(o) && PySequence_Size(o) == 3 )
{
newref_t py_rc(PySequence_GetItem(o, 0));
newref_t py_hint(PySequence_GetItem(o, 1));
@@ -111,5 +115,21 @@ private:
}
return rc;
}
static ssize_t handle_build_callinfo_output(
PyObject *o,
mblock_t *,
tinfo_t *,
mcallinfo_t **out_callinfo)
{
if ( o == nullptr || o == Py_None )
return 0;
mcallinfo_t *mi = nullptr;
const int cvt = SWIG_ConvertPtr(o, (void **) &mi, SWIGTYPE_p_mcallinfo_t, 0);
if ( !SWIG_IsOK(cvt) || mi == nullptr )
return 0;
*out_callinfo = new mcallinfo_t(*mi);
return 0;
}
};
//</inline(py_hexrays_hooks)>
+41 -91
View File
@@ -1,4 +1,6 @@
#<pycode(py_ida)>
import sys
def __make_idainfo_bound(func, attr):
def __func(self, *args):
return func(*args)
@@ -138,6 +140,11 @@ show_all_comments = inf_show_all_comments
show_comments = lambda *args: not inf_hide_comments()
show_repeatables = inf_show_repeatables
inf_get_comment = inf_get_cmt_indent
inf_set_comment = inf_set_cmt_indent
idainfo_comment_get = inf_get_cmt_indent
idainfo_comment_set = inf_set_cmt_indent
__make_idainfo_accessors(None, "is_graph_view", "set_graph_view")
if ida_idaapi.uses_swig_builtins:
@@ -168,95 +175,38 @@ def __wrap_hooks_callback(klass, new_name, old_name, do_call):
setattr(__wrapper, "__trampoline", True)
setattr(klass, new_name, __wrapper)
return __wrapper
def __set_module_dynattrs(modname, pdict):
import types
class _module_wrapper_t(types.ModuleType):
def __init__(self, orig):
self.orig = orig
def __getattribute__(self, name):
if name in pdict:
return pdict[name][0]()
elif name == "orig":
return types.ModuleType.__getattribute__(self, name)
elif name == "__dict__":
d = self.orig.__dict__
d = d.copy()
for name in pdict:
d[name] = pdict[name][0]()
return d
else:
return getattr(self.orig, name)
def __setattr__(self, name, value):
if name == "orig":
types.ModuleType.__setattr__(self, name, value)
else:
return setattr(self.orig, name, value)
sys.modules[modname] = _module_wrapper_t(sys.modules[modname])
__set_module_dynattrs(
__name__,
{
"MAXADDR" : (lambda: inf_get_privrange_start_ea(), None),
})
#</pycode(py_ida)>
#<pycode_BC695(py_ida)>
AF2_ANORET=AF_ANORET
AF2_CHKUNI=AF_CHKUNI
AF2_DATOFF=AF_DATOFF
AF2_DOCODE=AF_DOCODE
AF2_DODATA=AF_DODATA
AF2_FTAIL=AF_FTAIL
AF2_HFLIRT=AF_HFLIRT
AF2_JUMPTBL=AF_JUMPTBL
AF2_MEMFUNC=AF_MEMFUNC
AF2_PURDAT=AF_PURDAT
AF2_REGARG=AF_REGARG
AF2_SIGCMT=AF_SIGCMT
AF2_SIGMLT=AF_SIGMLT
AF2_STKARG=AF_STKARG
AF2_TRFUNC=AF_TRFUNC
AF2_VERSP=AF_VERSP
AF_ASCII=AF_STRLIT
ASCF_AUTO=STRF_AUTO
ASCF_COMMENT=STRF_COMMENT
ASCF_GEN=STRF_GEN
ASCF_SAVECASE=STRF_SAVECASE
ASCF_SERIAL=STRF_SERIAL
ASCF_UNICODE=STRF_UNICODE
INFFL_LZERO=OFLG_LZERO
ansi2idb=ida_idaapi._BC695.identity
idb2scr=ida_idaapi._BC695.identity
scr2idb=ida_idaapi._BC695.identity
showAllComments=show_all_comments
showComments=show_comments
showRepeatables=show_repeatables
toEA=to_ea
idainfo.ASCIIbreak = idainfo.strlit_break
idainfo.ASCIIpref = idainfo.strlit_pref
idainfo.ASCIIsernum = idainfo.strlit_sernum
idainfo.ASCIIzeroes = idainfo.strlit_zeroes
idainfo.asciiflags = idainfo.strlit_flags
idainfo.beginEA = idainfo.start_ea
idainfo.binSize = idainfo.bin_prefix_size
def my_get_proc_name(self):
return [self.procname, self.procname]
idainfo.get_proc_name = my_get_proc_name
idainfo.graph_view = property(idainfo.is_graph_view, idainfo.set_graph_view)
idainfo.mf = property(idainfo.is_be, idainfo.set_be)
idainfo.namelen = idainfo.max_autoname_len
idainfo.omaxEA = idainfo.omax_ea
idainfo.ominEA = idainfo.omin_ea
def make_outflags_accessors(bit):
def getter(self):
return (self.outflags & bit) != 0
def setter(self, value):
if value:
self.outflags |= bit
else:
self.outflags &= ~bit
return getter, setter
idainfo.s_assume = property(*make_outflags_accessors(OFLG_GEN_ASSUME))
idainfo.s_auto = property(idainfo.is_auto_enabled, idainfo.set_auto_enabled)
idainfo.s_null = property(*make_outflags_accessors(OFLG_GEN_NULL))
idainfo.s_org = property(*make_outflags_accessors(OFLG_GEN_ORG))
idainfo.s_prefseg = property(*make_outflags_accessors(OFLG_PREF_SEG))
idainfo.s_showauto = property(*make_outflags_accessors(OFLG_SHOW_AUTO))
idainfo.s_showpref = property(*make_outflags_accessors(OFLG_SHOW_PREF))
idainfo.s_void = property(*make_outflags_accessors(OFLG_SHOW_VOID))
idainfo.startIP = idainfo.start_ip
idainfo.startSP = idainfo.start_sp
def make_lflags_accessors(bit):
def getter(self):
return (self.lflags & bit) != 0
def setter(self, value):
if value:
self.lflags |= bit
else:
self.lflags &= ~bit
return getter, setter
idainfo.wide_high_byte_first = property(*make_lflags_accessors(LFLG_WIDE_HBF))
def make_obsolete_accessors():
def getter(self):
return False
def setter(self, value):
pass
return getter, setter
idainfo.allow_nonmatched_ops = property(*make_obsolete_accessors())
idainfo.check_manual_ops = property(*make_obsolete_accessors())
def __wrap_695_hooks_callback(klass, new_name, old_name, do_call):
w = __wrap_hooks_callback(klass, new_name, old_name, do_call)
setattr(w, "bc695_trampoline", True)
#</pycode_BC695(py_ida)>
+25 -25
View File
@@ -774,33 +774,33 @@ class IDAPython_displayhook:
_IDAPython_displayhook = IDAPython_displayhook()
sys.displayhook = _IDAPython_displayhook.displayhook
# ----------------------------------- helpers for bw-compat w/ 6.95 API
class __BC695:
def __init__(self):
self.FIXME = "FIXME @arnaud"
def false_p(self, *args):
return False
def identity(self, arg):
return arg
def dummy(self, *args):
pass
def replace_fun(self, new):
new.__dict__["bc695redef"] = True
_replace_module_function(new)
_BC695 = __BC695()
def _make_badattr_property(bad_attr, new_attr):
def _raise(*args):
raise AttributeError("Property %s has been replaced with %s" % (bad_attr, new_attr))
return property(_raise, _raise)
#</pycode(py_idaapi)>
#<pycode_BC695(py_idaapi)>
pycim_get_tcustom_control=pycim_get_widget
pycim_get_tform=pycim_get_widget
#</pycode_BC695(py_idaapi)>
def _make_one_time_warning_message(bad_attr, new_attr):
warned = [False]
def f():
if not warned[0]:
import traceback
# skip two frames to get the actual line which triggered the access
f = sys._getframe().f_back.f_back
traceback.print_stack(f)
print("Please use \"%s\" instead of \"%s\" (\"%s\" is kept for backward-compatibility, and will be removed soon.)" % (new_attr, bad_attr, bad_attr))
warned[0] = True
return f
def _make_missed_695bwcompat_property(bad_attr, new_attr, has_setter):
_notify_bwcompat = _make_one_time_warning_message(bad_attr, new_attr)
def _getter(self):
_notify_bwcompat()
return getattr(self, new_attr)
def _setter(self, v):
_notify_bwcompat()
return setattr(self, new_attr, v)
return property(_getter, _setter if has_setter else None)
#</pycode(py_idaapi)>
+15 -15
View File
@@ -137,17 +137,17 @@ public:
// class from and to IDC. The value of this variable must be set to two
int __idc_cvt_id__;
//--------------------------------------------------------------------------
loader_input_t(PyObject *pycapsule = NULL): li(NULL), own(OWN_NONE), __idc_cvt_id__(PY_ICID_OPAQUE)
loader_input_t(PyObject *pycapsule = nullptr): li(nullptr), own(OWN_NONE), __idc_cvt_id__(PY_ICID_OPAQUE)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( pycapsule != NULL && PyCapsule_IsValid(pycapsule, VALID_CAPSULE_NAME) )
if ( pycapsule != nullptr && PyCapsule_IsValid(pycapsule, VALID_CAPSULE_NAME) )
_from_capsule(pycapsule);
}
//--------------------------------------------------------------------------
void close()
{
if ( li == NULL )
if ( li == nullptr )
return;
PYW_GIL_GET;
@@ -157,7 +157,7 @@ public:
else if ( own == OWN_FROM_FP )
unmake_linput(li);
Py_END_ALLOW_THREADS;
li = NULL;
li = nullptr;
own = OWN_NONE;
}
@@ -174,14 +174,14 @@ public:
PYW_GIL_GET;
Py_BEGIN_ALLOW_THREADS;
li = open_linput(filename, remote);
if ( li != NULL )
if ( li != nullptr )
{
// Save file name
fn = filename;
own = OWN_CREATE;
}
Py_END_ALLOW_THREADS;
return li != NULL;
return li != nullptr;
}
//--------------------------------------------------------------------------
@@ -207,7 +207,7 @@ public:
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( !PyCapsule_IsValid(pycapsule, VALID_CAPSULE_NAME) )
return NULL;
return nullptr;
loader_input_t *l = new loader_input_t();
l->_from_capsule(pycapsule);
return l;
@@ -217,10 +217,10 @@ public:
static loader_input_t *from_fp(FILE *fp)
{
PYW_GIL_GET;
loader_input_t *l = NULL;
loader_input_t *l = nullptr;
Py_BEGIN_ALLOW_THREADS;
linput_t *fp_li = make_linput(fp);
if ( fp_li != NULL )
if ( fp_li != nullptr )
{
l = new loader_input_t();
l->own = OWN_FROM_FP;
@@ -244,7 +244,7 @@ public:
linput_t *l;
Py_BEGIN_ALLOW_THREADS;
l = create_memory_linput(start, size);
if ( l != NULL )
if ( l != nullptr )
{
close();
li = l;
@@ -252,7 +252,7 @@ public:
own = OWN_CREATE;
}
Py_END_ALLOW_THREADS;
return l != NULL;
return l != nullptr;
}
//--------------------------------------------------------------------------
@@ -284,7 +284,7 @@ public:
do
{
char *buf = (char *) malloc(sz + 5);
if ( buf == NULL )
if ( buf == nullptr )
break;
Py_BEGIN_ALLOW_THREADS;
qlgetz(li, fpos, buf, sz);
@@ -304,7 +304,7 @@ public:
buf.resize(len);
bool ok;
Py_BEGIN_ALLOW_THREADS;
ok = qlgets((char *) buf.begin(), buf.size(), li) != NULL;
ok = qlgets((char *) buf.begin(), buf.size(), li) != nullptr;
Py_END_ALLOW_THREADS;
if ( !ok )
Py_RETURN_NONE;
@@ -329,7 +329,7 @@ public:
//--------------------------------------------------------------------------
bool opened()
{
return li != NULL;
return li != nullptr;
}
//--------------------------------------------------------------------------
@@ -339,7 +339,7 @@ public:
do
{
char *buf = (char *) malloc(size + 5);
if ( buf == NULL )
if ( buf == nullptr )
break;
int r;
Py_BEGIN_ALLOW_THREADS;
+3 -3
View File
@@ -15,7 +15,7 @@ inline void mark_position(
ri.pos.cx = x;
ri.pos.cy = y;
lochist_entry_t loc(&ip, ri);
bookmarks_t::mark(loc, slot, NULL, comment, NULL);
bookmarks_t::mark(loc, slot, nullptr, comment, nullptr);
}
//-------------------------------------------------------------------------
@@ -25,7 +25,7 @@ inline ea_t get_marked_pos(int32 slot)
renderer_info_t ri;
lochist_entry_t loc(&ip, ri);
uint32 uslot = uint32(slot);
return bookmarks_t::get(&loc, NULL, &uslot, NULL)
return bookmarks_t::get(&loc, nullptr, &uslot, nullptr)
? loc.place()->toea()
: BADADDR;
}
@@ -37,7 +37,7 @@ inline PyObject *get_mark_comment(int32 slot)
idaplace_t ip(inf_get_min_ea(), 0);
renderer_info_t ri;
lochist_entry_t loc(&ip, ri);
if ( bookmarks_t::get_desc(&desc, loc, slot, NULL) )
if ( bookmarks_t::get_desc(&desc, loc, slot, nullptr) )
return IDAPyStr_FromUTF8(desc.c_str());
else
Py_RETURN_NONE;
+14 -14
View File
@@ -10,13 +10,13 @@ PyObject *py_appcall(
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( !PyList_Check(arg_list) )
return NULL;
return nullptr;
const type_t *type = (const type_t *) _type_or_none.begin();
const type_t *fields = (const p_list *) _fields.begin();
tinfo_t tif;
tinfo_t *ptif = NULL;
if ( tif.deserialize(NULL, &type, &fields) )
tinfo_t *ptif = nullptr;
if ( tif.deserialize(nullptr, &type, &fields) )
ptif = &tif;
// Convert Python arguments into IDC values
@@ -49,7 +49,7 @@ PyObject *py_appcall(
PyErr_SetString(
PyExc_ValueError,
"PyAppCall: Failed to convert Python values to IDC values");
return NULL;
return nullptr;
}
error_t ret;
@@ -89,13 +89,13 @@ PyObject *py_appcall(
ref_t py_appcall_exc;
idcvar_to_pyvar(idc_result, &py_appcall_exc);
PyErr_SetObject(PyExc_OSError, py_appcall_exc.o);
return NULL;
return nullptr;
}
// An error in the Appcall? (or an exception but AppCallOptions/DEBEV is not set)
else
{
PyErr_SetString(PyExc_Exception, qstrerror(ret));
return NULL;
return nullptr;
}
}
@@ -122,7 +122,7 @@ PyObject *py_appcall(
if ( idcvar_to_pyvar(idc_args[i], &py_item) == CIP_FAILED )
{
PyErr_SetString(PyExc_ValueError, "PyAppCall: Failed while converting IDC values to Python values");
return NULL;
return nullptr;
}
}
@@ -133,7 +133,7 @@ PyObject *py_appcall(
if ( idcvar_to_pyvar(idc_result, &py_result, PYWCVTF_STR_AS_BYTES) <= CIP_IMMUTABLE )
{
PyErr_SetString(PyExc_ValueError, "PyAppCall: Failed while converting IDC return value to Python return value");
return NULL;
return nullptr;
}
if ( (debug & IDA_DEBUG_APPCALL) != 0 )
{
@@ -169,7 +169,7 @@ static PyObject *dbg_get_registers()
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( dbg == NULL )
if ( dbg == nullptr )
Py_RETURN_NONE;
PyObject *py_list = PyList_New(dbg->nregs);
@@ -181,14 +181,14 @@ static PyObject *dbg_get_registers()
// Does this register have bit strings?
// (Make sure it does not use custom formats because bit_string would be the format name)
if ( ri.bit_strings != NULL && (ri.flags & REGISTER_CUSTFMT) == 0 )
if ( ri.bit_strings != nullptr && (ri.flags & REGISTER_CUSTFMT) == 0 )
{
int nbits = (int)b2a_width((int)get_dtype_size(ri.dtype), 0) * 4;
py_bits = PyList_New(nbits);
for ( int i=0; i < nbits; i++ )
{
const char *s = ri.bit_strings[i];
PyList_SetItem(py_bits, i, IDAPyStr_FromUTF8(s == NULL ? "" : s));
PyList_SetItem(py_bits, i, IDAPyStr_FromUTF8(s == nullptr ? "" : s));
}
}
else
@@ -255,8 +255,8 @@ static PyObject *dbg_read_memory(ea_t ea, size_t sz)
Py_RETURN_NONE;
// Create a Python string
PyObject *ret = IDAPyBytes_FromMemAndSize(NULL, Py_ssize_t(sz));
if ( ret == NULL )
PyObject *ret = IDAPyBytes_FromMemAndSize(nullptr, Py_ssize_t(sz));
if ( ret == nullptr )
Py_RETURN_NONE;
// Get the internal buffer
@@ -311,7 +311,7 @@ static PyObject *dbg_get_name()
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( dbg == NULL )
if ( dbg == nullptr )
Py_RETURN_NONE;
else
return IDAPyStr_FromUTF8(dbg->name);
+3 -7
View File
@@ -246,7 +246,7 @@ class Appcall_consts__(object):
def __getattr__(self, attr):
v = Appcall__.valueof(attr, self.__default)
if v is None:
raise ValueError("No constant with name " + attr)
raise AttributeError("No constant with name " + attr)
return v
# -----------------------------------------------------------------------
@@ -301,7 +301,7 @@ class Appcall__(object):
ea = name_or_ea
# could not resolve name or invalid address?
if ea == _ida_idaapi.BADADDR or not _ida_bytes.is_mapped(ea):
raise ValueError("Undefined function " + name_or_ea)
raise AttributeError("Undefined function " + name_or_ea)
return ea
@staticmethod
@@ -353,7 +353,7 @@ class Appcall__(object):
# resolve and raise exception on error
ea = self.__name_or_ea(name_or_ea)
if ea == _ida_idaapi.BADADDR:
raise ValueError("Undefined function " + name)
raise AttributeError("Undefined function " + name)
# Return the callable method
return Appcall_callable__(ea)
@@ -456,7 +456,3 @@ class Appcall__(object):
Appcall = Appcall__()
#</pycode(py_idd)>
#<pycode_BC695(py_idd)>
PROCESS_NO_THREAD=NO_THREAD
#</pycode_BC695(py_idd)>
+12 -12
View File
@@ -303,12 +303,12 @@ static PyObject *ph_get_instruc()
Py_ssize_t i = 0;
PYW_GIL_CHECK_LOCKED_SCOPE();
processor_t &ph = PH;
PyObject *py_result = PyTuple_New(ph.instruc_end - ph.instruc_start);
PyObject *py_result = PyList_New(ph.instruc_end - ph.instruc_start);
for ( const instruc_t *p = ph.instruc + ph.instruc_start, *end = ph.instruc + ph.instruc_end;
p != end;
++p )
{
PyTuple_SetItem(py_result, i++, Py_BuildValue("(sI)", p->name, p->feature));
PyList_SetItem(py_result, i++, Py_BuildValue("(sI)", p->name, p->feature));
}
return py_result;
}
@@ -363,7 +363,7 @@ static PyObject *ph_get_operand_info(
Py_BEGIN_ALLOW_THREADS;
do
{
if ( dbg == NULL || n == - 1 )
if ( dbg == nullptr || n == - 1 )
break;
// Allocate register space
@@ -447,7 +447,7 @@ struct IDP_Hooks : public hooks_base_t
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
#ifdef TESTABLE_BUILD
qstring dump_state() { return hooks_base_t::dump_state(mappings, mappings_size); }
PyObject *dump_state(bool assert_all_reimplemented=false) { return hooks_base_t::dump_state(mappings, mappings_size, assert_all_reimplemented); }
#endif
// hookgenIDP:methods
@@ -488,8 +488,8 @@ private:
static ssize_t cm_t_to_ssize_t(cm_t cm) { return ssize_t(cm); }
static bool _handle_qstring_output(PyObject *o, qstring *buf)
{
bool is_str = o != NULL && IDAPyStr_Check(o);
if ( is_str && buf != NULL )
bool is_str = o != nullptr && IDAPyStr_Check(o);
if ( is_str && buf != nullptr )
IDAPyStr_AsUTF8(buf, o);
Py_XDECREF(o);
return is_str;
@@ -508,7 +508,7 @@ private:
const char * /*line*/)
{
ssize_t rc = 0;
if ( o != NULL && IDAPyBytes_Check(o) )
if ( o != nullptr && IDAPyBytes_Check(o) )
{
char *s;
Py_ssize_t len = 0;
@@ -543,11 +543,11 @@ private:
&& PyBool_Check(py_bexec.o)
&& PyBool_Check(py_fexec.o) )
{
if ( pea != NULL )
if ( pea != nullptr )
*pea = nea;
if ( pbexec != NULL )
if ( pbexec != nullptr )
*pbexec = py_bexec.o == Py_True;
if ( pfexec != NULL )
if ( pfexec != nullptr )
*pfexec = py_fexec.o == Py_True;
return 1;
}
@@ -591,7 +591,7 @@ private:
{
rc = IDAPyInt_AsLong(py_rc.o);
*out_res = IDAPyInt_AsLong(py_out_res.o);
if ( out != NULL )
if ( out != nullptr )
out->swap(qs);
}
}
@@ -669,7 +669,7 @@ inline size_t sizeof_ldbl(void)
//-------------------------------------------------------------------------
static PyObject *_wrap_addr_in_pycapsule(void *addr)
{
return PyCapsule_New(addr, VALID_CAPSULE_NAME, NULL);
return PyCapsule_New(addr, VALID_CAPSULE_NAME, nullptr);
}
//-------------------------------------------------------------------------
+1 -1
View File
@@ -15,7 +15,7 @@ struct IDB_Hooks : public hooks_base_t
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
#ifdef TESTABLE_BUILD
qstring dump_state() { return hooks_base_t::dump_state(mappings, mappings_size); }
PyObject *dump_state(bool assert_all_reimplemented=false) { return hooks_base_t::dump_state(mappings, mappings_size, assert_all_reimplemented); }
#endif
// hookgenIDB:methods
+69 -76
View File
@@ -51,7 +51,7 @@ static PyObject *py_register_timer(int interval, PyObject *py_callback)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( py_callback == NULL || !PyCallable_Check(py_callback) )
if ( py_callback == nullptr || !PyCallable_Check(py_callback) )
Py_RETURN_NONE;
// An inner class hosting the callback method
@@ -61,14 +61,14 @@ static PyObject *py_register_timer(int interval, PyObject *py_callback)
{
PYW_GIL_GET;
py_timer_ctx_t *ctx = (py_timer_ctx_t *)ud;
newref_t py_result(PyObject_CallFunctionObjArgs(ctx->pyfunc.o, NULL));
newref_t py_result(PyObject_CallFunctionObjArgs(ctx->pyfunc.o, nullptr));
int ret = -1;
if ( PyErr_Occurred() )
{
msg("Exception in timer callback. This timer will be unregistered.\n");
PyErr_Print();
}
else if ( py_result != NULL )
else if ( py_result != nullptr )
{
ret = PyLong_AsLong(py_result.o);
}
@@ -86,9 +86,9 @@ static PyObject *py_register_timer(int interval, PyObject *py_callback)
tmr_t::callback,
ctx);
if ( ctx->timer_id != NULL )
if ( ctx->timer_id != nullptr )
{
return PyCapsule_New(ctx, VALID_CAPSULE_NAME, NULL);
return PyCapsule_New(ctx, VALID_CAPSULE_NAME, nullptr);
}
else
{
@@ -115,11 +115,11 @@ static bool py_unregister_timer(PyObject *py_timerctx)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( py_timerctx == NULL || !PyCapsule_IsValid(py_timerctx, VALID_CAPSULE_NAME) )
if ( py_timerctx == nullptr || !PyCapsule_IsValid(py_timerctx, VALID_CAPSULE_NAME) )
return false;
py_timer_ctx_t *ctx = (py_timer_ctx_t *) PyCapsule_GetPointer(py_timerctx, VALID_CAPSULE_NAME);
if ( ctx == NULL || !unregister_timer(ctx->timer_id) )
if ( ctx == nullptr || !unregister_timer(ctx->timer_id) )
return false;
python_timer_del(ctx);
@@ -144,7 +144,7 @@ static PyObject *py_choose_idasgn()
{
char *name = choose_idasgn();
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( name == NULL )
if ( name == nullptr )
{
Py_RETURN_NONE;
}
@@ -159,21 +159,23 @@ static PyObject *py_choose_idasgn()
//------------------------------------------------------------------------
/*
#<pydoc>
def get_highlight():
def get_highlight(v, flags=0):
"""
Returns the currently highlighted identifier and flags
@param v: The UI widget to operate on
@param flags: Optionally specify a slot (see kernwin.hpp), current otherwise
@return: a tuple (text, flags), or None if nothing
is highlighted or in case of error.
"""
pass
#</pydoc>
*/
static PyObject *py_get_highlight(TWidget *v)
static PyObject *py_get_highlight(TWidget *v, uint32 in_flags=0)
{
qstring buf;
uint32 flags;
bool ok = get_highlight(&buf, v, &flags);
bool ok = get_highlight(&buf, v, &flags, in_flags);
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( !ok )
Py_RETURN_NONE;
@@ -249,26 +251,15 @@ def read_selection(view, p0, p1):
*/
//------------------------------------------------------------------------
/*
#<pydoc>
def msg(text):
"""
Prints text into IDA's Output window
@param text: text to print
Can be Unicode, or string in local encoding
@return: number of bytes printed
"""
pass
#</pydoc>
*/
static PyObject *py_msg(PyObject *o)
{
const char *utf8 = NULL;
const char *utf8 = nullptr;
ref_t py_utf8;
if ( PyUnicode_Check(o) )
{
py_utf8 = newref_t(PyUnicode_AsUTF8String(o));
if ( PyErr_Occurred() != nullptr )
return nullptr;
utf8 = PyString_AsString(py_utf8.o);
}
else if ( PyString_Check(o) )
@@ -278,7 +269,7 @@ static PyObject *py_msg(PyObject *o)
else
{
PyErr_SetString(PyExc_TypeError, "A string expected");
return NULL;
return nullptr;
}
int rc;
Py_BEGIN_ALLOW_THREADS;
@@ -387,7 +378,7 @@ def process_ui_action(name):
*/
static bool py_process_ui_action(const char *name, int flags = 0)
{
return process_ui_action(name, flags, NULL);
return process_ui_action(name, flags, nullptr);
}
//------------------------------------------------------------------------
@@ -411,7 +402,7 @@ bool py_del_hotkey(PyObject *pyctx)
return false;
py_idchotkey_ctx_t *ctx = (py_idchotkey_ctx_t *) PyCapsule_GetPointer(pyctx, VALID_CAPSULE_NAME);
if ( ctx == NULL || !unregister_action(ctx->action_name.c_str()) )
if ( ctx == nullptr || !unregister_action(ctx->action_name.c_str()) )
return false;
delete ctx;
@@ -442,7 +433,7 @@ PyObject *py_add_hotkey(const char *hotkey, PyObject *pyfunc)
PYW_GIL_CHECK_LOCKED_SCOPE();
// Make sure a callable was passed
if ( !PyCallable_Check(pyfunc) )
return NULL;
return nullptr;
// Form the function name
qstring idc_func_name;
@@ -459,7 +450,7 @@ PyObject *py_add_hotkey(const char *hotkey, PyObject *pyfunc)
// Now add the global variable
idc_value_t *gvar = add_idc_gvar(idc_gvarname.c_str());
if ( gvar == NULL )
if ( gvar == nullptr )
break;
// The function body will call a registered IDC function that
@@ -482,7 +473,7 @@ PyObject *py_add_hotkey(const char *hotkey, PyObject *pyfunc)
gvar->set_pvoid(pyfunc);
// Return the context
return PyCapsule_New(ctx, VALID_CAPSULE_NAME, NULL);
return PyCapsule_New(ctx, VALID_CAPSULE_NAME, nullptr);
} while (false);
}
// Cleanup
@@ -500,7 +491,7 @@ static PyObject *py_take_database_snapshot(snapshot_t *ss)
bool b = take_database_snapshot(ss, &err_msg);
// Return (b, err_msg)
return Py_BuildValue("(Ns)", PyBool_FromLong(b), err_msg.empty() ? NULL : err_msg.c_str());
return Py_BuildValue("(Ns)", PyBool_FromLong(b), err_msg.empty() ? nullptr : err_msg.c_str());
}
//------------------------------------------------------------------------
@@ -529,7 +520,7 @@ static void idaapi py_ss_restore_callback(const char *err_msg, void *userdata)
Py_DECREF(o);
// We cannot raise an exception in the callback, just print it.
if ( result == NULL )
if ( result == nullptr )
PyErr_Print();
}
@@ -543,14 +534,14 @@ static PyObject *py_restore_database_snapshot(
// If there is no callback, just call the function directly
if ( pyfunc_or_none == Py_None )
return PyBool_FromLong(restore_database_snapshot(ss, NULL, NULL));
return PyBool_FromLong(restore_database_snapshot(ss, nullptr, nullptr));
// Create a new tuple or increase reference to pytuple_or_none
if ( pytuple_or_none == Py_None )
{
pytuple_or_none = PyTuple_New(0);
if ( pytuple_or_none == NULL )
return NULL;
if ( pytuple_or_none == nullptr )
return nullptr;
}
else
{
@@ -624,8 +615,8 @@ static int py_execute_sync(PyObject *py_callable, int reqf)
virtual int idaapi execute() override
{
PYW_GIL_GET;
newref_t py_result(PyObject_CallFunctionObjArgs(py_callable.o, NULL));
int ret = py_result == NULL || !IDAPyInt_Check(py_result.o)
newref_t py_result(PyObject_CallFunctionObjArgs(py_callable.o, nullptr));
int ret = py_result == nullptr || !IDAPyInt_Check(py_result.o)
? -1
: IDAPyInt_AsLong(py_result.o);
// if the requesting thread decided not to wait for the request to
@@ -716,8 +707,8 @@ static bool py_execute_ui_requests(PyObject *py_list)
// Get callable
ref_t py_callable = py_callables.at(py_callable_idx);
bool reschedule;
newref_t py_result(PyObject_CallFunctionObjArgs(py_callable.o, NULL));
reschedule = py_result != NULL && PyObject_IsTrue(py_result.o);
newref_t py_result(PyObject_CallFunctionObjArgs(py_callable.o, nullptr));
reschedule = py_result != nullptr && PyObject_IsTrue(py_result.o);
// No rescheduling? Then advance to the next callable
if ( !reschedule )
@@ -750,7 +741,7 @@ static bool py_execute_ui_requests(PyObject *py_list)
delete req;
return false;
}
execute_ui_requests(req, NULL);
execute_ui_requests(req, nullptr);
return true;
}
@@ -761,14 +752,16 @@ def set_dock_pos(src, dest, orient, left = 0, top = 0, right = 0, bottom = 0):
"""
Sets the dock orientation of a window relatively to another window.
Use the left, top, right, bottom parameters if DP_FLOATING is used,
or if you want to specify the width of docked windows.
@param src: Source docking control
@param dest: Destination docking control
@param orient: One of DOR_XXXX constants
@param left, top, right, bottom: These parameter if DOR_FLOATING is used, or if you want to specify the width of docked windows
@param orient: One of DP_XXXX constants
@return: Boolean
Example:
set_dock_pos('Structures', 'Enums', DOR_RIGHT) <- docks the Structures window to the right of Enums window
set_dock_pos('Structures', 'Enums', DP_RIGHT) <- docks the Structures window to the right of Enums window
"""
pass
#</pydoc>
@@ -796,19 +789,19 @@ public:
PyObject *get_dict()
{
newref_t json_module(PyImport_ImportModule("json"));
if ( json_module != NULL )
if ( json_module != nullptr )
{
borref_t json_globals(PyModule_GetDict(json_module.o));
if ( json_globals != NULL )
if ( json_globals != nullptr )
{
borref_t json_loads(PyDict_GetItemString(json_globals.o, "loads"));
if ( json_loads != NULL )
if ( json_loads != nullptr )
{
qstring clob;
if ( serialize_json(&clob, o) )
{
newref_t dict(PyObject_CallFunction(json_loads.o, "s", clob.c_str()));
if ( dict != NULL )
if ( dict != nullptr )
{
dict.incref();
return dict.o;
@@ -825,13 +818,13 @@ public:
if ( PyDict_Check(dict) )
{
newref_t json_module(PyImport_ImportModule("json"));
if ( json_module != NULL )
if ( json_module != nullptr )
{
borref_t json_globals(PyModule_GetDict(json_module.o));
if ( json_globals != NULL )
if ( json_globals != nullptr )
{
borref_t json_dumps(PyDict_GetItemString(json_globals.o, "dumps"));
if ( json_dumps != NULL )
if ( json_dumps != nullptr )
{
newref_t str(PyObject_CallFunction(json_dumps.o, "O", dict));
qstring buf;
@@ -866,7 +859,7 @@ struct UI_Hooks : public hooks_base_t
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
#ifdef TESTABLE_BUILD
qstring dump_state() { return hooks_base_t::dump_state(mappings, mappings_size); }
PyObject *dump_state(bool assert_all_reimplemented=false) { return hooks_base_t::dump_state(mappings, mappings_size, assert_all_reimplemented); }
#endif
// hookgenUI:methods
@@ -885,7 +878,7 @@ private:
static ssize_t handle_get_ea_hint_output(PyObject *o, qstring *buf, ea_t)
{
ssize_t rc = 0;
if ( o != NULL && IDAPyStr_Check(o) && IDAPyStr_AsUTF8(buf, o) )
if ( o != nullptr && IDAPyStr_Check(o) && IDAPyStr_AsUTF8(buf, o) )
rc = 1;
Py_XDECREF(o);
return rc;
@@ -893,17 +886,17 @@ private:
static ssize_t handle_hint_output(PyObject *o, qstring *hint, int *important_lines)
{
if ( o != NULL && PyTuple_Check(o) && PyTuple_Size(o) == 2 )
if ( o != nullptr && PyTuple_Check(o) && PyTuple_Size(o) == 2 )
{
borref_t el0(PyTuple_GetItem(o, 0));
qstring plug_hint;
if ( el0 != NULL
if ( el0 != nullptr
&& IDAPyStr_Check(el0.o)
&& IDAPyStr_AsUTF8(&plug_hint, el0.o)
&& !plug_hint.empty() )
{
borref_t el1(PyTuple_GetItem(o, 1));
if ( el1 != NULL && IDAPyInt_Check(el1.o) )
if ( el1 != nullptr && IDAPyInt_Check(el1.o) )
{
long lns = IDAPyInt_AsLong(el1.o);
if ( lns > 0 )
@@ -938,9 +931,9 @@ private:
{
if ( o == Py_None )
return 0;
TWidget *widget = NULL;
TWidget *widget = nullptr;
int cvt = SWIG_ConvertPtr(o, (void **) &widget, SWIGTYPE_p_TWidget, 0);
if ( !SWIG_IsOK(cvt) || widget == NULL )
if ( !SWIG_IsOK(cvt) || widget == nullptr )
return 0;
return ssize_t(widget);
}
@@ -958,10 +951,10 @@ bool py_register_action(action_desc_t *desc)
bool ok = register_action(*desc);
if ( ok )
{
// Let's set this to NULL, so when the wrapping Python action_desc_t
// Let's set this to nullptr, so when the wrapping Python action_desc_t
// instance is deleted, it doesn't try to delete the handler (See
// kernwin.i's action_desc_t::~action_desc_t()).
desc->handler = NULL;
desc->handler = nullptr;
}
return ok;
}
@@ -983,7 +976,7 @@ def py_attach_dynamic_action_to_popup(
popup_handle,
desc,
popuppath = None,
flags = 0)
flags = 0):
"""
Create & insert an action into the widget's popup menu
(::ui_attach_dynamic_action_to_popup).
@@ -1007,7 +1000,7 @@ bool py_attach_dynamic_action_to_popup(
TWidget *widget,
TPopupMenu *popup_handle,
action_desc_t *desc,
const char *popuppath = NULL,
const char *popuppath = nullptr,
int flags = 0)
{
bool ok = attach_dynamic_action_to_popup(
@@ -1017,7 +1010,7 @@ bool py_attach_dynamic_action_to_popup(
// the popup is dismissed,
// * fails: the action (and its handler) will be deleted right away
// Therefore, we must always drop ownership.
desc->handler = NULL;
desc->handler = nullptr;
return ok;
}
@@ -1025,13 +1018,13 @@ bool py_attach_dynamic_action_to_popup(
// twinline_t has a dummy destructor, that performs no cleanup.
struct disasm_line_t
{
disasm_line_t() : at(NULL) {}
disasm_line_t() : at(nullptr) {}
~disasm_line_t() { qfree(at); }
disasm_line_t(const disasm_line_t &other) { *this = other; }
disasm_line_t &operator=(const disasm_line_t &other)
{
qfree(at);
at = other.at == NULL ? NULL : other.at->clone();
at = other.at == nullptr ? nullptr : other.at->clone();
return *this;
}
place_t *at;
@@ -1121,7 +1114,7 @@ PyObject *py_set_nav_colorizer(PyObject *new_py_colorizer)
{
PYW_GIL_GET;
if ( py_colorizer == NULL ) // Shouldn't happen.
if ( py_colorizer == nullptr ) // Shouldn't happen.
return 0;
newref_t pyres = PyObject_CallFunction(
py_colorizer.o, "KK",
@@ -1129,7 +1122,7 @@ PyObject *py_set_nav_colorizer(PyObject *new_py_colorizer)
(unsigned long long) nbytes);
PyW_ShowCbErr("nav_colorizer");
uint32 rc = 0;
bool ok = pyres.o != NULL && PyLong_Check(pyres.o);
bool ok = pyres.o != nullptr && PyLong_Check(pyres.o);
if ( ok )
{
int overflow = 0;
@@ -1165,15 +1158,15 @@ PyObject *py_set_nav_colorizer(PyObject *new_py_colorizer)
// Always perform the call to set_nav_colorizer(): that has side-effects
// (e.g., updating the legend.)
bool first_install = py_colorizer == NULL;
bool first_install = py_colorizer == nullptr;
py_colorizer = borref_t(new_py_colorizer);
nav_colorizer_t *was_fun = NULL;
void *was_ud = NULL;
set_nav_colorizer(&was_fun, &was_ud, lambda_t::call_py_colorizer, NULL);
nav_colorizer_t *was_fun = nullptr;
void *was_ud = nullptr;
set_nav_colorizer(&was_fun, &was_ud, lambda_t::call_py_colorizer, nullptr);
if ( !first_install )
Py_RETURN_NONE;
PyObject *was_fun_ptr = PyCapsule_New((void *) was_fun, VALID_CAPSULE_NAME, NULL);
PyObject *was_ud_ptr = PyCapsule_New(was_ud, VALID_CAPSULE_NAME, NULL);
PyObject *was_fun_ptr = PyCapsule_New((void *) was_fun, VALID_CAPSULE_NAME, nullptr);
PyObject *was_ud_ptr = PyCapsule_New(was_ud, VALID_CAPSULE_NAME, nullptr);
PyObject *dict = PyDict_New();
PyDict_SetItemString(dict, "fun", was_fun_ptr);
PyDict_SetItemString(dict, "ud", was_ud_ptr);
@@ -1200,7 +1193,7 @@ uint32 py_call_nav_colorizer(
return 0;
borref_t py_fun(PyDict_GetItemString(dict, "fun"));
borref_t py_ud(PyDict_GetItemString(dict, "ud"));
if ( py_fun == NULL
if ( py_fun == nullptr
|| !PyCapsule_IsValid(py_fun.o, VALID_CAPSULE_NAME)
|| !PyCapsule_IsValid(py_ud.o, VALID_CAPSULE_NAME) )
{
@@ -1208,7 +1201,7 @@ uint32 py_call_nav_colorizer(
}
nav_colorizer_t *fun = (nav_colorizer_t *) PyCapsule_GetPointer(py_fun.o, VALID_CAPSULE_NAME);
void *ud = PyCapsule_GetPointer(py_ud.o, VALID_CAPSULE_NAME);
if ( fun == NULL )
if ( fun == nullptr )
return 0;
return fun(ea, nbytes, ud);
}
@@ -1320,7 +1313,7 @@ bool idaapi py_menu_item_callback(void *userdata)
newref_t result(PyEval_CallObject(func, args));
// We cannot raise an exception in the callback, just print it.
if ( result == NULL )
if ( result == nullptr )
{
PyErr_Print();
return false;
-355
View File
@@ -136,358 +136,3 @@ ida_ida.__wrap_hooks_callback(
from ida_pro import str2user
#</pycode(py_kernwin)>
#<pycode_BC695(py_kernwin)>
AST_DISABLE_FOR_FORM=AST_DISABLE_FOR_WIDGET
AST_ENABLE_FOR_FORM=AST_ENABLE_FOR_WIDGET
CB_CLOSE_IDB=CB_INVISIBLE
chtype_generic2=chtype_generic
chtype_segreg=chtype_srcp
close_tform=close_widget
find_tform=find_widget
get_current_tform=get_current_widget
def get_highlighted_identifier():
thing = get_highlight(get_current_viewer())
if thing and thing[1]:
return thing[0]
get_tform_title=get_widget_title
get_tform_type=get_widget_type
is_chooser_tform=is_chooser_widget
open_tform=display_widget
pyscv_get_tcustom_control=pyscv_get_widget
pyscv_get_tform=pyscv_get_widget
__read_selection70 = read_selection
def read_selection(*args):
if len(args) == 0:
# bw-compat
t0, t1, view = twinpos_t(), twinpos_t(), get_current_viewer()
sel = __read_selection70(view, t0, t1)
import ida_idaapi
a0, a1 = ida_idaapi.BADADDR, ida_idaapi.BADADDR
if sel:
a0, a1 = t0.place(view).toea(), t1.place(view).toea()
return sel, a0, a1
else:
return __read_selection70(*args)
readsel2=read_selection
switchto_tform=activate_widget
umsg=msg
def __wrap_uihooks_callback(name, do_call):
return ida_ida.__wrap_695_hooks_callback(UI_Hooks, name, name.replace("widget", "tform"), do_call)
__wrap_uihooks_callback("widget_visible", lambda cb, *args: cb(args[0], args[0]))
__wrap_uihooks_callback("widget_invisible", lambda cb, *args: cb(args[0], args[0]))
__wrap_uihooks_callback("populating_widget_popup", lambda cb, *args: cb(*args))
__wrap_uihooks_callback("finish_populating_widget_popup", lambda cb, *args: cb(*args))
__wrap_uihooks_callback("current_widget_changed", lambda cb, *args: cb(*args))
AskUsingForm=ask_form
HIST_ADDR=0
HIST_NUM=0
KERNEL_VERSION_MAGIC1=0
KERNEL_VERSION_MAGIC2=0
OpenForm=open_form
_askaddr=_ida_kernwin._ask_addr
_asklong=_ida_kernwin._ask_long
_askseg=_ida_kernwin._ask_seg
askaddr=ask_addr
askbuttons_c=ask_buttons
askfile_c=ask_file
def askfile2_c(forsave, defdir, filters, fmt):
if filters:
fmt = "FILTER %s\n%s" % (filters, fmt)
return ask_file(forsave, defdir, fmt)
askident=ask_ident
asklong=ask_long
def askqstr(defval, fmt):
return ask_str(defval, 0, fmt)
askseg=ask_seg
def askstr(hist, defval, fmt):
return ask_str(defval, hist, fmt)
asktext=ask_text
askyn_c=ask_yn
choose2_activate=choose_activate
choose2_close=choose_close
#choose2_create=choose_create
choose2_find=choose_find
#choose2_get_embedded=_choose_get_embedded_chobj_pointer
choose2_get_embedded_selection=lambda *args: None
choose2_refresh=choose_refresh
clearBreak=clr_cancelled
py_get_AskUsingForm=py_get_ask_form
py_get_OpenForm=py_get_open_form
setBreak=set_cancelled
wasBreak=user_cancelled
refresh_lists=refresh_choosers
# -------------------------------------------------------
class Choose2(object):
"""v.6.95 compatible chooser wrapper class."""
CH_MODAL = 0x01
CH_MULTI = 0x04
CH_MULTI_EDIT = 0x08
"""
The OnEditLine() callback will be called for all
selected items using the START_SEL/END_SEL
protocol.
This bit implies #CH_MULTI.
"""
CH_NOBTNS = 0x10
CH_ATTRS = 0x20
CH_NOIDB = 0x40
CH_BUILTIN_SHIFT = 19
CH_BUILTIN_MASK = 0x1F << CH_BUILTIN_SHIFT
# column flags (are specified in the widths array)
CHCOL_PLAIN = 0x00000000
CHCOL_PATH = 0x00010000
CHCOL_HEX = 0x00020000
CHCOL_DEC = 0x00030000
CHCOL_FORMAT = 0x00070000
# special values of the chooser index
NO_SELECTION = -1
"""there is no selected item"""
START_SEL = -2
"""before calling the first selected item"""
END_SEL = -3
"""after calling the last selected item"""
# the v.7.0 chooser object implementing the v.6.95 chooser
class ChooseWrapper(Choose):
def __init__(self, v695_chooser):
self.link = v695_chooser
# check what non-base callbacks we have
forbidden_cb = 0
for cb in [("OnInsertLine", Choose.CHOOSE_HAVE_INS ),
("OnDeleteLine", Choose.CHOOSE_HAVE_DEL ),
("OnEditLine", Choose.CHOOSE_HAVE_EDIT ),
("OnSelectLine", Choose.CHOOSE_HAVE_ENTER ),
("OnRefresh", Choose.CHOOSE_HAVE_REFRESH),
("OnSelectionChange", Choose.CHOOSE_HAVE_SELECT)]:
if not hasattr(self.link, cb[0]) or \
not callable(getattr(self.link, cb[0])):
forbidden_cb |= cb[1]
Choose.__init__(
self, self.link.title, self.link.cols,
forbidden_cb = forbidden_cb)
# redirect base callbacks to the v.6.95 chooser
def __getattr__(self, attr):
if attr in ["OnGetSize",
"OnGetLine",
"OnGetIcon",
"OnGetLineAttr",
"OnClose"]:
return getattr(self.link, attr)
return getattr(self.link, attr)
def Show(self, modal = False):
# set `flags` and `deflt`
self.flags = self.link.flags
if self.link.deflt == -1:
self.deflt = 0
else:
self.deflt = self.link.deflt - 1
self.flags |= Choose.CH_FORCE_DEFAULT
if (self.flags & Choose.CH_MULTI) != 0:
self.deflt = [self.deflt]
# copy simple attributes from v.6.95
for attr in ["title", "cols", "popup_names", "icon",
"x1", "y1", "x2", "y2",
"embedded", "width", "height"]:
if hasattr(self.link, attr):
setattr(self, attr, getattr(self.link, attr))
else:
delattr(self, attr)
return Choose.Show(self, modal)
def OnInsertLine(self, n):
# assert: hasattr(self.link, "OnInsertLine")
self.link.OnInsertLine()
# we preserve the selection
return (Choose.ALL_CHANGED, n)
if (self.link.flags & Choose2.CH_MULTI) == 0:
return (Choose.ALL_CHANGED, n)
else:
return [Choose.ALL_CHANGED] + n
def OnDeleteLine(self, n):
# assert: hasattr(self.link, "OnDeleteLine")
res = None
if (self.link.flags & Choose2.CH_MULTI) == 0:
res = self.link.OnDeleteLine(n)
else:
# assert: n is iterable and n
# call the callback multiple times
self.link.OnDeleteLine(Choose2.START_SEL)
res = None
for idx in n:
new_idx = self.link.OnDeleteLine(idx)
if res == None:
res = new_idx
self.link.OnDeleteLine(Choose2.END_SEL)
return [Choose.ALL_CHANGED] + self.adjust_last_item(res)
def OnEditLine(self, n):
# assert: hasattr(self.link, "OnEditLine")
if (self.link.flags & Choose2.CH_MULTI) == 0:
self.link.OnEditLine(n)
return (Choose.ALL_CHANGED, n) # preserve the selection
# assert: n is iterable and n
if (self.link.flags & Choose2.CH_MULTI_EDIT) == 0:
self.link.OnEditLine(n[0])
return [Choose.ALL_CHANGED] + n # preserve the selection
# call the callback multiple times
self.link.OnEditLine(Choose2.START_SEL)
for idx in n:
self.link.OnEditLine(idx)
self.link.OnEditLine(Choose2.END_SEL)
return [Choose.ALL_CHANGED] + n # preserve the selection
def OnSelectLine(self, n):
# assert: hasattr(self.link, "OnSelectLine")
if (self.link.flags & Choose2.CH_MULTI) == 0:
self.link.OnSelectLine(n)
return (Choose.ALL_CHANGED, n)
# assert: n is iterable and n
self.link.OnSelectLine(n[0])
return [Choose.ALL_CHANGED] + n # preserve the selection
def OnRefresh(self, n):
# assert: hasattr(self.link, "OnRefresh")
if (self.link.flags & Choose2.CH_MULTI) != 0:
# ignore all but the first item
n = n[0] if n else Choose.NO_SELECTION
res = self.link.OnRefresh(n)
return (Choose.ALL_CHANGED, res)
def OnSelectionChange(self, n):
# assert: hasattr(self.link, "OnSelectionChange")
if (self.link.flags & Choose2.CH_MULTI) == 0:
n = [n] if n != Choose.NO_SELECTION else []
self.link.OnSelectionChange(n)
def OnPopup(self, widget, popup_handle):
self.link._quick_commands.populate_popup(widget, popup_handle)
def __init__(self, title, cols, flags=0, popup_names=None,
icon=-1, x1=-1, y1=-1, x2=-1, y2=-1, deflt=-1,
embedded=False, width=None, height=None):
"""
Constructs a chooser window.
@param title: The chooser title
@param cols: a list of colums; each list item is a list of two items
example: [ ["Address", 10 | Choose2.CHCOL_HEX],
["Name", 30 | Choose2.CHCOL_PLAIN] ]
@param flags: One of CH_XXXX constants
@param deflt: Default starting item (1-based).
0 means that no item is selected,
-1 means that the first item selected for a new window and
that the selection is not updated for an existing window
@param popup_names: list of new captions to replace this list
["Insert", "Delete", "Edit", "Refresh"]
@param icon: Icon index (the icon should exist in ida resources or
an index to a custom loaded icon)
@param x1, y1, x2, y2: The default location (for txt-version)
@param embedded: Create as embedded chooser
@param width: Embedded chooser width
@param height: Embedded chooser height
"""
# remember attributes
self.title = title
self.flags = flags
self.cols = cols
self.deflt = deflt
self.popup_names = popup_names
self.icon = icon
self.x1 = x1
self.y1 = y1
self.x2 = x2
self.y2 = y2
self.embedded = embedded
self.width = width
self.height = height
# construct the v.7.0 chooser object
self.chobj = Choose2.ChooseWrapper(self)
def _qccb(ctx, cmd_id):
for idx in ctx.chooser_selection:
self.OnCommand(idx, cmd_id)
self._quick_commands = quick_widget_commands_t(_qccb)
# redirect methods to the v.7.0 chooser
def __getattr__(self, attr):
if attr not in ["GetEmbSelection",
"Activate",
"Refresh",
"Close",
"GetWidget"]:
raise AttributeError(attr)
return getattr(self.chobj, attr)
def Embedded(self):
"""
Creates an embedded chooser (as opposed to Show())
@return: Returns 1 on success
"""
return 1 if self.chobj.Embedded() == 0 else 0
def Show(self, modal=False):
"""
Activates or creates a chooser window
@param modal: Display as modal dialog
@return: For modal choosers it will return the selected item index (0-based)
or -1 in the case of error,
For non-modal choosers it will return 0
or -1 if the chooser was already open and is active now
"""
ret = self.chobj.Show(modal)
return -1 if ret < 0 else ret
def AddCommand(self,
caption,
flags = _ida_kernwin.CHOOSER_POPUP_MENU,
menu_index = -1,
icon = -1,
emb=None,
shortcut=None):
# Use the 'emb' as a sentinel. It will be passed the correct value
# from the EmbeddedChooserControl
if self.embedded and ((emb is None) or (emb != 2002)):
raise RuntimeError("Please add a command through "
"EmbeddedChooserControl.AddCommand()")
return self._quick_commands.add(
caption=caption,
flags=flags,
menu_index=menu_index,
icon=icon,
emb=emb,
shortcut=shortcut)
# callbacks
# def OnGetSize(self):
# def OnGetLine(self, n):
# def OnGetIcon(self, n):
# def OnGetLineAttr(self, n):
# def OnInsertLine(self):
# def OnDeleteLine(self, n):
# def OnEditLine(self, n):
# def OnSelectLine(self, n):
# def OnRefresh(self, n):
# def OnSelectionChange(self, sel_list):
# def OnClose(self):
# def OnCommand(self, n, cmd_id):
#</pycode_BC695(py_kernwin)>
+8 -8
View File
@@ -13,7 +13,7 @@ static bool textctrl_info_t_assign(PyObject *self, PyObject *other)
{
textctrl_info_t *lhs = textctrl_info_t_get_clink(self);
textctrl_info_t *rhs = textctrl_info_t_get_clink(other);
if ( lhs == NULL || rhs == NULL )
if ( lhs == nullptr || rhs == nullptr )
return false;
*lhs = *rhs;
@@ -24,7 +24,7 @@ static bool textctrl_info_t_assign(PyObject *self, PyObject *other)
static bool textctrl_info_t_set_text(PyObject *self, const char *s)
{
textctrl_info_t *ti = (textctrl_info_t *)pyobj_get_clink(self);
if ( ti == NULL )
if ( ti == nullptr )
return false;
ti->text = s;
return true;
@@ -34,14 +34,14 @@ static bool textctrl_info_t_set_text(PyObject *self, const char *s)
static const char *textctrl_info_t_get_text(PyObject *self)
{
textctrl_info_t *ti = (textctrl_info_t *)pyobj_get_clink(self);
return ti == NULL ? "" : ti->text.c_str();
return ti == nullptr ? "" : ti->text.c_str();
}
//-------------------------------------------------------------------------
static bool textctrl_info_t_set_flags(PyObject *self, unsigned int flags)
{
textctrl_info_t *ti = (textctrl_info_t *)pyobj_get_clink(self);
if ( ti == NULL )
if ( ti == nullptr )
return false;
ti->flags = flags;
return true;
@@ -51,14 +51,14 @@ static bool textctrl_info_t_set_flags(PyObject *self, unsigned int flags)
static unsigned int textctrl_info_t_get_flags(PyObject *self)
{
textctrl_info_t *ti = (textctrl_info_t *)pyobj_get_clink(self);
return ti == NULL ? 0 : ti->flags;
return ti == nullptr ? 0 : ti->flags;
}
//-------------------------------------------------------------------------
static bool textctrl_info_t_set_tabsize(PyObject *self, unsigned int tabsize)
{
textctrl_info_t *ti = (textctrl_info_t *)pyobj_get_clink(self);
if ( ti == NULL )
if ( ti == nullptr )
return false;
ti->tabsize = tabsize;
return true;
@@ -68,7 +68,7 @@ static bool textctrl_info_t_set_tabsize(PyObject *self, unsigned int tabsize)
static unsigned int textctrl_info_t_get_tabsize(PyObject *self)
{
textctrl_info_t *ti = (textctrl_info_t *)pyobj_get_clink(self);
return ti == NULL ? 0 : ti->tabsize;
return ti == nullptr ? 0 : ti->tabsize;
}
//---------------------------------------------------------------------------
@@ -286,7 +286,7 @@ static bool formchgcbfa_set_field_value(
case 7:
{
textctrl_info_t *ti = (textctrl_info_t *)pyobj_get_clink(py_val);
return ti != NULL && fa->set_text_value(fid, ti);
return ti != nullptr && fa->set_text_value(fid, ti);
}
// button - uint32
case 4:
+23 -8
View File
@@ -473,22 +473,30 @@ class Form(object):
Generic form input control.
It could be numeric control, string control, directory/file browsing, etc...
"""
def __init__(self, tp, width, swidth, hlp = None):
def __init__(self,
tp,
width,
swidth,
hlp=None,
is_relative_offset=False):
"""
@param width: Display width
@param swidth: String width
@param width: The maximum possible number of characters that
can be entered into the input field
@param swidth: The width of visible part of the input field
"""
Form.Control.__init__(self)
self.tp = tp
self.width = width
self.switdh = swidth
self.swidth = swidth
self.hlp = hlp
self.is_relative_offset = is_relative_offset
def get_tag(self):
return "%s%d:%s:%s:%s" % (
return "%s%d:%s%s:%s:%s" % (
self.tp, self.id,
"+" if self.is_relative_offset else "",
self.width,
self.switdh,
self.swidth,
":" if self.hlp is None else self.hlp)
def is_input_field(self):
@@ -499,10 +507,17 @@ class Form(object):
"""
A composite class serving as a base numeric input control class
"""
def __init__(self, tp=None, value=0, width=50, swidth=10, hlp=None):
def __init__(self,
tp=None,
value=0,
width=50,
swidth=10,
hlp=None,
is_relative_offset=False):
if tp is None:
tp = Form.FT_HEX
Form.InputControl.__init__(self, tp, width, swidth, hlp)
Form.InputControl.__init__(self,
tp, width, swidth, hlp, is_relative_offset)
Form.NumericArgument.__init__(self, self.tp, value)
+49 -49
View File
@@ -8,7 +8,7 @@ template <class T>
static void py_get_int(PyObject *self, T *prm, const char *name)
{
ref_t attr(PyW_TryGetAttrString(self, name));
if ( attr != NULL && attr.o != Py_None )
if ( attr != nullptr && attr.o != Py_None )
*prm = T(PyInt_AsLong(attr.o));
}
@@ -151,7 +151,7 @@ bool py_chooser_props_t::do_extract_from_pyobject(
// Get flags
out->flags = 0;
ref_t flags_attr(PyW_TryGetAttrString(o, S_FLAGS));
if ( flags_attr == NULL )
if ( flags_attr == nullptr )
RETERR("Missing or invalid mandatory '%s' attribute", S_FLAGS);
if ( IDAPyInt_Check(flags_attr.o) )
@@ -163,7 +163,7 @@ bool py_chooser_props_t::do_extract_from_pyobject(
// Get columns
int ncols = -1;
ref_t cols_attr(PyW_TryGetAttrString(o, "cols"));
if ( cols_attr != NULL )
if ( cols_attr != nullptr )
ncols = int(PyList_Size(cols_attr.o));
if ( ncols < 1 )
RETERR("Missing or invalid mandatory '%s' attribute", S_COLS);
@@ -179,7 +179,7 @@ bool py_chooser_props_t::do_extract_from_pyobject(
borref_t v(PyList_GetItem(list.o, 0));
// Extract string
if ( v != NULL )
if ( v != nullptr )
IDAPyStr_AsUTF8(&out->header_strings[i], v.o);
out->header[i] = out->header_strings[i].c_str();
@@ -187,7 +187,7 @@ bool py_chooser_props_t::do_extract_from_pyobject(
int width;
borref_t v2(PyList_GetItem(list.o, 1));
// No width? Guess width from column title
if ( v2 == NULL )
if ( v2 == nullptr )
width = ::qustrlen(out->header_strings[i].c_str());
else
width = PyInt_AsLong(v2.o);
@@ -197,7 +197,7 @@ bool py_chooser_props_t::do_extract_from_pyobject(
// Get popup names
// An array of 4 strings: ("Insert", "Delete", "Edit", "Refresh")
ref_t pn_attr(PyW_TryGetAttrString(o, S_POPUP_NAMES));
if ( pn_attr != NULL && PyList_Check(pn_attr.o) )
if ( pn_attr != nullptr && PyList_Check(pn_attr.o) )
{
Py_ssize_t npopups = PyList_Size(pn_attr.o);
if ( npopups > chooser_base_t::NSTDPOPUPS )
@@ -236,14 +236,14 @@ bool py_chooser_props_t::do_extract_from_pyobject(
// we can forbid some callbacks explicitly
uint32 forbidden_cb = 0;
ref_t forbidden_cb_attr(PyW_TryGetAttrString(o, "forbidden_cb"));
if ( forbidden_cb_attr != NULL && IDAPyInt_Check(forbidden_cb_attr.o) )
if ( forbidden_cb_attr != nullptr && IDAPyInt_Check(forbidden_cb_attr.o) )
forbidden_cb = uint32(IDAPyInt_AsLong(forbidden_cb_attr.o));
out->features = 0;
for ( int i = 0; i < qnumber(callbacks); ++i )
{
ref_t cb_attr(PyW_TryGetAttrString(o, callbacks[i].name));
bool have_cb = cb_attr != NULL && PyCallable_Check(cb_attr.o);
bool have_cb = cb_attr != nullptr && PyCallable_Check(cb_attr.o);
if ( have_cb && (forbidden_cb & callbacks[i].have) == 0 )
{
out->features |= callbacks[i].have;
@@ -259,7 +259,7 @@ bool py_chooser_props_t::do_extract_from_pyobject(
// Check if *embedded
ref_t emb_attr(PyW_TryGetAttrString(o, S_EMBEDDED));
if ( emb_attr != NULL && PyObject_IsTrue(emb_attr.o) == 1 )
if ( emb_attr != nullptr && PyObject_IsTrue(emb_attr.o) == 1 )
out->features |= CFEAT_EMBEDDED;
#undef RETERR
@@ -284,9 +284,9 @@ struct py_chooser_mixin_t
~py_chooser_mixin_t()
{
PYW_GIL_GET;
self = newref_t(NULL);
dirspec = newref_t(NULL);
dirtree = newref_t(NULL);
self = newref_t(nullptr);
dirspec = newref_t(nullptr);
dirtree = newref_t(nullptr);
_instances.del(this);
}
@@ -327,8 +327,8 @@ bool py_chooser_mixin_t::mixin_init(chooser_base_t *chobj)
if ( !has_feature(CFEAT_INIT) )
return chobj->chooser_base_t::init();
PYW_GIL_GET;
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *)S_ON_INIT, NULL));
if ( pyres.result == NULL || pyres.result.o == Py_None )
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *)S_ON_INIT, nullptr));
if ( pyres.result == nullptr || pyres.result.o == Py_None )
return chobj->chooser_base_t::init();
return bool(PyInt_AsLong(pyres.result.o));
}
@@ -337,8 +337,8 @@ bool py_chooser_mixin_t::mixin_init(chooser_base_t *chobj)
size_t py_chooser_mixin_t::mixin_get_count() const
{
PYW_GIL_GET;
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *)S_ON_GET_SIZE, NULL));
if ( pyres.result == NULL || pyres.result.o == Py_None )
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *)S_ON_GET_SIZE, nullptr));
if ( pyres.result == nullptr || pyres.result.o == Py_None )
return 0;
return size_t(PyInt_AsLong(pyres.result.o));
}
@@ -359,9 +359,9 @@ void py_chooser_mixin_t::mixin_get_row(
PyObject_CallMethod(
self.o, (char *)S_ON_GET_LINE,
"i", int(n)));
if ( PyErr_Occurred() != NULL )
if ( PyErr_Occurred() != nullptr )
return;
if ( list.result != NULL )
if ( list.result != nullptr )
{
if ( PySequence_Check(list.result.o) )
{
@@ -369,7 +369,7 @@ void py_chooser_mixin_t::mixin_get_row(
for ( int i = chobj->columns - 1; i >= 0; --i )
{
newref_t item(PySequence_GetItem(list.result.o, Py_ssize_t(i)));
if ( item != NULL )
if ( item != nullptr )
{
if ( !IDAPyStr_Check(item.o) )
{
@@ -389,7 +389,7 @@ void py_chooser_mixin_t::mixin_get_row(
"Expected 'list' for row %" FMT_Z, n);
}
}
if ( PyErr_Occurred() != NULL )
if ( PyErr_Occurred() != nullptr )
return;
*icon_ = chobj->icon;
@@ -399,9 +399,9 @@ void py_chooser_mixin_t::mixin_get_row(
PyObject_CallMethod(
self.o, (char *)S_ON_GET_ICON,
"i", int(n)));
if ( PyErr_Occurred() != NULL )
if ( PyErr_Occurred() != nullptr )
return;
if ( pyres.result != NULL )
if ( pyres.result != nullptr )
*icon_ = PyInt_AsLong(pyres.result.o);
}
@@ -411,14 +411,14 @@ void py_chooser_mixin_t::mixin_get_row(
PyObject_CallMethod(
self.o, (char *)S_ON_GET_LINE_ATTR,
"i", int(n)));
if ( PyErr_Occurred() != NULL )
if ( PyErr_Occurred() != nullptr )
return;
if ( pyres.result != NULL && PyList_Check(pyres.result.o) )
if ( pyres.result != nullptr && PyList_Check(pyres.result.o) )
{
PyObject *item;
if ( (item = PyList_GetItem(pyres.result.o, 0)) != NULL )
if ( (item = PyList_GetItem(pyres.result.o, 0)) != nullptr )
attrs->color = PyInt_AsLong(item);
if ( (item = PyList_GetItem(pyres.result.o, 1)) != NULL )
if ( (item = PyList_GetItem(pyres.result.o, 1)) != nullptr )
attrs->flags = PyInt_AsLong(item);
}
}
@@ -430,7 +430,7 @@ void py_chooser_mixin_t::mixin_closed(chooser_base_t *chobj)
PYW_GIL_GET;
if ( has_feature(CFEAT_ONCLOSE) )
{
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *)S_ON_CLOSE, NULL));
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *)S_ON_CLOSE, nullptr));
}
else
{
@@ -442,7 +442,7 @@ void py_chooser_mixin_t::mixin_closed(chooser_base_t *chobj)
newref_t tramp(PyObject_GetAttrString(self.o, "ui_hooks_trampoline"));
if ( tramp.o != Py_None )
{
newref_t unhook_res(PyObject_CallMethod(tramp.o, "unhook", NULL));
newref_t unhook_res(PyObject_CallMethod(tramp.o, "unhook", nullptr));
}
}
PyObject_DelAttrString(self.o, "ui_hooks_trampoline");
@@ -453,18 +453,18 @@ void py_chooser_mixin_t::mixin_closed(chooser_base_t *chobj)
dirtree_t *py_chooser_mixin_t::mixin_get_dirtree(const chooser_base_t * /*chobj*/)
{
if ( !has_feature(CFEAT_GETDIRTREE) )
return NULL;
return nullptr;
PYW_GIL_GET;
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *) S_ON_GET_DIRTREE, NULL));
if ( pyres.result == NULL )
return NULL;
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *) S_ON_GET_DIRTREE, nullptr));
if ( pyres.result == nullptr )
return nullptr;
if ( !PyTuple_Check(pyres.result.o) || PyTuple_Size(pyres.result.o) != 2 )
{
GET_DIRTREE_BAD_RESULT:
PyErr_Format(PyExc_TypeError, "%s must return a tuple (dirspec_t, dirtree_t)", S_ON_GET_DIRTREE);
return NULL;
return nullptr;
}
{
@@ -494,7 +494,7 @@ inode_t py_chooser_mixin_t::mixin_index_to_inode(size_t n) const
{
PYW_GIL_GET;
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *) S_ON_INDEX_TO_INODE, PY_BV_SZ, Py_ssize_t(n)));
if ( pyres.result != NULL )
if ( pyres.result != nullptr )
{
uint64 u64;
if ( PyW_GetNumber(pyres.result.o, &u64) )
@@ -512,7 +512,7 @@ diffpos_t py_chooser_mixin_t::mixin_index_to_diffpos(size_t n) const
{
PYW_GIL_GET;
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *) S_ON_INDEX_TO_DIFFPOS, PY_BV_SZ, Py_ssize_t(n)));
if ( pyres.result != NULL )
if ( pyres.result != nullptr )
{
uint64 u64;
if ( PyW_GetNumber(pyres.result.o, &u64) )
@@ -540,9 +540,9 @@ class py_chooser_t : public chooser_t, public py_chooser_mixin_t
return false;
PYW_GIL_GET;
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *) name, "i", n));
if ( pyres.result == NULL || pyres.result.o == Py_None )
if ( pyres.result == nullptr || pyres.result.o == Py_None )
return false;
if ( out != NULL )
if ( out != nullptr )
{
// [ changed, idx ]
cbret_t ret;
@@ -550,13 +550,13 @@ class py_chooser_t : public chooser_t, public py_chooser_mixin_t
{
{
newref_t item(PySequence_GetItem(pyres.result.o, 0));
if ( item.o != NULL && IDAPyInt_Check(item.o) )
if ( item.o != nullptr && IDAPyInt_Check(item.o) )
ret.changed = cbres_t(IDAPyInt_AsLong(item.o));
}
if ( ret.changed != NOTHING_CHANGED )
{
newref_t item(PySequence_GetItem(pyres.result.o, 1));
if ( item.o != NULL && IDAPyInt_Check(item.o) )
if ( item.o != nullptr && IDAPyInt_Check(item.o) )
ret.idx = ssize_t(IDAPyInt_AsSsize_t(item.o));
}
}
@@ -612,7 +612,7 @@ public:
virtual void idaapi select(ssize_t n) const override
{
_call(NULL, CFEAT_SELECT, S_ON_SELECTION_CHANGE, int(n));
_call(nullptr, CFEAT_SELECT, S_ON_SELECTION_CHANGE, int(n));
}
};
@@ -627,7 +627,7 @@ class py_chooser_multi_t : public chooser_multi_t, public py_chooser_mixin_t
PYW_GIL_GET;
ref_t py_list(PyW_SizeVecToPyList(*sel));
pycall_res_t pyres(PyObject_CallMethod(self.o, (char *) name, "O", py_list.o));
if ( pyres.result == NULL || pyres.result.o == Py_None )
if ( pyres.result == nullptr || pyres.result.o == Py_None )
return false;
// [ changed, idx, ... ]
cbres_t res;
@@ -643,7 +643,7 @@ class py_chooser_multi_t : public chooser_multi_t, public py_chooser_mixin_t
res = cbres_t(sel->front());
sel->erase(sel->begin());
}
if ( out != NULL )
if ( out != nullptr )
*out = res;
return true;
}
@@ -696,7 +696,7 @@ public:
virtual void idaapi select(const sizevec_t &_sel) const override
{
sizevec_t sel = _sel;
_call(NULL, CFEAT_SELECT, S_ON_SELECTION_CHANGE, &sel);
_call(nullptr, CFEAT_SELECT, S_ON_SELECTION_CHANGE, &sel);
}
};
@@ -705,7 +705,7 @@ chooser_base_t *py_chooser_mixin_t::create_concrete_instance(
py_chooser_props_t &props,
PyObject *o)
{
chooser_base_t *chobj = NULL;
chooser_base_t *chobj = nullptr;
if ( (props.flags & CH_MULTI) == 0 )
chobj = new py_chooser_t(o, props);
else
@@ -746,7 +746,7 @@ PyObject *choose_choose(PyObject *self)
if ( !py_chooser_props_t::extract_from_pyobject(&props, self, &errbuf) )
{
PyErr_SetString(PyExc_AttributeError, errbuf.c_str());
return NULL;
return nullptr;
}
chooser_base_t *chobj = py_chooser_mixin_t::create_concrete_instance(props, self);
@@ -763,7 +763,7 @@ PyObject *choose_choose(PyObject *self)
// Get *deflt
sizevec_t deflt;
ref_t deflt_attr(PyW_TryGetAttrString(self, "deflt"));
if ( deflt_attr != NULL
if ( deflt_attr != nullptr
&& PyList_Check(deflt_attr.o)
&& PyW_PyListToSizeVec(&deflt, deflt_attr.o) < 0 )
{
@@ -798,14 +798,14 @@ TWidget *choose_get_widget(PyObject *self)
qstring title, errbuf;
return py_chooser_props_t::get_title_from_pyobject(&title, self, &errbuf)
? find_widget(title.c_str())
: NULL;
: nullptr;
}
//------------------------------------------------------------------------
void choose_activate(PyObject *self)
{
TWidget *w = choose_get_widget(self);
if ( w != NULL )
if ( w != nullptr )
activate_widget(w, true);
}
@@ -825,7 +825,7 @@ PyObject *choose_create_embedded_chobj(PyObject *self)
else
{
PyErr_SetString(PyExc_AttributeError, errbuf.c_str());
return NULL;
return nullptr;
}
return PyLong_FromUnsignedLongLong(ptr);
}
+15 -15
View File
@@ -80,7 +80,7 @@ private:
"s",
line));
PyW_ShowCbErr(S_ON_EXECUTE_LINE);
return result != NULL && PyObject_IsTrue(result.o);
return result != nullptr && PyObject_IsTrue(result.o);
}
//--------------------------------------------------------------------------
@@ -114,7 +114,7 @@ private:
*vk_key,
shift));
bool ok = result != NULL && PyTuple_Check(result.o);
bool ok = result != nullptr && PyTuple_Check(result.o);
PyW_ShowCbErr(S_ON_KEYDOWN);
@@ -124,7 +124,7 @@ private:
if ( sz > 0 )
{
borref_t _r(PyTuple_GetItem(result.o, 0));
if ( _r != NULL && IDAPyStr_Check(_r.o) )
if ( _r != nullptr && IDAPyStr_Check(_r.o) )
IDAPyStr_AsUTF8(line, _r.o);
}
@@ -134,7 +134,7 @@ private:
if ( sz > col ) \
{ \
borref_t _r(PyTuple_GetItem(result.o, col)); \
if ( _r != NULL && PyThingy##_Check(_r.o) ) \
if ( _r != nullptr && PyThingy##_Check(_r.o) ) \
*out = PyThingy##_##AsThingy(_r.o); \
} \
} while ( false )
@@ -171,7 +171,7 @@ private:
line,
x));
bool ok = result != NULL && IDAPyStr_Check(result.o);
bool ok = result != nullptr && IDAPyStr_Check(result.o);
PyW_ShowCbErr(S_ON_COMPLETE_LINE);
if ( ok )
IDAPyStr_AsUTF8(completion, result.o);
@@ -197,7 +197,7 @@ private:
line,
x));
PyW_ShowCbErr(S_ON_FIND_COMPLETIONS);
if ( PyErr_Occurred() != NULL )
if ( PyErr_Occurred() != nullptr )
return false;
return idapython_convert_cli_completions(
out_completions, out_match_start, out_match_end, py_res);
@@ -218,10 +218,10 @@ public:
// Find an empty slot
for ( cli_idx = 0; cli_idx < MAX_PY_CLI; ++cli_idx )
{
if ( py_clis[cli_idx] == NULL )
if ( py_clis[cli_idx] == nullptr )
break;
}
py_cli_t *py_cli = NULL;
py_cli_t *py_cli = nullptr;
do
{
// No free slots?
@@ -237,7 +237,7 @@ public:
// Store 'flags'
{
ref_t flags_attr(PyW_TryGetAttrString(py_obj, S_FLAGS));
if ( flags_attr == NULL )
if ( flags_attr == nullptr )
py_cli->cli.flags = 0;
else
py_cli->cli.flags = PyLong_AsLong(flags_attr.o);
@@ -262,9 +262,9 @@ public:
if ( !PyObject_HasAttrString(py_obj, S_ON_EXECUTE_LINE) )
break;
py_cli->cli.execute_line = py_cli_cbs[cli_idx].execute_line;
py_cli->cli.unused = (void *) (PyObject_HasAttrString(py_obj, S_ON_COMPLETE_LINE) ? py_cli_cbs[cli_idx].complete_line : NULL);
py_cli->cli.keydown = PyObject_HasAttrString(py_obj, S_ON_KEYDOWN) ? py_cli_cbs[cli_idx].keydown : NULL;
py_cli->cli.find_completions = PyObject_HasAttrString(py_obj, S_ON_FIND_COMPLETIONS) ? py_cli_cbs[cli_idx].find_completions : NULL;
py_cli->cli.unused = (void *) (PyObject_HasAttrString(py_obj, S_ON_COMPLETE_LINE) ? py_cli_cbs[cli_idx].complete_line : nullptr);
py_cli->cli.keydown = PyObject_HasAttrString(py_obj, S_ON_KEYDOWN) ? py_cli_cbs[cli_idx].keydown : nullptr;
py_cli->cli.find_completions = PyObject_HasAttrString(py_obj, S_ON_FIND_COMPLETIONS) ? py_cli_cbs[cli_idx].find_completions : nullptr;
// install CLI
install_command_interpreter(&py_cli->cli);
@@ -287,7 +287,7 @@ public:
static void unbind(int cli_idx)
{
// Out of bounds or not set?
if ( cli_idx < 0 || cli_idx >= MAX_PY_CLI || py_clis[cli_idx] == NULL )
if ( cli_idx < 0 || cli_idx >= MAX_PY_CLI || py_clis[cli_idx] == nullptr )
return;
py_cli_t *py_cli = py_clis[cli_idx];
@@ -299,12 +299,12 @@ public:
delete py_cli;
}
py_clis[cli_idx] = NULL;
py_clis[cli_idx] = nullptr;
return;
}
};
py_cli_t *py_cli_t::py_clis[MAX_PY_CLI] = { NULL };
py_cli_t *py_cli_t::py_clis[MAX_PY_CLI] = { nullptr };
#define DECL_PY_CLI_CB(CBN) { s_execute_line##CBN, s_complete_line##CBN, s_keydown##CBN }
const py_cli_cbs_t py_cli_t::py_cli_cbs[MAX_PY_CLI] =
{
+59 -59
View File
@@ -84,12 +84,12 @@ public:
simpleline_t *get_line(size_t nline)
{
return nline >= lines.size() ? NULL : &lines[nline];
return nline >= lines.size() ? nullptr : &lines[nline];
}
simpleline_t *get_line(place_t *pl)
{
return pl == NULL ? NULL : get_line(((simpleline_place_t *)pl)->n);
return pl == nullptr ? nullptr : get_line(((simpleline_place_t *)pl)->n);
}
size_t count() const
@@ -183,7 +183,7 @@ class py_simplecustview_t
if ( _this->widget != viewer )
return 0;
place_t *place = va_arg(va, place_t *);
if ( place == NULL )
if ( place == nullptr )
return 0;
int *important_lines = va_arg(va, int *);
return _this->on_hint(place, important_lines, hint) ? 1 : 0;
@@ -259,7 +259,7 @@ class py_simplecustview_t
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_result(PyObject_CallMethod(py_self, (char *)S_ON_CLICK, "i", shift));
PyW_ShowCbErr(S_ON_CLICK);
return py_result != NULL && PyObject_IsTrue(py_result.o);
return py_result != nullptr && PyObject_IsTrue(py_result.o);
}
//--------------------------------------------------------------------------
@@ -269,7 +269,7 @@ class py_simplecustview_t
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_result(PyObject_CallMethod(py_self, (char *)S_ON_DBL_CLICK, "i", shift));
PyW_ShowCbErr(S_ON_DBL_CLICK);
return py_result != NULL && PyObject_IsTrue(py_result.o);
return py_result != nullptr && PyObject_IsTrue(py_result.o);
}
//--------------------------------------------------------------------------
@@ -277,26 +277,26 @@ class py_simplecustview_t
void on_curpos_changed()
{
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_result(PyObject_CallMethod(py_self, (char *)S_ON_CURSOR_POS_CHANGED, NULL));
newref_t py_result(PyObject_CallMethod(py_self, (char *)S_ON_CURSOR_POS_CHANGED, nullptr));
PyW_ShowCbErr(S_ON_CURSOR_POS_CHANGED);
}
//--------------------------------------------------------------------------
void on_close()
{
if ( py_self != NULL )
if ( py_self != nullptr )
{
// Call the close method if it is there and the object is still bound
if ( (features & HAVE_CLOSE) != 0 )
{
PYW_GIL_CHECK_LOCKED_SCOPE();
newref_t py_result(PyObject_CallMethod(py_self, (char *)S_ON_CLOSE, NULL));
newref_t py_result(PyObject_CallMethod(py_self, (char *)S_ON_CLOSE, nullptr));
PyW_ShowCbErr(S_ON_CLOSE);
}
// Cleanup
Py_DECREF(py_self);
py_self = NULL;
py_self = nullptr;
}
}
@@ -313,7 +313,7 @@ class py_simplecustview_t
shift));
PyW_ShowCbErr(S_ON_KEYDOWN);
return py_result != NULL && PyObject_IsTrue(py_result.o);
return py_result != nullptr && PyObject_IsTrue(py_result.o);
}
//--------------------------------------------------------------------------
@@ -329,12 +329,12 @@ class py_simplecustview_t
bvsz_t(ln)));
PyW_ShowCbErr(S_ON_HINT);
bool ok = py_result != NULL
bool ok = py_result != nullptr
&& PyTuple_Check(py_result.o)
&& PyTuple_Size(py_result.o) == 2;
if ( ok )
{
if ( important_lines != NULL )
if ( important_lines != nullptr )
*important_lines = PyInt_AsLong(PyTuple_GetItem(py_result.o, 0));
IDAPyStr_AsUTF8(&hint, PyTuple_GetItem(py_result.o, 1));
}
@@ -352,7 +352,7 @@ class py_simplecustview_t
PY_BV_SZ,
bvsz_t(menu_id)));
PyW_ShowCbErr(S_ON_POPUP_MENU);
return py_result != NULL && PyObject_IsTrue(py_result.o);
return py_result != nullptr && PyObject_IsTrue(py_result.o);
}
//--------------------------------------------------------------------------
@@ -365,7 +365,7 @@ class py_simplecustview_t
public:
py_simplecustview_t()
{
py_this = py_self = py_last_link = NULL;
py_this = py_self = py_last_link = nullptr;
init_vars();
}
~py_simplecustview_t() {}
@@ -376,26 +376,26 @@ public:
{
data.clear();
features = 0;
widget = NULL;
widget = nullptr;
}
void close()
{
if ( widget != NULL )
if ( widget != nullptr )
close_widget(widget, WCLS_SAVE | WCLS_CLOSE_LATER);
}
bool set_range(
const place_t *minplace = NULL,
const place_t *maxplace = NULL)
const place_t *minplace = nullptr,
const place_t *maxplace = nullptr)
{
if ( widget == NULL )
if ( widget == nullptr )
return false;
set_custom_viewer_range(
widget,
minplace == NULL ? data.get_min() : minplace,
maxplace == NULL ? data.get_max() : maxplace);
minplace == nullptr ? data.get_min() : minplace,
maxplace == nullptr ? data.get_max() : maxplace);
return true;
}
@@ -404,12 +404,12 @@ public:
int *x = 0,
int *y = 0)
{
return widget == NULL ? NULL : get_custom_viewer_place(widget, mouse, x, y);
return widget == nullptr ? nullptr : get_custom_viewer_place(widget, mouse, x, y);
}
bool refresh()
{
if ( widget == NULL )
if ( widget == nullptr )
return false;
refresh_custom_viewer(widget);
@@ -420,14 +420,14 @@ public:
{
// query the cursor position
int x, y;
if ( get_place(mouse, &x, &y) == NULL )
if ( get_place(mouse, &x, &y) == nullptr )
return false;
// query the line at the cursor
qstring qline;
get_current_line(&qline, mouse, true);
const char *line = qline.begin();
if ( line == NULL )
if ( line == nullptr )
return false;
if ( x >= (int)qstrlen(line) )
@@ -464,12 +464,12 @@ public:
bool create(const char *_title, int _features)
{
// Already created? (in the instance)
if ( widget != NULL )
if ( widget != nullptr )
return true;
// Already created? (in IDA windows list)
TWidget *found = find_widget(_title);
if ( found != NULL )
if ( found != nullptr )
return false;
title = _title;
@@ -496,7 +496,7 @@ public:
data.get_min(),
data.get_max(),
data.get_min(),
(const renderer_info_t *) NULL,
(const renderer_info_t *) nullptr,
data.get_ud(),
&handlers,
this);
@@ -558,7 +558,7 @@ public:
int x, y;
pl = get_place(mouse, &x, &y);
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( pl == NULL )
if ( pl == nullptr )
Py_RETURN_NONE;
return Py_BuildValue("(" PY_BV_SZ "ii)", bvsz_t(data.to_lineno(pl)), x, y);
}
@@ -568,7 +568,7 @@ public:
{
simpleline_t *r = data.get_line(nline);
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( r == NULL )
if ( r == nullptr )
Py_RETURN_NONE;
return Py_BuildValue("(sII)", r->line.c_str(), (unsigned int)r->color, (unsigned int)r->bgcolor);
}
@@ -596,7 +596,7 @@ public:
bool init(PyObject *py_link, const char *title)
{
// Already created?
if ( widget != NULL )
if ( widget != nullptr )
return true;
// Probe callbacks
@@ -628,15 +628,15 @@ public:
Py_INCREF(py_self);
// Return a reference to the C++ instance (only once)
if ( py_this == NULL )
py_this = PyCapsule_New(this, VALID_CAPSULE_NAME, NULL);
if ( py_this == nullptr )
py_this = PyCapsule_New(this, VALID_CAPSULE_NAME, nullptr);
return true;
}
bool show()
{
if ( widget == NULL && py_last_link != NULL )
if ( widget == nullptr && py_last_link != nullptr )
{
// Re-create the view (with same previous parameters)
if ( !init(py_last_link, title.c_str()) )
@@ -644,7 +644,7 @@ public:
}
// Closed already?
if ( widget == NULL )
if ( widget == nullptr )
return false;
display_widget(widget, WOPN_DP_TAB|WOPN_RESTORE);
@@ -653,20 +653,20 @@ public:
bool get_selection(size_t *x1, size_t *y1, size_t *x2, size_t *y2)
{
if ( widget == NULL )
if ( widget == nullptr )
return false;
twinpos_t p1, p2;
if ( !::read_selection(widget, &p1, &p2) )
return false;
if ( y1 != NULL )
if ( y1 != nullptr )
*y1 = data.to_lineno(p1.at);
if ( y2 != NULL )
if ( y2 != nullptr )
*y2 = data.to_lineno(p2.at);
if ( x1 != NULL )
if ( x1 != nullptr )
*x1 = size_t(p1.x);
if ( x2 != NULL )
if ( x2 != nullptr )
*x2 = p2.x;
return true;
}
@@ -687,7 +687,7 @@ public:
PYW_GIL_CHECK_LOCKED_SCOPE();
return PyCapsule_IsValid(py_this, VALID_CAPSULE_NAME)
? (py_simplecustview_t *) PyCapsule_GetPointer(py_this, VALID_CAPSULE_NAME)
: NULL;
: nullptr;
}
PyObject *get_pythis()
@@ -723,7 +723,7 @@ PyObject *pyscv_init(PyObject *py_link, const char *title)
bool pyscv_refresh(PyObject *py_this)
{
DECL_THIS;
return _this != NULL && _this->refresh();
return _this != nullptr && _this->refresh();
}
//--------------------------------------------------------------------------
@@ -731,7 +731,7 @@ PyObject *pyscv_get_current_line(PyObject *py_this, bool mouse, bool notags)
{
DECL_THIS;
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( _this == NULL )
if ( _this == nullptr )
Py_RETURN_NONE;
qstring line;
_this->get_current_line(&line, mouse, notags);
@@ -744,39 +744,39 @@ PyObject *pyscv_get_current_line(PyObject *py_this, bool mouse, bool notags)
bool pyscv_is_focused(PyObject *py_this)
{
DECL_THIS;
return _this != NULL && _this->is_focused();
return _this != nullptr && _this->is_focused();
}
size_t pyscv_count(PyObject *py_this)
{
DECL_THIS;
return _this == NULL ? 0 : _this->count();
return _this == nullptr ? 0 : _this->count();
}
bool pyscv_show(PyObject *py_this)
{
DECL_THIS;
return _this != NULL && _this->show();
return _this != nullptr && _this->show();
}
void pyscv_close(PyObject *py_this)
{
DECL_THIS;
if ( _this != NULL )
if ( _this != nullptr )
_this->close();
}
bool pyscv_jumpto(PyObject *py_this, size_t ln, int x, int y)
{
DECL_THIS;
return _this != NULL && _this->jumpto(ln, x, y);
return _this != nullptr && _this->jumpto(ln, x, y);
}
// Returns the line tuple
PyObject *pyscv_get_line(PyObject *py_this, size_t nline)
{
DECL_THIS;
if ( _this == NULL )
if ( _this == nullptr )
{
PYW_GIL_CHECK_LOCKED_SCOPE();
Py_RETURN_NONE;
@@ -789,7 +789,7 @@ PyObject *pyscv_get_line(PyObject *py_this, size_t nline)
PyObject *pyscv_get_pos(PyObject *py_this, bool mouse)
{
DECL_THIS;
if ( _this == NULL )
if ( _this == nullptr )
{
PYW_GIL_CHECK_LOCKED_SCOPE();
Py_RETURN_NONE;
@@ -801,7 +801,7 @@ PyObject *pyscv_get_pos(PyObject *py_this, bool mouse)
PyObject *pyscv_clear_lines(PyObject *py_this)
{
DECL_THIS;
if ( _this != NULL )
if ( _this != nullptr )
_this->clear();
PYW_GIL_CHECK_LOCKED_SCOPE();
Py_RETURN_NONE;
@@ -812,35 +812,35 @@ PyObject *pyscv_clear_lines(PyObject *py_this)
bool pyscv_add_line(PyObject *py_this, PyObject *py_sl)
{
DECL_THIS;
return _this != NULL && _this->add_line(py_sl);
return _this != nullptr && _this->add_line(py_sl);
}
//--------------------------------------------------------------------------
bool pyscv_insert_line(PyObject *py_this, size_t nline, PyObject *py_sl)
{
DECL_THIS;
return _this != NULL && _this->insert_line(nline, py_sl);
return _this != nullptr && _this->insert_line(nline, py_sl);
}
//--------------------------------------------------------------------------
bool pyscv_patch_line(PyObject *py_this, size_t nline, size_t offs, int value)
{
DECL_THIS;
return _this != NULL && _this->patch_line(nline, offs, value);
return _this != nullptr && _this->patch_line(nline, offs, value);
}
//--------------------------------------------------------------------------
bool pyscv_del_line(PyObject *py_this, size_t nline)
{
DECL_THIS;
return _this != NULL && _this->del_line(nline);
return _this != nullptr && _this->del_line(nline);
}
//--------------------------------------------------------------------------
PyObject *pyscv_get_selection(PyObject *py_this)
{
DECL_THIS;
if ( _this == NULL )
if ( _this == nullptr )
{
PYW_GIL_CHECK_LOCKED_SCOPE();
Py_RETURN_NONE;
@@ -853,7 +853,7 @@ PyObject *pyscv_get_current_word(PyObject *py_this, bool mouse)
{
DECL_THIS;
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( _this != NULL )
if ( _this != nullptr )
{
qstring word;
if ( _this->get_current_word(mouse, word) )
@@ -867,14 +867,14 @@ PyObject *pyscv_get_current_word(PyObject *py_this, bool mouse)
bool pyscv_edit_line(PyObject *py_this, size_t nline, PyObject *py_sl)
{
DECL_THIS;
return _this != NULL && _this->edit_line(nline, py_sl);
return _this != nullptr && _this->edit_line(nline, py_sl);
}
//-------------------------------------------------------------------------
TWidget *pyscv_get_widget(PyObject *py_this)
{
DECL_THIS;
return _this == NULL ? NULL : _this->get_widget();
return _this == nullptr ? nullptr : _this->get_widget();
}
+3 -3
View File
@@ -17,7 +17,7 @@ bool py_idaview_t::Bind(PyObject *self)
{
// Already a py_idaview_t associated to this object?
py_idaview_t *_this = (py_idaview_t *) view_extract_this(self);
if ( _this != NULL )
if ( _this != nullptr )
return false;
qstring title;
@@ -26,7 +26,7 @@ bool py_idaview_t::Bind(PyObject *self)
// Get the IDAView associated to this TWidget
TWidget *widget = find_widget(title.c_str());
if ( widget == NULL )
if ( widget == nullptr )
return false;
// Get unique py_idaview_t associated to that TWidget
@@ -55,7 +55,7 @@ bool py_idaview_t::Bind(PyObject *self)
bool py_idaview_t::Unbind(PyObject *self)
{
py_idaview_t *_this = (py_idaview_t *) view_extract_this(self);
if ( _this == NULL )
if ( _this == nullptr )
return false;
_this->unbind(true);
return true;
+11 -11
View File
@@ -24,7 +24,7 @@ class plgform_t
PyObject_CallMethod(
_this->py_obj.o,
(char *)S_ON_CLOSE, "O",
PyCapsule_New(widget, VALID_CAPSULE_NAME, NULL)));
PyCapsule_New(widget, VALID_CAPSULE_NAME, nullptr)));
PyW_ShowCbErr(S_ON_CLOSE);
}
_this->unhook();
@@ -36,7 +36,7 @@ class plgform_t
void unhook()
{
idapython_unhook_from_notification_point(HT_UI, s_callback, this);
widget = NULL;
widget = nullptr;
// Call DECREF at last, since it may trigger __del__
PYW_GIL_CHECK_LOCKED_SCOPE();
@@ -44,7 +44,7 @@ class plgform_t
}
public:
plgform_t() : widget(NULL) {}
plgform_t() : widget(nullptr) {}
bool show(
PyObject *obj,
@@ -55,7 +55,7 @@ public:
// Already displayed?
TWidget *f = find_widget(caption);
if ( f != NULL )
if ( f != nullptr )
{
// Our form?
if ( f == widget )
@@ -71,12 +71,12 @@ public:
// Create a form
widget = create_empty_widget(caption);
if ( widget == NULL )
if ( widget == nullptr )
return false;
if ( !idapython_hook_to_notification_point(HT_UI, s_callback, this, /*is_hooks_base=*/ false) )
{
widget = NULL;
widget = nullptr;
return false;
}
@@ -92,7 +92,7 @@ public:
PyObject_CallMethod(
py_obj.o,
(char *)S_ON_CREATE, "O",
PyCapsule_New(widget, VALID_CAPSULE_NAME, NULL)));
PyCapsule_New(widget, VALID_CAPSULE_NAME, nullptr)));
PyW_ShowCbErr(S_ON_CREATE);
if ( !create_only )
@@ -102,7 +102,7 @@ public:
void close(int options = 0)
{
if ( widget != NULL )
if ( widget != nullptr )
close_widget(widget, options);
}
@@ -140,7 +140,7 @@ static bool plgform_show(
int options = WOPN_DP_TAB|WOPN_RESTORE)
{
DECL_PLGFORM;
return plgform != NULL && plgform->show(py_obj, caption, options);
return plgform != nullptr && plgform->show(py_obj, caption, options);
}
static void plgform_close(
@@ -148,7 +148,7 @@ static void plgform_close(
int options)
{
DECL_PLGFORM;
if ( plgform != NULL )
if ( plgform != nullptr )
plgform->close(options);
}
@@ -156,7 +156,7 @@ static TWidget *plgform_get_widget(
PyObject *py_link)
{
DECL_PLGFORM;
return plgform != NULL ? plgform->get_widget() : NULL;
return plgform != nullptr ? plgform->get_widget() : nullptr;
}
#undef DECL_PLGFORM
-17
View File
@@ -200,20 +200,3 @@ class PluginForm(object):
WCLS_CLOSE_LATER = WCLS_DELETE_LATER
#</pycode(py_kernwin_plgform)>
plg = PluginForm()
plg.Show("This is it")
#<pycode_BC695(py_kernwin_plgform)>
PluginForm.FORM_MDI = PluginForm.WOPN_MDI
PluginForm.FORM_TAB = PluginForm.WOPN_TAB
PluginForm.FORM_RESTORE = PluginForm.WOPN_RESTORE
PluginForm.FORM_ONTOP = PluginForm.WOPN_ONTOP
PluginForm.FORM_MENU = PluginForm.WOPN_MENU
PluginForm.FORM_CENTERED = PluginForm.WOPN_CENTERED
PluginForm.FORM_PERSIST = PluginForm.WOPN_PERSIST
PluginForm.FORM_SAVE = PluginForm.WCLS_SAVE
PluginForm.FORM_NO_CONTEXT = PluginForm.WCLS_NO_CONTEXT
PluginForm.FORM_DONT_SAVE_SIZE = PluginForm.WCLS_DONT_SAVE_SIZE
PluginForm.FORM_CLOSE_LATER = PluginForm.WCLS_CLOSE_LATER
#</pycode_BC695(py_kernwin_plgform)>
+1 -1
View File
@@ -15,7 +15,7 @@ struct View_Hooks : public hooks_base_t
bool hook() { return hooks_base_t::hook(); }
bool unhook() { return hooks_base_t::unhook(); }
#ifdef TESTABLE_BUILD
qstring dump_state() { return hooks_base_t::dump_state(mappings, mappings_size); }
PyObject *dump_state(bool assert_all_reimplemented=false) { return hooks_base_t::dump_state(mappings, mappings_size, assert_all_reimplemented); }
#endif
// hookgenVIEW:methods
+8 -8
View File
@@ -3,7 +3,7 @@
//<code(py_lines)>
//------------------------------------------------------------------------
static PyObject *py_get_user_defined_prefix = NULL;
static PyObject *py_get_user_defined_prefix = nullptr;
static void idaapi s_py_get_user_defined_prefix(
qstring *buf,
ea_t ea,
@@ -48,10 +48,10 @@ static PyObject *py_set_user_defined_prefix(size_t width, PyObject *pycb)
Py_XDECREF(py_get_user_defined_prefix);
// ...and clear it
py_get_user_defined_prefix = NULL;
py_get_user_defined_prefix = nullptr;
// Uninstall user defind prefix
set_user_defined_prefix(0, NULL);
set_user_defined_prefix(0, nullptr);
}
else if ( PyCallable_Check(pycb) )
{
@@ -119,8 +119,8 @@ def generate_disassembly(ea, max_lines, as_stack, notags):
@param as_stack: Display undefined items as 2/4/8 bytes
@return:
- None on failure
- tuple(most_important_line_number, tuple(lines)) : Returns a tuple containing
the most important line number and a tuple of generated lines
- tuple(most_important_line_number, list(lines)) : Returns a tuple containing
the most important line number and a list of generated lines
"""
pass
#</pydoc>
@@ -140,7 +140,7 @@ PyObject *py_generate_disassembly(
int lnnum;
int nlines = generate_disassembly(&lines, &lnnum, ea, max_lines, as_stack);
newref_t py_tuple(PyTuple_New(nlines));
newref_t py_list(PyList_New(nlines));
for ( int i=0; i < nlines; i++ )
{
const qstring &l = lines[i];
@@ -150,9 +150,9 @@ PyObject *py_generate_disassembly(
tag_remove(&qbuf, l);
s = qbuf.c_str();
}
PyTuple_SetItem(py_tuple.o, i, IDAPyStr_FromUTF8(s));
PyList_SetItem(py_list.o, i, IDAPyStr_FromUTF8(s));
}
return Py_BuildValue("(iO)", lnnum, py_tuple.o);
return Py_BuildValue("(iO)", lnnum, py_list.o);
}
//</inline(py_lines)>
#endif
-6
View File
@@ -35,9 +35,3 @@ def COLSTR(str, tag):
return SCOLOR_ON + tag + str + SCOLOR_OFF + tag
#</pycode(py_lines)>
#<pycode_BC695(py_lines)>
COLOR_UTF8=cvar.COLOR_ADDR+10 # old value of COLOR_UTF8; shouldn't trigger anything
add_long_cmt=add_extra_cmt
describe=add_extra_line
#</pycode_BC695(py_lines)>
+7 -7
View File
@@ -53,11 +53,11 @@ static PyObject *py_load_plugin(const char *name)
prepare_programmatic_plugin_load(name);
plugin_t *r = load_plugin(name);
PYW_GIL_CHECK_LOCKED_SCOPE();
prepare_programmatic_plugin_load(NULL);
if ( r == NULL )
prepare_programmatic_plugin_load(nullptr);
if ( r == nullptr )
Py_RETURN_NONE;
else
return PyCapsule_New(r, VALID_CAPSULE_NAME, NULL);
return PyCapsule_New(r, VALID_CAPSULE_NAME, nullptr);
}
//------------------------------------------------------------------------
@@ -72,7 +72,7 @@ def run_plugin(plg):
pass
#</pydoc>
*/
static bool py_run_plugin(PyObject *plg, int arg)
static bool py_run_plugin(PyObject *plg, size_t arg)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
if ( !PyCapsule_IsValid(plg, VALID_CAPSULE_NAME) )
@@ -96,14 +96,14 @@ static bool py_load_and_run_plugin(const char *name, size_t arg)
if ( qfileexist(name) )
prepare_programmatic_plugin_load(name);
bool rc = load_and_run_plugin(name, arg);
prepare_programmatic_plugin_load(NULL);
prepare_programmatic_plugin_load(nullptr);
return rc;
}
//-------------------------------------------------------------------------
static PyObject *py_extract_module_from_archive(const char *fname, bool is_remote=false)
{
char *temp_file_ptr = NULL;
char *temp_file_ptr = nullptr;
char fname_buf[QMAXPATH];
qstrncpy(fname_buf, fname, sizeof(fname_buf));
bool ok = extract_module_from_archive(
@@ -111,7 +111,7 @@ static PyObject *py_extract_module_from_archive(const char *fname, bool is_remot
sizeof(fname_buf),
&temp_file_ptr,
is_remote);
return Py_BuildValue("(ss)", ok ? fname_buf : NULL, ok ? temp_file_ptr : NULL);
return Py_BuildValue("(ss)", ok ? fname_buf : nullptr, ok ? temp_file_ptr : nullptr);
}
//</inline(py_loader)>
-11
View File
@@ -1,11 +0,0 @@
#<pycode_BC695(py_loader)>
NEF_TIGHT=0
@bc695redef
def save_database(outfile, flags=0):
if isinstance(flags, bool):
flags = DBFL_KILL if flags else 0
return _ida_loader.save_database(outfile, flags)
save_database_ex=save_database
MAX_FILE_FORMAT_NAME=64
#</pycode_BC695(py_loader)>
+1 -1
View File
@@ -10,7 +10,7 @@ bool py_extract_type_from_metadata(tinfo_t *out, const bytevec_t &in)
const uchar *ptr = in.begin();
const uchar *end = in.end();
extract_type_from_metadata(&tp, ptr, end);
out->deserialize(NULL, &tp.type, &tp.fields);
out->deserialize(nullptr, &tp.type, &tp.fields);
}
return tp.userti;
}
+5 -5
View File
@@ -6,7 +6,7 @@
//-------------------------------------------------------------------------
// callback for enumerating imports
// ea: import address
// name: import name (NULL if imported by ordinal)
// name: import name (nullptr if imported by ordinal)
// ord: import ordinal (0 for imports by name)
// param: user parameter passed to enum_import_names()
// return: 1-ok, 0-stop enumeration
@@ -18,12 +18,12 @@ static int idaapi py_import_enum_cb(
{
// If no name, try to get the name associated with the 'ea'. It may be coming from IDS
qstring name_buf;
if ( name == NULL && get_name(&name_buf, ea) > 0 )
if ( name == nullptr && get_name(&name_buf, ea) > 0 )
name = name_buf.begin();
PYW_GIL_CHECK_LOCKED_SCOPE();
ref_t py_name;
if ( name == NULL )
if ( name == nullptr )
py_name = borref_t(Py_None);
else
py_name = newref_t(IDAPyStr_FromUTF8(name));
@@ -36,8 +36,8 @@ static int idaapi py_import_enum_cb(
py_ea.o,
py_name.o,
py_ord.o,
NULL));
return py_result != NULL && PyObject_IsTrue(py_result.o) ? 1 : 0;
nullptr));
return py_result != nullptr && PyObject_IsTrue(py_result.o) ? 1 : 0;
}
//</code(py_nalt)>
+2 -109
View File
@@ -9,113 +9,6 @@ def get_switch_info(*args):
def get_abi_name():
import ida_typeinf
return ida_typeinf.get_abi_name()
# for backward compatibility
get_initial_version = get_initial_idb_version
#</pycode(py_nalt)>
#<pycode_BC695(py_nalt)>
ASCSTR_LAST=7
ASCSTR_LEN2=STRTYPE_LEN2
ASCSTR_LEN4=STRTYPE_LEN4
ASCSTR_PASCAL=STRTYPE_PASCAL
ASCSTR_TERMCHR=STRTYPE_TERMCHR
ASCSTR_ULEN2=STRTYPE_LEN2_16
ASCSTR_ULEN4=STRTYPE_LEN4_16
ASCSTR_UNICODE=STRTYPE_C_16
ASCSTR_UTF16=STRTYPE_C_16
ASCSTR_UTF32=STRTYPE_C_32
REF_VHIGH=V695_REF_VHIGH
REF_VLOW=V695_REF_VLOW
SWI_END_IN_TBL=SWI_DEF_IN_TBL
SWI_BC695_EXTENDED=0x8000
SWI2_INDIRECT=SWI_INDIRECT >> 16
SWI2_SUBTRACT=SWI_SUBTRACT >> 16
import ida_netnode
RIDX_AUTO_PLUGINS=ida_netnode.BADNODE
change_encoding_name=rename_encoding
def del_tinfo2(ea, n=None):
if n is not None:
return del_op_tinfo(ea, n)
else:
return del_tinfo(ea)
get_encodings_count=get_encoding_qty
def get_op_tinfo(*args):
import ida_typeinf
if isinstance(args[2], ida_typeinf.tinfo_t): # 6.95: ea, n, tinfo_t
ea, n, tif = args
else: # 7.00: tinfo_t, ea, n
tif, ea, n = args
return _ida_nalt.get_op_tinfo(tif, ea, n)
get_op_tinfo2=get_op_tinfo
def is_unicode(strtype):
return (strtype & STRWIDTH_MASK) > 0
set_op_tinfo2=set_op_tinfo
set_tinfo2=set_tinfo
def make_switch_info_t__init__(real_init):
def wrapper(self):
real_init(self)
self.bc695_api = False
return wrapper
switch_info_t.__init__ = make_switch_info_t__init__(switch_info_t.__init__)
switch_info_t.regdtyp = switch_info_t.regdtype
def get_tinfo(*args):
import ida_typeinf
if isinstance(args[1], ida_typeinf.tinfo_t): # 6.95: ea, tinfo_t
ea, tif = args
else: # 7.00: tinfo_t, ea
tif, ea = args
return _ida_nalt.get_tinfo(tif, ea)
get_tinfo2=get_tinfo
def get_refinfo(*args):
if isinstance(args[2], refinfo_t): # 6.95: ea, n, refinfo_t
ea, n, ri = args
else: # 7.00: refinfo_t, ea, n
ri, ea, n = args
return _ida_nalt.get_refinfo(ri, ea, n)
get_switch_info_ex=get_switch_info
set_switch_info_ex=set_switch_info
del_switch_info_ex=del_switch_info
switch_info_ex_t_assign=_ida_nalt.switch_info_t_assign
switch_info_ex_t_get_custom=_ida_nalt.switch_info_t_custom_get
switch_info_ex_t_get_defjump=_ida_nalt.switch_info_t_defjump_get
switch_info_ex_t_get_elbase=_ida_nalt.switch_info_t_elbase_get
switch_info_ex_t_get_flags=_ida_nalt.switch_info_t_flags_get
switch_info_ex_t_get_ind_lowcase=_ida_nalt.switch_info_t_ind_lowcase_get
switch_info_ex_t_get_jcases=_ida_nalt.switch_info_t_jcases_get
switch_info_ex_t_get_jumps=_ida_nalt.switch_info_t_jumps_get
switch_info_ex_t_get_ncases=_ida_nalt.switch_info_t_ncases_get
switch_info_ex_t_get_regdtyp=_ida_nalt.switch_info_t_regdtype_get
switch_info_ex_t_get_regnum=_ida_nalt.switch_info_t_regnum_get
switch_info_ex_t_get_startea=_ida_nalt.switch_info_t_startea_get
switch_info_ex_t_get_values_lowcase=_ida_nalt.switch_info_t__get_values_lowcase
switch_info_ex_t_set_custom=_ida_nalt.switch_info_t_custom_set
switch_info_ex_t_set_defjump=_ida_nalt.switch_info_t_defjump_set
switch_info_ex_t_set_elbase=_ida_nalt.switch_info_t_elbase_set
switch_info_ex_t_set_flags=_ida_nalt.switch_info_t_flags_set
switch_info_ex_t_set_ind_lowcase=_ida_nalt.switch_info_t_ind_lowcase_set
switch_info_ex_t_set_jcases=_ida_nalt.switch_info_t_jcases_set
switch_info_ex_t_set_jumps=_ida_nalt.switch_info_t_jumps_set
switch_info_ex_t_set_ncases=_ida_nalt.switch_info_t_ncases_set
switch_info_ex_t_set_regdtyp=_ida_nalt.switch_info_t_regdtype_set
switch_info_ex_t_set_regnum=_ida_nalt.switch_info_t_regnum_set
switch_info_ex_t_set_startea=_ida_nalt.switch_info_t_startea_set
switch_info_ex_t_set_values_lowcase=_ida_nalt.switch_info_t__set_values_lowcase
def __switch_info_t_get_flags__(instance):
return _ida_nalt.switch_info_t_flags_get(instance) | SWI_BC695_EXTENDED
def __switch_info_t_set_flags__(instance, v):
if instance.bc695_api:
v |= (_ida_nalt.switch_info_t_flags_get(instance) & 0xFFFF0000)
_ida_nalt.switch_info_t_flags_set(instance, v)
switch_info_t.flags = property(__switch_info_t_get_flags__, __switch_info_t_set_flags__)
def __switch_info_t_get_flags2__(instance):
instance.bc695_api = True
return _ida_nalt.switch_info_t_flags_get(instance) >> 16
def __switch_info_t_set_flags2__(instance, v):
instance.bc695_api = True
flags = _ida_nalt.switch_info_t_flags_get(instance)
instance.flags = (flags & 0xFFFF) | (v << 16)
switch_info_t.flags2 = property(__switch_info_t_get_flags2__, __switch_info_t_set_flags2__)
switch_info_ex_t=switch_info_t
#</pycode_BC695(py_nalt)>
+2 -2
View File
@@ -14,10 +14,10 @@ PyObject *get_debug_names(ea_t ea1, ea_t ea2, bool return_list=false)
get_debug_names(&names, ea1, ea2);
Py_END_ALLOW_THREADS;
PyObject *dict = Py_BuildValue("{}");
if ( dict != NULL )
if ( dict != nullptr )
{
ea_t last_ea = BADADDR;
PyObject *list = NULL;
PyObject *list = nullptr;
for ( ea_name_vec_t::iterator it = names.begin(); it != names.end(); ++it )
{
PyObject *name_obj = IDAPyStr_FromUTF8(it->name.c_str());
-39
View File
@@ -70,42 +70,3 @@ def calc_gtn_flags(fromaddr, ea):
return gtn_flags
#</pycode(py_name)>
#<pycode_BC695(py_name)>
GN_INSNLOC=0
@bc695redef
def demangle_name(name, mask, demreq=DQT_FULL): # make flag optional, so demangle_name & demangle_name2 can use it
return _ida_name.demangle_name(name, mask, demreq)
demangle_name2=demangle_name
def do_name_anyway(ea, name, maxlen=0):
return force_name(ea, name)
extract_name2=extract_name
get_debug_name2=get_debug_name
def get_true_name(ea0, ea1=None):
if ea1 is None:
ea = ea0
else:
ea = ea1
return get_name(ea)
is_ident_char=is_ident_cp
is_visible_char=is_visible_cp
def make_visible_name(name, sz=0):
if sz > 0:
name = name[0:sz]
return _ida_name.validate_name(name, VNT_VISIBLE)
def validate_name2(name, sz=0):
if sz > 0:
name = name[0:sz]
return _ida_name.validate_name(name, VNT_IDENT)
def validate_name3(name):
return _ida_name.validate_name(name, VNT_IDENT)
isident=is_ident
@bc695redef
def get_name(*args):
if len(args) == 2:
if args[0] != _ida_idaapi.BADADDR:
print("Compatibility get_name(from, ea) was called with non-BADADDR first argument (0x%08x). There is no equivalent in the new API, and the results might be erroneous." % args[0]);
return _ida_name.get_name(args[1])
else:
return _ida_name.get_name(*args)
#</pycode_BC695(py_name)>
-14
View File
@@ -1,14 +0,0 @@
#<pycode_BC695(py_netnode)>
netnode.alt1st = netnode.altfirst
netnode.alt1st_idx8 = netnode.altfirst_idx8
netnode.altnxt = netnode.altnext
netnode.char1st = netnode.charfirst
netnode.char1st_idx8 = netnode.charfirst_idx8
netnode.charnxt = netnode.charnext
netnode.hash1st = netnode.hashfirst
netnode.hashnxt = netnode.hashnext
netnode.sup1st = netnode.supfirst
netnode.sup1st_idx8 = netnode.supfirst_idx8
netnode.supnxt = netnode.supnext
#</pycode_BC695(py_netnode)>
-9
View File
@@ -1,9 +0,0 @@
#<pycode_BC695(py_offset)>
calc_reference_basevalue=calc_basevalue
calc_reference_target=calc_target
def set_offset(ea, n, base):
import ida_idaapi
otype = get_default_reftype(ea)
return op_offset(ea, n, otype, ida_idaapi.BADADDR, base) > 0
#</pycode_BC695(py_offset)>
+10 -10
View File
@@ -6,7 +6,7 @@ static bool qstrvec_t_assign(PyObject *self, PyObject *other)
{
qstrvec_t *lhs = qstrvec_t_get_clink(self);
qstrvec_t *rhs = qstrvec_t_get_clink(other);
if ( lhs == NULL || rhs == NULL )
if ( lhs == nullptr || rhs == nullptr )
return false;
*lhs = *rhs;
return true;
@@ -16,7 +16,7 @@ static PyObject *qstrvec_t_addressof(PyObject *self, size_t idx)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
qstrvec_t *sv = qstrvec_t_get_clink(self);
if ( sv == NULL || idx >= sv->size() )
if ( sv == nullptr || idx >= sv->size() )
Py_RETURN_NONE;
else
return PyLong_FromUnsignedLongLong(size_t(&sv->at(idx)));
@@ -29,7 +29,7 @@ static bool qstrvec_t_set(
const char *s)
{
qstrvec_t *sv = qstrvec_t_get_clink(self);
if ( sv == NULL || idx >= sv->size() )
if ( sv == nullptr || idx >= sv->size() )
return false;
(*sv)[idx] = s;
return true;
@@ -41,7 +41,7 @@ static bool qstrvec_t_from_list(
{
PYW_GIL_CHECK_LOCKED_SCOPE();
qstrvec_t *sv = qstrvec_t_get_clink(self);
return (sv == NULL || !PySequence_Check(py_list))
return (sv == nullptr || !PySequence_Check(py_list))
? false
: (PyW_PyListToStrVec(sv, py_list) >= 0);
}
@@ -49,14 +49,14 @@ static bool qstrvec_t_from_list(
static size_t qstrvec_t_size(PyObject *self)
{
qstrvec_t *sv = qstrvec_t_get_clink(self);
return sv == NULL ? 0 : sv->size();
return sv == nullptr ? 0 : sv->size();
}
static PyObject *qstrvec_t_get(PyObject *self, size_t idx)
{
PYW_GIL_CHECK_LOCKED_SCOPE();
qstrvec_t *sv = qstrvec_t_get_clink(self);
if ( sv == NULL || idx >= sv->size() )
if ( sv == nullptr || idx >= sv->size() )
Py_RETURN_NONE;
return IDAPyStr_FromUTF8(sv->at(idx).c_str());
}
@@ -64,7 +64,7 @@ static PyObject *qstrvec_t_get(PyObject *self, size_t idx)
static bool qstrvec_t_add(PyObject *self, const char *s)
{
qstrvec_t *sv = qstrvec_t_get_clink(self);
if ( sv == NULL )
if ( sv == nullptr )
return false;
sv->push_back(s);
return true;
@@ -73,7 +73,7 @@ static bool qstrvec_t_add(PyObject *self, const char *s)
static bool qstrvec_t_clear(PyObject *self, bool qclear)
{
qstrvec_t *sv = qstrvec_t_get_clink(self);
if ( sv == NULL )
if ( sv == nullptr )
return false;
if ( qclear )
@@ -90,7 +90,7 @@ static bool qstrvec_t_insert(
const char *s)
{
qstrvec_t *sv = qstrvec_t_get_clink(self);
if ( sv == NULL || idx >= sv->size() )
if ( sv == nullptr || idx >= sv->size() )
return false;
sv->insert(sv->begin() + idx, s);
return true;
@@ -99,7 +99,7 @@ static bool qstrvec_t_insert(
static bool qstrvec_t_remove(PyObject *self, size_t idx)
{
qstrvec_t *sv = qstrvec_t_get_clink(self);
if ( sv == NULL || idx >= sv->size() )
if ( sv == nullptr || idx >= sv->size() )
return false;
sv->erase(sv->begin()+idx);

Some files were not shown because too many files have changed in this diff Show More