Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I obtain a list of groups a user belongs to using VC++ ?

Status
Not open for further replies.

dagehring

Programmer
May 12, 2000
2
US
I have an application that is written in Microsoft Visual C++ 6.0 running on <br>NT 4.0. Based on a users name, I need to obtain the list of groups they belong to (<br>i.e.: User-&gt;jdoe belongs to groups-&gt;User & Administrator). I assume that there is an API call that I need do use but cannot find it. Any help <br>would be appreciated. <br><br>Thanks!!!<br>
 
Dear dagehring,<br><br>From the MSDN library:<br><br>NetUserGetGroups<br>The NetUserGetGroups function retrieves a list of global groups to which a specified user belongs.<br><br>Security Requirements<br>Only members of the Administrators or Account Operators local group can successfully execute NetUserGetGroups or on a computer that has local security enabled, except when users request details about their own accounts.<br><br>NET_API_STATUS NetUserGetGroups(<br>&nbsp;&nbsp;LPCWSTR servername,&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;LPCWSTR username,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;DWORD level,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;LPBYTE *bufptr,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;DWORD prefmaxlen,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;LPDWORD entriesread,&nbsp;&nbsp;<br>&nbsp;&nbsp;LPDWORD totalentries&nbsp;&nbsp;<br>);<br>&nbsp;<br>Good Luck<br>-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top