io.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef IO_H
  2. #define IO_H
  3. #define NSSM_STDIN_SHARING FILE_SHARE_WRITE
  4. #define NSSM_STDIN_DISPOSITION OPEN_EXISTING
  5. #define NSSM_STDIN_FLAGS FILE_ATTRIBUTE_NORMAL
  6. #define NSSM_STDOUT_SHARING (FILE_SHARE_READ | FILE_SHARE_WRITE)
  7. #define NSSM_STDOUT_DISPOSITION OPEN_ALWAYS
  8. #define NSSM_STDOUT_FLAGS FILE_ATTRIBUTE_NORMAL
  9. #define NSSM_STDERR_SHARING (FILE_SHARE_READ | FILE_SHARE_WRITE)
  10. #define NSSM_STDERR_DISPOSITION OPEN_ALWAYS
  11. #define NSSM_STDERR_FLAGS FILE_ATTRIBUTE_NORMAL
  12. typedef struct {
  13. TCHAR *service_name;
  14. TCHAR *path;
  15. unsigned long sharing;
  16. unsigned long disposition;
  17. unsigned long flags;
  18. HANDLE read_handle;
  19. HANDLE write_handle;
  20. __int64 size;
  21. unsigned long *tid_ptr;
  22. unsigned long *rotate_online;
  23. bool timestamp_log;
  24. __int64 line_length;
  25. bool copy_and_truncate;
  26. unsigned long rotate_delay;
  27. } logger_t;
  28. void close_handle(HANDLE *, HANDLE *);
  29. void close_handle(HANDLE *);
  30. int get_createfile_parameters(HKEY, TCHAR *, TCHAR *, unsigned long *, unsigned long, unsigned long *, unsigned long, unsigned long *, unsigned long, bool *);
  31. int set_createfile_parameter(HKEY, TCHAR *, TCHAR *, unsigned long);
  32. int delete_createfile_parameter(HKEY, TCHAR *, TCHAR *);
  33. HANDLE write_to_file(TCHAR *, unsigned long, SECURITY_ATTRIBUTES *, unsigned long, unsigned long);
  34. void rotate_file(TCHAR *, TCHAR *, unsigned long, unsigned long, unsigned long, unsigned long, bool);
  35. int get_output_handles(nssm_service_t *, STARTUPINFO *);
  36. int use_output_handles(nssm_service_t *, STARTUPINFO *);
  37. void close_output_handles(STARTUPINFO *);
  38. void cleanup_loggers(nssm_service_t *);
  39. unsigned long WINAPI log_and_rotate(void *);
  40. #endif