Can we check if a running application or a program uses .Net framework to execute itself?
If you suspect that an application might be a . NET application simply start it and check the process column again for that app. In this case, the first instance I find is Microsoft AD web services. 7) Right-click the service that is highlighted in yellow and select Properties.
NET Core is installed on Windows is: Press Windows + R. Type cmd. On the command prompt, type dotnet --version.
Use Registry Editor (older framework versions) From the Start menu, choose Run, enter regedit, and then select OK. You must have administrative credentials to run regedit. Open the subkey that matches the version you want to check. Use the table in the Detect .NET Framework 1.0 through 4.0 section.
GetProcessById() function in C#. In the above code, we created a function isRunning() that checks if a process is running or not. The isRunning() function takes the process id as an argument and returns true if the process is running and returns false if it is not running.
There's a trick I once learned from Scott Hanselman's list of interview questions. You can easily list all programs running .NET in command prompt by using:
tasklist /m "mscor*"
It will list all processes that have mscor*
amongst their loaded modules.
We can apply the same method in code:
public static bool IsDotNetProcess(this Process process)
{
var modules = process.Modules.Cast<ProcessModule>().Where(
m => m.ModuleName.StartsWith("mscor", StringComparison.InvariantCultureIgnoreCase));
return modules.Any();
}
Use the CLR COM interfaces ICorPublish and ICorPublishProcess. The easiest way to do this from C# is to borrow some code from SharpDevelop's debugger, and do the following:
ICorPublish publish = new ICorPublish();
ICorPublishProcess process;
process = publish.GetProcess(PidToCheck);
if (process == null || !process.IsManaged)
{
// Not managed.
}
else
{
// Managed.
}
Use System.Reflection.Assembly.LoadFrom
function to load the .exe file. This function will throw exception if you try to load binary file that is not .NET assembly.
I know this is about a million years too late, but in case it helps - my favourite method to figure out if an exe is using .net is to run MSIL disassembler against it which comes with .net SDK. If a .net exe you indeed have, you'll get a nice graphical breakdown of its contents; if a plain old win32 exe it be, you'll get a message telling you so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With