26 March, 2013
07 March, 2013
As you know service.exe generates environment variables for service every time when it starts the new service process. It merges it's own environment with ones from different places such as:
- HKLM\System\CurrentControlSet\Control\Session Manager\Environment
- Environment key from HKLM\SYSTEM\CurrentControlSet\Services\YourService
- AppEnvironment key from HKLM\SYSTEM\CurrentControlSet\Services\YourService\Parameters
However, there are some not clear things with service.exe. It doesn't work correctly with REG_DWORD, but other part of Windows understand REG_DWORD correctly. So, newer write REG_DWORD values in HKLM\System\CurrentControlSet\Control\Session Manager\Environment. Please use only REG_SZ.
service.exe got it's own environment variables at the system startup and doesn't change till shutdown. So, every service in system get the mix of current environment variables and environment variables from startup. So, it's impossible to delete environment variable if it was on system startup, but it's possible to overlap the value.