i tried to create to look dll that loaded in process. but i got error when getting process with system.dll. it throw error message:
System.ComponentModel.
This will ignore Exceptions thrown by accessing process.Modules.
public IEnumerable<string> GetProcessFileName(string searchBy)
{
foreach(var process in Process.GetProcesses())
{
try{
var p = process.Modules.Cast<ProcessModule>()
.Where(m => m.FileName.Contains(searchBy))
.Select(x => x.FileName);
return p;
}
catch(Exception e){
//write to log
//Console.Write(e);
}
}
return Enumerable.Empty<string>();
}