RegistryKey 读取注册表信息

RegistryKey读取注册表,明明看得到却读不到?

不要直接使用:

1
var localMachineKey = Registry.LocalMachine;

而是使用如下与计算机位数相关的代码

1
2
var useRegistryView = Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32;
var localMachineKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, useRegistryView);

);