return qsc;\r
}\r
\r
+int set_service_description(const TCHAR *service_name, SC_HANDLE service_handle, TCHAR *buffer) {\r
+ SERVICE_DESCRIPTION description;\r
+ ZeroMemory(&description, sizeof(description));\r
+ /*\r
+ lpDescription must be NULL if we aren't changing, the new description\r
+ or "".\r
+ */\r
+ if (buffer && buffer[0]) description.lpDescription = buffer;\r
+ else description.lpDescription = _T("");\r
+\r
+ if (ChangeServiceConfig2(service_handle, SERVICE_CONFIG_DESCRIPTION, &description)) return 0;\r
+\r
+ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_SERVICE_CONFIG_DESCRIPTION_FAILED, service_name, error_string(GetLastError()), 0);\r
+ return 1;\r
+}\r
+\r
int get_service_description(const TCHAR *service_name, SC_HANDLE service_handle, unsigned long len, TCHAR *buffer) {\r
if (! buffer) return 1;\r
\r
}\r
\r
if (service->description[0] || editing) {\r
- SERVICE_DESCRIPTION description;\r
- ZeroMemory(&description, sizeof(description));\r
- if (service->description[0]) description.lpDescription = service->description;\r
- else description.lpDescription = 0;\r
- if (! ChangeServiceConfig2(service->handle, SERVICE_CONFIG_DESCRIPTION, &description)) {\r
- log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_SERVICE_CONFIG_DESCRIPTION_FAILED, service->name, error_string(GetLastError()), 0);\r
- }\r
+ set_service_description(service->name, service->handle, service->description);\r
}\r
\r
SERVICE_DELAYED_AUTO_START_INFO delayed;\r
void cleanup_nssm_service(nssm_service_t *);\r
SC_HANDLE open_service_manager();\r
QUERY_SERVICE_CONFIG *query_service_config(const TCHAR *, SC_HANDLE);\r
+int set_service_description(const TCHAR *, SC_HANDLE, TCHAR *);\r
int get_service_description(const TCHAR *, SC_HANDLE, unsigned long, TCHAR *);\r
int get_service_startup(const TCHAR *, SC_HANDLE, const QUERY_SERVICE_CONFIG *, unsigned long *);\r
int get_service_username(const TCHAR *, const QUERY_SERVICE_CONFIG *, TCHAR **, size_t *);\r