- RegSetValueEx (hrootkey, env_vars[i].name, 0, REG_EXPAND_SZ,
- value, lstrlen (value) + 1);
+ /* Replace only those settings that already exist. */
+ if (RegQueryValueEx (hrootkey, env_vars[i].name, NULL,
+ NULL, NULL, NULL) == ERROR_SUCCESS)
+ RegSetValueEx (hrootkey, env_vars[i].name, 0, REG_EXPAND_SZ,
+ value, lstrlen (value) + 1);