backport changes from 1.4.3 branch

This commit is contained in:
Marian Krivos
2012-01-07 11:06:14 +00:00
parent cc90b38ae5
commit 6268aa3865
69 changed files with 10381 additions and 5761 deletions

View File

@@ -34,6 +34,9 @@
//
#if !defined(_WIN32_WCE)
#include "Poco/Util/WinRegistryConfiguration.h"
#include "Poco/Util/WinRegistryKey.h"
#include "Poco/NumberFormatter.h"
@@ -45,10 +48,10 @@ namespace Poco {
namespace Util {
WinRegistryConfiguration::WinRegistryConfiguration(const std::string& rootPath): _rootPath(rootPath)
WinRegistryConfiguration::WinRegistryConfiguration(const std::string& rootPath, REGSAM extraSam): _rootPath(rootPath), _extraSam(extraSam)
{
// rootPath must end with backslash
std::string::iterator it = _rootPath.end();
// rootPath must end with backslash
std::string::iterator it = _rootPath.end();
if (*(--it) != '\\')
_rootPath.append("\\");
}
@@ -61,12 +64,12 @@ WinRegistryConfiguration::~WinRegistryConfiguration()
bool WinRegistryConfiguration::getRaw(const std::string& key, std::string& value) const
{
std::string keyName;
std::string fullPath = _rootPath + ConvertToRegFormat(key, keyName);
WinRegistryKey aKey(fullPath, true);
bool exists = aKey.exists(keyName);
if (exists)
{
std::string keyName;
std::string fullPath = _rootPath + ConvertToRegFormat(key, keyName);
WinRegistryKey aKey(fullPath, true, _extraSam);
bool exists = aKey.exists(keyName);
if (exists)
{
WinRegistryKey::Type type = aKey.type(keyName);
switch (type)
@@ -90,10 +93,10 @@ bool WinRegistryConfiguration::getRaw(const std::string& key, std::string& value
void WinRegistryConfiguration::setRaw(const std::string& key, const std::string& value)
{
std::string keyName;
std::string fullPath = _rootPath+ConvertToRegFormat(key, keyName);
WinRegistryKey aKey(fullPath);
aKey.setString(keyName, value);
std::string keyName;
std::string fullPath = _rootPath+ConvertToRegFormat(key, keyName);
WinRegistryKey aKey(fullPath, false, _extraSam);
aKey.setString(keyName, value);
}
@@ -110,13 +113,13 @@ void WinRegistryConfiguration::enumerate(const std::string& key, Keys& range) co
range.push_back("HKEY_USERS");
}
else
{
std::string keyName;
std::string fullPath = _rootPath+ConvertToRegFormat(key, keyName);
WinRegistryKey aKey(fullPath, true);
aKey.values(range);
aKey.subKeys(range);
}
{
std::string keyName;
std::string fullPath = _rootPath+ConvertToRegFormat(key, keyName);
WinRegistryKey aKey(fullPath, true, _extraSam);
aKey.values(range);
aKey.subKeys(range);
}
}
@@ -142,3 +145,6 @@ std::string WinRegistryConfiguration::ConvertToRegFormat(const std::string& key,
} } // namespace Poco::Util
#endif // !defined(_WIN32_WCE)