return expand_parameter(key, value, data, datalen, sanitise, true);\r
}\r
\r
+/*\r
+ Sets a string in the registry.\r
+ Returns: 0 if it was set.\r
+ 1 on error.\r
+*/\r
+int set_expand_string(HKEY key, char *value, char *string) {\r
+ if (RegSetValueEx(key, value, 0, REG_EXPAND_SZ, (const unsigned char *) string, (unsigned long) strlen(string) + 1) == ERROR_SUCCESS) return 0;\r
+ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_SETVALUE_FAILED, value, error_string(GetLastError()), 0);\r
+ return 1;\r
+}\r
+\r
+/*\r
+ Set an unsigned long in the registry.\r
+ Returns: 0 if it was set.\r
+ 1 on error.\r
+*/\r
+int set_number(HKEY key, char *value, unsigned long number) {\r
+ if (RegSetValueEx(key, value, 0, REG_DWORD, (const unsigned char *) &number, sizeof(number)) == ERROR_SUCCESS) return 0;\r
+ log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_SETVALUE_FAILED, value, error_string(GetLastError()), 0);\r
+ return 1;\r
+}\r
+\r
/*\r
Query an unsigned long from the registry.\r
Returns: 1 if a number was retrieved.\r
int set_environment(char *, HKEY, char **);\r
int expand_parameter(HKEY, char *, char *, unsigned long, bool, bool);\r
int expand_parameter(HKEY, char *, char *, unsigned long, bool);\r
+int set_expand_string(HKEY, char *, char *);\r
+int set_number(HKEY, char *, unsigned long);\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