X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=service.cpp;h=873b8a8f537b423a968a94cb38ad7eaf65246650;hb=23b8173ce06a843f18a9269fc6f7d4d0d224cd4c;hp=21726df7f90ad7b2b661791b6e5fa75796730487;hpb=a7ad3a9d294a66bb42bdbb068d620832182ea6b2;p=nssm.git diff --git a/service.cpp b/service.cpp index 21726df..873b8a8 100644 --- a/service.cpp +++ b/service.cpp @@ -12,6 +12,7 @@ char flags[CMD_LENGTH]; char dir[MAX_PATH]; bool stopping; unsigned long throttle_delay; +unsigned long stop_method; HANDLE throttle_timer; LARGE_INTEGER throttle_duetime; FILETIME creation_time; @@ -372,7 +373,7 @@ int start_service() { /* Get startup parameters */ char *env = 0; - int ret = get_parameters(service_name, exe, sizeof(exe), flags, sizeof(flags), dir, sizeof(dir), &env, &throttle_delay, &si); + int ret = get_parameters(service_name, exe, sizeof(exe), flags, sizeof(flags), dir, sizeof(dir), &env, &throttle_delay, &stop_method, &si); if (ret) { log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_GET_PARAMETERS_FAILED, service_name, 0); return stop_service(2, true, true); @@ -431,7 +432,7 @@ int stop_service(unsigned long exitcode, bool graceful, bool default_action) { if (pid) { /* Shut down service */ log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_TERMINATEPROCESS, service_name, exe, 0); - kill_process(service_name, process_handle, pid, 0); + kill_process(service_name, stop_method, process_handle, pid, 0); } else log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_PROCESS_ALREADY_STOPPED, service_name, exe, 0); @@ -480,7 +481,7 @@ void CALLBACK end_service(void *arg, unsigned char why) { } /* Clean up. */ - kill_process_tree(service_name, pid, exitcode, pid, &creation_time, &exit_time); + kill_process_tree(service_name, stop_method, pid, exitcode, pid, &creation_time, &exit_time); /* The why argument is true if our wait timed out or false otherwise.