Skip to content

Commit 1874da8

Browse files
starsunyzlmrexodia
authored andcommitted
Fix export name parsing
1 parent 425a531 commit 1874da8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/dbg/module.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,18 @@ static void ReadExportDirectory(MODINFO & Info, ULONG_PTR FileMapVA)
169169

170170
auto nameOffset = rva2offset(addressOfNames[i]);
171171
if(nameOffset) // Silent ignore (3) by ntdll loader: invalid names or addresses of names
172-
Info.exports[index].name = String((const char*)(nameOffset + FileMapVA));
172+
{
173+
// Info.exports has excluded some invalid exports, so addressOfNameOrdinals[i] is not equal to
174+
// the index of Info.exports. We need to iterate over Info.exports.
175+
for(size_t j = 0; j < Info.exports.size(); j++)
176+
{
177+
if(index + exportDir->Base == Info.exports[j].ordinal)
178+
{
179+
Info.exports[j].name = String((const char*)(nameOffset + FileMapVA));
180+
break;
181+
}
182+
}
183+
}
173184
}
174185
}
175186

0 commit comments

Comments
 (0)