Solved

NetUserGetGroups0 returns 234 and loops forever

Posted on 2000-03-03
6
262 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

758 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

19 Experts available now in Live!

Get 1:1 Help Now