io.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 copy_and_truncate;
  24. unsigned long rotate_delay;
  25. } logger_t;
  26. int get_createfile_parameters(HKEY, TCHAR *, TCHAR *, unsigned long *, unsigned long, unsigned long *, unsigned long, unsigned long *, unsigned long, bool *);
  27. int set_createfile_parameter(HKEY, TCHAR *, TCHAR *, unsigned long);
  28. int delete_createfile_parameter(HKEY, TCHAR *, TCHAR *);
  29. HANDLE write_to_file(TCHAR *, unsigned long, SECURITY_ATTRIBUTES *, unsigned long, unsigned long);
  30. void rotate_file(TCHAR *, TCHAR *, unsigned long, unsigned long, unsigned long, unsigned long, bool);
  31. int get_output_handles(nssm_service_t *, STARTUPINFO *);
  32. void close_output_handles(STARTUPINFO *);
  33. unsigned long WINAPI log_and_rotate(void *);
  34. #endif