tags:

views:

122

answers:

1

We are using WIX to install a number of services we create. I am writing a quick utility to dump the currently installed services. I just iterate over subkeys of:

SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall 

looking for DisplayName

The problem is, only two of my ten services show up in the list.

However, when I look at the subkeys in regedit, they are there. As well, they are in installed programs (and I can find them in SELECT * from Win32_Product too).

I looked through the MSDN docs, trying to find out if there is some special "view" of the registry that I am missing. Maybe it is a privilege issue? But I am running the tool as admin. Is there some hive mounting issue?

Just to be clear with the code, here is the test app code (from this answer):

string registry_key = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using(Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
{
    foreach(string subkey_name in key.GetSubKeyNames())
    {
        using(RegistryKey subkey = key.OpenSubKey(subkey_name))
        {
                Console.WriteLine(subkey.GetValue("DisplayName"));
        }
    }
}

Any thoughts on this?

A: 

The problem is a 32/64 bit issue. It seems that some of the installations happened under

HKEY_LOCAL_MACHINE\Software\WOW6432node\... 

When I enumerate them both, I get all of my installations.

Apparently I can also use:

RegistryKey.OpenBaseKey with a RegistryView.Registry64/32 

instead of the WOW6432node too.