mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
b02427417c
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5614 21ef857c-d57f-4fe0-8362-d861dc6d29cd
45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
// <file>
|
|
// <copyright see="prj:///doc/copyright.txt"/>
|
|
// <license see="prj:///doc/license.txt"/>
|
|
// <owner name="David Srbecký" email="dsrbecky@gmail.com"/>
|
|
// <version>$Revision: 2185 $</version>
|
|
// </file>
|
|
|
|
#pragma warning disable 1591
|
|
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
|
|
namespace Debugger.Interop
|
|
{
|
|
public static class NativeMethods
|
|
{
|
|
[DllImport("kernel32.dll")]
|
|
public static extern bool CloseHandle(IntPtr handle);
|
|
|
|
//[DllImport("mscoree.dll", CharSet = CharSet.Unicode, PreserveSig = false)]
|
|
//public static extern Debugger.Interop.CorDebug.ICorDebug CreateDebuggingInterfaceFromVersion(int debuggerVersion, string debuggeeVersion);
|
|
|
|
[DllImport("mscoree.dll", CharSet = CharSet.Unicode)]
|
|
public static extern int GetCORVersion([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder szName, Int32 cchBuffer, out Int32 dwLength);
|
|
|
|
[DllImport("mscoree.dll", CharSet = CharSet.Unicode)]
|
|
public static extern int GetRequestedRuntimeVersion(string exeFilename, [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pVersion, Int32 cchBuffer, out Int32 dwLength);
|
|
|
|
/// <summary>
|
|
/// Get the .NET version of the process that called this function
|
|
/// </summary>
|
|
public static string GetDebuggerVersion()
|
|
{
|
|
int size;
|
|
NativeMethods.GetCORVersion(null, 0, out size);
|
|
StringBuilder sb = new StringBuilder(size);
|
|
int hr = NativeMethods.GetCORVersion(sb, sb.Capacity, out size);
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
#pragma warning restore 1591
|