C#Registry fetch:OpenRemoteBaseKey - " IOExepction:句柄无效"错误

时间:2017-01-04 13:16:04

标签: c# .net windows registry

我使用这一简单的行访问远程计算机上的注册表(例如CurrentUser):

RegistryKey r = RegistryKey.OpenRemoteBaseKey(RegistryHive.CurrentUser, "machineName");

完美无缺,但是当我尝试这一行时:

RegistryKey r2 = RegistryKey.OpenRemoteBaseKey(RegistryHive.CurrentConfig, "machineName");

我收到以下错误:

  

IOExecption未处理:句柄无效。

我能使其发挥作用的唯一方法是使用:

RegistryKey r3 = RegistryKey.OpenRemoteBaseKey(RegistryHive.CurrentUser, "");

但它只适用于我的本地机器,这不是我需要的。

操作系统:在Windows 7和Windows Server 2012 R2上试用

我一直在网上搜索,但我无法找到解决问题的方法。很少有人甚至解决这个错误。任何帮助都非常感谢。

0 个答案:

没有答案
相关问题