/* Initialise status */\r
ZeroMemory(&service->status, sizeof(service->status));\r
service->status.dwServiceType = SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS;\r
- service->status.dwControlsAccepted = SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE;\r
+ service->status.dwControlsAccepted = SERVICE_ACCEPT_POWEREVENT | SERVICE_ACCEPT_SHUTDOWN | SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE;\r
service->status.dwWin32ExitCode = NO_ERROR;\r
service->status.dwServiceSpecificExitCode = 0;\r
service->status.dwCheckPoint = 0;\r
case SERVICE_CONTROL_CONTINUE: return _T("CONTINUE");\r
case SERVICE_CONTROL_INTERROGATE: return _T("INTERROGATE");\r
case NSSM_SERVICE_CONTROL_ROTATE: return _T("ROTATE");\r
+ case SERVICE_CONTROL_POWEREVENT: return _T("POWEREVENT");\r
default: return 0;\r
}\r
}\r
if (service->rotate_stdout_online == NSSM_ROTATE_ONLINE) service->rotate_stdout_online = NSSM_ROTATE_ONLINE_ASAP;\r
if (service->rotate_stderr_online == NSSM_ROTATE_ONLINE) service->rotate_stderr_online = NSSM_ROTATE_ONLINE_ASAP;\r
return NO_ERROR;\r
+\r
+ case SERVICE_CONTROL_POWEREVENT:\r
+ if (event != PBT_APMRESUMEAUTOMATIC) {\r
+ log_service_control(service->name, control, false);\r
+ return NO_ERROR;\r
+ }\r
+ log_service_control(service->name, control, true);\r
+ end_service((void *) service, false);\r
+ return NO_ERROR;\r
}\r
\r
/* Unknown control */\r