X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;ds=sidebyside;f=settings.cpp;h=f50dcc454f9bd4680e13309fef5e869ba1b73926;hb=ac8cdc8a64606b7027344c8fd4d5f7f9bc871e90;hp=7d08e134850f0fd568d12e8f2df9f05bbac0b563;hpb=6adc886e1fa296f67aacef0c01994e302e8caf86;p=nssm.git diff --git a/settings.cpp b/settings.cpp index 7d08e13..f50dcc4 100644 --- a/settings.cpp +++ b/settings.cpp @@ -452,7 +452,9 @@ static int setting_get_priority(const TCHAR *service_name, void *param, const TC unsigned long constant; switch (get_number(key, (TCHAR *) name, &constant, false)) { - case 0: return value_from_string(name, value, (const TCHAR *) default_value); + case 0: + if (value_from_string(name, value, (const TCHAR *) default_value) == -1) return -1; + return 0; case -1: return -1; } @@ -727,20 +729,20 @@ int native_get_displayname(const TCHAR *service_name, void *param, const TCHAR * } int native_set_environment(const TCHAR *service_name, void *param, const TCHAR *name, void *default_value, value_t *value, const TCHAR *additional) { - HKEY key = open_service_registry(service_name, KEY_SET_VALUE, false); + HKEY key = open_service_registry(service_name, KEY_SET_VALUE, true); if (! key) return -1; - int ret = setting_set_environment(service_name, (void *) key, NSSM_NATIVE_ENVIRONMENT, default_value, value, additional); + int ret = setting_set_environment(service_name, (void *) key, name, default_value, value, additional); RegCloseKey(key); return ret; } int native_get_environment(const TCHAR *service_name, void *param, const TCHAR *name, void *default_value, value_t *value, const TCHAR *additional) { - HKEY key = open_service_registry(service_name, KEY_READ, false); + HKEY key = open_service_registry(service_name, KEY_READ, true); if (! key) return -1; ZeroMemory(value, sizeof(value_t)); - int ret = setting_get_environment(service_name, (void *) key, NSSM_NATIVE_ENVIRONMENT, default_value, value, additional); + int ret = setting_get_environment(service_name, (void *) key, name, default_value, value, additional); RegCloseKey(key); return ret; }