return;\r
}\r
\r
- /* Get startup parameters */\r
- int ret = get_parameters(argv[0], exe, sizeof(exe), flags, sizeof(flags), dir, sizeof(dir));\r
- if (ret) {\r
- log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_GET_PARAMETERS_FAILED, argv[0], 0);\r
- service_status.dwCurrentState = SERVICE_STOPPED;\r
- /* An accurate, if not particularly helpful, status */\r
- service_status.dwWin32ExitCode = ERROR_SERVICE_NOT_ACTIVE;\r
- SetServiceStatus(service_handle, &service_status);\r
- return;\r
- }\r
-\r
service_status.dwCurrentState = SERVICE_START_PENDING;\r
service_status.dwWaitHint = NSSM_RESET_THROTTLE_RESTART + NSSM_WAITHINT_MARGIN;\r
SetServiceStatus(service_handle, &service_status);\r
PROCESS_INFORMATION pi;\r
ZeroMemory(&pi, sizeof(pi));\r
\r
+ /* Get startup parameters */\r
+ int ret = get_parameters(service_name, exe, sizeof(exe), flags, sizeof(flags), dir, sizeof(dir));\r
+ if (ret) {\r
+ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_GET_PARAMETERS_FAILED, service_name, 0);\r
+ return stop_service(2, true, true);\r
+ }\r
+\r
/* Launch executable with arguments */\r
char cmd[CMD_LENGTH];\r
if (_snprintf(cmd, sizeof(cmd), "%s %s", exe, flags) < 0) {\r