roteme has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I encountered a strange problem to read some keys from registry.

My program should be run on Win7 32|64 bit and XP 32|64 bit (All options).

I successfully run the following simple code on Win7 64bit:

use Win32::Registry; my $Register = "Software"; my ($hkey, @key_list, $key); $HKEY_LOCAL_MACHINE->Open($Register,$hkey)|| die $!; $hkey->GetKeys(\@key_list); print "$Register keys\n"; foreach $key (@key_list) { print "$key\n"; } $hkey->Close();

But if I create registry key "Software\\Test" NOT UNDER "SOFTWARE\Wow6432Node" the program failed – can read the key

my $Register = "Software\\Test";

How can I control the reading from registry for 32 and 64

How can I control to read this key:

Software\\Test

And How can I control to read this key:

SOFTWARE\Wow6432Node\\Test

Please advice

Replies are listed 'Best First'.
Re: Reading key from registry (32 and 64 Bit)
by BrowserUk (Patriarch) on Feb 29, 2012 at 17:18 UTC

    See 32-bit and 64-bit Application Data in the Registry.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      Thanks - But how can i read keys on x64 machine from

      HKEY_LOCAL_MACHINE\SOFTWARE\Intel

      and not from

      HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node

      Wow6432Node folder?
        Thanks - But how can i read keys on x64 machine from HKEY_LOCAL_MACHINE\SOFTWARE\Intel and not from HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node Wow6432Node folder?

        My interpretation of this:

        To disable and enable registry reflection for a particular key, use the RegDisableReflectionKey and RegEnableReflectionKey functions. Applications should disable reflection only for the registry keys that they create and not attempt to disable reflection for the predefined keys such as HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER. To determine which keys are on the reflection list, use the RegQueryReflectionKey function.

        Is that you shouldn't -- even if you can work out a way to do so.

        The rules are there for good reason -- the configuration of things will often need to be different for the 32-bit and 64-bit versions of the same software.

        If you choose to ignore the rules, then you will likely end up breaking something. At best, it will be your own program. At worst, it could be the OS.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        The start of some sanity?