Fix get_filename_component() registry view

Some find-modules use get_filename_component() to expand registry
values.  We need to look in both the 32-bit and 64-bit registry views
when expanding values.  We prefer the one that the target application
would see.  See issue #8792.
This commit is contained in:
Brad King 2009-09-30 13:45:24 -04:00
parent 56d1a1780d
commit c63e3bd13c
1 changed files with 21 additions and 1 deletions

View File

@ -35,7 +35,27 @@ bool cmGetFilenameComponentCommand
std::string result;
std::string filename = args[1];
cmSystemTools::ExpandRegistryValues(filename);
if(filename.find("[HKEY") != filename.npos)
{
// Check the registry as the target application would view it.
cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_32;
cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_64;
if(this->Makefile->PlatformIs64Bit())
{
view = cmSystemTools::KeyWOW64_64;
other_view = cmSystemTools::KeyWOW64_32;
}
cmSystemTools::ExpandRegistryValues(filename, view);
if(filename.find("/registry") != filename.npos)
{
std::string other = args[1];
cmSystemTools::ExpandRegistryValues(other, other_view);
if(other.find("/registry") == other.npos)
{
filename = other;
}
}
}
std::string storeArgs;
std::string programArgs;
if (args[2] == "PATH")