List Info

Thread: Accessing the registry with Win32::TieRegistry on XP as std user not working




Accessing the registry with Win32::TieRegistry on XP as std user not working
user name
2006-04-19 21:51:15
Yeah,
 
    It's a permission thing with the registry ... I ran across it a few months back and posted to this list. ; In the end I found the fix myself.  Try this code instead:
 
-----------------
my $reg_key = Registry->Open("HKEY_LOCAL_MACHINE\\Software\\ActiveState\\", {Access=>1});
or $error = "ERROR: Can't access registry key because, $^E\n";
print "error was \"$error\"\n";
-----------------
 
    Specifying the Access level is the key. ; By the way Access=>;1 only gives you read access to that key.
 
Bill


From: perl-win32-admin-bounceslistserv.ActiveState.com [mailto:perl-win32-admin-bounceslistserv.ActiveState.com] On Behalf Of Castle, Eric
Sent: Wednesday, April 19, 2006 5:02 PM
To: perl-win32-adminlistserv.ActiveState.com
Subject: Accessing the registry with Win32::TieRegistry on XP as std user not working

Hi,
 
In preparation for the Vista OS release, I am testing out how our perl scripts work when running as a standard user on Windows XP SP2. This user has no power user or admin permissions.
 
So far when I try to access the registry ( using Win32::TieRegistry) I get an error - the same error that I would get if the registry key did not exist. I tried using perl 5.6.1 and 5.8 and it behaves the same in both. ; If running the same script as a user with power user or admin priveldges, the scripts work fine and have no problems accessing the registry.
 
Other (non-perl) applications running as std user are able to access the registry just fine (don't know if they can alter it but they can at least read it). 
 
The registry key I was accessing was HKEY_LOCAL_MACHINE\Software\ActiveState\ 
 
The error message I get back in $^E is:  "The system could not find the environment option that was entered".   Here is a sample script I used to test out the problem:
 
use Win32::TieRegistry;
 
my $error = "";
my $reg_key = $Registry->{"HKEY_LOCAL_MACHINE\\Software\\ActiveState\\"}
or $error = "ERROR: Can't access registry key because, $^E\n";
print "error was \"$error\"\n";
 
Has anyone else run into this? ; I'm gonna do a search through MSDN also and see this has come up.
 
Thanks,
Eric
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )