0
mirror of https://github.com/sampletext32/ParkanPlayground.git synced 2025-05-21 04:41:18 +03:00

Remove function list truncation to show all exported and imported functions

This commit is contained in:
bird_egop 2025-04-12 17:22:20 +03:00
parent e4adb45ed2
commit 49a0a9e3a3

View File

@ -99,18 +99,12 @@ namespace X86Disassembler
Console.WriteLine($"Number of Functions: {peFile.ExportDirectory.NumberOfFunctions}");
Console.WriteLine($"Number of Names: {peFile.ExportDirectory.NumberOfNames}");
// Display the first 10 exported functions (if any)
int count = Math.Min(10, peFile.ExportedFunctions.Count);
for (int i = 0; i < count; i++)
// Display all exported functions
for (int i = 0; i < peFile.ExportedFunctions.Count; i++)
{
var function = peFile.ExportedFunctions[i];
Console.WriteLine($" {i}: {function.Name} (Ordinal={function.Ordinal}, RVA=0x{function.Address:X8})");
}
if (peFile.ExportedFunctions.Count > 10)
{
Console.WriteLine($" ... and {peFile.ExportedFunctions.Count - 10} more");
}
}
private static void DisplayImportedFunctions(PEFormat peFile)
@ -124,16 +118,14 @@ namespace X86Disassembler
Console.WriteLine("\nImported Functions:");
Console.WriteLine($"Number of Imported DLLs: {peFile.ImportDescriptors.Count}");
// Display the first 5 imported DLLs and their functions
int dllCount = Math.Min(5, peFile.ImportDescriptors.Count);
for (int i = 0; i < dllCount; i++)
// Display all imported DLLs and their functions
for (int i = 0; i < peFile.ImportDescriptors.Count; i++)
{
var descriptor = peFile.ImportDescriptors[i];
Console.WriteLine($" DLL: {descriptor.DllName}");
// Display the first 5 functions from this DLL
int funcCount = Math.Min(5, descriptor.Functions.Count);
for (int j = 0; j < funcCount; j++)
// Display all functions from this DLL
for (int j = 0; j < descriptor.Functions.Count; j++)
{
var function = descriptor.Functions[j];
if (function.IsOrdinal)
@ -146,16 +138,11 @@ namespace X86Disassembler
}
}
if (descriptor.Functions.Count > 5)
if (i < peFile.ImportDescriptors.Count - 1)
{
Console.WriteLine($" ... and {descriptor.Functions.Count - 5} more");
Console.WriteLine(); // Add a blank line between DLLs for better readability
}
}
if (peFile.ImportDescriptors.Count > 5)
{
Console.WriteLine($" ... and {peFile.ImportDescriptors.Count - 5} more DLLs");
}
}
}
}