seven_shen has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; use Win32::TieRegistry; my $PID_KEY_ROOT = "LMachine\\SOFTWARE\\"; my $PID_KEY = "Test"; my $reg = new Win32::TieRegistry $PID_KEY_ROOT, {Delimiter=>"\\"}; print "$reg\n"; $reg->CreateKey($PID_KEY) or die("$^E\n");
The test is to add one Key in registry. The above codes works normally in administrator priviledge, but couldn't run in standard user, for example in WIN7/Vista with UAC enabled:
Use of uninitialized value $reg n concatenation <.> or string at test. +pl line 8. Can't call method "CreateKey" on an undefined value at test.pl line 9.
Seems the module can not work successfully if some keys in registry is out of user priviledge.
Some guys suggest to add Access control like:
#!/usr/bin/perl -w use strict; use Win32::TieRegistry; my $PID_KEY_ROOT = "LMachine\\SOFTWARE\\"; my $PID_KEY = "Test"; my $reg = new Win32::TieRegistry $PID_KEY_ROOT,{Access=>"KEY_READ",Del +imiter=>"\\"}; print "$reg\n"; $reg->CreateKey($PID_KEY) or die("$^E\n");
This works for:
my $reg = new Win32::TieRegistry $PID_KEY_ROOT,{Access=>"KEY_READ",Delimiter=>"\\"};but fails for:
$reg->CreateKey($PID_KEY)
The output is : Access is denied
Any solutions(substitutions)?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Deficiency of Win32::TieRegistry in user priviledge
by Anonymous Monk on Jun 17, 2011 at 07:48 UTC | |
|
Re: Deficiency of Win32::TieRegistry in user priviledge
by Anonymous Monk on Jun 17, 2011 at 08:11 UTC | |
|
Re: Deficiency of Win32::TieRegistry in user priviledge
by locked_user sundialsvc4 (Abbot) on Jun 17, 2011 at 13:08 UTC |