Skip Menu |

This queue is for tickets about the Win32-TieRegistry CPAN distribution.

Report information
The Basics
Id: 57047
Status: open
Priority: 0/
Queue: Win32-TieRegistry

People
Owner: Nobody in particular
Requestors: klinebch [...] gmail.com
PLICEASE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.26
Fixed in: (no value)



Subject: Windows 7 Registry Oddities
I'm having trouble reading the registry with this module in Windows 7. For example, I am querying for a subkey I know is present but it always comes back as key not found in the following snippet: use Win32::TieRegistry; $Win32::TieRegistry::Registry->Delimiter("/"); my $pointer=$Win32::TieRegistry::Registry->{"LMachine/SOFTWARE/ComputerAssociates/"}; if (defined $pointer) { print "key was found.\n"; } else { print "key not found.\n"; } As best I can tell, this appears to be a windows 7 security-related issue. When I run the same snippet on Windows 2003 server, it works. Watching in a debugger, it appears the subkeys are all null. When I run (similar to one of your top examples on perldoc): use Win32::TieRegistry; $Win32::TieRegistry::Registry->Delimiter("/"); my $key= $Registry->{"HKEY_CURRENT_USER/SOFTWARE"} or die "Can't read key: $EXTENDED_OS_ERROR\n"; it fails with the error: Usage: Win32API::Registry::regConstant("CONST_NAME") at C:/Perl/lib/Win32/TieRegistry.pm line 292 Any hints as to how to control registry access permissions? I am running this as an administrator account. Thanks, Chris
From: klinebch [...] gmail.com
A little more clarification after testing: The following code works fine (notice the key is CURRENT_USER). use Win32::TieRegistry; $Win32::TieRegistry::Registry->Delimiter("/"); my $key= $Win32::TieRegistry::Registry->{"HKEY_CURRENT_USER/SOFTWARE/ComputerAssociates"} or die "Can't read key: $EXTENDED_OS_ERROR\n"; When I change that code from CURRENT_USER key to LOCAL_MACHINE key, it fails with: Can't read key: The system could not find the environment option that was entered. Upon further review, running the program in an administrator-privileged command window works fine, but running in a normal command window fails. This should probably be documented as something to watch out for with permissions. There's nothing to fix, but it was very confusing. Thanks.
From: anthony [...] unihedron.com
Show quoted text
> There's nothing to fix, but it was very confusing.
Why is this not a bug? I can see a regular user not being allowed to write into some places. But, requiring administrator access just to read seems a little odd.
From: anthony [...] unihedron.com
OK, I got my problems solved. Some examples in the doc show simple reads as: $data= $Registry->{$key.$subkey}; But the default access to the registry in the module KEY_READ|KEY_WRITE. This worked on previous versions of Windows. In Windows 7, the script must be "Run as administrator", otherwise nothing will be returned. Due to apparently stricter access control in Windows 7, simple reads must be explicitly defined as KEY_READ only: $data= $Registry->Open($key,{Access=>KEY_READ()})->{$subkey};
Subject: Re: [rt.cpan.org #57047] Windows 7 Registry Oddities
Date: Fri, 13 Aug 2010 13:43:46 -0700
To: bug-Win32-TieRegistry [...] rt.cpan.org
From: Tye McQueen <tye.mcqueen [...] gmail.com>
I have an enhancement that removes such annoyances. I need to get that released. FYI. Tye On Aug 13, 2010 1:39 PM, "Anthony Tekatch via RT" < bug-Win32-TieRegistry@rt.cpan.org> wrote: Queue: Win32-TieRegistry Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=57047 > OK, I got my problems solved. Some examples in the doc show simple reads as: $data= $Registry->{$key.$subkey}; But the default access to the registry in the module KEY_READ|KEY_WRITE. This worked on previous versions of Windows. In Windows 7, the script must be "Run as administrator", otherwise nothing will be returned. Due to apparently stricter access control in Windows 7, simple reads must be explicitly defined as KEY_READ only: $data= $Registry->Open($key,{Access=>KEY_READ()})->{$subkey};
Is there any timeline for when this bug fix is going to be released? Or a patch if you can point me to it.
Try to set system UAC down and it should works. 在2011-十二月-21 10:31:38 星期三时,BRIANPUGH写到: Show quoted text
> Is there any timeline for when this bug fix is going to be released? Or > a patch if you can point me to it.