Home » Community » Coffee corner » What next?
Re: What next? [message #46520 is a reply to message #46517] |
Thu, 19 May 2016 17:17 |
omari
Messages: 266 Registered: March 2010
|
Experienced Member |
|
|
Hi,
I think, we can find all MSCxx installation paths, by enumeration of registry subkeys and values.
please, test the function below, and let us know if it success or fail to detect your.
on my win7 64, it show:
SDK found:
C:\Program Files (x86)\Windows Kits\10
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A
C:\Program Files (x86)\Windows Kits\8.0
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A
C:\Program Files (x86)\Windows Kits\8.1
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A
Visual Studio found:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\
C:\Program Files (x86)\Microsoft Visual Studio 12.0\
C:\Program Files (x86)\Microsoft Visual Studio 14.0\
the code:
#include <Core/Core.h>
using namespace Upp;
Vector<String> GetWinRegSubKeys(String reg_path, HKEY base_key = HKEY_LOCAL_MACHINE)
{
HKEY key = 0;
DWORD dwSize = 0;
DWORD count; // subkeys
Vector<String> v;
if(RegOpenKeyEx(base_key, reg_path, 0, KEY_READ, &key) != ERROR_SUCCESS)
return v;
StringBuffer buf(2048);
RegQueryInfoKey(key,NULL,NULL,NULL,&count,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
for(int i=0; i< count; i++){
dwSize = 2048;
RegEnumKeyEx(key,i,buf,&dwSize,NULL,NULL,NULL,NULL);
v.Add( String(buf.Begin(), dwSize)) ;
}
RegCloseKey(key);
return v;
}
Vector<String> GetWinRegValues(String reg_path, HKEY base_key = HKEY_LOCAL_MACHINE)
{
HKEY key = 0;
DWORD dwSize = 0;
DWORD count; // subkeys
Vector<String> v;
if(RegOpenKeyEx(base_key, reg_path, 0, KEY_READ, &key) != ERROR_SUCCESS)
return v;
StringBuffer buf(2048);
RegQueryInfoKey(key,NULL,NULL,NULL,NULL,NULL,NULL, &count,NULL,NULL,NULL,NULL);
for(int i=0; i< count; i++){
dwSize = 2048;
RegEnumValue(key, i, buf, &dwSize, NULL, NULL, NULL, NULL);
v.Add( String(buf.Begin(), dwSize)) ;
}
RegCloseKey(key);
return v;
}
String NormalizePathNN(const String& path)
{
return IsNull(path) ? path : NormalizePath(path);
}
void FindMSC()
{
Vector<String> v = GetWinRegSubKeys("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows", HKEY_LOCAL_MACHINE);
if(v.GetCount())
LOG("SDK found:");
else
LOG("no SDK found");
for(int i = 0; i < v.GetCount(); i++)
{
LOG(NormalizePathNN(GetWinRegString("InstallationFolder",
"SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\" + v[i],
HKEY_LOCAL_MACHINE)));
}
v = GetWinRegValues("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7", HKEY_LOCAL_MACHINE);
if(v.GetCount())
LOG("Visual Studio found:");
else
LOG("No Visual Studio found");
for(int i = 0; i < v.GetCount(); i++)
{
LOG(GetWinRegString(v[i], "SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7", HKEY_LOCAL_MACHINE));
}
}
CONSOLE_APP_MAIN
{
FindMSC();
}
regards
omari.
|
|
|
|
|
What next?
By: mirek on Thu, 17 December 2015 15:54
|
|
|
Re: What next?
By: Tom1 on Thu, 17 December 2015 17:25
|
|
|
Re: What next?
By: Klugier on Thu, 17 December 2015 18:16
|
|
|
Re: What next?
By: mirek on Thu, 17 December 2015 19:07
|
|
|
Re: What next?
|
|
|
Re: What next?
By: mirek on Sun, 20 December 2015 10:46
|
|
|
Re: What next?
|
|
|
Re: What next?
By: mr_ped on Sun, 20 December 2015 21:29
|
|
|
Re: What next?
|
|
|
Re: What next?
By: mirek on Mon, 21 December 2015 20:55
|
|
|
Re: What next?
By: mr_ped on Thu, 17 December 2015 17:56
|
|
|
Re: What next?
By: mirek on Thu, 17 December 2015 18:16
|
|
|
Re: What next?
By: mirek on Thu, 17 December 2015 18:53
|
|
|
Re: What next?
By: mr_ped on Fri, 18 December 2015 09:49
|
|
|
Re: What next?
|
|
|
Re: What next?
By: Novo on Fri, 18 December 2015 04:53
|
|
|
Re: What next?
By: mirek on Fri, 18 December 2015 11:01
|
|
|
Re: What next?
By: Novo on Fri, 18 December 2015 05:19
|
|
|
Re: What next?
By: mirek on Fri, 18 December 2015 10:59
|
|
|
Re: What next?
By: Novo on Sat, 19 December 2015 04:37
|
|
|
Re: What next?
|
|
|
Re: What next?
By: deep on Sat, 19 December 2015 14:23
|
|
|
Re: What next?
By: Sgifan on Sun, 20 December 2015 00:31
|
|
|
Re: What next?
|
|
|
Re: What next?
By: mirek on Sun, 20 December 2015 10:59
|
|
|
Re: What next?
By: Sgifan on Mon, 21 December 2015 23:31
|
|
|
Re: What next?
By: Sgifan on Mon, 21 December 2015 23:35
|
|
|
Re: What next?
|
|
|
Re: What next?
By: Sgifan on Mon, 21 December 2015 23:50
|
|
|
Re: What next?
|
|
|
Re: What next?
By: Sgifan on Tue, 22 December 2015 23:46
|
|
|
Re: What next?
By: koldo on Wed, 23 December 2015 07:30
|
|
|
Re: What next?
By: Sgifan on Wed, 23 December 2015 15:10
|
|
|
Re: What next?
By: mirek on Fri, 01 January 2016 11:31
|
|
|
Re: What next?
By: mdelfede on Sun, 21 February 2016 17:21
|
|
|
Re: What next?
|
|
|
Re: What next?
|
|
|
Re: What next?
By: koldo on Tue, 17 May 2016 09:11
|
|
|
Re: What next?
By: mirek on Thu, 19 May 2016 11:14
|
|
|
Re: What next?
By: omari on Thu, 19 May 2016 17:17
|
|
|
Re: What next?
By: koldo on Thu, 19 May 2016 17:20
|
|
|
Re: What next?
|
|
|
Re: What next?
By: koldo on Fri, 20 May 2016 08:34
|
|
|
Re: What next?
By: mirek on Sat, 21 May 2016 19:57
|
|
|
Re: What next?
|
|
|
Re: What next?
By: koldo on Wed, 01 June 2016 16:28
|
|
|
Re: What next?
By: mirek on Thu, 02 June 2016 11:32
|
|
|
Re: What next?
By: koldo on Fri, 03 June 2016 08:32
|
|
|
Re: What next?
|
|
|
Re: What next?
|
|
|
Re: What next?
|
Goto Forum:
Current Time: Sun May 12 04:36:14 CEST 2024
Total time taken to generate the page: 0.02333 seconds
|