Windows Perl Scripting Forums » Perl

Recursing Permissions on a Registry Object

(1 post)
  • Started 6 years ago by jsanio

Tags:


  1. jsanio
    Member

    Hi All

    I am running
    - Perl v5.8.7
    - Win32-Perms [0.2002.06.05]
    - Win32-Registry (Sept 2005) Also with Win32::TieRegistry (Mar 2006)

    I am executing the code as administrator

    I have googled the the web and news groups and have not found a response to this issue.

    I am trying to recursively add permissions (read access) to all Keys under the the HKLM,HKCC hives. I am able to successfully update the Target Hive or Sub key BUT I am unable to recurse down the hive adding the priviledges.

    Any and all comments are welcome.


    CODE SNIP

    my $RegKeyObj=$Registry->Connect( $HOST, $regkey, { Access=>KEY_ALL_ACCESS, Delimiter=>"/" });
    $::HKEY_CURRENT_USER->Connect($HOST,$key) or die "Can't read $HOST $regkey $^E\n";
    my $PermsObj = new Win32::Perms($key);
    $PermsObj->Dump;
    $PermsObj->Remove($LocalGroup);
    print "The path represents a ", $TYPE{$PermsObj->GetType()}, ".\n";
    print $SubDir, "-- $? -- \n";
    print ($PermsObj->IsContainer())? "":"not " ;
    print $?,"\n";
    if ( $PermsObj->IsContainer() ) {
    if ($PermsObj->Allow($LocalGroup,READ,CONTAINER_INHERIT_ACE)) {
    $PermsObj->SetRecurse();
    print "$?\n";
    print "Change Successful\n";
    } else {
    print "Change Failed\n";
    }
    }
    if ($PermsObj->Allow($LocalGroup,READ|READ_CONTROL|STANDARD_RIGHTS_READ,CONTAINER_INHERIT_ACE|OBJECT_INHERIT_ACE)) {
    $PermsObj->SetRecurse();
    print "$?\n";
    print "Change Successful\n";
    } else {
    print "Change Failed\n";
    }

    };
    if ($@) {
    print $@,"\n";
    }
    }
    <<< SNOP
    Posted 6 years ago #

RSS feed for this topic

Reply

You must log in to post.