Regedit shows keys that are not listed using GetSubKeyNames()

岁酱吖の 提交于 2019-12-04 16:45:18
Ganesh R.

Is your OS x64? If that is the case, for "LocalMachine\Software" there are two different nodes: Normal for x64 apps and Wow6432Node for x86 apps.

A sample application to demonstrate the above.

using System;
using Microsoft.Win32;

namespace ConsoleApplication1
{
  internal class Program
  {
    public static void Main()
    {
      String[] values = Registry.LocalMachine.OpenSubKey(@"SOFTWARE").GetSubKeyNames();
      foreach (String value in values)
                Console.WriteLine(value);
    }
  }
}

This is the output of the code on my machine when the console application is built in x86:

Adobe
AGEIA Technologies
Alcohol Soft
Apple Computer, Inc.
Apple Inc.
Aureal
Avira
Azureus
BazisSoft
C07ft5Y
Canon
Citrix
...

This is the output on my machine when the console application is built in x64:

7-Zip
AGEIA Technologies
Apple Computer, Inc.
Apple Inc.
ATI Technologies
Canon
Classes
Clients
...

As you see, the outputs vary a lot based on whether the application is x86 or x64.

EDIT: A similar question was asked on StackOverflow previously.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!