Subject: | 02_main tests fail, here is a fix |
Date: | Thu, 26 Feb 2015 15:09:04 -0500 |
To: | bug-Win32-TieRegistry [...] rt.cpan.org |
From: | Bruce Reed <bruce [...] brucereed.com> |
The 02_main tests fail in Win32::TieRegistry.
This is caused by the key a security restriction in the registry.
In the key being used -
CUser/Software/Microsoft/Windows/CurrentVersion/Policies/Explorer//NoDriveTypeAutoRunthe
Policies subkey is set to ReadOnly access, but the default access for
TieRegistry is Read/Write access.
If we add ":KEY_", to the imports, and reopen the key with KEY_READ
access, then the subkey is read successfully, and the tests run OK.
*my*$reg;
*use* Win32::TieRegistry (
Delimiter *=>* "/",
ArrayValues *=>* 1,
TiedRef *=>* \$reg,
":KEY_",
":REG_",
);
$reg *=* $reg*->Open*('', *{*Access *=>* KEY_READ*}* );
*my* $val *=* $reg*->{* "CUser/Software/Microsoft/Windows/CurrentVersion/"
*.* "Policies/Explorer//NoDriveTypeAutoRun" *}*;
ok( $val, 'Opened CU/SW/MS/Win/CV/Pol/Exp//NoDriveTypeAutoRun' );
is( REG_DWORD, $val*->*[1], 'Type is REG_DWORD' );
like( $val*->*[0], qr/^0x[\da-f]{8}$/i, 'Value matches expected' );