Possible Duplicate:
How do I tell if a win32 application uses the .NET runtime
There is a way to manually recognize if a specific ".exe" process was written with C++(unmanaged code) or with C#(managed code)?
Possible Duplicate:
How do I tell if a win32 application uses the .NET runtime
There is a way to manually recognize if a specific ".exe" process was written with C++(unmanaged code) or with C#(managed code)?
If you're trying to determine if a process is a .NET process, I can suggest a solution inspired from Dave Van den Eynde's answer in this topic: How do I tell if a win32 application uses the .NET runtime
"An application is a .NET executable if it requires mscoree.dll to run.".
Given that, you check the process' modules to see if mscoree is listed.
foreach (var process in Process.GetProcesses())
{
if (process.Modules.OfType<ProcessModule>().Any(m => m.ModuleName.Equals("mscoree.dll", StringComparison.OrdinalIgnoreCase)))
{
Console.WriteLine("{0} is a .NET process", process.ProcessName);
}
}
Here you can find details how it can be done: Determining Whether a DLL or EXE Is a Managed Component
You can run peverify or ildasm (available from the Visual Studio Command Line environment) on the file and it will give you an error if it's not managed code. Note that this will fail in some cases where they use a protection system that encrypts the IL and hides the CLR bootloader, but most programs don't have this protection.
If it's a .NET .exe (or .dll for that matter), it will have a dependency on mscoree.dll which you can see by examining it with Dependency Walker or something similar.
If you want to do so programatically, you could take this VB project as a starting point.
This won't tell you the language for sure though. You can't tell a C# from a VB.NET (or other .NET language) program or a C++ from a C program (or other non .NET language). There are some things that can rule one or the other out as being the only language used, or make one or the other more likely. There could even be unmanaged code making use of mscoree.dll in some weird way.