Browse Source

Merge pull request #1187 from rjsocha/win-service-description

Add description for Windows service
pull/4/head
Adam Ierymenko 4 years ago committed by GitHub
parent
commit
3def00370e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      windows/ZeroTierOne/ServiceInstaller.cpp

7
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("ZeroTier network virtualization service.");
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,9 @@ std::string InstallService(PSTR pszServiceName,
goto Cleanup;
}
// Setup service description
sd.lpDescription = szDesc;
ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &sd);
Cleanup:
// Centralized cleanup for all allocated resources.
if (schSCManager)

Loading…
Cancel
Save