I'm using the DIA SDK from C#.
Right now I have something like:
static void Main(string[] args)
{
var v = new DiaSource();
v.loadDataForExe("Temp.exe", null, null); // native, with symbols
Dia2Lib.IDiaSession session;
v.openSession(out session);
var items = new Stack<KeyValuePair<IDiaSymbol, int>>();
items.Push(new KeyValuePair<IDiaSymbol, int>(session.globalScope, 0));
while (items.Count > 0)
{
var pair = items.Pop();
var symbol = pair.Key;
if (symbol.function != 0)
{
// What do I do?
}
// Push child symbols onto stack
IDiaEnumSymbols enumSymbols;
symbol.findChildren(SymTagEnum.SymTagNull, null, 0, out enumSymbols);
if (enumSymbols != null)
{
foreach (IDiaSymbol child in enumSymbols)
{
if (symbol.symIndexId == child.symIndexId)
{
// Why do some nodes contain themselves?
// Break out if that's the case...
break;
}
items.Push(
new KeyValuePair<IDiaSymbol, int>(child, pair.Value + 1));
}
}
}
}
How would I go about using the DIA SDK to browse the code, and, specifically, find any jump tables and their target addresses (i.e. those produced by the switch
statement) in my executable?
I have already verified that they exist, I just don't know how to access them.
I tagged C# because I'm using C# with COM, but I also tagged C++ because the SDK is originally in C++ (with COM). Feel free to remove either that might be inappropriate; thanks.