GetRequestedRuntimeInfo Function

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



[in] The name of the application.


[in] A string specifying the version number of the runtime.


[in] The name of the configuration file that is associated with pExe.


[in] One or more of the STARTUP_FLAGS Enumeration enumeration values.


[in] One or more of the RUNTIME_INFO_FLAGS Enumeration enumeration values.


[out] A buffer that contains the directory path to the runtime upon successful completion.


[in] The length of the directory buffer.


[out] A pointer to the length of the directory path string.


[out] A buffer that contains the version number of the runtime upon successful completion.


[in] The length of the version string buffer.


[out] A pointer to the length of the version string.

This method returns standard Component Object Model (COM) error codes, as defined in WinError.h, in addition to the following values.

Return code Description


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 Enumeration 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 Function 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 enumeration at a time:




Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: MSCorEE.idl

Library: MSCorEE.dll

.NET Framework Version: 2.0, 1.1

Community Additions