1

I'm trying to get a list of installed programs by enumerating registry keys. As a test, I'm doing this:

#!perl
use warnings;
use strict;
use Data::Dumper;

my $registry;

use Win32::TieRegistry (
    'ArrayValues' => 1,
    'Delimiter'   => '/',
    'TiedRef'     => \$registry,
);

my $regkey = 'HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Windows/CurrentVersion/Uninstall/';

my $lmachine64 = $registry->Open( $regkey, { 'Access' => Win32::TieRegistry::KEY_READ() } );

print Data::Dumper::Dumper( $lmachine64 );

Some of the sub-keys show the data that seems to perfectly match what I see in regedit, and other sub-keys show as being empty even though regedit shows that they contain data. I can't find what's different among the keys that would make some of them have child data and others not.

I'm running this on Windows 7 64-bit with Strawberry Perl v5.20.2. I don't have a Windows 32-bit system to test this and see if it's related to being 64-bit. I've tried this in an elevated command prompt, and I've modified the offending keys so that "Everyone" has full control, all with no effect.

I've also tried this with HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Uninstall/ (without Wow6432Node), and the same thing happens (some keys contain child values and some don't).

UPDATE

When I run the above code, one of the blank keys looks like this:

'{04036F66-8809-4BCF-BA28-892460F70054}/' => bless( {}, 'Win32::TieRegistry' ),

One of the non-blank keys something look like this:

'{92FB6C44-E685-45AD-9B20-CADF4CABA132}.KB2894854v2/' => bless( {
                                                                               '/ReleaseType' => [
                        'Security Update',
                        1
                      ],
    '/' => [
             'KB2894854v2',
                     ],
etc...

However, if on the blank key I run this:

print Data::Dumper::Dumper( $blank_key->{'DisplayName'} );

Then I get the expected value. Is this perhaps an issue Data::Dumper?

Nick Coons
  • 3,682
  • 1
  • 19
  • 21

0 Answers0