User Management
User profiles allow several users to access a device, keeping their individual preferences and settings separate. Only one user can be logged on at a time.
To log on a new user, use the SetCurrentUser function. SetCurrentUser will log off the previous user, if any, and log on the new user. Note that SetCurrentUser simply switches the user registry. It does not communicate a user logon to system processes, drivers, or services. It also does not shut down non-system applications. There is currently no mechanism to reset system processes with a new user's settings. So, in most cases, a device reset is required to boot with the new user's settings.
Additionally, since the OEM's startup user interface (UI), which requests the user's name and password, is started after some system drivers and services that read a user's preferences, such as the screen input panel keyboard, those drivers and services require a user to be logged on at boot. If those drivers and services are in use, the OEM will need to specify a default user to be logged on during boot. The device will start with that user's settings, and when the startup UI calls SetCurrentUser, the user will be authenticated and fully logged on.
SetCurrentUser also authenticates the user by passing a buffer of opaque user data, such as a password, to the security subsystem. That buffer is used internally by functions, such as the CryptProtectData function to protect a user's password. To change the user's opaque data buffer, for instance to change their password, use the SetUserData function.
To find out which user is currently logged on, call the GetUserNameEx function with the NameWindowsCeLocal name format. This function will return the user name that was passed to SetCurrentUser.
Each user is given a separate user profile directory into which applications can put user-specific files and data. To retrieve the location of the current user's profile directory, call the SHGetSpecialFolderLocation or SHGetSpecialFolderPath function with the CSIDL_PROFILE identifier.
There may be other passwords in the system. Do not confuse the current user's password with the system password, which is controlled by the SetPassword, CheckPassword, SetPasswordStatus, and GetPasswordStatus functions. The system password applies to the entire system and is independent of the current user logged on. Network passwords are another example of passwords that are independent of the current user.
See Also
User Profiles | User Profile Setup | User Profile Storage
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.