mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Add description for Windos service
This commit is contained in:
parent
b6b11dbf82
commit
bfe5c758ba
1 changed files with 8 additions and 1 deletions
|
@ -53,6 +53,8 @@ std::string InstallService(PSTR pszServiceName,
|
||||||
char szPathTmp[MAX_PATH],szPath[MAX_PATH];
|
char szPathTmp[MAX_PATH],szPath[MAX_PATH];
|
||||||
SC_HANDLE schSCManager = NULL;
|
SC_HANDLE schSCManager = NULL;
|
||||||
SC_HANDLE schService = 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)
|
if (GetModuleFileName(NULL, szPathTmp, ARRAYSIZE(szPath)) == 0)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +79,7 @@ std::string InstallService(PSTR pszServiceName,
|
||||||
schSCManager, // SCManager database
|
schSCManager, // SCManager database
|
||||||
pszServiceName, // Name of service
|
pszServiceName, // Name of service
|
||||||
pszDisplayName, // Name to display
|
pszDisplayName, // Name to display
|
||||||
SERVICE_QUERY_STATUS, // Desired access
|
SERVICE_ALL_ACCESS, // Desired access
|
||||||
SERVICE_WIN32_OWN_PROCESS, // Service type
|
SERVICE_WIN32_OWN_PROCESS, // Service type
|
||||||
dwStartType, // Service start type
|
dwStartType, // Service start type
|
||||||
SERVICE_ERROR_NORMAL, // Error control type
|
SERVICE_ERROR_NORMAL, // Error control type
|
||||||
|
@ -94,6 +96,11 @@ std::string InstallService(PSTR pszServiceName,
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup service description
|
||||||
|
sd.lpDescription = szDesc;
|
||||||
|
if (!ChangeServiceConfig2(schService, SERVICE_CONFIG_DESCRIPTION, &sd)) {
|
||||||
|
ret = "CreateService failed (description)";
|
||||||
|
}
|
||||||
Cleanup:
|
Cleanup:
|
||||||
// Centralized cleanup for all allocated resources.
|
// Centralized cleanup for all allocated resources.
|
||||||
if (schSCManager)
|
if (schSCManager)
|
||||||
|
|
Loading…
Add table
Reference in a new issue