I found this in the Mailing list archive a while ago.  Hopefully the author 
will forgive me, I forgot to include his name.  It should help you though.

Jeremy

sub SID_bin2text {
  my($bin) = @_;

  my($Revision, $SubAuthorityCount,@IdentifierAuthorities) = unpack("CCnnn", 
$bin);
  ($IdentifierAuthorities[0] || $IdentifierAuthorities[1]) and return;
  my($temp, $temp2, @SubAuthorities) = unpack("VVV$SubAuthorityCount",$bin);
  return "S-$Revision-$IdentifierAuthorities[2]-".join("-",@SubAuthorities);
}

sub SID_text2bin {
  my($text) = @_;

  my(@Values) = split(/\-/, $text);
  (@Values[0] == "S") or return;
  return pack("CCnnnV".(@Values-3), $Values[1], @Values-3, 0, 0, $Values[2], 
@Values[3..(@Values-1)]);
}


>From: Jangale V-S <[EMAIL PROTECTED]>
>To: "'[EMAIL PROTECTED]'"  
><[EMAIL PROTECTED]>
>Subject: Win32::LookupAccountName in perl
>Date: Mon, 23 Apr 2001 14:51:04 +0200
>
>Hi perl friends
>
>I am trying to get SID of user using perl command
>
>Win32::LookupAccountName(SYSTEM, ACCOUNT, DOMAIN, SID, SIDTYPE)
>
>I am getting SID in coded format.
>
>I tried to unpack it without any success. Will anyone guide me on this?
>
>Thanks in advance,
>
>
>V.S. Jangale,
>
>
>_______________________________________________
>Perl-Win32-Users mailing list
>[EMAIL PROTECTED]
>http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to