summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/iceserviceinstall/Install.cpp15
-rw-r--r--cpp/src/iceserviceinstall/ServiceInstaller.cpp29
-rw-r--r--cpp/src/iceserviceinstall/ServiceInstaller.h2
3 files changed, 24 insertions, 22 deletions
diff --git a/cpp/src/iceserviceinstall/Install.cpp b/cpp/src/iceserviceinstall/Install.cpp
index 05c97c10063..3417c9044da 100644
--- a/cpp/src/iceserviceinstall/Install.cpp
+++ b/cpp/src/iceserviceinstall/Install.cpp
@@ -209,19 +209,20 @@ Install::usage() const
" HKEY_LOCAL_MACHINE.\n"
"\n"
"Valid properties:\n"
- "ImagePath Full path to <service>.exe. The default value is\n"
- " " << defaultImagePath << "\n" <<
- "DisplayName Display name of the service.\n"
- "Description Description of the service.\n"
"AutoStart If non-zero, the service is started automatically when\n"
" the computer starts up. The default value is 1.\n"
- "ObjectName Account used to run the service. Defaults to\n"
- " NT Authority\\LocalService.\n"
- "Password Password for ObjectName.\n"
+ "Debug Show diagnostics when installing/uninstalling a service.\n"
"DependOnRegistry If non-zero, the service depends on the IceGrid registry\n"
" service (the IceGrid registry service name is computed\n"
" using Ice.Default.Locator in <config-file>).\n"
+ "Description Description of the service.\n"
+ "DisplayName Display name of the service.\n"
"EventLog The name of the EventLog used by this service;\n"
" the default is Application.\n"
+ "ImagePath Full path to <service>.exe. The default value is\n"
+ " " << defaultImagePath << "\n" <<
+ "ObjectName Account used to run the service. Defaults to\n"
+ " NT Authority\\LocalService.\n"
+ "Password Password for ObjectName.\n"
;
}
diff --git a/cpp/src/iceserviceinstall/ServiceInstaller.cpp b/cpp/src/iceserviceinstall/ServiceInstaller.cpp
index 5033fa5ed82..6d30511bc89 100644
--- a/cpp/src/iceserviceinstall/ServiceInstaller.cpp
+++ b/cpp/src/iceserviceinstall/ServiceInstaller.cpp
@@ -125,6 +125,15 @@ IceServiceInstaller::install(const PropertiesPtr& properties)
{
throw runtime_error(imagePath + ": not found");
}
+ else
+ {
+ string imageDir = imagePath;
+ imageDir.erase(imageDir.rfind('\\'));
+ if(imageDir != "")
+ {
+ grantPermissions(imageDir.c_str(), SE_FILE_OBJECT, true, GENERIC_READ | GENERIC_EXECUTE);
+ }
+ }
string dependency;
@@ -148,7 +157,7 @@ IceServiceInstaller::install(const PropertiesPtr& properties)
if(!mkdir(registryDataDir))
{
- grantPermissions(registryDataDir, SE_FILE_OBJECT, true, true);
+ grantPermissions(registryDataDir, SE_FILE_OBJECT, true, FILE_ALL_ACCESS);
}
}
else if(_serviceType == icegridnode)
@@ -165,7 +174,7 @@ IceServiceInstaller::install(const PropertiesPtr& properties)
if(!mkdir(nodeDataDir))
{
- grantPermissions(nodeDataDir, SE_FILE_OBJECT, true, true);
+ grantPermissions(nodeDataDir, SE_FILE_OBJECT, true, FILE_ALL_ACCESS);
}
grantPermissions("MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib", SE_REGISTRY_KEY, true);
@@ -489,7 +498,7 @@ IceServiceInstaller::initializeSid(const string& name)
}
void
-IceServiceInstaller::grantPermissions(const string& path, SE_OBJECT_TYPE type, bool inherit, bool fullControl) const
+IceServiceInstaller::grantPermissions(const string& path, SE_OBJECT_TYPE type, bool inherit, DWORD desiredAccess) const
{
if(_debug)
{
@@ -558,7 +567,7 @@ IceServiceInstaller::grantPermissions(const string& path, SE_OBJECT_TYPE type, b
if(type == SE_FILE_OBJECT)
{
- if(fullControl)
+ if(desiredAccess == FILE_ALL_ACCESS)
{
done = (accessMask & READ_CONTROL) && (accessMask & SYNCHRONIZE) && (accessMask & 0x1F) == 0x1F;
}
@@ -583,15 +592,7 @@ IceServiceInstaller::grantPermissions(const string& path, SE_OBJECT_TYPE type, b
else
{
EXPLICIT_ACCESS_W ea = { 0 };
-
- if(type == SE_FILE_OBJECT && fullControl)
- {
- ea.grfAccessPermissions = (accessMask | FILE_ALL_ACCESS);
- }
- else
- {
- ea.grfAccessPermissions = (accessMask | GENERIC_READ);
- }
+ ea.grfAccessPermissions = (accessMask | desiredAccess);
ea.grfAccessMode = GRANT_ACCESS;
if(inherit)
{
@@ -673,7 +674,7 @@ IceServiceInstaller::mkdir(const string& path) const
}
else
{
- grantPermissions(path, SE_FILE_OBJECT, true, true);
+ grantPermissions(path, SE_FILE_OBJECT, true, FILE_ALL_ACCESS);
return true;
}
}
diff --git a/cpp/src/iceserviceinstall/ServiceInstaller.h b/cpp/src/iceserviceinstall/ServiceInstaller.h
index 5879b10daf5..93bfe5514f5 100644
--- a/cpp/src/iceserviceinstall/ServiceInstaller.h
+++ b/cpp/src/iceserviceinstall/ServiceInstaller.h
@@ -41,7 +41,7 @@ private:
bool fileExists(const std::string&) const;
void grantPermissions(const std::string& path, SE_OBJECT_TYPE type = SE_FILE_OBJECT,
- bool inherit = false, bool fullControl = false) const;
+ bool inherit = false, DWORD desiredAccess = GENERIC_READ) const;
bool mkdir(const std::string&) const;
void addLog(const std::string&) const;