// ---------------------------------------------------------------------------------------------- // Copyright (c) Mattias H�gstr�m. // ---------------------------------------------------------------------------------------------- // This source code is subject to terms and conditions of the Microsoft Public License. A // copy of the license can be found in the License.html file at the root of this distribution. // If you cannot locate the Microsoft Public License, please send an email to // dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound // by the terms of the Microsoft Public License. // ---------------------------------------------------------------------------------------------- // You must not remove this notice, or any other, from this software. // ---------------------------------------------------------------------------------------------- #include "stdafx.h" using namespace System; using namespace System::Diagnostics; struct DotNetHelper { public: static bool IsClr4Process(Process^ process) { auto modules = process->Modules; for each(ProcessModule^ module in modules) { if (module->ModuleName->StartsWith("clr", StringComparison::InvariantCultureIgnoreCase)) { return true; } } return false; } static bool IsDotNetProcess(Process^ process) { auto modules = process->Modules; for each(ProcessModule^ module in modules) { if (module->ModuleName->StartsWith("mscor", StringComparison::InvariantCultureIgnoreCase)) { return true; } } return false; } }; bool IsClr4Process(int pId) { Process^ process = Process::GetProcessById(pId); return DotNetHelper::IsClr4Process(process); } bool IsDotNetProcess(int pId) { Process^ process = Process::GetProcessById(pId); return DotNetHelper::IsDotNetProcess(process); } //bool IsClr4Process(int pId) //{ // return true; //} // //bool IsDotNetProcess(int pId) //{ // return true; //}
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)