1
0
Fork 0

DBG: add OptionalHeader.AddressOfEntryPoint to the displayed symbols

This commit is contained in:
Bálint Faragó 2018-10-28 23:44:56 +01:00 committed by Duncan Ogilvie
parent b32c97507d
commit 5a4f15e9f5
3 changed files with 17 additions and 10 deletions

View File

@ -611,6 +611,12 @@ void GetModuleInfo(MODINFO & Info, ULONG_PTR FileMapVA)
Info.entry = 0; Info.entry = 0;
} }
// Setup the pseudo entry point symbol
Info.entrySymbol.name = "OptionalHeader.AddressOfEntryPoint";
Info.entrySymbol.forwarded = false;
Info.entrySymbol.ordinal = 0;
Info.entrySymbol.rva = moduleOEP;
// Enumerate all PE sections // Enumerate all PE sections
WORD sectionCount = Info.headers->FileHeader.NumberOfSections; WORD sectionCount = Info.headers->FileHeader.NumberOfSections;
Info.sections.clear(); Info.sections.clear();

View File

@ -91,6 +91,8 @@ struct MODINFO
std::vector<MODRELOCATIONINFO> relocations; std::vector<MODRELOCATIONINFO> relocations;
std::vector<duint> tlsCallbacks; std::vector<duint> tlsCallbacks;
MODEXPORT entrySymbol;
std::vector<MODEXPORT> exports; std::vector<MODEXPORT> exports;
DWORD exportOrdinalBase = 0; //ordinal - 'exportOrdinalBase' = index in 'exports' DWORD exportOrdinalBase = 0; //ordinal - 'exportOrdinalBase' = index in 'exports'
std::vector<size_t> exportsByName; //index in 'exports', sorted by export name std::vector<size_t> exportsByName; //index in 'exports', sorted by export name

View File

@ -66,6 +66,15 @@ void SymEnum(duint Base, CBSYMBOLENUM EnumCallback, void* UserData)
symbolptr.symbol = &modInfo->exports.at(i); symbolptr.symbol = &modInfo->exports.at(i);
cbData.cbSymbolEnum(&symbolptr, cbData.user); cbData.cbSymbolEnum(&symbolptr, cbData.user);
} }
// Emit pseudo entry point symbol
{
SYMBOLPTR symbolptr;
symbolptr.modbase = Base;
symbolptr.symbol = &modInfo->entrySymbol;
cbData.cbSymbolEnum(&symbolptr, cbData.user);
}
for(size_t i = 0; i < modInfo->imports.size(); i++) for(size_t i = 0; i < modInfo->imports.size(); i++)
{ {
SYMBOLPTR symbolptr; SYMBOLPTR symbolptr;
@ -85,16 +94,6 @@ void SymEnum(duint Base, CBSYMBOLENUM EnumCallback, void* UserData)
} }
} }
} }
// Emit pseudo entry point symbol
/*SYMBOLINFO symbol;
memset(&symbol, 0, sizeof(SYMBOLINFO));
symbol.decoratedSymbol = "OptionalHeader.AddressOfEntryPoint";
symbol.addr = ModEntryFromAddr(Base);
if(symbol.addr)
EnumCallback(&symbol, UserData);
SymEnumImports(Base, EnumCallback, cbData);*/
} }
void SymEnumFromCache(duint Base, CBSYMBOLENUM EnumCallback, void* UserData) void SymEnumFromCache(duint Base, CBSYMBOLENUM EnumCallback, void* UserData)