Try to build PDB files even for releases.
[nssm.git] / service.h
index 6da55f3..46664de 100644 (file)
--- a/service.h
+++ b/service.h
@@ -1,8 +1,6 @@
 #ifndef SERVICE_H\r
 #define SERVICE_H\r
 \r
-#include <ntsecapi.h>\r
-\r
 /*\r
   MSDN says the commandline in CreateProcess() is limited to 32768 characters\r
   and the application name to MAX_PATH.\r
@@ -19,7 +17,6 @@
 \r
 #define ACTION_LEN 16\r
 \r
-#define NSSM_LOCALSYSTEM_ACCOUNT _T("LocalSystem")\r
 #define NSSM_KERNEL_DRIVER _T("SERVICE_KERNEL_DRIVER")\r
 #define NSSM_FILE_SYSTEM_DRIVER _T("SERVICE_FILE_SYSTEM_DRIVER")\r
 #define NSSM_WIN32_OWN_PROCESS _T("SERVICE_WIN32_OWN_PROCESS")\r
@@ -49,10 +46,13 @@ typedef struct {
   TCHAR dir[DIR_LENGTH];\r
   TCHAR *env;\r
   __int64 affinity;\r
+  TCHAR *dependencies;\r
+  unsigned long dependencieslen;\r
   unsigned long envlen;\r
   TCHAR *env_extra;\r
   unsigned long env_extralen;\r
   unsigned long priority;\r
+  unsigned long no_console;\r
   TCHAR stdin_path[PATH_LENGTH];\r
   unsigned long stdin_sharing;\r
   unsigned long stdin_disposition;\r
@@ -61,6 +61,8 @@ typedef struct {
   unsigned long stdout_sharing;\r
   unsigned long stdout_disposition;\r
   unsigned long stdout_flags;\r
+  bool use_stdout_pipe;\r
+  HANDLE stdout_si;\r
   HANDLE stdout_pipe;\r
   HANDLE stdout_thread;\r
   unsigned long stdout_tid;\r
@@ -68,15 +70,22 @@ typedef struct {
   unsigned long stderr_sharing;\r
   unsigned long stderr_disposition;\r
   unsigned long stderr_flags;\r
+  bool use_stderr_pipe;\r
+  HANDLE stderr_si;\r
   HANDLE stderr_pipe;\r
   HANDLE stderr_thread;\r
   unsigned long stderr_tid;\r
+  bool hook_share_output_handles;\r
   bool rotate_files;\r
+  bool timestamp_log;\r
+  bool stdout_copy_and_truncate;\r
+  bool stderr_copy_and_truncate;\r
   unsigned long rotate_stdout_online;\r
   unsigned long rotate_stderr_online;\r
   unsigned long rotate_seconds;\r
   unsigned long rotate_bytes_low;\r
   unsigned long rotate_bytes_high;\r
+  unsigned long rotate_delay;\r
   unsigned long default_exit_action;\r
   unsigned long restart_delay;\r
   unsigned long throttle_delay;\r
@@ -84,22 +93,32 @@ typedef struct {
   unsigned long kill_console_delay;\r
   unsigned long kill_window_delay;\r
   unsigned long kill_threads_delay;\r
+  bool kill_process_tree;\r
   SC_HANDLE handle;\r
   SERVICE_STATUS status;\r
   SERVICE_STATUS_HANDLE status_handle;\r
   HANDLE process_handle;\r
   unsigned long pid;\r
   HANDLE wait_handle;\r
+  unsigned long exitcode;\r
   bool stopping;\r
   bool allow_restart;\r
   unsigned long throttle;\r
   CRITICAL_SECTION throttle_section;\r
   bool throttle_section_initialised;\r
+  CRITICAL_SECTION hook_section;\r
+  bool hook_section_initialised;\r
   CONDITION_VARIABLE throttle_condition;\r
   HANDLE throttle_timer;\r
   LARGE_INTEGER throttle_duetime;\r
+  FILETIME nssm_creation_time;\r
   FILETIME creation_time;\r
   FILETIME exit_time;\r
+  TCHAR *initial_env;\r
+  unsigned long last_control;\r
+  unsigned long start_requested_count;\r
+  unsigned long start_count;\r
+  unsigned long exit_count;\r
 } nssm_service_t;\r
 \r
 void WINAPI service_main(unsigned long, TCHAR **);\r
@@ -117,20 +136,27 @@ unsigned long priority_index_to_constant(int);
 nssm_service_t *alloc_nssm_service();\r
 void set_nssm_service_defaults(nssm_service_t *);\r
 void cleanup_nssm_service(nssm_service_t *);\r
-SC_HANDLE open_service_manager();\r
-SC_HANDLE open_service(SC_HANDLE, TCHAR *, TCHAR *, unsigned long);\r
+SC_HANDLE open_service_manager(unsigned long);\r
+SC_HANDLE open_service(SC_HANDLE, TCHAR *, unsigned long, TCHAR *, unsigned long);\r
 QUERY_SERVICE_CONFIG *query_service_config(const TCHAR *, SC_HANDLE);\r
+int append_to_dependencies(TCHAR *, unsigned long, TCHAR *, TCHAR **, unsigned long *, int);\r
+int remove_from_dependencies(TCHAR *, unsigned long, TCHAR *, TCHAR **, unsigned long *, int);\r
+int set_service_dependencies(const TCHAR *, SC_HANDLE, TCHAR *);\r
+int get_service_dependencies(const TCHAR *, SC_HANDLE, TCHAR **, unsigned long *, int);\r
+int get_service_dependencies(const TCHAR *, SC_HANDLE, TCHAR **, unsigned long *);\r
 int set_service_description(const TCHAR *, SC_HANDLE, TCHAR *);\r
 int get_service_description(const TCHAR *, SC_HANDLE, unsigned long, TCHAR *);\r
 int get_service_startup(const TCHAR *, SC_HANDLE, const QUERY_SERVICE_CONFIG *, unsigned long *);\r
 int get_service_username(const TCHAR *, const QUERY_SERVICE_CONFIG *, TCHAR **, size_t *);\r
-int grant_logon_as_service(const TCHAR *);\r
+void set_service_environment(nssm_service_t *);\r
+void unset_service_environment(nssm_service_t *);\r
 int pre_install_service(int, TCHAR **);\r
 int pre_remove_service(int, TCHAR **);\r
 int pre_edit_service(int, TCHAR **);\r
 int install_service(nssm_service_t *);\r
 int remove_service(nssm_service_t *);\r
 int edit_service(nssm_service_t *, bool);\r
+int control_service(unsigned long, int, TCHAR **, bool);\r
 int control_service(unsigned long, int, TCHAR **);\r
 void set_service_recovery(nssm_service_t *);\r
 int monitor_service(nssm_service_t *);\r
@@ -138,6 +164,8 @@ int start_service(nssm_service_t *);
 int stop_service(nssm_service_t *, unsigned long, bool, bool);\r
 void CALLBACK end_service(void *, unsigned char);\r
 void throttle_restart(nssm_service_t *);\r
-int await_shutdown(nssm_service_t *, TCHAR *, unsigned long);\r
+int await_single_handle(SERVICE_STATUS_HANDLE, SERVICE_STATUS *, HANDLE, TCHAR *, TCHAR *, unsigned long);\r
+int list_nssm_services(int, TCHAR **);\r
+int service_process_tree(int, TCHAR **);\r
 \r
 #endif\r