settings.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef SETTINGS_H
  2. #define SETTINGS_H
  3. #define NSSM_NATIVE_DEPENDONGROUP _T("DependOnGroup")
  4. #define NSSM_NATIVE_DEPENDONSERVICE _T("DependOnService")
  5. #define NSSM_NATIVE_DESCRIPTION _T("Description")
  6. #define NSSM_NATIVE_DISPLAYNAME _T("DisplayName")
  7. #define NSSM_NATIVE_ENVIRONMENT _T("Environment")
  8. #define NSSM_NATIVE_IMAGEPATH _T("ImagePath")
  9. #define NSSM_NATIVE_NAME _T("Name")
  10. #define NSSM_NATIVE_OBJECTNAME _T("ObjectName")
  11. #define NSSM_NATIVE_STARTUP _T("Start")
  12. #define NSSM_NATIVE_TYPE _T("Type")
  13. /* Are additional arguments needed? */
  14. #define ADDITIONAL_GETTING (1 << 0)
  15. #define ADDITIONAL_SETTING (1 << 1)
  16. #define ADDITIONAL_RESETTING (1 << 2)
  17. #define ADDITIONAL_CRLF (1 << 3)
  18. #define ADDITIONAL_MANDATORY ADDITIONAL_GETTING|ADDITIONAL_SETTING|ADDITIONAL_RESETTING
  19. #define DEPENDENCY_SERVICES (1 << 0)
  20. #define DEPENDENCY_GROUPS (1 << 1)
  21. #define DEPENDENCY_ALL (DEPENDENCY_SERVICES|DEPENDENCY_GROUPS)
  22. typedef union {
  23. unsigned long numeric;
  24. TCHAR *string;
  25. } value_t;
  26. typedef int (*setting_function_t)(const TCHAR *, void *, const TCHAR *, void *, value_t *, const TCHAR *);
  27. typedef struct {
  28. const TCHAR *name;
  29. unsigned long type;
  30. void *default_value;
  31. bool native;
  32. int additional;
  33. setting_function_t set;
  34. setting_function_t get;
  35. setting_function_t dump;
  36. } settings_t;
  37. int set_setting(const TCHAR *, HKEY, settings_t *, value_t *, const TCHAR *);
  38. int set_setting(const TCHAR *, SC_HANDLE, settings_t *, value_t *, const TCHAR *);
  39. int get_setting(const TCHAR *, HKEY, settings_t *, value_t *, const TCHAR *);
  40. int get_setting(const TCHAR *, SC_HANDLE, settings_t *, value_t *, const TCHAR *);
  41. int dump_setting(const TCHAR *, HKEY, SC_HANDLE, settings_t *);
  42. #endif