* autoload.cc (CreateProfile): Import.

(LoadUserProfileW): Import.
	* registry.cc (get_registry_hive_path): Move to sec_auth.cc.
	(load_registry_hive): Remove.
	* registry.h (get_registry_hive_path): Drop declaration.
	(load_registry_hive): Ditto.
	* sec_auth.cc (get_user_profile_directory): Moved from registry.cc and
	renamed.  Take third parameter with buffer length.
	(load_user_profile): New function taking over for load_registry_hive.
	Use official functions to load profile.  If profile is missing, create
	it on Vista and later.
	* security.h (get_user_profile_directory): Declare.
	(load_user_profile): Declare.
	* syscalls.cc (seteuid32): Replace call to load_registry_hive with call
	to load_user_profile.
	* uinfo.cc (cygheap_user::env_userprofile): Replace call to
	get_registry_hive_path with call to get_user_profile_directory.
This commit is contained in:
Corinna Vinschen
2014-12-02 10:49:47 +00:00
parent 195a9205e5
commit 41f77e25f1
8 changed files with 145 additions and 109 deletions

View File

@ -482,13 +482,13 @@ cygheap_user::env_userprofile (const char *name, size_t namelen)
if (test_uid (puserprof, name, namelen))
return puserprof;
/* User hive path is never longer than MAX_PATH. */
WCHAR userprofile_env_buf[MAX_PATH];
/* User profile path is never longer than MAX_PATH. */
WCHAR profile[MAX_PATH];
WCHAR win_id[UNLEN + 1]; /* Large enough for SID */
cfree_and_set (puserprof, almost_null);
if (get_registry_hive_path (get_windows_id (win_id), userprofile_env_buf))
sys_wcstombs_alloc (&puserprof, HEAP_STR, userprofile_env_buf);
if (get_user_profile_directory (get_windows_id (win_id), profile, MAX_PATH))
sys_wcstombs_alloc (&puserprof, HEAP_STR, profile);
return puserprof;
}