Skip to content

Commit d2bd33c

Browse files
authored
Merge pull request x64dbg#3701 from WindowsAPI/fix/resolve-ordinal-imports
Fix ordinal imports display by resolving to function names
2 parents 489f2bc + 252413c commit d2bd33c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/dbg/symbolinfo.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,22 +493,38 @@ bool SymbolFromAddressExact(duint address, SYMBOLINFO* info)
493493
}
494494
}
495495

496+
// module entry point pseudo-symbol
496497
if(modInfo->entry != 0 && modInfo->entrySymbol.rva == rva)
497498
{
498499
modInfo->entrySymbol.convertToGuiSymbol(base, info);
499500
return true;
500501
}
501502

502-
// search in module imports
503+
// search in module imports (iat)
503504
{
504505
auto modImport = modInfo->findImport(rva);
505506
if(modImport != nullptr)
506507
{
508+
// for imports by ordinal, try to resolve the real symbol
509+
if(modImport->ordinal != -1)
510+
{
511+
duint exportAddress = 0;
512+
if(DbgMemRead(address, &exportAddress, sizeof(exportAddress)) && exportAddress != 0)
513+
{
514+
if(SymbolFromAddressExact(exportAddress, info))
515+
{
516+
// override the address of the export symbol with the IAT address
517+
info->addr = address;
518+
return true;
519+
}
520+
}
521+
}
522+
523+
// fall back to the import symbol itself
507524
modImport->copyToGuiSymbol(base, info);
508525
return true;
509526
}
510527
}
511-
512528
return false;
513529
}
514530

0 commit comments

Comments
 (0)