Enable on-demand rotation.
[nssm.git] / nssm.h
1 #ifndef NSSM_H\r
2 #define NSSM_H\r
3 \r
4 #define _WIN32_WINNT 0x0500\r
5 #include <fcntl.h>\r
6 #include <io.h>\r
7 #include <shlwapi.h>\r
8 #include <stdarg.h>\r
9 #include <stdio.h>\r
10 #include <tchar.h>\r
11 #include <windows.h>\r
12 #include "service.h"\r
13 #include "event.h"\r
14 #include "imports.h"\r
15 #include "messages.h"\r
16 #include "process.h"\r
17 #include "registry.h"\r
18 #include "settings.h"\r
19 #include "io.h"\r
20 #include "gui.h"\r
21 \r
22 int str_equiv(const TCHAR *, const TCHAR *);\r
23 void strip_basename(TCHAR *);\r
24 int str_number(const TCHAR *, unsigned long *, TCHAR **);\r
25 int str_number(const TCHAR *, unsigned long *);\r
26 int num_cpus();\r
27 int usage(int);\r
28 \r
29 #define NSSM _T("NSSM")\r
30 #ifdef _WIN64\r
31 #define NSSM_ARCHITECTURE _T("64-bit")\r
32 #else\r
33 #define NSSM_ARCHITECTURE _T("32-bit")\r
34 #endif\r
35 #ifdef _DEBUG\r
36 #define NSSM_DEBUG _T(" debug")\r
37 #else\r
38 #define NSSM_DEBUG _T("")\r
39 #endif\r
40 #define NSSM_CONFIGURATION NSSM_ARCHITECTURE NSSM_DEBUG\r
41 #include "version.h"\r
42 \r
43 /*\r
44   Throttle the restart of the service if it stops before this many\r
45   milliseconds have elapsed since startup.  Override in registry.\r
46 */\r
47 #define NSSM_RESET_THROTTLE_RESTART 1500\r
48 \r
49 /*\r
50   How many milliseconds to wait for the application to die after sending\r
51   a Control-C event to its console.  Override in registry.\r
52 */\r
53 #define NSSM_KILL_CONSOLE_GRACE_PERIOD 1500\r
54 /*\r
55   How many milliseconds to wait for the application to die after posting to\r
56   its windows' message queues.  Override in registry.\r
57 */\r
58 #define NSSM_KILL_WINDOW_GRACE_PERIOD 1500\r
59 /*\r
60   How many milliseconds to wait for the application to die after posting to\r
61   its threads' message queues.  Override in registry.\r
62 */\r
63 #define NSSM_KILL_THREADS_GRACE_PERIOD 1500\r
64 \r
65 /* Margin of error for service status wait hints in milliseconds. */\r
66 #define NSSM_WAITHINT_MARGIN 2000\r
67 \r
68 /* Methods used to try to stop the application. */\r
69 #define NSSM_STOP_METHOD_CONSOLE (1 << 0)\r
70 #define NSSM_STOP_METHOD_WINDOW (1 << 1)\r
71 #define NSSM_STOP_METHOD_THREADS (1 << 2)\r
72 #define NSSM_STOP_METHOD_TERMINATE (1 << 3)\r
73 \r
74 /* Startup types. */\r
75 #define NSSM_STARTUP_AUTOMATIC 0\r
76 #define NSSM_STARTUP_DELAYED 1\r
77 #define NSSM_STARTUP_MANUAL 2\r
78 #define NSSM_STARTUP_DISABLED 3\r
79 \r
80 /* Exit actions. */\r
81 #define NSSM_EXIT_RESTART 0\r
82 #define NSSM_EXIT_IGNORE 1\r
83 #define NSSM_EXIT_REALLY 2\r
84 #define NSSM_EXIT_UNCLEAN 3\r
85 #define NSSM_NUM_EXIT_ACTIONS 4\r
86 \r
87 /* Process priority. */\r
88 #define NSSM_REALTIME_PRIORITY 0\r
89 #define NSSM_HIGH_PRIORITY 1\r
90 #define NSSM_ABOVE_NORMAL_PRIORITY 2\r
91 #define NSSM_NORMAL_PRIORITY 3\r
92 #define NSSM_BELOW_NORMAL_PRIORITY 4\r
93 #define NSSM_IDLE_PRIORITY 5\r
94 \r
95 /* How many milliseconds to wait before updating service status. */\r
96 #define NSSM_SERVICE_STATUS_DEADLINE 20000\r
97 \r
98 /* User-defined service controls can be in the range 128-255. */\r
99 #define NSSM_SERVICE_CONTROL_ROTATE 128\r
100 \r
101 #endif\r