设置注册表权限
来源:互联网 发布:数据分析招聘网 编辑:程序博客网 时间:2024/05/18 07:42
using Microsoft.Win32;
using System.Security.AccessControl;
using System.Security.Principal;
public static string Get_Reg_Val(string GroupName, string ValueName, string DefaultVal)
{try
{
string sValue = "";
try
{
sValue = (Registry.GetValue(strRegFullPath + GroupName,
ValueName, "")).ToString();
if (sValue == "")
throw new Exception();
}
catch(Exception)
{
RegistrySecurity userSecurity = new RegistrySecurity();
RegistryAccessRule userRule = new RegistryAccessRule("Everyone",
RegistryRights.FullControl,
AccessControlType.Allow);
userSecurity.AddAccessRule(userRule);
//if Registry key not set, create key and set default value
RegistryKey newKeyPass = Registry.LocalMachine.CreateSubKey(strRegLMPath + GroupName,
RegistryKeyPermissionCheck.ReadWriteSubTree,
userSecurity);
newKeyPass.SetValue(ValueName, DefaultVal);
sValue = DefaultVal;
}
return sValue;
}
catch (Exception ex)
{
return ex.Message;
}
}
阅读全文
0 0
- 设置注册表权限
- 一个注册表权限设置程序例子
- SetAcl2.3.0注册表、文件权限设置工具
- 一个注册表权限设置程序例子 .
- VC注册表操作之设置权限
- 木马、病毒防范之注册表权限设置法
- 用setacl通过命令行来设置注册表的权限
- 编程设置修改文件和注册表权限最新完整例子
- 注册表设置
- 修改注册表权限等
- c# 注册表权限不足
- win7权限注册表
- 修改注册表权限。。
- 修改注册表权限
- subinacl 处理注册表权限
- 一招搞定几万种木马----→ 注册表权限设置.更新8.6
- 一招搞定几万种木马----→ 注册表权限设置.更新8.6
- C#设置注册表权限失败,修改应用程序以管理员身份执行
- 费曼技巧——高速学习的方法
- 【Github教程】史上最全github使用方法:github入门到精通
- Windows环境下采用eclipse连接虚拟机中的Hadoop伪分布式集群
- Java数据结构解析
- 数据库优化知识
- 设置注册表权限
- 简述 ascii、unicode、utf-8、gbk 的关系
- 程序员如何成为自由职业者?
- Linus实验楼笔记——第11节:简单的文本处理
- Python 初级学习笔记
- ubutun 16.04安装并配置node+mongodb服务
- Hadoop 2.7.4 源代码编译
- Java学习-简单爬虫系统
- PHP类和对象