I am trying to copy registry permissions from one key to another (and eventually to many others). key1 has full read/write permission for administrator and read permission for users, but key2 only has read permission for administrator (although I can change permission by manually running regedit) and no permission for users. This script doesn't seem to do anything (it prints the values, but does not change security that I can see). I also tried setting full read/write permission on key2 for the administrator group in regedit (though the other keys I want to change don't have it), but user permissions don't get added:
use strict;
use warnings;
use Win32::TieRegistry qw( Delimiter / KEY_READ KEY_WRITE );
use Win32 qw(
DACL_SECURITY_INFORMATION
SACL_SECURITY_INFORMATION
);
my $path = 'LMachine/Software/Classes';
my $key1 = 'opendocument.WriterDocument.1';
my $key2 = 'opendocument.WriterGlobalDocument.1';
my $r = $Registry->{"$path/$key1"};
print $r->{"/"},"\n";
my $sec;
$r->RegGetKeySecurity( DACL_SECURITY_INFORMATION, $sec, [] );
# Only have read access on this - but can manually run regedit
# and change permissions
my $r2 = $Registry->Open("$path/$key2", {Access => KEY_READ(), Delimit
+er=>"/"});
#my $r2 = $Registry->{"$path/$key2"};
print $r2->{"/"},"\n";
$r2->RegSetKeySecurity( DACL_SECURITY_INFORMATION, $sec );
Update: Just to mention where I'm trying to go with this, there's a bug when you upgrade OpenOffice which causes insufficient permissions on these keys for users (works ok for Admin accounts), so I'd like to fix all permissions for keys in this path with keys or values that start with 'openoffice.' or 'soffice.'.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.