IDR icon indicating copy to clipboard operation
IDR copied to clipboard

IDC script with type applying

Open lab313ru opened this issue 8 years ago • 1 comments
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?

lab313ru avatar Nov 25 '16 16:11 lab313ru

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(...).

crypto2011 avatar Nov 26 '16 09:11 crypto2011