X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=service.h;h=d4d2e0f0b1f77a2620f7b3138c7098977aa01905;hb=aa519d5f870a1069107c04fca707f84ea5d204a6;hp=c9824d498106bc8009cc543bcf521ac8b06ceeb7;hpb=5b9e64a9ae1fbf1254c9c246e5b123d3aa77a37a;p=nssm.git diff --git a/service.h b/service.h index c9824d4..d4d2e0f 100644 --- a/service.h +++ b/service.h @@ -1,6 +1,8 @@ #ifndef SERVICE_H #define SERVICE_H +#include + /* MSDN says the commandline in CreateProcess() is limited to 32768 characters and the application name to MAX_PATH. @@ -13,11 +15,24 @@ #define KEY_LENGTH 255 #define VALUE_LENGTH 16383 #define SERVICE_NAME_LENGTH KEY_LENGTH - 55 +#define SERVICE_DISPLAYNAME_LENGTH 256 #define ACTION_LEN 16 +#define NSSM_LOCALSYSTEM_ACCOUNT _T("LocalSystem") + typedef struct { + bool native; TCHAR name[SERVICE_NAME_LENGTH]; + TCHAR displayname[SERVICE_DISPLAYNAME_LENGTH]; + TCHAR description[VALUE_LENGTH]; + unsigned long startup; + TCHAR *username; + size_t usernamelen; + TCHAR *password; + size_t passwordlen; + unsigned long type; + TCHAR image[MAX_PATH]; TCHAR exe[EXE_LENGTH]; TCHAR flags[VALUE_LENGTH]; TCHAR dir[MAX_PATH]; @@ -37,6 +52,10 @@ typedef struct { unsigned long stderr_sharing; unsigned long stderr_disposition; unsigned long stderr_flags; + bool rotate_files; + unsigned long rotate_seconds; + unsigned long rotate_bytes_low; + unsigned long rotate_bytes_high; unsigned long default_exit_action; unsigned long throttle_delay; unsigned long stop_method; @@ -70,10 +89,16 @@ nssm_service_t *alloc_nssm_service(); void set_nssm_service_defaults(nssm_service_t *); void cleanup_nssm_service(nssm_service_t *); SC_HANDLE open_service_manager(); +QUERY_SERVICE_CONFIG *query_service_config(const TCHAR *, SC_HANDLE); +int get_service_description(const TCHAR *, SC_HANDLE, unsigned long, TCHAR *); +int get_service_startup(const TCHAR *, SC_HANDLE, const QUERY_SERVICE_CONFIG *, unsigned long *); +int get_service_username(const TCHAR *, const QUERY_SERVICE_CONFIG *, TCHAR **, size_t *); int pre_install_service(int, TCHAR **); int pre_remove_service(int, TCHAR **); +int pre_edit_service(int, TCHAR **); int install_service(nssm_service_t *); int remove_service(nssm_service_t *); +int edit_service(nssm_service_t *, bool); void set_service_recovery(nssm_service_t *); int monitor_service(nssm_service_t *); int start_service(nssm_service_t *);