HKEY key = open_registry(service->name, KEY_READ);\r
if (! key) return 1;\r
\r
+ /* Don't expand parameters when retrieving for the GUI. */\r
+ bool expand = si ? true : false;\r
+\r
/* Try to get executable file - MUST succeed */\r
- if (expand_parameter(key, NSSM_REG_EXE, service->exe, sizeof(service->exe), false)) {\r
+ if (get_string(key, NSSM_REG_EXE, service->exe, sizeof(service->exe), expand, false, true)) {\r
RegCloseKey(key);\r
return 3;\r
}\r
\r
/* Try to get flags - may fail and we don't care */\r
- if (expand_parameter(key, NSSM_REG_FLAGS, service->flags, sizeof(service->flags), false)) {\r
+ if (get_string(key, NSSM_REG_FLAGS, service->flags, sizeof(service->flags), expand, false, true)) {\r
log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_NO_FLAGS, NSSM_REG_FLAGS, service->name, service->exe, 0);\r
ZeroMemory(service->flags, sizeof(service->flags));\r
}\r
\r
/* Try to get startup directory - may fail and we fall back to a default */\r
- if (expand_parameter(key, NSSM_REG_DIR, service->dir, sizeof(service->dir), true) || ! service->dir[0]) {\r
+ if (get_string(key, NSSM_REG_DIR, service->dir, sizeof(service->dir), expand, true, true) || ! service->dir[0]) {\r
_sntprintf_s(service->dir, _countof(service->dir), _TRUNCATE, _T("%s"), service->exe);\r
strip_basename(service->dir);\r
if (service->dir[0] == _T('\0')) {\r
\r
/* Try to get processor affinity - may fail. */\r
TCHAR buffer[512];\r
- if (expand_parameter(key, NSSM_REG_AFFINITY, buffer, sizeof(buffer), false, false) || ! buffer[0]) service->affinity = 0LL;\r
+ if (get_string(key, NSSM_REG_AFFINITY, buffer, sizeof(buffer), false, false, false) || ! buffer[0]) service->affinity = 0LL;\r
else if (affinity_string_to_mask(buffer, &service->affinity)) {\r
log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_BOGUS_AFFINITY_MASK, service->name, buffer);\r
service->affinity = 0LL;\r