|
using System;
using System.Runtime.InteropServices;
namespace RegExTester
{
/// <summary>
/// Class by Corrado Cavalli, found on UGIDOTNET.ORG
/// </summary>
public class CLRInfos
{
//API declares
[DllImport("mscoree.dll")] static extern Int32 GetCORSystemDirectory ([MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder buffer,Int32 buflen, ref Int32 numbytes);
[DllImport("mscoree.dll")] static extern Int32 GetCORVersion ([MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder buffer,Int32 buflen, ref Int32 numbytes);
static public String SystemDirectory()
{
System.Text.StringBuilder buf=new System.Text.StringBuilder(1024);
Int32 iBytes=0;
Int32 ret= GetCORSystemDirectory(buf,buf.Capacity, ref iBytes);
return buf.ToString().Substring(0,iBytes-1);
}
public static string Version()
{
System.Text.StringBuilder buf = new System.Text.StringBuilder(1024);
Int32 iBytes=0;
Int32 ret= GetCORVersion(buf,buf.Capacity, ref iBytes);
return buf.ToString().Substring(0,iBytes-1);
}
}
}
|
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.
I'm from Argentina, 28 y/o (by 2011) and work as a software developer since I was 16 after messing around with computers since I was 8.