return 0;\r
}\r
\r
+/*\r
+ Query an unsigned long from the registry.\r
+ Returns: 1 if a number was retrieved.\r
+ 0 if none was found and must_exist is false.\r
+ -1 if none was found and must_exist is true.\r
+ -2 otherwise.\r
+*/\r
+int get_number(HKEY key, char *value, unsigned long *number, bool must_exist) {\r
+ unsigned long type = REG_DWORD;\r
+ unsigned long number_len = sizeof(unsigned long);\r
+\r
+ int ret = RegQueryValueEx(key, value, 0, &type, (unsigned char *) number, &number_len);\r
+ if (ret == ERROR_SUCCESS) return 1;\r
+\r
+ if (ret == ERROR_FILE_NOT_FOUND) {\r
+ if (! must_exist) return 0;\r
+ }\r
+\r
+ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_QUERYVALUE_FAILED, value, error_string(GetLastError()), 0);\r
+ if (ret == ERROR_FILE_NOT_FOUND) return -1;\r
+\r
+ return -2;\r
+}\r
+\r
+int get_number(HKEY key, char *value, unsigned long *number) {\r
+ return get_number(key, value, number, true);\r
+}\r
+\r
int get_parameters(char *service_name, char *exe, int exelen, char *flags, int flagslen, char *dir, int dirlen, char **env, unsigned long *throttle_delay) {\r
unsigned long ret;\r
\r
int create_exit_action(char *, const char *);\r
int set_environment(char *, HKEY, char **);\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
int get_parameters(char *, char *, int, char *, int, char *, int, char **, unsigned long *);\r
int get_exit_action(char *, unsigned long *, unsigned char *, bool *);\r
\r