My program contains several dlls which depend on MSVCP100.dll and MSVCR100.dll, in Win7 my program runs without any problem, however in Win8 it failed to locate these two dlls. I notice that in Win8 there is no VCRedist installed by default, so apparently I need to install the VCRedist to enable my program.
The question is, how do I check if the VCRedist is installed?
Looks like we can do it by searching in registry [1] [2]. However, it seems there are many versions of VCRedist(VC2012,2010,2008,2005...), so I need to go through all these registry keys?
Since your DLLs depend on MSVCR100.dll, you'll want to find VCRedist for VC 2010.
The number after 'MSVCR' or 'MSVCP' is the internal version of Visual Studio x10 - http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Version_history lists the values for the various versions.
For Visual Studio 2010 you can detect if the runtime is already installed by checking the "Installed" value of HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86
for 32-bit applications/DLLs and HKLM\SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x64
for 64-bit applications/DLLs.
For Visual Studio 2010 and previous versions, http://blogs.msdn.com/b/astebner/archive/2010/05/05/10008146.aspx has a good explanation of methods for detecting if the runtime is installed.
With Visual Studio 2012 things have changed and the VCRedist key no longer exists. Instead you may look at the Installed
value of the reg key (for 32-bit applications) Software\Microsoft\VisualStudio\11.0\VC\Runtimes\x86