mirror of
https://github.com/sampletext32/ParkanPlayground.git
synced 2025-05-19 20:01:17 +03:00
Fix DLL name parsing in export directory to properly separate DLL name from function names
This commit is contained in:
parent
8dfc0b1a7b
commit
bc572f5d33
@ -318,10 +318,27 @@ namespace X86Disassembler
|
|||||||
directory.AddressOfNameOrdinals = reader.ReadUInt32();
|
directory.AddressOfNameOrdinals = reader.ReadUInt32();
|
||||||
|
|
||||||
// Read the DLL name
|
// Read the DLL name
|
||||||
|
try
|
||||||
|
{
|
||||||
uint dllNameRVA = directory.Name;
|
uint dllNameRVA = directory.Name;
|
||||||
reader.BaseStream.Seek(RvaToOffset(dllNameRVA), SeekOrigin.Begin);
|
uint dllNameOffset = RvaToOffset(dllNameRVA);
|
||||||
byte[] dllNameBytes = reader.ReadBytes(256);
|
reader.BaseStream.Seek(dllNameOffset, SeekOrigin.Begin);
|
||||||
directory.DllName = Encoding.ASCII.GetString(dllNameBytes).TrimEnd('\0');
|
|
||||||
|
// Read the null-terminated ASCII string
|
||||||
|
StringBuilder nameBuilder = new StringBuilder();
|
||||||
|
byte b;
|
||||||
|
|
||||||
|
while ((b = reader.ReadByte()) != 0)
|
||||||
|
{
|
||||||
|
nameBuilder.Append((char)b);
|
||||||
|
}
|
||||||
|
|
||||||
|
directory.DllName = nameBuilder.ToString();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
directory.DllName = "Unknown";
|
||||||
|
}
|
||||||
|
|
||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user