#include <ida.hpp>
#include <idp.hpp>
#include <loader.hpp>
#include <kernwin.hpp>
#include <xref.hpp>
int idaapi IDAP_init(void)
{
msg("init %s\n",inf.procname); //获取处理器架构 inf为loader.hpp中的全局变量
return PLUGIN_KEEP;
}
bool idaapi run(size_t arg)
{
xrefblk_t xb;
ea_t addr = get_screen_ea();
for(bool res = xb.first_to(addr, XREF_FAR);res;res = xb.next_to())
{
msg("Form: %llx, To: %llx\n",xb.from,xb.to); //from:调用者 to:被调用者
msg("Type: %d, IsCode: %d\n",xb.type,xb.iscode); //Type: 将数据类型引用和代码引用细分 IsCode:检测是代码引用还是数据引用
}
return true;
}
void idaapi term(void){}
char IDAP_comment[] = "This is my test plugin-in";
char IDAP_help[] = "My plugin";
char IDAP_name[] = "My plugin";
char IDAP_hotkey[] = "";
plugin_t PLUGIN =
{
IDP_INTERFACE_VERSION,
PLUGIN_PROC,
IDAP_init,
NULL,
run,
IDAP_comment,
IDAP_help,
IDAP_name,
IDAP_hotkey
};