I am using this code to make a list of all the installed programs:
object line;
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))
        {
            line = subkey.GetValue("DisplayName");
            if (line != null)
            {
                listBox1.Items.Add(line);
            }
        }
    }
}
On a 64-bit windows, this redirects to Wow6432Node \Microsoft\Windows\CurrentVersion\Uninstall. But some program entries are still located in the original path and the list is incomplete. How can I avoid redirection and read the values from both paths on a 64-bit Windows installation (and only the first one on a 32-bit windows)?
 
     
     
     
     
    