What is the meaning of these Windows Environment variables:
Who set them? When? Who use them? For doing what?
How the configuration of the samba server modify these variables?
USERPROFILE
is set by userenv!LoadUserProfileW
which is called when, well, loading the user's profile (the HKEY_USERS\<sid>
hive).
/noprofile
for runas
) then the process is run in the Default User
profile which still has this variable set - since the moment it was loaded at system's startup.HOMEDRIVE
, HOMEPATH
and HOMESHARE
(as well as several other variables) are set by shell32!RegenerateUserEnvironment
which is called on Explorer initialization1. They are placed in the (volatile) HKCU\Volatile Environment
key which, being volatile, persists until the profile's unload.
USERPROFILE
nowadays.HOMEPATH
to be set, SYSTEM
must have permissions for the profile's directory (they are initially set, of course, but may vanish when e.g. playing with Cygwin's chmod
).1The code also sets a few variables that are already set by userenv
. This suggests that this is an older code that persists since NT4 days. Difference between profile and home path - Server Fault confirms that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With