c - add current/selected user to a group -


Can someone tell me how (programmatically) I can add current / selected user to a group (like electricity

P> OK if all you want is to add a user to a local group, then you want the NetLocalGroupAddMembers API (it's way to do in C For example).

As a simple example:

  LOCALGROUP_MEMBERS_INFO_3 members [1]; // Using a fully qualified name, LOCALGROUP_MEMBERS_INFO_0 member [0] can also use SIDs. Lgrmi3_domainandname = L "MAIN \\ Username"; Status = NetLocalGroupAddMembers (NULL, L "Power User", 3, (LPBETE) Member, 1);  

The name of the group is the only literal name of the group on the system, which you can programmatically determine by using something:

  PLOCALGROUP_INFO_0 groups = NULL; DWORD dwCount = 0; DWORD dwTotalCount = 0; NET_API_STATUS status = NetLocalGroupEnum (NULL, 0, (LPBYT *) and group, MAX_PREFERRED_LENGTH, and dwCount, and dwTotalCount, NULL); If (position == NERR_Success) {for (DWORD i = 0; i  

To add to a global group you will have to use the Netgood EdusUser API instead.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -