getCurrentOSUserLocal()
The function returns the user name, full name, description and the groups of a Windows & Linux user.
Synopsis
int getCurrentOSUserLocal(string &username, string &fullname, string
&description, dyn_string &groups [, string password]);
Parameters
Parameter | Meaning |
---|---|
&username | The user name of the Windows & Linux user. |
&fullname | The full name of the Windows & Linux user. |
&description | The description of the Windows & Linux user. |
&groups | The user groups the Windows & Linux 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. |
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.
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
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