getCurrentOSUserLocal()

The function getCurrentOSUserLocal() returns the user name, full name, description and the groups of a Windows user.

Synopsis

int getCurrentOSUserLocal(string &username, string &fullname, string

&description, dyn_string &groups [, string password]);

Synopsis

Parameter Meaning
&username The user name of the Windows user.
&fullname The full name of the Windows user.
&description The description of the Windows user.
&groups The user groups the Windows user belongs to.
password The password of the user. This parameter is optional. The password is, however, necessary to get the groups of the user.

Return Value

int

Error

The function returns -1 in case of errors and otherwise 0.

Description

The function returns the user name, full name, description and the groups of a Windows user. The behavior of this function is controlled via the optional parameter password. If a password exists, the data of the user username is returned (in case of a correct user name/password). If a password is not specified, the data of the currently logged in user is returned (in this case the groups, the user belongs to, are not returned). The function can be used locally.

Example

main()
{
  string user, full, desc;
  dyn_string group;
  getCurrentOSUserLocal(user, full, desc, group);
  DebugN(user, full, desc, group);
} 
// Returns the data of the current user                            

Example

main()
{
  string user, full, desc, pass;
  dyn_string group;
  user="mdavis";
  pass="password";
  getCurrentOSUserLocal(user, full, desc, group, pass);
  DebugN(user, full, desc, group);
} 
// Returns the data of the user "mdavis" with password
"password"

Assignment

User administration, waiting control function.

Availability

CTRL

See also

getAllOSGroups(), getAllOSUsers(), getCurrentDomainName(), getWindowsEvents() and verifyOSUser()