return get_number(key, value, number, true);\r
}\r
\r
+void override_milliseconds(char *service_name, HKEY key, char *value, unsigned long *buffer, unsigned long default_value, unsigned long event) {\r
+ unsigned long type = REG_DWORD;\r
+ unsigned long buflen = sizeof(unsigned long);\r
+ bool ok = false;\r
+ unsigned long ret = RegQueryValueEx(key, value, 0, &type, (unsigned char *) buffer, &buflen);\r
+ if (ret != ERROR_SUCCESS) {\r
+ if (ret != ERROR_FILE_NOT_FOUND) {\r
+ if (type != REG_DWORD) {\r
+ char milliseconds[16];\r
+ _snprintf_s(milliseconds, sizeof(milliseconds), _TRUNCATE, "%lu", default_value);\r
+ log_event(EVENTLOG_WARNING_TYPE, event, service_name, value, milliseconds, 0);\r
+ }\r
+ else log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_QUERYVALUE_FAILED, value, error_string(GetLastError()), 0);\r
+ }\r
+ }\r
+ else ok = true;\r
+\r
+ if (! ok) *buffer = default_value;\r
+}\r
+\r
int get_parameters(char *service_name, char *exe, unsigned long exelen, char *flags, unsigned long flagslen, char *dir, unsigned long dirlen, char **env, unsigned long *throttle_delay, unsigned long *stop_method, STARTUPINFO *si) {\r
unsigned long ret;\r
\r
int expand_parameter(HKEY, char *, char *, unsigned long, bool);\r
int get_number(HKEY, char *, unsigned long *, bool);\r
int get_number(HKEY, char *, unsigned long *);\r
+void override_milliseconds(char *, HKEY, char *, unsigned long *, unsigned long, unsigned long);\r
int get_parameters(char *, char *, unsigned long, char *, unsigned long, char *, unsigned long, char **, unsigned long *, unsigned long *, STARTUPINFO *);\r
int get_exit_action(char *, unsigned long *, unsigned char *, bool *);\r
\r