All,
I have a call to the NetUserGetGroups API and can get the first entry in the returned User Groups back.
My question is, how do I iterate through the entire list of user groups??
the code I am using is below:-
Code:Public Function GetGroups(ByVal UserID As String) As Boolean Dim GI0 As New GROUP_USERS_INFO_0() Dim Level As Integer = 0 Dim Server As String = GetPDC() & vbNullChar Dim i As Integer Dim lRet As Integer = -1 Dim size As Integer = Marshal.SizeOf(GI0) Dim lpBuf As IntPtr = Marshal.AllocHGlobal(size) Dim EntriesRead As Integer Dim TotalEntries As Integer UserID = UserID & vbNullChar Marshal.StructureToPtr(GI0, lpBuf, True) lRet = NetUserGetGroups(Server, UserID, Level, lpBuf, -1, _ EntriesRead, TotalEntries) If lRet = NERR_SUCCESS Then GI0 = CType(Marshal.PtrToStructure(lpBuf, _ GetType(GROUP_USERS_INFO_0)), GROUP_USERS_INFO_0) For i = 1 To EntriesRead _myGroupsbox.Items.Add(GI0.grui0_name) 'How do I get the next Group!!!!!???? Next End If




Reply With Quote