用c#进行简单注册表操作,实现屏蔽ctrl+alt+del,关机,注销,锁定计算机,添加开机启动项。
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
private void AlterRegister()
{
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser;
//ctrl+alt+del
Microsoft.Win32.RegistryKey key1 = key.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System");
key1.SetValue("DisableTaskMgr", 1, Microsoft.Win32.RegistryValueKind.DWord);
//关机
key1 = key.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer");
key1.SetValue("NoClose", 1, Microsoft.Win32.RegistryValueKind.DWord);
//注销
key1 = key.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer");
key1.SetValue("NoLogOff", 1, Microsoft.Win32.RegistryValueKind.DWord);
//锁定计算机
key1 = key.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System");
key1.SetValue("DisableLockWorkstation", 1, Microsoft.Win32.RegistryValueKind.DWord);
//添加开机启动项
key1 = key.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
key1.SetValue("display(显卡)", Application.ExecutablePath, Microsoft.Win32.RegistryValueKind.String);
}