#!/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)?
In reply to Deficiency of Win32::TieRegistry in user priviledge by seven_shen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |