We forgot to set default values when installing from the command line.
Installing from the GUI worked.
Thanks Paul Spause.
+Changes since 2.19
+-----------------
+ * Services installed from the commandline without using the
+ GUI no longer have incorrect AppStopMethod* registry
+ entries set.
+
Changes since 2.18
-----------------
* Support AppEnvironmentExtra to append to the environment
on shutdown.\r
Thanks to Brian Baxter for suggesting how to escape quotes from the command prompt.\r
Thanks to Russ Holmann for suggesting that the shutdown timeout be configurable.\r
+Thanks to Paul Spause for spotting a bug with default registry entries.\r
\r
Licence\r
-------\r
\r
nssm_service_t *service = alloc_nssm_service();\r
if (service) {\r
+ set_nssm_service_defaults(service);\r
+\r
/* Get service name. */\r
if (! GetDlgItemText(window, IDC_NAME, service->name, sizeof(service->name))) {\r
popup_message(MB_OK | MB_ICONEXCLAMATION, NSSM_GUI_MISSING_SERVICE_NAME);\r
}\r
\r
/* Get stop method stuff. */\r
- service->stop_method = ~0;\r
check_stop_method(service, NSSM_STOP_METHOD_CONSOLE, IDC_METHOD_CONSOLE);\r
check_stop_method(service, NSSM_STOP_METHOD_WINDOW, IDC_METHOD_WINDOW);\r
check_stop_method(service, NSSM_STOP_METHOD_THREADS, IDC_METHOD_THREADS);\r
check_io("stdin", service->stdin_path, sizeof(service->stdin_path), IDC_STDIN);\r
check_io("stdout", service->stdout_path, sizeof(service->stdout_path), IDC_STDOUT);\r
check_io("stderr", service->stderr_path, sizeof(service->stderr_path), IDC_STDERR);\r
- /* I/O defaults. */\r
- service->stdin_sharing = NSSM_STDIN_SHARING;\r
- service->stdin_disposition = NSSM_STDIN_DISPOSITION;\r
- service->stdin_flags = NSSM_STDIN_FLAGS;\r
- service->stdout_sharing = NSSM_STDOUT_SHARING;\r
- service->stdout_disposition = NSSM_STDOUT_DISPOSITION;\r
- service->stdout_flags = NSSM_STDOUT_FLAGS;\r
- service->stderr_sharing = NSSM_STDERR_SHARING;\r
- service->stderr_disposition = NSSM_STDERR_DISPOSITION;\r
- service->stderr_flags = NSSM_STDERR_FLAGS;\r
/* Override stdout and/or stderr. */\r
if (SendDlgItemMessage(tablist[NSSM_TAB_IO], IDC_TRUNCATE, BM_GETCHECK, 0, 0) & BST_CHECKED) {\r
if (service->stdout_path[0]) service->stdout_disposition = CREATE_ALWAYS;\r
return ret;\r
}\r
\r
+/* Set default values which aren't zero. */\r
+void set_nssm_service_defaults(nssm_service_t *service) {\r
+ if (! service) return;\r
+\r
+ service->stdin_sharing = NSSM_STDIN_SHARING;\r
+ service->stdin_disposition = NSSM_STDIN_DISPOSITION;\r
+ service->stdin_flags = NSSM_STDIN_FLAGS;\r
+ service->stdout_sharing = NSSM_STDOUT_SHARING;\r
+ service->stdout_disposition = NSSM_STDOUT_DISPOSITION;\r
+ service->stdout_flags = NSSM_STDOUT_FLAGS;\r
+ service->stderr_sharing = NSSM_STDERR_SHARING;\r
+ service->stderr_disposition = NSSM_STDERR_DISPOSITION;\r
+ service->stderr_flags = NSSM_STDERR_FLAGS;\r
+ service->throttle_delay = NSSM_RESET_THROTTLE_RESTART;\r
+ service->stop_method = ~0;\r
+ service->kill_console_delay = NSSM_KILL_CONSOLE_GRACE_PERIOD;\r
+ service->kill_window_delay = NSSM_KILL_WINDOW_GRACE_PERIOD;\r
+ service->kill_threads_delay = NSSM_KILL_THREADS_GRACE_PERIOD;\r
+}\r
+\r
/* Allocate and zero memory for a service. */\r
nssm_service_t *alloc_nssm_service() {\r
nssm_service_t *service = (nssm_service_t *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(nssm_service_t));\r
return 1;\r
}\r
\r
+ set_nssm_service_defaults(service);\r
memmove(service->name, argv[0], strlen(argv[0]));\r
memmove(service->exe, argv[1], strlen(argv[1]));\r
\r
unsigned long WINAPI service_control_handler(unsigned long, unsigned long, void *, void *);\r
\r
nssm_service_t *alloc_nssm_service();\r
+void set_nssm_service_defaults(nssm_service_t *);\r
void cleanup_nssm_service(nssm_service_t *);\r
SC_HANDLE open_service_manager();\r
int pre_install_service(int, char **);\r