La déclaration de l'environnement %1 pour le service %2 n'est pas du type REG_MULTI_SZ. Cette déclaration sera ignorée.
.
+MessageId = +1
+SymbolicName = NSSM_EVENT_SERVICE_CONTROL_HANDLED
+Severity = Informational
+Language = English
+Service %1 received %2 control, which will be handled.
+.
+Language = French
+Le service %1 a reçu le code de contrôle %2, qui sera pris en compte.
+.
+
+MessageId = +1
+SymbolicName = NSSM_EVENT_SERVICE_CONTROL_NOT_HANDLED
+Severity = Informational
+Language = English
+Service %1 received unsupported %2 control, which will not be handled.
+.
+Language = French
+Le service %1 a reçu le code de contrôle %2, qui n'est pas géré. Aucune action ne sera entreprise en réponse à cette demande.
+.
+
+MessageId = +1
+SymbolicName = NSSM_EVENT_SERVICE_CONTROL_UNKNOWN
+Severity = Informational
+Language = English
+Service %1 received unknown service control message %2, which will be ignored.
+.
+Language = French
+Le service %1 a reçu le code de contrôle inconnu %2, qui sera donc ignoré.
+.
+
return;\r
}\r
\r
+ log_service_control(service_name, 0, true);\r
+\r
service_status.dwCurrentState = SERVICE_START_PENDING;\r
service_status.dwWaitHint = throttle_delay + NSSM_WAITHINT_MARGIN;\r
SetServiceStatus(service_handle, &service_status);\r
return 0;\r
}\r
\r
+char *service_control_text(unsigned long control) {\r
+ switch (control) {\r
+ /* HACK: there is no SERVICE_CONTROL_START constant */\r
+ case 0: return "START";\r
+ case SERVICE_CONTROL_STOP: return "STOP";\r
+ case SERVICE_CONTROL_SHUTDOWN: return "SHUTDOWN";\r
+ case SERVICE_CONTROL_PAUSE: return "PAUSE";\r
+ case SERVICE_CONTROL_CONTINUE: return "CONTINUE";\r
+ case SERVICE_CONTROL_INTERROGATE: return "INTERROGATE";\r
+ default: return 0;\r
+ }\r
+}\r
+\r
+void log_service_control(char *service_name, unsigned long control, bool handled) {\r
+ char *text = service_control_text(control);\r
+ unsigned long event;\r
+\r
+ if (! text) {\r
+ /* "0x" + 8 x hex + NULL */\r
+ text = (char *) HeapAlloc(GetProcessHeap(), 0, 11);\r
+ if (! text) {\r
+ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "control code", "log_service_control", 0);\r
+ return;\r
+ }\r
+ if (_snprintf(text, 11, "0x%08x", control) < 0) {\r
+ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "control code", "log_service_control", 0);\r
+ HeapFree(GetProcessHeap(), 0, text);\r
+ return;\r
+ }\r
+\r
+ event = NSSM_EVENT_SERVICE_CONTROL_UNKNOWN;\r
+ }\r
+ else if (handled) event = NSSM_EVENT_SERVICE_CONTROL_HANDLED;\r
+ else event = NSSM_EVENT_SERVICE_CONTROL_NOT_HANDLED;\r
+\r
+ log_event(EVENTLOG_INFORMATION_TYPE, event, service_name, text, 0);\r
+\r
+ if (event == NSSM_EVENT_SERVICE_CONTROL_UNKNOWN) {\r
+ HeapFree(GetProcessHeap(), 0, text);\r
+ }\r
+}\r
+\r
/* Service control handler */\r
unsigned long WINAPI service_control_handler(unsigned long control, unsigned long event, void *data, void *context) {\r
switch (control) {\r
case SERVICE_CONTROL_SHUTDOWN:\r
case SERVICE_CONTROL_STOP:\r
+ log_service_control(service_name, control, true);\r
stop_service(0, true, true);\r
return NO_ERROR;\r
\r
case SERVICE_CONTROL_CONTINUE:\r
+ log_service_control(service_name, control, true);\r
if (! throttle_timer) return ERROR_CALL_NOT_IMPLEMENTED;\r
throttle = 0;\r
ZeroMemory(&throttle_duetime, sizeof(throttle_duetime));\r
We don't accept pause messages but it isn't possible to register\r
only for continue messages so we have to handle this case.\r
*/\r
+ log_service_control(service_name, control, false);\r
return ERROR_CALL_NOT_IMPLEMENTED;\r
}\r
\r
/* Unknown control */\r
+ log_service_control(service_name, control, false);\r
return ERROR_CALL_NOT_IMPLEMENTED;\r
}\r
\r