#include <ida.hpp>
#include <idp.hpp>
#include <loader.hpp>
#include <kernwin.hpp>
int __stdcall IDP_init(void)
{
//在这里做一些校验,以确保您的插件是被用在合适的环境里。
if ( 0 )
{
error("sorry!");
return PLUGIN_SKIP;
}
return PLUGIN_KEEP;
}
void __stdcall IDP_term(void)
{
//当结束插件时,一般您可以在此添加一点任务清理的代码。
return;
}
// 插件可以从plugins.cfg文件中,被传进一个整型参数。
// 当按下不同的热键或者菜单时,您需要一个插件做不同的事情时,这非常有用。
void __stdcall IDP_run(int arg)
{
// 插件的实体
msg("Hello world!\n");
return;
}
// 在Edit->Plugins 菜单中,插件的现实名称,它能被用户的plugins.cfg文件改写
char IDP_name[] = "My plugin";
char IDP_comment[] = "This is my test plug-in";
char IDP_help[] = "My plugin";
char IDP_hotkey[] = "Ctrl-Alt-X"; // 启动插件的热键
// 所有PLUGIN对象导出的重要属性。
plugin_t PLUGIN =
{
IDP_INTERFACE_VERSION, // IDA version plug-in is written for
0, // Flags (see below)
IDP_init, // Initialisation function
IDP_term, // Clean-up function
IDP_run, // Main plug-in body
IDP_comment, // Comment – unused
IDP_help, // As above – unused
IDP_name, // Plug-in name shown in Edit->Plugins menu
IDP_hotkey // Hot key to run the plug-in
};