Solved

NetUserGetGroups0 returns 234 and loops forever

Posted on 2000-03-03
6
263 Views
Last Modified: 2008-03-17
I using the EnumerateGroups function from MSDN article Q159498 and for certain user accounts, NetUserGetGroups0 returns a 234 and loops forever.  If I take out the Do..Loop then it does not display all of the user's groups.

Using NT4 workstation on NT4 Domain.
0
Comment
Question by:jfunderb
  • 3
  • 2
6 Comments
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 2581011
0
 

Author Comment

by:jfunderb
ID: 2581227
They have the exact same code that I have.  But need to know what this 234 means and how to get around it.  Here's a piece of the code with very brief comments.  Maybe someone can expand on it a little...

       If Result <> 0 And Result <> 234 Then    ' 234 means multiple reads
                                                ' required
         Debug.Print "Error " & Result & " enumerating group " & EntriesRead & " of " & TotalEntries
         EnumerateGroups = 123456
         Exit Function
       End If
0
 

Author Comment

by:jfunderb
ID: 2581232
Adjusted points to 250
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Accepted Solution

by:
karlww earned 250 total points
ID: 2581520
I believe you need to keep increasing your requested buffer size.  Consider this snipit for NetServerEnum;
    lngInfoLevel = 101
    lngMaxLen = 0
    lngServerType = SV_TYPE_ALL
    Do
        '//Increase the buffer size
        lngMaxLen = lngMaxLen + 1024
        '//Call to enum
        lngRC = NetServerEnum(ByVal strMachine, _
                              lngInfoLevel, _
                              lngBuffer, _
                              lngMaxLen, _
                              lngEntriesRead, _
                              lngTotalEntries, _
                              lngServerType, _
                              ByVal 0&, _
                              lngResumeHandle _
                              )
        '//Check for sucess-- otherwise we need to free the buffer
        If CBool(lngRC) Then NetApiBufferFree lngBuffer
    Loop While lngRC = 234    
    '//now loop thru
    ReDim ServerList(0 To lngEntriesRead - 1) As String
0
 

Author Comment

by:jfunderb
ID: 2581649
Your exactly right.  I was getting a little immpaientent, so I called Microsoft and they told me the same thing - increase the buffer size.  By adding this line it seems to work...

BufLen = 65335

Thanks!
0
 
LVL 1

Expert Comment

by:karlww
ID: 2581734
You're welocme!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now