Jump to content

IsMember extra


SumTingWong
 Share

Recommended Posts

Whilst Larry is kept busy doing socket functions, I thought I would add my bit and do a simple IsMember function.

Usage as below:

Dim $naDllRet

; Description:  IsMember
; Parameters:   str - Username
;                     (if checking global groups, the username must be 20 chars or less)
;                     (if checking local groups, domain username must be specified as DOMAIN\user)
;               str - Group name (256 chars or less)
;               int - Flag (0 for local group and 1 for global group)
; Requirements: If checking global group, a valid DC must be accessible
; Return:       1 - user found in group
;               0 - user not found in group or error

; Check if pacman is a member of the global Domain Users group
$naDllRet = DllCall(@ScriptDir & "\IsMember.dll", "int", "IsMember", _
                    "str", "pacman", _
                    "str", "Domain Users", _
                    "int", 1)
MsgBox(4096,'debug:' , '$naDllRet:' & $naDllRet[0]);### Debug MSGBOX 

; Check if MYDOMAIN\pacman is a member of the local Administrators group
$naDllRet = DllCall(@ScriptDir & "\IsMember.dll", "int", "IsMember", _
                    "str", "MYDOMAIN\pacman", _
                    "str", "Administrators", _
                    "int", 0)
MsgBox(4096,'debug:' , '$naDllRet:' & $naDllRet[0]);### Debug MSGBOX

This function also checks local groups in which the user is indirectly a member (that is, the user has membership in a global group that is itself a member of one or more local groups).

@Larry, I can send the code to you if you want to include it in your Xtra dll.

Please have a look at Larry's AU3Xtra.dll here for this function.

Edited by pacman
Link to comment
Share on other sites

sure... larrydalooza AT yahoo.com

lemme know how you want to be recognized...

I will release the source for AU3Xtra.dll when I get proper documentation and the code cleaned up... which may take some time, as I suspect some of the code may make it into the official AutoIt3, thereby giving itself eligibility for removal from AU3Xtra.dll...

Lar.

<{POST_SNAPBACK}>

Larry, Pelles C project on its way.

Nah, I don't need to be recognized as I lifted the code straight from MSDN and just jumbled it around a bit... :idiot: (as you do!)

Cheers

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...