繁体   English   中英

GetSubKeysNames()使用远程注册表返回Null-WPF

[英]GetSubKeysNames() returns null using Remote Registry - WPF

在我的程序中,我试图使用服务器的远程注册表从所有用户那里获取SID列表。 它们位于LocalMachine中:

\\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

这是我的代码:

public void ReadRegKeys(string machineName)
    {
        RegistryKey rk = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, machineName);
        rk.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList");
        string[] regKeys = rk.GetSubKeyNames();

        foreach(string item in regKeys) {
            //Do something
    }

我的问题是该数组不包含名称/键。.我没有收到错误,并且该数组保持为空。 之后,我尝试读取HKEY_Users的子键,并且成功。 所有子键均已正确保存在阵列中。

有什么办法吗?

谢谢

好的,我找到了解决方案。必须在OpenRemoteBaseKey()方法的末尾添加RegistryView.Registry64

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM