Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SetCurrentUser

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function sets the current user as logged on.


BOOL SetCurrentUser( 
  LPCWSTR lpszUserName, 
  LPBYTE lpbUserSecret, 
  DWORD dwDataSize, 
  BOOL bCreateIfNew 
);

lpszUserName

[in] NULL-terminated string containing the user's logon name. The name must be a valid file name because a directory is created for the user profile. User names are case-insensitive.

lpbUserSecret

[in] Buffer of user-specific encrypted data, such as a password.

dwDataSize

[in] Size of the user secret data.

bCreateIfNew

[in] Specifies that a new user is created if the name specified in lpszUserName does not already exist on the system.

Returns TRUE if the new user was logged on. If the specified user was already logged on, returns FALSE and leaves that user logged on. In this case, GetLastError returns ERROR_USER_EXISTS. If the call fails for any other reason, this function returns FALSE and logs the current user off.

This function is accessible only to privileged applications.

When the user is logged on, this function adjusts the registry as applicable and provides the user encrypted data to the security subsystem to unlock the user credentials. This function logs off any previous user.

If the new user is the same as the previous user, the call fails, and GetLastError returns ERROR_USER_EXISTS, leaving the same user logged on. It makes no call to the security subsystem. In any other case when this function fails, the current user is logged off, and no new user is logged on.

If there is no user, set lpszUserName and lpbUserSecret to NULL, dwDataSize to zero, and bCreateIfNew to FALSE.

Headerpwinreg.h
Librarycoredll.lib
Windows Embedded CEWindows CE .NET 4.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2014 Microsoft