Regedit 显示未使用 GetSubKeyNames() 列出的键 [英] Regedit shows keys that are not listed using GetSubKeyNames()

查看:43
本文介绍了Regedit 显示未使用 GetSubKeyNames() 列出的键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经检查了其他一些关于 SO 的回复,但据我所知,这是一个与我得到的点击率不同的问题.

I've checked some other replies on SO but as far I can see, this is a different issue than the hits I got.

当我打开 RegEdit 时,我可以看到一组键,但是当我从我的程序中使用例如列出它们时:

When I open RegEdit, I can see a set of keys but when I list them from my program using e.g.:

Registry.LocalMachine.OpenSubKey(@"SOFTWARE").GetSubKeyNames()

其中一些丢失了.我认为这可能与访问权限有关,所以我也检查了 .CurrentUser.在那里可以体验到相同的行为.只是没有列出一些子项.

some of them are missing. I thought it might to do with the access rights so I checked .CurrentUser too. The same behavior can be experienced there. A few of the subkeys are just not listed.

我错过了什么?

推荐答案

您的操作系统是 x64 吗?如果是这种情况,LocalMachine\Software"有两个不同的节点:Normal for x64 apps 和 Wow6432Node for x86 apps.

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);
    }
  }
}

当控制台应用程序内置在 x86 中时,这是我机器上代码的输出:

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

Adobe
AGEIA技术
酒精软
苹果电脑公司
苹果公司
奥雷尔
Avira
蔚蓝
BazisSoft
C07ft5Y
佳能
思杰
...

当控制台应用程序内置在 x64 中时,这是我机器上的输出:

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

7-Zip
AGEIA技术
苹果电脑公司
苹果公司
ATI 技术
佳能
课程
客户
...

如您所见,根据应用程序是 x86 还是 x64,输出会有很大差异.

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

类似问题之前在 StackOverflow 上被问过.

A similar question was asked on StackOverflow previously.

这篇关于Regedit 显示未使用 GetSubKeyNames() 列出的键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆