IDR
IDR copied to clipboard
IDC script with type applying
trafficstars
There are the following methods in idc:
- idc.GetType(ea);
- idc.SetType(ea, type_string);
They're used the same way as pressing Y button at function header. Is it possible to add types definitions in this script?
I think it's possible: int __fastcall TIDCGen::OutputProc(int pos, PInfoRec recN, bool imp) { itemName = recN->GetName(); int fromPos = pos; DWORD fromAdr = Pos2Adr(pos);
if (itemName != "")
{
int idx = names->IndexOf(itemName);
if (idx == -1)
{
names->Add(itemName);
fprintf(idcF, "MakeUnkn(0x%lX, 1);\n", fromAdr);
fprintf(idcF, "MakeNameEx(0x%lX, \"%s\", 0x20);\n", fromAdr, itemName.c_str());
//fprintf(idcF, "ApplyType(0x%lX, \"%s\", 0);\n", fromAdr, recN->MakeIDCPrototype(...));
}
else
{
PREPNAMEINFO info = GetNameInfo(idx);
if (!info)
{
info = new REPNAMEINFO;
info->index = idx;
info->counter = 0;
repeated->Add((void*)info);
}
int cnt = info->counter;
info->counter++;
fprintf(idcF, "MakeUnkn(0x%lX, 1);\n", fromAdr);
fprintf(idcF, "MakeNameEx(0x%lX, \"%s_%d\", 0x20);\n", fromAdr, itemName.c_str(), cnt);
//fprintf(idcF, "ApplyType(0x%lX, \"%s_%d\", 0);\n", fromAdr, recN->MakeIDCPrototype(...), cnt);
}
MakeComment(pos, recN->MakePrototype(fromAdr, true, false, false, true, false));
}
... I have no time to write this function String __fastcall InfoRec::MakeIDCPrototype(...).