[Cmake-commits] [cmake-commits] king committed SystemTools.cxx 1.225 1.226 SystemTools.hxx.in 1.73 1.74
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue May 27 14:47:02 EDT 2008
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv11536/Source/kwsys
Modified Files:
SystemTools.cxx SystemTools.hxx.in
Log Message:
ENH: Added WOW64 key view support to KWSys SystemTools' windows registry API.
- Add an argument to registry read/write/delete methods to specify
a 32-bit or 64-bit view.
- Default is the bit-ness of the running program.
- See issue #7095.
Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.225
retrieving revision 1.226
diff -C 2 -d -r1.225 -r1.226
*** SystemTools.cxx 11 May 2008 02:48:53 -0000 1.225
--- SystemTools.cxx 27 May 2008 18:47:00 -0000 1.226
***************
*** 494,497 ****
--- 494,521 ----
}
+ #if defined(KEY_WOW64_32KEY) && defined(KEY_WOW64_64KEY)
+ # define KWSYS_ST_KEY_WOW64_32KEY KEY_WOW64_32KEY
+ # define KWSYS_ST_KEY_WOW64_64KEY KEY_WOW64_64KEY
+ #else
+ # define KWSYS_ST_KEY_WOW64_32KEY 0x0200
+ # define KWSYS_ST_KEY_WOW64_64KEY 0x0100
+ #endif
+
+ #if defined(_WIN32) && !defined(__CYGWIN__)
+ static DWORD SystemToolsMakeRegistryMode(DWORD mode,
+ SystemTools::KeyWOW64 view)
+ {
+ if(view == SystemTools::KeyWOW64_32)
+ {
+ return mode | KWSYS_ST_KEY_WOW64_32KEY;
+ }
+ else if(view == SystemTools::KeyWOW64_64)
+ {
+ return mode | KWSYS_ST_KEY_WOW64_64KEY;
+ }
+ return mode;
+ }
+ #endif
+
// Read a registry value.
// Example :
***************
*** 502,506 ****
#if defined(_WIN32) && !defined(__CYGWIN__)
! bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value)
{
bool valueset = false;
--- 526,531 ----
#if defined(_WIN32) && !defined(__CYGWIN__)
! bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value,
! KeyWOW64 view)
{
bool valueset = false;
***************
*** 550,554 ****
second.c_str(),
0,
! KEY_READ,
&hKey) != ERROR_SUCCESS)
{
--- 575,579 ----
second.c_str(),
0,
! SystemToolsMakeRegistryMode(KEY_READ, view),
&hKey) != ERROR_SUCCESS)
{
***************
*** 590,594 ****
}
#else
! bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &)
{
return false;
--- 615,620 ----
}
#else
! bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &,
! KeyWOW64)
{
return false;
***************
*** 605,609 ****
#if defined(_WIN32) && !defined(__CYGWIN__)
! bool SystemTools::WriteRegistryValue(const char *key, const char *value)
{
kwsys_stl::string primary = key;
--- 631,636 ----
#if defined(_WIN32) && !defined(__CYGWIN__)
! bool SystemTools::WriteRegistryValue(const char *key, const char *value,
! KeyWOW64 view)
{
kwsys_stl::string primary = key;
***************
*** 655,659 ****
"",
REG_OPTION_NON_VOLATILE,
! KEY_WRITE,
NULL,
&hKey,
--- 682,686 ----
"",
REG_OPTION_NON_VOLATILE,
! SystemToolsMakeRegistryMode(KEY_WRITE, view),
NULL,
&hKey,
***************
*** 675,679 ****
}
#else
! bool SystemTools::WriteRegistryValue(const char *, const char *)
{
return false;
--- 702,706 ----
}
#else
! bool SystemTools::WriteRegistryValue(const char *, const char *, KeyWOW64)
{
return false;
***************
*** 689,693 ****
#if defined(_WIN32) && !defined(__CYGWIN__)
! bool SystemTools::DeleteRegistryValue(const char *key)
{
kwsys_stl::string primary = key;
--- 716,720 ----
#if defined(_WIN32) && !defined(__CYGWIN__)
! bool SystemTools::DeleteRegistryValue(const char *key, KeyWOW64 view)
{
kwsys_stl::string primary = key;
***************
*** 736,740 ****
second.c_str(),
0,
! KEY_WRITE,
&hKey) != ERROR_SUCCESS)
{
--- 763,767 ----
second.c_str(),
0,
! SystemToolsMakeRegistryMode(KEY_WRITE, view),
&hKey) != ERROR_SUCCESS)
{
***************
*** 753,757 ****
}
#else
! bool SystemTools::DeleteRegistryValue(const char *)
{
return false;
--- 780,784 ----
}
#else
! bool SystemTools::DeleteRegistryValue(const char *, KeyWOW64)
{
return false;
Index: SystemTools.hxx.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.hxx.in,v
retrieving revision 1.73
retrieving revision 1.74
diff -C 2 -d -r1.73 -r1.74
*** SystemTools.hxx.in 27 Mar 2008 21:05:11 -0000 1.73
--- SystemTools.hxx.in 27 May 2008 18:47:00 -0000 1.74
***************
*** 709,725 ****
/**
* Read a registry value
*/
! static bool ReadRegistryValue(const char *key, kwsys_stl::string &value);
/**
* Write a registry value
*/
! static bool WriteRegistryValue(const char *key, const char *value);
/**
* Delete a registry value
*/
! static bool DeleteRegistryValue(const char *key);
/** -----------------------------------------------------------------
--- 709,735 ----
/**
+ * Specify access to the 32-bit or 64-bit application view of
+ * registry values. The default is to match the currently running
+ * binary type.
+ */
+ enum KeyWOW64 { KeyWOW64_Default, KeyWOW64_32, KeyWOW64_64 };
+
+ /**
* Read a registry value
*/
! static bool ReadRegistryValue(const char *key, kwsys_stl::string &value,
! KeyWOW64 view = KeyWOW64_Default);
/**
* Write a registry value
*/
! static bool WriteRegistryValue(const char *key, const char *value,
! KeyWOW64 view = KeyWOW64_Default);
/**
* Delete a registry value
*/
! static bool DeleteRegistryValue(const char *key,
! KeyWOW64 view = KeyWOW64_Default);
/** -----------------------------------------------------------------
More information about the Cmake-commits
mailing list