1
0
Fork 0

Fix export name parsing

This commit is contained in:
Zhang Li 2019-04-28 04:08:04 +08:00 committed by Duncan Ogilvie
parent 425a531535
commit 1874da8657
1 changed files with 12 additions and 1 deletions

View File

@ -169,7 +169,18 @@ static void ReadExportDirectory(MODINFO & Info, ULONG_PTR FileMapVA)
auto nameOffset = rva2offset(addressOfNames[i]);
if(nameOffset) // Silent ignore (3) by ntdll loader: invalid names or addresses of names
Info.exports[index].name = String((const char*)(nameOffset + FileMapVA));
{
// Info.exports has excluded some invalid exports, so addressOfNameOrdinals[i] is not equal to
// the index of Info.exports. We need to iterate over Info.exports.
for(size_t j = 0; j < Info.exports.size(); j++)
{
if(index + exportDir->Base == Info.exports[j].ordinal)
{
Info.exports[j].name = String((const char*)(nameOffset + FileMapVA));
break;
}
}
}
}
}