Windows Perl Scripting Forums » Perl

Win32::Perms hanging

(1 post)
  • Started 6 years ago by runrig

Tags:


  1. runrig
    Member

    I would like to copy permissions from one registry key to another (actually a bunch of others), but either nothing happens, or it gets hung up on the Set(or SetDacl) eating more and more memory. I've tried passing in a 'registry:...' style path and a Win32::Registry object, but no luck.

    If I create the Win32::Perms object with a Win32::Registry object, and try to set permission on a 'registry:...' path, it eats memory. If I try to Set on a Win32::Registry object, then nothing happens.

    If I try to create a Win32::Perms object with a 'registry:..' path, then the Dump doesn't have the ACL permissions for groups and users.

    Here is the code:


    #!/usr/bin/perl

    use strict;
    use warnings;

    use Win32::Registry;
    use Win32::Perms;

    my $path = 'SOFTWARE\\Classes';
    my $key1 = 'opendocument.WriterDocument.1';
    my $key2 = 'opendocument.WriterGlobalDocument.1';

    $::HKEY_LOCAL_MACHINE->Open("$path\\$key1", my $doc1) or die "Acck: $^E";

    #This doesn't work (nothing in Dump)
    #my $p = Win32::Perms->new("HKEY_LOCAL_MACHINE\\$path\\$key1");

    my $p = Win32::Perms->new($doc1);
    $p->Dump;
    print "Set\n";
    $p->SetDacl("registry:HKEY_LOCAL_MACHINE\\$path\\$key2", 1) or die "Acck: $^E";
    print "Set!\n";
    $p->Close;
    $doc1->Close;
    #$doc2->Close;

    Posted 6 years ago #

RSS feed for this topic

Reply

You must log in to post.