Skip to content

Commit

Permalink
Also load static symbols from MAP files
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukem9 committed Aug 23, 2015
1 parent 152b542 commit 2a844b5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion idaldr/Ldr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ bool ApplyMapSymbols(char *Path, duint ModuleBase)
{
size_t sectionCount = GetPE32Data(modulePath, 0, UE_SECTIONNUMBER);

for (int i = 0; i < sectionCount; i++)
for (size_t i = 0; i < sectionCount; i++)
{
MapFileSegment segdef;
memset(&segdef, 0, sizeof(segdef));
Expand Down
25 changes: 21 additions & 4 deletions idaldr/Map/MapReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,11 @@ bool MapFile::LoadSegment(char *Line)

bool MapFile::LoadSymbols()
{
/*
Address Publics by Value
0001:00000000 _init_proc
*/
//
// Address Publics by Value
// 0001:00000000 _init_proc
//
// Load regular symbols
char *startPos = strstr(m_FileData, "Address");

if (!startPos)
Expand All @@ -258,6 +259,22 @@ bool MapFile::LoadSymbols()
return false;
}

if (!EnumerateLines(startPos, 'SYMB'))
return false;

//
// Static symbols
// 0001:00000027 _pre_c_init 00401027 f MSVCRT:wcrtexe.obj
//
// Now load static symbols (these are optional)
startPos = strstr(m_FileData, "Static symbols");

if (!startPos)
{
_plugin_logprintf("Couldn't find starting position for static symbols, skipping\n");
return true;
}

return EnumerateLines(startPos, 'SYMB');
}

Expand Down
4 changes: 2 additions & 2 deletions peid/peid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ duint PEiDPatternScan(const char *Pattern, bool EntryPoint, PBYTE ModuleCopy, du
//
if (EntryPoint)
{
//ModuleBase = 0;
//ModuleSize = 0;
//ModuleBase = ep_start;
//ModuleSize = ep_size;
}

//
Expand Down

0 comments on commit 2a844b5

Please sign in to comment.