|
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.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Born in 1977, works as a freelancer, focusing on Database / Software Architecture.
In the free time writes articles for two of the major Italian programming magazines (Computer Programming and VBJ) and also develops nice and useful programs.
His major interests and skills are the .NET framework (C# in particular) and SQL Server.