This is another often-asked question. As of today, there is no managed answer. mscoree!GetCORSystemDirectory returns the directory of where .Net framework is installed. It is documented here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/grfungetcorsystemdirectory.asp).
Note the document is not complete. Here is what it says:
<quote>Returns the installation directory of the common language runtime that is loaded into the process. The installation directory is fully qualified, for example, "c:\windows\microsoft.net\framework\v1.0.3705".</quote>
What it really does is, if CLR is loaded in the process, this API returns the installation directory of the CLR loaded in the process, as described in the document. If CLR is not loaded in the process, this API returns the installation directory of the highest CLR version installed on the machine. If you have both v1 and v1.1 installed, this API will return the installation directory of v1.1.
<update> Joseph Ward mentioned that there is a managed code to get it using System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(). I mentioned RuntimeEnvironment class here http://blogs.msdn.com/junfeng/archive/2004/03/11/87782.aspx </update>