Some more IDA script from me!
In this installment of label-that-feature, we focus on databases to easily identify when functions are accessing database information.
http://dl.getdropbox.com/u/29438/IDA...lDatabases.idc
Example of productivity enhancement:
Code:
signed int __cdecl lua_GetItemIcon(int a1)
{
int v1; // esi@1
int v2; // eax@2
char *v3; // eax@4
DWORD v4; // esi@8
char *v5; // ebx@9
char v6; // zf@9
signed int result; // eax@11
int v8; // eax@11
char icon[260]; // [sp+8h] [bp-108h]@11
char *v10; // [sp+10Ch] [bp-4h]@9
v1 = 0;
if ( lua_isnumber(a1) )
{
v2 = lua_tointeger(a1, 1);
LABEL_5:
v1 = v2;
goto LABEL_6;
}
if ( lua_isstring(a1, 1) )
{
v3 = lua_tostring(a1, 1, 0);
v2 = GetItemIDByName(v3);
goto LABEL_5;
}
LABEL_6:
if ( v1 >= g_ItemDB.minIndex && v1 <= g_ItemDB.maxIndex && (v4 = g_ItemDB.Rows[v1 - g_ItemDB.minIndex]) != 0 )
{
v5 = ClientDBStringLookup(3);
v6 = *v5 == 0;
v10 = "\\";
if ( v6 )
v10 = nullString;
v8 = CGItem_C__GetInventoryArt(*(_DWORD *)(v4 + 20));
SStrPrintf(icon, 260u, "%s%s%s", v5, v10, v8);
lua_pushstring(a1, icon);
result = 1;
}
else
{
result = 0;
}
return result;
}
Note: This was written around IDA 5.5, if you have an inferior version; manually insert the struct as follows:
Code:
#pragma pack(push, 1)
struct WoWClientDB
{
void *funcTable;
int isLoaded;
int numRows;
int maxIndex;
int minIndex;
int stringTable;
void *funcTable2;
DWORD FirstRow;
DWORD *Rows;
};
#pragma pack(pop)