In Microsoft Visual C++ I have the following piece of code to access a path in registry. Then I read a value of key Installed
with RegQueryValueEx
. So far so good, the value seems to be 1
, which corresponds with the presence of Visual C++ 2010 runtime on my system. (it happens to be a piece of code to detect the presence of the c++ runtime).
Now when I check with regedit.exe
at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0
I do not see VC
in the tree.
How is this possible? I have copied/pasted all paths and code in this question, so they must be correct.
Code in C++ application:
HKEY RegistryKey;
DWORD ErrorCode;
DWORD RegDwordValue = 0;
DWORD RegDwordValueSize = sizeof(DWORD);
if((ErrorCode = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
"SOFTWARE\\Microsoft\\VisualStudio\\10.0\\VC\\VCRedist\\x86",
0, //Reserved
KEY_READ,
&RegistryKey)) != ERROR_SUCCESS)
{
//Either the key does not exists, or registry access is denied. Anyway, detection did not succeed
std::cout << "Could not read registry path:\n\t" << lpcRegistryPath << "\n\tError code: " << ErrorCode;
return false;
}
if((ErrorCode = RegQueryValueEx( RegistryKey,
lpcValueToQuery,
NULL,
NULL,
(LPBYTE)&RegDwordValue,
&RegDwordValueSize
)) != ERROR_SUCCESS)
{
std::cout << "Could not read registry value, error " << ErrorCode;
return false;
}
EDIT: I have added an export of the registry below
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Debugger]
"FEQARuntimeImplDll"="C:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\Packages\\Debugger\\X64\\Microsoft.VisualStudio.Debugger.Runtime.Impl.dll"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Packages]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Packages\{4A0C6509-BF90-43DA-ABEE-0ABA3A8527F1}]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Packages\{4A0C6509-BF90-43DA-ABEE-0ABA3A8527F1}\Settings]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Packages\{4A0C6509-BF90-43DA-ABEE-0ABA3A8527F1}\Settings\Tools]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Packages\{4A0C6509-BF90-43DA-ABEE-0ABA3A8527F1}\Settings\Tools\SSISScript]
"ScriptLanguage"="CSharp"