aboutsummaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2016-01-12 10:13:17 +0100
committerPierre Ossman <ossman@cendio.se>2016-01-12 10:13:17 +0100
commit018c67e6e1cdfb5e0494ad987093738b7fe7e60d (patch)
treed037135640e794e90ae026fabe91e88bc9fed781 /win
parent9986dce0ae20b0821a5e189f58e86a764079048b (diff)
downloadtigervnc-018c67e6e1cdfb5e0494ad987093738b7fe7e60d.tar.gz
tigervnc-018c67e6e1cdfb5e0494ad987093738b7fe7e60d.zip
Provide description for services
The argument named "desc" was not actually the description, but rather the short "display name". Add handling for the actual description to reduce confusion.
Diffstat (limited to 'win')
-rw-r--r--win/rfb_win32/Service.cxx12
-rw-r--r--win/rfb_win32/Service.h3
-rw-r--r--win/winvnc/winvnc.cxx1
3 files changed, 12 insertions, 4 deletions
diff --git a/win/rfb_win32/Service.cxx b/win/rfb_win32/Service.cxx
index 99b3eaa1..c385fa05 100644
--- a/win/rfb_win32/Service.cxx
+++ b/win/rfb_win32/Service.cxx
@@ -391,7 +391,9 @@ bool rfb::win32::initEventLogLogger(const TCHAR* srcname) {
// -=- Registering and unregistering the service
-bool rfb::win32::registerService(const TCHAR* name, const TCHAR* desc,
+bool rfb::win32::registerService(const TCHAR* name,
+ const TCHAR* display,
+ const TCHAR* desc,
int argc, char** argv) {
// - Initialise the default service parameters
@@ -429,15 +431,19 @@ bool rfb::win32::registerService(const TCHAR* name, const TCHAR* desc,
if (!scm)
throw rdr::SystemException("unable to open Service Control Manager", GetLastError());
-
+ // - Add the service
ServiceHandle service = CreateService(scm,
- name, desc, SC_MANAGER_ALL_ACCESS,
+ name, display, SC_MANAGER_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,
SERVICE_AUTO_START, SERVICE_ERROR_IGNORE,
cmdline.buf, NULL, NULL, NULL, NULL, NULL);
if (!service)
throw rdr::SystemException("unable to create service", GetLastError());
+ // - Set a description
+ SERVICE_DESCRIPTION sdesc = {(LPTSTR)desc};
+ ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &sdesc);
+
// - Register the event log source
RegKey hk, hk2;
diff --git a/win/rfb_win32/Service.h b/win/rfb_win32/Service.h
index 198726ce..cbb6263d 100644
--- a/win/rfb_win32/Service.h
+++ b/win/rfb_win32/Service.h
@@ -105,7 +105,8 @@ namespace rfb {
// event source information, etc.
// *** should really accept TCHAR argv
- bool registerService(const TCHAR* name, const TCHAR* desc, int argc, char** argv);
+ bool registerService(const TCHAR* name, const TCHAR* display,
+ const TCHAR* desc, int argc, char** argv);
bool unregisterService(const TCHAR* name);
bool startService(const TCHAR* name);
diff --git a/win/winvnc/winvnc.cxx b/win/winvnc/winvnc.cxx
index cb0e8e45..ff16aacd 100644
--- a/win/winvnc/winvnc.cxx
+++ b/win/winvnc/winvnc.cxx
@@ -169,6 +169,7 @@ static void processParams(int argc, char** argv) {
int j = i;
i = argc;
if (rfb::win32::registerService(VNCServerService::Name,
+ _T("TigerVNC Server"),
_T("Provides remote access to this machine via the VNC/RFB protocol."),
argc-(j+1), &argv[j+1]))
MsgBoxOrLog("Registered service successfully");