checkdll.css.
using System;
using System.Diagnostics;
using System.IO;namespace FrameworkExamples
{
//HOW TO Get information about the modules being referenced
// by a running process with the DOT NET Frameworkclass SampleProcessModules
{
static void Main()
{
Process[] p;//get the current process
//p = Process.GetCurrentProcess(“iexplore.exe”);
p=Process.GetProcessesByName(“Iexplore”);//get all the dlls this class is using
foreach(ProcessModule module in p.Modules)
{
//dll name
Print(module.ModuleName, 20);//full path
Print(module.FileName, 75);
//dll version
Print(module.FileVersionInfo.FileVersion, 20);//last write time
Print(File.GetLastWriteTime(module.FileName).ToShortDateString(), 20);Console.WriteLine();
}//cleanup
p.Close();
p = null;
}//utility function for writing to the console
static void Print(string towrite, int maxlen)
{
if (towrite.Length >= maxlen)
{
Console.Write(towrite.Substring(0, maxlen – 4)+”… “);
return;
}
towrite += new string(‘ ‘, maxlen – towrite.Length);Console.Write(towrite);
}
}
}