3 * Support AppEnvironment for compatibility with srvany.
7 * Fixed failure to compile messages.mc in paths containing spaces.
9 * Fixed edge case with CreateProcess().
11 Correctly handle the case where the application executable is under
12 a path which contains space and an executable sharing the initial
13 part of that path (up to a space) exists.
17 * Fixed failure to run on Windows versions prior to Vista.
21 * Read Application, AppDirectory and AppParameters before each restart so
22 a change to any one doesn't require restarting NSSM itself.
24 * Fixed messages not being sent to the event log correctly in some
27 * Try to handle (strictly incorrect) quotes in AppDirectory.
29 Windows directories aren't allowed to contain quotes so CreateProcess()
30 will fail if the AppDirectory is quoted. Note that it succeeds even if
31 Application itself is quoted as the application plus parameters are
32 interpreted as a command line.
34 * Fixed failed to write full arguments to AppParameters when
39 Back off from restarting the application immediately if it starts
40 successfully but exits too soon. The default value of "too soon" is
41 1500 milliseconds. This can be configured by adding a DWORD value
42 AppThrottle to the registry.
44 Handle resume messages from the service console to restart the
45 application immediately even if it is throttled.
47 * Try to kill the process tree gracefully.
49 Before calling TerminateProcess() on all processes assocatiated with
50 the monitored application, enumerate all windows and threads and
51 post appropriate messages to them. If the application bothers to
52 listen for such messages it has a chance to shut itself down gracefully.
56 * Handle missing registry values.
58 Warn if AppParameters is missing. Warn if AppDirectory is missing or
59 unset and choose a fallback directory.
60 First try to find the parent directory of the application. If that
61 fails, eg because the application path is just "notepad" or something,
62 start in the Windows directory.
64 * Kill process tree when stopping service.
66 Ensure that all child processes of the monitored application are
67 killed when the service stops by recursing through all running
68 processes and terminating those whose parent is the application
69 or one of its descendents.
73 * Removed incorrect ExpandEnvironmentStrings() error.
75 A log_event() call was inadvertently left in the code causing an error
76 to be set to the eventlog saying that ExpandEnvironmentStrings() had
77 failed when it had actually succeeded.
81 * Allow use of REG_EXPAND_SZ values in the registry.
83 * Don't suicide on exit status 0 by default.
85 Suiciding when the application exits 0 will cause recovery actions to be
86 taken. Usually this is inappropriate. Only suicide if there is an
87 explicit AppExit value for 0 in the registry.
89 Technically such behaviour could be abused to do something like run a
90 script after successful completion of a service but in most cases a
91 suicide is undesirable when no actual failure occurred.
93 * Don't hang if startup parameters couldn't be determined.
94 Instead, signal that the service entered the STOPPED state.
95 Set START_PENDING state prior to actual startup.
99 * Ensure systems recovery actions can happen.
101 In Windows versions earlier than Vista the service manager would only
102 consider a service failed (and hence eligible for recovery action) if
103 the service exited without setting its state to SERVICE_STOPPED, even if
104 it signalled an error exit code.
105 In Vista and later the service manager can be configured to treat a
106 graceful shutdown with error code as a failure but this is not the
109 Try to configure the service manager to use the new behaviour when
110 starting the service so users who set AppExit to Exit can use recovery
113 Also recognise the new AppExit option Suicide for use on pre-Vista
114 systems. When AppExit is Suicide don't stop the service but exit
115 inelegantly, which should be seen as a failure.
119 * Send properly formatted messages to the event log.
121 * Fixed truncation of very long path lengths in the registry.
125 * Decide how to handle application exit.
127 When the service exits with exit code n look in
128 HKLM\SYSTEM\CurrentControlSet\Services\<service>\Parameters\AppExit\<n>,
129 falling back to the unnamed value if no such code is listed. Parse the
130 (string) value of this entry as follows:
132 Restart: Start the application again (NSSM default).
133 Ignore: Do nothing (srvany default).
134 Exit: Stop the service.
138 * Added support for building a 64-bit executable.
140 * Added project files for newer versions of Visual Studio.