Fix WOW64 registry mode on Windows 2000 (#10759)

CMake fails to find any registry paths on Windows 2000: according to regmon
it fails with an access denied error. I double checked all the access rights
and they are fine. After checking the access modes on MSDN I found that it
says KEY_WOW64_32KEY / KEY_WOW64_64KEY are not supported on Windows 2000.
CMake does not check if the current system supports Wow64 before applying
these flags.

This commit adds a check for IsWow64Process in kernel32.dll before adding
these flags.

Author: Axel Gembe <ago@bastart.eu.org>
Signed-off-by: Axel Gembe <ago@bastart.eu.org>
This commit is contained in:
David Cole 2011-01-07 07:31:56 -05:00
parent fd4875b4c0
commit 4b05a21302
1 changed files with 8 additions and 0 deletions

View File

@ -563,6 +563,14 @@ void SystemTools::ReplaceString(kwsys_stl::string& source,
static DWORD SystemToolsMakeRegistryMode(DWORD mode, static DWORD SystemToolsMakeRegistryMode(DWORD mode,
SystemTools::KeyWOW64 view) SystemTools::KeyWOW64 view)
{ {
// only add the modes when on a system that supports Wow64.
static void *wow64p = GetProcAddress(GetModuleHandle("kernel32"),
"IsWow64Process");
if(wow64p == NULL)
{
return mode;
}
if(view == SystemTools::KeyWOW64_32) if(view == SystemTools::KeyWOW64_32)
{ {
return mode | KWSYS_ST_KEY_WOW64_32KEY; return mode | KWSYS_ST_KEY_WOW64_32KEY;