nssm.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef NSSM_H
  2. #define NSSM_H
  3. #define _WIN32_WINNT 0x0500
  4. #include <fcntl.h>
  5. #include <io.h>
  6. #include <shlwapi.h>
  7. #include <stdarg.h>
  8. #include <stdio.h>
  9. #include <tchar.h>
  10. #include <windows.h>
  11. #include "service.h"
  12. #include "event.h"
  13. #include "imports.h"
  14. #include "messages.h"
  15. #include "process.h"
  16. #include "registry.h"
  17. #include "settings.h"
  18. #include "io.h"
  19. #include "gui.h"
  20. int str_equiv(const TCHAR *, const TCHAR *);
  21. void strip_basename(TCHAR *);
  22. int str_number(const TCHAR *, unsigned long *, TCHAR **);
  23. int str_number(const TCHAR *, unsigned long *);
  24. int num_cpus();
  25. int usage(int);
  26. #define NSSM _T("NSSM")
  27. #ifdef _WIN64
  28. #define NSSM_ARCHITECTURE _T("64-bit")
  29. #else
  30. #define NSSM_ARCHITECTURE _T("32-bit")
  31. #endif
  32. #ifdef _DEBUG
  33. #define NSSM_DEBUG _T(" debug")
  34. #else
  35. #define NSSM_DEBUG _T("")
  36. #endif
  37. #define NSSM_CONFIGURATION NSSM_ARCHITECTURE NSSM_DEBUG
  38. #include "version.h"
  39. /*
  40. Throttle the restart of the service if it stops before this many
  41. milliseconds have elapsed since startup. Override in registry.
  42. */
  43. #define NSSM_RESET_THROTTLE_RESTART 1500
  44. /*
  45. How many milliseconds to wait for the application to die after sending
  46. a Control-C event to its console. Override in registry.
  47. */
  48. #define NSSM_KILL_CONSOLE_GRACE_PERIOD 1500
  49. /*
  50. How many milliseconds to wait for the application to die after posting to
  51. its windows' message queues. Override in registry.
  52. */
  53. #define NSSM_KILL_WINDOW_GRACE_PERIOD 1500
  54. /*
  55. How many milliseconds to wait for the application to die after posting to
  56. its threads' message queues. Override in registry.
  57. */
  58. #define NSSM_KILL_THREADS_GRACE_PERIOD 1500
  59. /* Margin of error for service status wait hints in milliseconds. */
  60. #define NSSM_WAITHINT_MARGIN 2000
  61. /* Methods used to try to stop the application. */
  62. #define NSSM_STOP_METHOD_CONSOLE (1 << 0)
  63. #define NSSM_STOP_METHOD_WINDOW (1 << 1)
  64. #define NSSM_STOP_METHOD_THREADS (1 << 2)
  65. #define NSSM_STOP_METHOD_TERMINATE (1 << 3)
  66. /* Startup types. */
  67. #define NSSM_STARTUP_AUTOMATIC 0
  68. #define NSSM_STARTUP_DELAYED 1
  69. #define NSSM_STARTUP_MANUAL 2
  70. #define NSSM_STARTUP_DISABLED 3
  71. /* Exit actions. */
  72. #define NSSM_EXIT_RESTART 0
  73. #define NSSM_EXIT_IGNORE 1
  74. #define NSSM_EXIT_REALLY 2
  75. #define NSSM_EXIT_UNCLEAN 3
  76. #define NSSM_NUM_EXIT_ACTIONS 4
  77. /* Process priority. */
  78. #define NSSM_REALTIME_PRIORITY 0
  79. #define NSSM_HIGH_PRIORITY 1
  80. #define NSSM_ABOVE_NORMAL_PRIORITY 2
  81. #define NSSM_NORMAL_PRIORITY 3
  82. #define NSSM_BELOW_NORMAL_PRIORITY 4
  83. #define NSSM_IDLE_PRIORITY 5
  84. /* How many milliseconds to wait before updating service status. */
  85. #define NSSM_SERVICE_STATUS_DEADLINE 20000
  86. #endif