mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 03:20:11 +01:00
XML: complete merge from 1.4.2
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
|
||||
|
||||
#include "Poco/Util/WinService.h"
|
||||
#include "Poco/Util/WinRegistryKey.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include "Poco/Exception.h"
|
||||
#if defined(POCO_WIN32_UTF8)
|
||||
@@ -53,6 +54,8 @@ namespace Util {
|
||||
|
||||
|
||||
const int WinService::STARTUP_TIMEOUT = 30000;
|
||||
const std::string WinService::REGISTRY_KEY("SYSTEM\\CurrentControlSet\\Services\\");
|
||||
const std::string WinService::REGISTRY_DESCRIPTION("Description");
|
||||
|
||||
|
||||
WinService::WinService(const std::string& name):
|
||||
@@ -256,9 +259,27 @@ WinService::Startup WinService::getStartup() const
|
||||
}
|
||||
|
||||
|
||||
void WinService::setDescription(const std::string& description)
|
||||
{
|
||||
std::string key(REGISTRY_KEY);
|
||||
key += _name;
|
||||
WinRegistryKey regKey(HKEY_LOCAL_MACHINE, key);
|
||||
regKey.setString(REGISTRY_DESCRIPTION, description);
|
||||
}
|
||||
|
||||
|
||||
std::string WinService::getDescription() const
|
||||
{
|
||||
std::string key(REGISTRY_KEY);
|
||||
key += _name;
|
||||
WinRegistryKey regKey(HKEY_LOCAL_MACHINE, key, true);
|
||||
return regKey.getString(REGISTRY_DESCRIPTION);
|
||||
}
|
||||
|
||||
|
||||
void WinService::open() const
|
||||
{
|
||||
if (!tryOpen())
|
||||
if (!tryOpen())
|
||||
throw NotFoundException("service does not exist", _name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user