Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

samba - What is the meaning of these Windows Environment variables: HOMEDRIVE, HOMEPATH, HOMESHARE, USERPROFILE

What is the meaning of these Windows Environment variables:

  • HOMEDRIVE,
  • HOMEPATH,
  • HOMESHARE,
  • and USERPROFILE?

Who set them? When? Who use them? For doing what?

How the configuration of the samba server modify these variables?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

USERPROFILE is set by userenv!LoadUserProfileW which is called when, well, loading the user's profile (the HKEY_USERS<sid> hive).

  • This typically happens the first time a process is started for the user.
  • If you specifically arranged not to load the profile (e.g. with /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) HKCUVolatile Environment key which, being volatile, persists until the profile's unload.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...