Get acess to Registry Editor in C#

Yuri Augusto 41 Reputation points
2022-10-07T16:35:24.237+00:00

Hello!
Hi! I'm developing an application that lists windows programs in C#.NET. It searches through the Registry Editor, accessing three different locations, namely:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall HKEY_CURRENT_USER\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall

when I'm trying to access the first path, the program is always directed to the second path and I have no idea why this is happening. can anybody help me?

When I use

key = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall ");

the program goes to path : "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"

Developer technologies Windows Forms
Developer technologies .NET Other
Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2022-10-07T16:52:00.14+00:00

    there are two registries, 32 bit & 64 bit.

    you appear to be accessing the 32 bit version on a 64bit o/s, thus the "\WOW6432Node\". the 32 bit registry values are loaded into the 64 bit registry under this node.

    explicit access:

    RegistryKey localKey32 = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32);
    RegistryKey localKey64 = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.