4 #define _WIN32_WINNT 0x0500
\r
10 #include "imports.h"
\r
11 #include "messages.h"
\r
12 #include "process.h"
\r
13 #include "registry.h"
\r
15 #include "service.h"
\r
18 int str_equiv(const char *, const char *);
\r
21 #define NSSM_VERSION "2.17"
\r
22 #define NSSM_VERSIONINFO 2,17,0,0
\r
23 #define NSSM_DATE "2013-11-12"
\r
26 MSDN says the commandline in CreateProcess() is limited to 32768 characters
\r
27 and the application name to MAX_PATH.
\r
28 A registry key is limited to 255 characters.
\r
29 A registry value is limited to 16383 characters.
\r
30 Therefore we limit the service name to accommodate the path under HKLM.
\r
32 #define EXE_LENGTH MAX_PATH
\r
33 #define CMD_LENGTH 32768
\r
34 #define KEY_LENGTH 255
\r
35 #define VALUE_LENGTH 16383
\r
36 #define SERVICE_NAME_LENGTH KEY_LENGTH - 55
\r
39 Throttle the restart of the service if it stops before this many
\r
40 milliseconds have elapsed since startup. Override in registry.
\r
42 #define NSSM_RESET_THROTTLE_RESTART 1500
\r
45 How many milliseconds to wait for the application to die after sending
\r
46 a Control-C event to its console.
\r
48 #define NSSM_KILL_CONSOLE_GRACE_PERIOD 1500
\r
50 How many milliseconds to wait for the application to die after posting to
\r
51 its windows' message queues.
\r
53 #define NSSM_KILL_WINDOW_GRACE_PERIOD 1500
\r
55 How many milliseconds to wait for the application to die after posting to
\r
56 its threads' message queues.
\r
58 #define NSSM_KILL_THREADS_GRACE_PERIOD 1500
\r
60 /* Margin of error for service status wait hints in milliseconds. */
\r
61 #define NSSM_WAITHINT_MARGIN 2000
\r
63 /* Methods used to try to stop the application. */
\r
64 #define NSSM_STOP_METHOD_CONSOLE (1 << 0)
\r
65 #define NSSM_STOP_METHOD_WINDOW (1 << 1)
\r
66 #define NSSM_STOP_METHOD_THREADS (1 << 2)
\r
67 #define NSSM_STOP_METHOD_TERMINATE (1 << 3)
\r