[ACCEPTED]-How to detect VC++ 2008 redistributable?-redistributable
I don't think any of those solution can 14 help when your using different OS ! For 13 ex, MsiQueryProductState will always returned 12 -1 using Vista VC8.0
while -1 for VC8.0/8.0 11 SP1/9.0 with Windows 7 ! So the GUID solution 10 that microsoft provided, doesn't work in 9 all cases
so i guess i'm forced to stuck 8 with the %windir%\winsxs approach and search 7 for
- x86_Microsoft.VC80.CRT*
- x86_Microsoft.VC90.CRT*
For those who are looking for all GUIDs, Here 6 is a list i created:
Visual C++ 2005 runtime 5 files
* VC 8.0 (x86) - {A49F249F-0C91-497F-86DF-B2585E8E76B7}
* VC 8.0 (x64) - {6E8E85E8-CE4B-4FF5-91F7-04999C9FAE6A}
* VC 8.0 (ia64) - {03ED71EA-F531-4927-AABD-1C31BCE8E187}
Visual C++ 2005 SP1 runtime files
* VC 8.0 SP1 (x86) - {7299052B-02A4-4627-81F2-1818DA5D550D}
* VC 8.0 SP1 (x64) - {071C9B48-7C32-4621-A0AC-3F809523288F}
* VC 8.0 SP1 (ia64) - {0F8FB34E-675E-42ED-850B-29D98C2ECE08}
Visual 4 C++ 2005 SP1 ATL Security Update runtime 3 files
* VC 8.0 SP1 ATL Patch (x86) - {837B34E3-7C30-493C-8F6A-2B0F04E2912C}
* VC 8.0 SP1 ATL Patch (x64) - {6CE5BAE9-D3CA-4B99-891A-1DC6C118A5FC}
* VC 8.0 SP1 ATL Patch (ia64) - {85025851-A784-46D8-950D-05CB3CA43A13}
Visual C++ 2008 runtime files
* VC 9.0 (x86) - {FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}
* VC 9.0 (x64) - {350AA351-21FA-3270-8B7A-835434E766AD}
* VC 9.0 (ia64) - {2B547B43-DB50-3139-9EBE-37D419E0F5FA}
Visual 2 C++ 2008 SP1 runtime files
* VC 9.0 SP1 (x86) - {9A25302D-30C0-39D9-BD6F-21E6EC160475}
* VC 9.0 SP1 (x64) - {8220EEFE-38CD-377E-8595-13398D740ACE}
* VC 9.0 SP1 (ia64) - {5827ECE1-AEB0-328E-B813-6FC68622C1F9}
Visual C++ 2008 1 SP1 ATL Security Update runtime files
* VC 9.0 SP1 ATL (x86) - {1F1C2DFC-2D24-3E06-BCB8-725134ADF989}
* VC 9.0 SP1 ATL (x64) - {4B6C7001-C7D6-3710-913E-5BC23FCE91E6}
* VC 9.0 SP1 ATL (ia64) - {977AD349-C2A8-39DD-9273-285C08987C7B}
Check the registry:
VC++2008 (sp1): HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{3C3D696B-0DB7-3C6D-A356-3DB8CE541918}
or
VC++2008 1 (original): HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}
Latest one for VC2005:
Visual C++ 2005 Service 2 Pack 1 Redistributable Package MFC Security 1 Update
* VC 8.0 SP1 MFCLOC Patch (x86) - {710F4C1C-CC18-4C49-8CBF-51240C89A1A2}
* VC 8.0 SP1 MFCLOC Patch (x64) - {AD8A2FA1-06E7-4B0D-927D-6E54B3D31028}
* VC 8.0 SP1 MFCLOC Patch (ia64) - {C2F60BDA-462A-4A72-8E4D-CA431A56E9EA}
8.0.50727.6195
http://www.microsoft.com/downloads/details.aspx?familyid=AE2E1A40-7B45-4FE9-A20F-2ED2923ACA62
Quick and dirty:
if (LoadLibrary(L"msvcrt80.dll")!=NULL)
{
// it is installed
}
Loadlibrary will handle 1 searching the paths for you.
looks like there is another solution proposed by a Microsoft-Developer, using 12 MsiQueryProductState API, alas also relying on the GUIDs.
Update: The code 11 went live yesterday and seems to be working 10 fine. Here is what is beeing done: It is 9 checked for the latest-known-to-me GUID 8 AND the path² to-where-it-is-supposed-to-be-installed. If 7 both fails, it is installed. This seems 6 to work fine.
Additionally, it is installed 5 with the command line arguments "/qb" which 4 means "unattended but not invisible". See 3 this other blog post about those params.
FWIW, GUIDs for Microsoft 2 Visual C++ 2008 / VC90 SP1 Redistributable 1 - x86 9.0.30729
- 64bit 30729.17: 8220EEFE-38CD-377E-8595-13398D740ACE
- 32bit 30729.17: 9A25302D-30C0-39D9-BD6F-21E6EC160475
- 32bit 30729.01: 6AFCA4E1-9B78-3640-8F72-A7BF33448200
² The path:
$WINDIR\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729*
Check for $WINDIR\WinSxS\x86_Microsoft.VC90.CRT_*
if, for example, you're checking 1 for the Visual Studio 2008 redistributable.
I open-sourced a Visual C++ project on Github that checks for VC++ redistributable DLLs specifically and made it 7 available under the Apache 2.0 license.
It 6 has three different methods for checking 5 for the availability of VC++9 and VC++10 4 runtimes:
- Checks the MsiQueryProductState APIs;
- Inspect the contents of the WinSxS folder for matching product directories; and
- Checks the current working directory for any local versions of the VC++9 and VC++10 runtimes (and inspects their contents.)
edit: Here's a sample of what using 3 it actually looks like:
wcout << _T("Checking for the availability of VC++ runtimes..") << endl;
wcout << _T("----------- Visual C++ 2008 (VC++9) -----------") << endl;
wcout << _T("Visual C++ 2008 (x86) ? ") << (IsVC2008Installed_x86() ? _T("true") : _T("false")) << endl;
wcout << _T("Visual C++ 2008 (x64) ? ") << (IsVC2008Installed_x64() ? _T("true") : _T("false")) << endl;
wcout << _T("Visual C++ 2008 SP1 (x86) ? ") << (IsVC2008SP1Installed_x86() ? _T("true") : _T("false")) << endl;
wcout << _T("Visual C++ 2008 SP1 (x64) ? ") << (IsVC2008SP1Installed_x64() ? _T("true") : _T("false")) << endl;
I licensed the crt-detector project 2 under Apache 2.0, so feel free to use it 1 in your own applications.
Update for anyone else hitting this problem:
1) If 16 you have Visual Studio installed, the required 15 DLLs will be present, but the "redist package" is 14 not, so the registry keys are missing. (i.e. this 13 will give a false negative). However, installing 12 the redist over the top in this situation 11 is harmless.
2) Every major release of the 10 redist (Any combination of VS2005/VS2008, x86/x64/IA64, and 9 service packs: SP1,ATL security update) has 8 a different GUID. Take care if you are expecting 7 to deploy your application on both x86 and 6 x64 PCs.
3) If you use LoadLibrary or a check 5 for Dll files, make sure you target the 4 correct version. If you look for "any" copy 3 of msvcrt80.dll (etc) then you won't be 2 able to tell if it is the version your program 1 was linked to.
Product code for "Microsoft Visual C++ 2008 2 Service Pack 1 Redistributable Package MFC 1 Security Update (x86)" is {9BE518E6-ECC6-35A9-88E4-87755C07200F}
You can check for the files under the WINDOWS\WinSxS 4 directory to see which versions you have 3 installed. Often many versions can be installed 2 at one time so you might need to check the 1 specific versions you have installed.
Found registry entry for VC2008 redistributable. Here 1 is my solution:
BOOL IsVC2008RedistInstalled(LPCTSTR pLogFile)
{
TCHAR szLogEntry[256];
memset(szLogEntry, '0', sizeof(szLogEntry));
HKEY hKey;
LONG lErr;
TCHAR csid[256];
_stprintf( csid, _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{9A25302D-30C0-39D9-BD6F-21E6EC160475}"));
lErr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, csid, 0, KEY_QUERY_VALUE, &hKey);
if (lErr == ERROR_SUCCESS)
{
_stprintf(szLogEntry, _T("VC2008 Redistributable was installed before.\n"));
toFile(pLogFile, szLogEntry);
return TRUE;
}
else
{
_stprintf(szLogEntry, _T("VC2008 Redistributable was not installed before. %ld\n"), lErr);
toFile(pLogFile, szLogEntry);
return FALSE;
}
}
I'd like to extend the GUID list with the 12 following values:
32bit 30729.17
{9A25302D-30C0-39D9-BD6F-21E6EC160475}
32bit 11 30729.01
{6AFCA4E1-9B78-3640-8F72-A7BF33448200}
64bit 10 30729.17
{8220EEFE-38CD-377E-8595-13398D740ACE}
64bit 9 30729.01
{0DF3AE91-E533-3960-8516-B23737F8B7A2}
VC++2008 8 (sp1)
{3C3D696B-0DB7-3C6D-A356-3DB8CE541918}
VC++2008 7 (original)
{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}
IA64 6 30729.01
{22E23C71-C27A-3F30-8849-BB6129E50679}
32bit 5 30729.4148
{7B33F480-496D-334A-BAC2-205DEC0CBC2D}
Visual 4 Studio 2008 Professional SP1
{D7DAD1E4-45F4-3B2B-899A-EA728167EC4F}
32bit 3 30729.01
{F333A33D-125C-32A2-8DCE-5C5D14231E27}
So 2 please decide, whether it's a good idea 1 to check the presence of VCredist by GUIDs.
The surest way is using the MsiQueryProductState API with the 2 GUID of the different vcredist versions.
It 1 works!
Regards.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.