Solved

NetUserGetGroups0 returns 234 and loops forever

Posted on 2000-03-03
6
264 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 70

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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

821 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