Topic created on: June 29, 2007 03:08 CDT by
luckiejacky 
.
Hi,
When you right-click on the function name, you'll get the guessed function type. Say
sub_1234
you'll get
sub_1234(int,int,int);
how can I get the string like this thru the SDK?
I found somethin like this from
typeinf.hpp
// calculate function argument locations
// type - pointer to function type string
// arglocs - the result array
// each entry in the array will contain an offset from the stack pointer
// for the first stack argument the offset will be zero
// register locations are represented like this: the register number combined with ARGLOC_REG
// maxn - number of elements in arglocs
// returns: number_of_arguments. -1 means error.
// type is advanced to the function argument types array
inline int calc_arglocs(const type_t *&type, ulong *arglocs, int maxn)
{
if ( !ph.ti() || !is_type_func(*type) ) return -1;
return ph.notify(ph.calc_arglocs, &type, arglocs, maxn);
}
Any suggestions on exactly how to go about getting this string will be greatly appreciated!
Jack
I once used something like this , don't know if this might help
write_functions_protos(ea_t start_ea){
char buf[MAXSTR] = {0};
char seg_name[MAXSTR] = {0};
//print prototypes to buf and output to .h file
//guess prototype if not explicitly set by "Y" in ida
type_t * types = new type_t [MAXSTR];
p_list * fields = new p_list [MAXSTR];
//type_t * types = (type_t *)malloc (MAXSTR);
//p_list * fields = (p_list *)malloc (MAXSTR);
size_t tsize = 100;
size_t fsize = 100;
//guess_type(start_ea,types,tsize,fields,fsize);
//set_ti(start_ea, types, fields);
print_type(start_ea, buf, MAXSTR, 0);
//free(types);
//free(fields);
if (buf != NULL && *buf != '\0'){
//out_str(&hfile ,"extern \"C\"\t");
out_str(&hfile,"\t");
out_str(&hfile, buf);
out_str(&hfile,";\n");
}else{
guess_type(start_ea,types,tsize,fields,fsize);
set_ti(start_ea, types, fields);
print_type(start_ea, buf, MAXSTR, 0);
//out_str(&hfile ,"extern \"C\"\t");
out_str(&hfile,"\t");
out_str(&hfile,buf);
out_str(&hfile,";\n");
get_segm_name(start_ea,seg_name,MAXSTR);
msg("%s:%08x: no explicit function prototype applying guess\n",seg_name);
}
|