Game Development Reference
In this chapter, I present a solution that can determine the list of Common
Language Runtimes that are correctly installed and allow enumeration through
them. The solution will also account for service packs and renamed folder locations.
The large segments of source code have been removed from this chapter and are available on the
Companion Web site in order to fit this chapter into the topic. Please refer to the source code of
the example in order to clarify any implementation questions.
The code in this section forms the solution for this chapter. The code compiles
into a static library that can be reused across multiple projects.
The full source code for the solution is available on the Companion Web site.
We do not want a dependency on mscoree , so we use LoadLibrary and
GetProcAddress in order to use the needed functions. The prototype for
FSGetRequestedRuntimeInfo is also copied directly into the source code so that we do
not have a dependency on the header file for mscoree .
typedef HRESULT (__stdcall *FPGetRequestedRuntimeInfo)
The constructor for the version check class first determines whether the .NET
framework is installed (in any shape or form); then it determines the base instal-
lation path for the .NET framework.