5 MSDN says the commandline in CreateProcess() is limited to 32768 characters
\r
6 and the application name to MAX_PATH.
\r
7 A registry key is limited to 255 characters.
\r
8 A registry value is limited to 16383 characters.
\r
9 Therefore we limit the service name to accommodate the path under HKLM.
\r
11 #define EXE_LENGTH MAX_PATH
\r
12 #define CMD_LENGTH 32768
\r
13 #define KEY_LENGTH 255
\r
14 #define VALUE_LENGTH 16383
\r
15 #define SERVICE_NAME_LENGTH KEY_LENGTH - 55
\r
17 #define ACTION_LEN 16
\r
20 char name[SERVICE_NAME_LENGTH];
\r
21 char exe[EXE_LENGTH];
\r
22 char flags[VALUE_LENGTH];
\r
25 unsigned long envlen;
\r
27 unsigned long env_extralen;
\r
28 char stdin_path[MAX_PATH];
\r
29 char stdout_path[MAX_PATH];
\r
30 char stderr_path[MAX_PATH];
\r
31 unsigned long default_exit_action;
\r
32 unsigned long throttle_delay;
\r
33 unsigned long stop_method;
\r
34 unsigned long kill_console_delay;
\r
35 unsigned long kill_window_delay;
\r
36 unsigned long kill_threads_delay;
\r
38 SERVICE_STATUS status;
\r
39 SERVICE_STATUS_HANDLE status_handle;
\r
40 HANDLE process_handle;
\r
45 unsigned long throttle;
\r
46 CRITICAL_SECTION throttle_section;
\r
47 bool throttle_section_initialised;
\r
48 CONDITION_VARIABLE throttle_condition;
\r
49 HANDLE throttle_timer;
\r
50 LARGE_INTEGER throttle_duetime;
\r
51 FILETIME creation_time;
\r
55 void WINAPI service_main(unsigned long, char **);
\r
56 char *service_control_text(unsigned long);
\r
57 void log_service_control(char *, unsigned long, bool);
\r
58 unsigned long WINAPI service_control_handler(unsigned long, unsigned long, void *, void *);
\r
60 nssm_service_t *alloc_nssm_service();
\r
61 void cleanup_nssm_service(nssm_service_t *);
\r
62 SC_HANDLE open_service_manager();
\r
63 int pre_install_service(int, char **);
\r
64 int pre_remove_service(int, char **);
\r
65 int install_service(nssm_service_t *);
\r
66 int remove_service(nssm_service_t *);
\r
67 void set_service_recovery(nssm_service_t *);
\r
68 int monitor_service(nssm_service_t *);
\r
69 int start_service(nssm_service_t *);
\r
70 int stop_service(nssm_service_t *, unsigned long, bool, bool);
\r
71 void CALLBACK end_service(void *, unsigned char);
\r
72 void throttle_restart(nssm_service_t *);
\r
73 int await_shutdown(nssm_service_t *, char *, unsigned long);
\r