afff8c429efcaee17eeace001d269c21a6fcb030
[nssm.git] / nssm.h
1 #ifndef NSSM_H\r
2 #define NSSM_H\r
3 \r
4 #define _WIN32_WINNT 0x0500\r
5 #include <shlwapi.h>\r
6 #include <stdarg.h>\r
7 #include <stdio.h>\r
8 #include <windows.h>\r
9 #include "event.h"\r
10 #include "messages.h"\r
11 #include "process.h"\r
12 #include "registry.h"\r
13 #include "io.h"\r
14 #include "service.h"\r
15 #include "gui.h"\r
16 \r
17 int str_equiv(const char *, const char *);\r
18 \r
19 #define NSSM "nssm"\r
20 #define NSSM_VERSION "2.16"\r
21 #define NSSM_VERSIONINFO 2,16,0,0\r
22 #define NSSM_DATE "2012-12-01"\r
23 \r
24 /*\r
25   MSDN says the commandline in CreateProcess() is limited to 32768 characters\r
26   and the application name to MAX_PATH.\r
27   A registry key is limited to 255 characters.\r
28   A registry value is limited to 16383 characters.\r
29   Therefore we limit the service name to accommodate the path under HKLM.\r
30 */\r
31 #define EXE_LENGTH MAX_PATH\r
32 #define CMD_LENGTH 32768\r
33 #define KEY_LENGTH 255\r
34 #define VALUE_LENGTH 16383\r
35 #define SERVICE_NAME_LENGTH KEY_LENGTH - 55\r
36 \r
37 /*\r
38   Throttle the restart of the service if it stops before this many\r
39   milliseconds have elapsed since startup.  Override in registry.\r
40 */\r
41 #define NSSM_RESET_THROTTLE_RESTART 1500\r
42 \r
43 /*\r
44   How many milliseconds to wait for the application to die after sending\r
45   a Control-C event to its console.\r
46 */\r
47 #define NSSM_KILL_CONSOLE_GRACE_PERIOD 1500\r
48 /*\r
49   How many milliseconds to wait for the application to die after posting to\r
50   its windows' message queues.\r
51 */\r
52 #define NSSM_KILL_WINDOW_GRACE_PERIOD 1500\r
53 /*\r
54   How many milliseconds to wait for the application to die after posting to\r
55   its threads' message queues.\r
56 */\r
57 #define NSSM_KILL_THREADS_GRACE_PERIOD 1500\r
58 \r
59 /* Margin of error for service status wait hints in milliseconds. */\r
60 #define NSSM_WAITHINT_MARGIN 2000\r
61 \r
62 /* Methods used to try to stop the application. */\r
63 #define NSSM_STOP_METHOD_CONSOLE (1 << 0)\r
64 #define NSSM_STOP_METHOD_WINDOW (1 << 1)\r
65 #define NSSM_STOP_METHOD_THREADS (1 << 2)\r
66 #define NSSM_STOP_METHOD_TERMINATE (1 << 3)\r
67 \r
68 #endif\r