rendered paste body#include <idc.idc>
static namepackets()
{
auto table, offsets;
auto offset;
auto id;
auto rel;
auto ea;
auto name;
auto callop, callimm, calldst, calldstname;
id = 0x5003;
table = LocByName("tPacketHandlersFor5000");
offsets = LocByName("tPacketHandlersFor5000Offsets");
while (1)
{
rel = id - 0x5003;
if (rel > 0xE2)
{
break;
}
ea = offsets + rel;
offset = Byte(ea);
ea = table + (offset * 4);
offset = Dword(ea);
//Message("%04X = %08X\n", id, offset);
name = form("lPacketHandle%04X", id);
//MakeNameEx(ea, "", 0);
MakeNameEx(offset, name, 0);
callop = Byte(offset + 3);
if (callop == 0xE8)
{
callimm = Dword(offset + 4);
calldst = offset + 8 + callimm;
//Message("%04X = %08X -> %08X\n", id, offset, calldst);
calldstname = form("fPacketHandle%04X", id);
MakeNameEx(calldst, calldstname, 0);
}
id++;
}
}
static main()
{
namepackets();
}