本文介绍了HKEY_LOCAL_MACHINE注册表访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在通过C#尝试一些远程注册表操作。我已经编写了一个测试 的应用程序,只需从指定的 机器上的指定配置单元中获取指定的密钥。对OpenSubKey的调用是抛出System.SecurityException。 还有一点需要注意:坐在我本地的盒子里,我可以打开注册表并连接到 远程注册表。我看到三个配置单元:_CLASSES_ROOT,_LOCAL_MACHINE和 _USERS。我可以打开除HKEY_LOCAL_MACHINE以外的所有内容。当我尝试扩展那个时, 我收到一条简单的错误消息,告诉我几乎什么都没有。 所以我很确定我''正在遇到某种权限问题。 这是一个开发服务器,但我还是不想过多地瞎逛 而不知道我是什么我在做。通过终端服务,我向HKEY_LOCAL_MACHINE和一些子键添加了LOCAL SERVICE 。那没有用。我还在Local Security Polcy中找到了两个有趣的条目:远程访问的注册表 路径和远程可访问的注册表路径和子路径。我并没有把这些东西弄得很糟糕,但我确实注意到任何一个 条目都没有蜂巢,而且它没有看起来像我可以看到的所有路径连接 远程通过regedit在这些列表中(但我可能是错的)。 那么'是什么'远程访问这些密钥的神奇公式?还有一些 他们默认绑定了吗?我不认为这里的任何人明确决定 使远程无法访问local_machine hive ... 这里有一些细节: 我的机器:Windows 2000专业版 远程机器:Windows 2003 Server 我是两台机器上的管理员... 只是为了好玩,这里是一个代码示例: public static RegistryKey GetKey(RegistryHive hive,string key,string server) { RegistryKey parentKey; RegistryKey returnKey = null; if(server == null || server.Length == 0) { server = string.Empty; } parentKey = RegistryKey.OpenRemoteBaseKey(hive,server); if(parentKey!= null) { try { //下面的线路 // System.SecurityException returnKey = parentKey.OpenSubKey(key,true); } catch (异常例外) { //处理异常! returnKey = null; } } 返回returnKey; } I''m attempting some remote registry manipulation via C#. I''ve written a testapp to simply grab a specified key from a specified hive on a specifiedmachine. The call to OpenSubKey is throwing System.SecurityException. Also of note: Sitting at my local box, I can open regedit and connect to theremote registry. I see three hives: _CLASSES_ROOT, _LOCAL_MACHINE, and_USERS. I can open all but HKEY_LOCAL_MACHINE. When I try to expand that one,I get a simple error message that tells me almost nothing. So I''m fairly certain I''m running up against some kind of permissions issue.This is a dev server, but I still don''t want to go mucking around too muchwithout knowing what I''m doing. Via Terminal Services, I added LOCAL SERVICEto HKEY_LOCAL_MACHINE and a few sub keys. That didn''t help. I also found twointeresting entries in the Local Security Polcy: Remotely accessible registrypaths and Remotely accesible registry paths and sub-paths. I didn''t messaround with those much, but I did notice that there''s no hive on any of theentries, and it doesn''t LOOK like all of the paths I can see connectingremotely via regedit are in those lists (but I could be wrong). So what''s the magic formula for accessing these keys remotely? And are someof them tied down by default? I don''t think anyone here specifically decidedto make the local_machine hive inaccessible remotely... Here''s some details:My Machine: Windows 2000 ProfessionalRemote Machine: Windows 2003 ServerI''m an admin on both machines... Just for fun, here''s a code sample: public static RegistryKey GetKey(RegistryHive hive, string key, string server){RegistryKey parentKey;RegistryKey returnKey = null; if (server == null || server.Length == 0){server = string.Empty;} parentKey = RegistryKey.OpenRemoteBaseKey(hive, server);if (parentKey != null){try{// THE LINE BELOW THROWS//System.SecurityException returnKey = parentKey.OpenSubKey(key, true);}catch(Exception exception){// handle the exception!returnKey = null;} } return returnKey;} 推荐答案 你需要成为远程机器上的管理员才能工作。 Willy。 You need to be an admininistrator on the remote machine for this to work. Willy. 你需要成为这是远程机器上的管理员。 Willy。 You need to be an admininistrator on the remote machine for this to work. Willy. 你需要成为远程机器上的管理员才能工作。 Willy。 You need to be an admininistrator on the remote machine for this to work. Willy. 这篇关于HKEY_LOCAL_MACHINE注册表访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-24 17:47