要生成gdl文件可以使用idc脚本,也可以使用sdk的相关函数,但是函数使用比较复杂,其实是俺自己都没搞清楚那个东东该咋玩。丢银啊。
相关的函数有两个:
// Generate a flow chart GDL file
// outfile - output file name. GDL extension will be used
// title - graph title
// ea1 - beginning of the area to flow chart
// ea2 - end of the area to flow chart. if ea2 == BADADDR
// then ea1 is treated as an address within a function.
// That function will be flow charted.
// flags - combination of CHART_... constants
success GenFuncGdl(string outfile, string title, long ea1, long ea2, long flags);
和
// Generate a function call graph GDL file
// outfile - output file name. GDL extension will be used
// title - graph title
// ea1 - beginning of the area to flow chart
// ea2 - end of the area to flow chart. if ea2 == BADADDR
// then ea1 is treated as an address within a function.
// That function will be flow charted.
// flags - combination of CHART_GEN_GDL, CHART_WINGRAPH, CHART_NOLIBFUNCS
success GenCallGdl(string outfile, string title, long flags);
简单测试代码:
#include <ida.idc>
#include <idc.idc>
static main()
{
auto str_gdlpath;
str_gdlpath = GetIdbPath();
str_gdlpath = substr(str_gdlpath,0,strlen(str_gdlpath)-4)+".gdl";
GenCallGdl(str_gdlpath, "Call Gdl", CHART_WINGRAPH);
Message("Gdl file have been saved to %s",str_gdlpath);
}