Jump to content
Sign in to follow this  
lcloki

Is it a Bug?

Recommended Posts

lcloki

Hello there ...

I am getting 2 from @error after calling this call.

The documentations means:

@error = 2 unknown "return type".

Func showVar($var, $name="unnamed")
        
        $tmp = "--------------------------------" & @CRLF
        
        If IsArray($var) Then
            For $i = 0 To UBound
                $tmp &= "   #" & $i & ": " & $tmp[$i]
            Next
        Else
            $tmp &= $name & ": " & $var
        EndIf
        
        Return $tmp
        
    EndFunc

    Func _NetLocalGroupEnum($servername="", $level=0)

        Local $arr[1]

    ;   NET_API_STATUS NetLocalGroupEnum(
    ;     LPCWSTR servername,
    ;     DWORD level,
    ;     LPBYTE* bufptr,
    ;     DWORD prefmaxlen,
    ;     LPDWORD entriesread,
    ;     LPDWORD totalentries,
    ;     PDWORD_PTR resume_handle
    ;   );

            
        If $level = 0 Then
            $bufptr = DllStructCreate("ptr")    ; GROUP_INFO_0
        Else
            MsgBox(0, "", "failed!")
        EndIf
        
        $hresume        = DllStructCreate("ptr")
        $entriesread    = 0
        $totalentries   = 0
        
        $res = DllCall( "netapi32.dll", "long", "NetLocalGroupEnum", _
                        "wstr", $servername, _
                        "int", $level, _
                        "long", DllStructGetPtr($bufptr), _
                        "int", -1, _
                        "ptr_int", $entriesread, _
                        "ptr_int", $totalentries, _
                        "long", DllStructGetPtr($hresume) _
                        )
                        
    ;#cs
        MsgBox(0, "",   "@error: " & @error & @CRLF & _
                        showVar($res, "res") )
    ;#ce            

    EndFunc

    _NetLocalGroupEnum()

Does anybody know whats wrong? I looked for NET_API_STATUS a it should be and long value. See here for example.

MSDN Library & NetLocalGroupEnum

Share this post


Link to post
Share on other sites
Jos

Hello there ...

I am getting 2 from @error after calling this call.

<{POST_SNAPBACK}>

"ptr_int" is not a valid value..... Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
lcloki

thx, that was it ... :dance:

studip mistake ... :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×