Gets version and directory information about the common language runtime (CLR) requested by an application.
HRESULT GetRequestedRuntimeInfo ( [in] LPCWSTR pExe, [in] LPCWSTR pwszVersion, [in] LPCWSTR pConfigurationFile, [in] DWORD startupFlags, [in] DWORD runtimeInfoFlags, [out] LPWSTR pDirectory, [in] DWORD dwDirectory, [out] DWORD *dwDirectoryLength, [out] LPWSTR pVersion, [in] DWORD cchBuffer, [out] DWORD *dwlength );
This method returns standard Component Object Model (COM) error codes, as defined in WinError.h, in addition to the following values.
The method completed successfully.
The directory buffer is not large enough to store the directory path.
- or -
The version buffer is not large enough to store the version string.
The GetRequestedRuntimeInfo method returns run-time information about the version loaded into the process, which is not necessarily the latest version installed on the computer.
In the .NET Framework version 2.0, you can get information about the latest installed version by using the GetRequestedRuntimeInfo method as follows:
Specify the pExe, pwszVersion, and pConfigurationFile parameters as null.
Specify the RUNTIME_INFO_UPGRADE_VERSION flag in the RUNTIME_INFO_FLAGS enumerations for the runtimeInfoFlags parameter.
The GetRequestedRuntimeInfo method does not return the latest CLR version in the following circumstances:
An application configuration file that specifies loading a particular CLR version exists. Note that the .NET Framework will use the configuration file even if you specify null for the pConfigurationFile parameter.
The CorBindToRuntimeEx method was called specifying an earlier CLR version.
An application that was compiled for an earlier CLR version is currently running.
For the runtimeInfoFlags parameter, you can specify only one of the architecture constants of the RUNTIME_INFO_FLAGS enumeration at a time: