不能在注册表中写 [英] Not Able to write in registry

查看:140
本文介绍了不能在注册表中写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows 7上的注册表中进行写操作,但是由于存在安全原因,它无法显示在注册表中,这是一个例外.请帮助我解决这个问题.请通过代码向我建议一些解决方案.

在此先感谢

I am trying to write in registries on my windows seven but its in showing an exception that Its not able to write in registry due to security reasons. Please help me to get ride of this problem. Please suggest me some solution through code.

thanks in advance

推荐答案

看看文章
look at article Analog Digital Clock Screen Saver and App

see class RegistryWrapper


这取决于要写入的注册表部分.您可以写入HKey_Current_User.
当您要写入HKey_Local_Machine时,将清单添加到您的应用程序中,并注明requestedExecutionLevel level="requireAdministrator".另请参见
http://msdn.microsoft.com/en-us/library/bb756929.aspx [ ^ ].
但是,请再次考虑是否真的有必要将数据写入注册表的该部分.通常,%programdata%\Company Name\Product Name中的配置文件更合适.
It depends on the part of the registry you want to write to. You can write into HKey_Current_User.
When you want to write into HKey_Local_Machine, add a manifest to your application, stating requestedExecutionLevel level="requireAdministrator". See also http://msdn.microsoft.com/en-us/library/bb756929.aspx[^].
But think again whether it is really necessary to write data to that part of the registry. Often, a configuration file in %programdata%\Company Name\Product Name is more appriopriate.


您好,

我在使用我的方法之前先给它赋予适当的权限:

Hello,

I use this before my methods to give that method proper permissions:

[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]



希望这会有所帮助.



Hope this helps.


这篇关于不能在注册表中写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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