nssm.h 2.6 KB

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