nssm.h 1.9 KB

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