From bfe5c758ba38ab453e1f450738d09855c91e66d2 Mon Sep 17 00:00:00 2001 From: Robert Socha Date: Sat, 18 Apr 2020 18:56:28 +0200 Subject: [PATCH 1/2] Add description for Windos service --- windows/ZeroTierOne/ServiceInstaller.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/windows/ZeroTierOne/ServiceInstaller.cpp b/windows/ZeroTierOne/ServiceInstaller.cpp index d302d9f62..ef7007477 100644 --- a/windows/ZeroTierOne/ServiceInstaller.cpp +++ b/windows/ZeroTierOne/ServiceInstaller.cpp @@ -53,6 +53,8 @@ std::string InstallService(PSTR pszServiceName, char szPathTmp[MAX_PATH],szPath[MAX_PATH]; SC_HANDLE schSCManager = NULL; SC_HANDLE schService = NULL; + SERVICE_DESCRIPTION sd; + LPTSTR szDesc = TEXT("Provides secure encrypted communications between hosts over an insecure networks."); if (GetModuleFileName(NULL, szPathTmp, ARRAYSIZE(szPath)) == 0) { @@ -77,7 +79,7 @@ std::string InstallService(PSTR pszServiceName, schSCManager, // SCManager database pszServiceName, // Name of service pszDisplayName, // Name to display - SERVICE_QUERY_STATUS, // Desired access + SERVICE_ALL_ACCESS, // Desired access SERVICE_WIN32_OWN_PROCESS, // Service type dwStartType, // Service start type SERVICE_ERROR_NORMAL, // Error control type @@ -94,6 +96,11 @@ std::string InstallService(PSTR pszServiceName, goto Cleanup; } + // Setup service description + sd.lpDescription = szDesc; + if (!ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &sd)) { + ret = "CreateService failed (description)"; + } Cleanup: // Centralized cleanup for all allocated resources. if (schSCManager) From e1a328527342d69f86a394dec6702865a7db22fa Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Mon, 7 Mar 2022 13:52:05 -0500 Subject: [PATCH 2/2] Update ServiceInstaller.cpp Some very minor changes to this PR --- windows/ZeroTierOne/ServiceInstaller.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/windows/ZeroTierOne/ServiceInstaller.cpp b/windows/ZeroTierOne/ServiceInstaller.cpp index ef7007477..05a78002e 100644 --- a/windows/ZeroTierOne/ServiceInstaller.cpp +++ b/windows/ZeroTierOne/ServiceInstaller.cpp @@ -54,7 +54,7 @@ std::string InstallService(PSTR pszServiceName, SC_HANDLE schSCManager = NULL; SC_HANDLE schService = NULL; SERVICE_DESCRIPTION sd; - LPTSTR szDesc = TEXT("Provides secure encrypted communications between hosts over an insecure networks."); + LPTSTR szDesc = TEXT("ZeroTier network virtualization service."); if (GetModuleFileName(NULL, szPathTmp, ARRAYSIZE(szPath)) == 0) { @@ -98,9 +98,7 @@ std::string InstallService(PSTR pszServiceName, // Setup service description sd.lpDescription = szDesc; - if (!ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &sd)) { - ret = "CreateService failed (description)"; - } + ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &sd); Cleanup: // Centralized cleanup for all allocated resources. if (schSCManager)