What about the following...

Excerpt from:
http://cpansearch.perl.org/src/TEVERETT/Win32-Security-0.50/lib/Win32/Se
curity/SID.pm

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

        my(@Values) = split(/\-/, $text);
        (shift(@Values) eq 'S' && scalar(@Values) >= 3) or return;
        my $Revision = shift(@Values);
        my $IdentifierAuthority = shift(@Values);
        if (substr($IdentifierAuthority, 0, 2) eq '0x') {
                $IdentifierAuthority = pack("H12",
substr($IdentifierAuthority, 2));
        } else {
                $IdentifierAuthority = pack("nN", 0,
$IdentifierAuthority);
        }
        return pack("CCa6V*", $Revision, scalar(@Values),
$IdentifierAuthority, @Values);
}

 

-----Original Message-----
From: perl-win32-users-boun...@listserv.activestate.com
[mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of
Barry Brevik
Sent: Wednesday, July 18, 2012 11:30 AM
To: perl Win32-users
Subject: Help with LookupAccountSID (again)

Previously I had asked for help with Win32::LookupAccountSID().
Specifically, the call requires that the SID be in a binary format.

One helpful user pointed me to this:
http://code.activestate.com/lists/perl-win32-users/26301/

All of that works, except the article's author is first getting the
binary SID from the Win32::LookupAccountName() call, which is a chicken
and egg thing.

I need to know how to convert a SID like this:
'{S-1-5-21-1406052347-744958519-16733337701-1424}'

...into its equivalent binary form for use in the
Win32::LookupAccountSID() call. Does anyone out there know how to do
this?

TIA,

Barry Brevik

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

Reply via email to