X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=registry.cpp;h=458127cd6fe127c3a4f111aef5336ada0cafa2dc;hb=277723e318f71a9ff9948e3286df509af79c1dc8;hp=382cb0f46076c897c35dacd1ea0639d7ab000ebb;hpb=728c4f6eb96313e764600810aa754663a5091f38;p=nssm.git diff --git a/registry.cpp b/registry.cpp index 382cb0f..458127c 100644 --- a/registry.cpp +++ b/registry.cpp @@ -72,6 +72,18 @@ int create_parameters(nssm_service_t *service) { if (service->stdout_path[0]) set_expand_string(key, NSSM_REG_STDOUT, service->stdout_path); if (service->stderr_path[0]) set_expand_string(key, NSSM_REG_STDERR, service->stderr_path); + /* Environment */ + if (service->env) { + if (RegSetValueEx(key, NSSM_REG_ENV, 0, REG_MULTI_SZ, (const unsigned char *) service->env, (unsigned long) service->envlen) != ERROR_SUCCESS) { + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_SETVALUE_FAILED, NSSM_REG_ENV, error_string(GetLastError()), 0); + } + } + if (service->env_extra) { + if (RegSetValueEx(key, NSSM_REG_ENV_EXTRA, 0, REG_MULTI_SZ, (const unsigned char *) service->env_extra, (unsigned long) service->env_extralen) != ERROR_SUCCESS) { + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_SETVALUE_FAILED, NSSM_REG_ENV_EXTRA, error_string(GetLastError()), 0); + } + } + /* Close registry. */ RegCloseKey(key);