Title: RE: Win32API::Net

After you showed that it is just a bitwise '&' operation, I played around with it because it didn't make sense that the module would force you to make a table with the flag values. Then I realized that is what they mean by the 'symbols'. So if you import the symbols for the User* functions:

use Win32API::Net qw(:User);

You can then use the following, avoiding the creation of any table:

print "Account disabled.\n" if ($hash{'flags'} & Win32API::Net::UF_ACCOUNTDISABLE());

Saves you some typing. Thanks for your help!

Jim

-----Original Message-----
From: $Bill Luebkert [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 17, 2006 7:23 PM
To: Jim Bartlett
Cc: perl-win32-users@listserv.ActiveState.com
Subject: Re: Win32API::Net


Jim Bartlett wrote:

> Woohoo. This works great! I appreciate the help (sorry for the newbie
> questions).

You can also table drive it (not sure of the complete set) :

my %UF = (
  SCRIPT                      =>    0x0001,
  ACCOUNTDISABLE              =>    0x0002,
  HOMEDIR_REQUIRED            =>    0x0008,
  LOCKOUT                     =>    0x0010,
  PASSWD_NOTREQD              =>    0x0020,
  PASSWD_CANT_CHANGE          =>    0x0040,
  ENCRYPTED_TEXT_PASSWD_ALLOW =>    0x0080,
  TEMP_DUPLICATE_ACCOUNT      =>    0x0100,
  NORMAL_ACCOUNT              =>    0x0200,
  INTERDOMAIN_TRUST_ACCOUNT   =>    0x0800,
  WORKSTATION_TRUST_ACCOUNT   =>    0x1000,
  SERVER_TRUST_ACCOUNT        =>    0x2000,
  DONT_EXPIRE_PASSWD          =>   0x10000,
  MNS_LOGON_ACCOUNT           =>   0x20000,
  SMARTCARD_REQUIRED          =>   0x40000,
  TRUSTED_FOR_DELEGATION      =>   0x80000,
  NOT_DELEGATED               =>  0x100000,
  PASSWORD_EXPIRED            =>  0x800000,
  TRUSTED_TO_AUTH_FOR_DELEGAT => 0x1000000,
);
my %rev_UF = reverse %UF;

for my $flag (0x203, 0x201, 0x202) {
        foreach (sort keys %rev_UF) {
                print "$rev_UF{$_} " if $flag & $_;
        }
        print "\n";
}

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to