nssm.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 <windows.h>
  8. #include "event.h"
  9. #include "imports.h"
  10. #include "messages.h"
  11. #include "process.h"
  12. #include "registry.h"
  13. #include "io.h"
  14. #include "service.h"
  15. #include "gui.h"
  16. int str_equiv(const char *, const char *);
  17. #define NSSM "nssm"
  18. #define NSSM_VERSION "2.17"
  19. #define NSSM_VERSIONINFO 2,17,0,0
  20. #define NSSM_DATE "2013-11-12"
  21. /*
  22. MSDN says the commandline in CreateProcess() is limited to 32768 characters
  23. and the application name to MAX_PATH.
  24. A registry key is limited to 255 characters.
  25. A registry value is limited to 16383 characters.
  26. Therefore we limit the service name to accommodate the path under HKLM.
  27. */
  28. #define EXE_LENGTH MAX_PATH
  29. #define CMD_LENGTH 32768
  30. #define KEY_LENGTH 255
  31. #define VALUE_LENGTH 16383
  32. #define SERVICE_NAME_LENGTH KEY_LENGTH - 55
  33. /*
  34. Throttle the restart of the service if it stops before this many
  35. milliseconds have elapsed since startup. Override in registry.
  36. */
  37. #define NSSM_RESET_THROTTLE_RESTART 1500
  38. /*
  39. How many milliseconds to wait for the application to die after sending
  40. a Control-C event to its console. Override in registry.
  41. */
  42. #define NSSM_KILL_CONSOLE_GRACE_PERIOD 1500
  43. /*
  44. How many milliseconds to wait for the application to die after posting to
  45. its windows' message queues. Override in registry.
  46. */
  47. #define NSSM_KILL_WINDOW_GRACE_PERIOD 1500
  48. /*
  49. How many milliseconds to wait for the application to die after posting to
  50. its threads' message queues. Override in registry.
  51. */
  52. #define NSSM_KILL_THREADS_GRACE_PERIOD 1500
  53. /* Margin of error for service status wait hints in milliseconds. */
  54. #define NSSM_WAITHINT_MARGIN 2000
  55. /* Methods used to try to stop the application. */
  56. #define NSSM_STOP_METHOD_CONSOLE (1 << 0)
  57. #define NSSM_STOP_METHOD_WINDOW (1 << 1)
  58. #define NSSM_STOP_METHOD_THREADS (1 << 2)
  59. #define NSSM_STOP_METHOD_TERMINATE (1 << 3)
  60. /* How many milliseconds to wait before updating service status. */
  61. #define NSSM_SHUTDOWN_CHECKPOINT 20000
  62. #endif