Jump to content
Sign in to follow this  

How to handle the array in this DllCall() ?

Recommended Posts


Hello Guys,

I am really really frustated :dance: with a API-Call, and I think it isn't hard to handle.

I simply want to add a user to a local group. :dance:

So, please take a look:

NET_API_STATUS NetLocalGroupAddMembers(

  LPCWSTR servername,

  LPCWSTR groupname,

  DWORD level,

  LPBYTE buf,

  DWORD totalentries




    [in] Pointer to a constant string that specifies the DNS or NetBIOS name of the remote server on which the function is to execute. If this parameter is NULL, the local computer is used. Windows NT:  This string must begin with \\.


    [in] Pointer to a constant string that specifies the name of the local group to which the specified users or global groups will be added. For more information, see the following Remarks section.


    [in] Specifies the information level of the data. This parameter can be one of the following values.

    Value  Meaning

    0  Specifies the security identifier (SID) of the new local group member. The buf parameter points to an array of LOCALGROUP_MEMBERS_INFO_0 structures.

    3  Specifies the domain and name of the new local group member. The buf parameter points to an array of LOCALGROUP_MEMBERS_INFO_3 structures.


    [in] Pointer to a buffer that contains the data for the new local group members. The format of this data depends on the value of the level parameter. For more information, see Network Management Function Buffers.


    [in] Specifies the number of entries in the buffer pointed to by the buf parameter.

So, that's my problem. I don't know, how to handle the array problem. The rest isn't so hard.

I am sure, the following code should lead in the right direction ...

$res     = DllCall( "netapi32.dll", "int", "NetLocalGroupAddMembers", _
                            "wstr", $servername, _  
                            "wstr", $group, _
                            "int", 3, _
                            ?, ?
                            "int", 1)

I was trying the half day to get this damn call running ... but know my head is :whistle: ...

:(MSDN Lib - NetLocalGroupAddMembers()

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