From: Pierre Ossman Date: Tue, 12 Jan 2016 09:13:17 +0000 (+0100) Subject: Provide description for services X-Git-Tag: v1.6.90~61 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=018c67e6e1cdfb5e0494ad987093738b7fe7e60d;p=tigervnc.git 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. --- 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");