Is it possible to extract header
from a dll
? Is this practice possible? If so, how can I do it?
Is it possible to extract header
from a dll
? Is this practice possible? If so, how can I do it?
If you are using C #, use the class FileVersionInfo
:
myFileVersionInfo = FileVersionInfo.GetVersionInfo("dll-alvo.dll");
Instance properties expose the build details - for example CompanyName
, ProductName
, and ProductVersion
.
To extract the classes of a given assembly , you need to use reflection :
Assembly assembly = Assembly.ReflectionOnlyLoadFrom("dll-alvo.dll");
foreach (Type tc in assembly .GetTypes())
{
Console.WriteLine(tc.FullName);
}
And finally listing all methods of a given class:
foreach (Type tc in assembly .GetTypes())
{
if (tc.IsAbstract)
{
Console.WriteLine("Abstract Class : " + tc.Name);
}
else if (tc.IsPublic)
{
Console.WriteLine("Public Class : " + tc.Name);
}
else if (tc.IsSealed)
{
Console.WriteLine("Sealed Class : " + tc.Name);
}
//Obtém lista de nomes de métodos
MemberInfo[] methodName = tc.GetMethods();
foreach (MemberInfo method in methodName)
{
if (method.ReflectedType.IsPublic)
{
Console.WriteLine("Método público : " + method.Name.ToString());
}
else
{
Console.WriteLine("Método não público : " + method.Name.ToString());
}
}
}