Example #1
0
        public static bool IsManagedProcess(Process proc)
        {
            bool ismanaged = false;

            for (int i = 0; i < proc.Modules.Count; i++)
            {
                if (proc.Modules[i].ModuleName.Equals("mscorlib.dll") ||
                    proc.Modules[i].ModuleName.Equals("mscorlib.ni.dll"))
                {
                    //make sure its version 2.0
                    System.Reflection.AssemblyName name = System.Reflection.AssemblyName.GetAssemblyName(proc.Modules[i].FileName);
                    if ((!name.Equals(string.Empty)) && name.Version.Major == 2)
                    {
                        ismanaged = true;
                    }
                    break;
                }
            }
            return(false);
        }