@@ -15,12 +15,20 @@ All expressions should resolve to a string.
1515#include < algorithm>
1616#include < regex>
1717#include < functional>
18+
19+ #ifdef _MSC_VER
20+ #pragma warning(push)
21+ #pragma warning(disable: 4267 4244)
22+ #endif
1823#include < ida.hpp>
1924#include < loader.hpp>
2025#include < kernwin.hpp>
2126#include < expr.hpp>
2227#include < registry.hpp>
2328#include < diskio.hpp>
29+ #ifdef _MSC_VER
30+ #pragma warning(pop)
31+ #endif
2432
2533#include " utils_impl.cpp"
2634
@@ -52,24 +60,24 @@ typedef qvector<macro_def_t> macros_t;
5260// Default macros
5361static macro_def_t DEFAULT_MACROS[] =
5462{
55- {" $!" , " ${'0x%x' % idc.here()}$" , " Current cursor location (0x...)" },
56- {" $!!" , " ${'%x' % idc.here()}$" , " Current cursor location" },
57- {" $> " , " ${'0x%x' % idc.SegEnd (idc.here())}$" , " Current segment end (0x...)" },
58- {" $>> " , " ${'%x' % idc.SegEnd (idc.here())}$" , " Current segment end" },
59- {" $<" , " ${'0x %x' % idc.SegStart (idc.here())}$" , " Current segment start (0x...) " },
60- {" $<< " , " ${'%x' % idc.SegStart (idc.here())}$" , " Current segment start " },
61- {" $[ " , " ${'0x%x' % idc.SelStart() }$" , " Selection start (0x...)" },
62- {" $[[ " , " ${'%x' % idc.SelStart() }$" , " Selection start " },
63- {" $@b " , " ${'0x%x' % idc.Byte (idc.here())}$" , " Byte value at current cursor location (0x...)" },
64- {" $@B " , " ${'%x' % idc.Byte (idc.here())}$" , " Byte value at current cursor location" },
65- {" $@d " , " ${'0x%x' % idc.Dword (idc.here())}$" , " Dword value at current cursor location (0x...)" },
66- {" $@D " , " ${'%x' % idc.Dword (idc.here())}$" , " Dword value at current cursor location" },
67- {" $@q " , " ${'0x%x' % idc.Qword(idc.here()) }$" , " Qword value at current cursor location (0x...)" },
68- {" $@Q " , " ${'%x' % idc.Qword(idc.here()) }$" , " Qword value at current cursor location " },
69- {" $]] " , " ${'%x' % idc.SelEnd ()}$" , " Selection end " },
70- {" $]" , " ${'0x %x' % idc.SelEnd ()}$" , " Selection end (0x...) " },
71- {" $#" , " ${'0x%x' % (idc.SelEnd () - idc.SelStart ())}$" , " Selection size (0x...)" },
72- {" $##" , " ${'%x' % (idc.SelEnd () - idc.SelStart ())}$" , " Selection size" }
63+ {" $!" , " ${'0x%x' % idc.here()}$" , " Current cursor location (0x...)" },
64+ {" $!!" , " ${'%x' % idc.here()}$" , " Current cursor location" },
65+ {" $< " , " ${'0x%x' % idc.get_segm_start (idc.here())}$" , " Current segment start (0x...)" },
66+ {" $>" , " ${'0x %x' % idc.get_segm_end (idc.here())}$" , " Current segment end (0x...) " },
67+ {" $<< " , " ${'%x' % idc.get_segm_start (idc.here())}$" , " Current segment start" },
68+ {" $>> " , " ${'%x' % idc.get_segm_end (idc.here())}$" , " Current segment end " },
69+ {" $@b " , " ${'0x%x' % idc.get_wide_byte(idc.here()) }$" , " Byte value at current cursor location (0x...)" },
70+ {" $@B " , " ${'%x' % idc.get_wide_byte(idc.here()) }$" , " Byte value at current cursor location " },
71+ {" $@d " , " ${'0x%x' % idc.get_wide_dword (idc.here())}$" , " Dword value at current cursor location (0x...)" },
72+ {" $@D " , " ${'%x' % idc.get_wide_dword (idc.here())}$" , " Dword value at current cursor location" },
73+ {" $@q " , " ${'0x%x' % idc.get_qword (idc.here())}$" , " Qword value at current cursor location (0x...)" },
74+ {" $@Q " , " ${'%x' % idc.get_qword (idc.here())}$" , " Qword value at current cursor location" },
75+ {" $[ " , " ${'0x%x' % idc.read_selection_start() }$" , " Selection start (0x...)" },
76+ {" $] " , " ${'0x %x' % idc.read_selection_end() }$" , " Selection end (0x...) " },
77+ {" $[[ " , " ${'%x' % idc.read_selection_start ()}$" , " Selection start " },
78+ {" $]] " , " ${'%x' % idc.read_selection_end ()}$" , " Selection end" },
79+ {" $#" , " ${'0x%x' % (idc.read_selection_end () - idc.read_selection_start ())}$" , " Selection size (0x...)" },
80+ {" $##" , " ${'%x' % (idc.read_selection_end () - idc.read_selection_start ())}$" , " Selection size" }
7381};
7482
7583// -------------------------------------------------------------------------
@@ -111,7 +119,7 @@ template <size_t... indices> struct execute_line_with_ctx_gen_t<std::index_seque
111119 static constexpr bool (idaapi *callbacks[])(const char *) = { execute_line<indices>... };
112120};
113121
114- auto g_cli_execute_line_with_ctx = execute_line_with_ctx_gen_t <std::make_index_sequence<MAX_CTX>>::callbacks;
122+ static auto g_cli_execute_line_with_ctx = execute_line_with_ctx_gen_t <std::make_index_sequence<MAX_CTX>>::callbacks;
115123
116124// Ignore UI hooks when set
117125bool g_b_ignore_ui_notification = false ;
@@ -390,6 +398,9 @@ macro_editor_t g_macro_editor;
390398// --------------------------------------------------------------------------
391399int idaapi init (void )
392400{
401+ if (!is_idaq ())
402+ return PLUGIN_SKIP;
403+
393404 msg (" IDA Command Line Interface macros initialized\n " );
394405
395406 hook_to_notification_point (HT_UI, ui_callback);
0 commit comments