访问注册表项“HKEY_LOCAL_MACHINE \SYSTEM\currentcontrolset \services \ USBSTOR”被拒绝。 [英] Access to the registry key 'HKEY_LOCAL_MACHINE\SYSTEM\currentcontrolset\services\USBSTOR' is denied.

查看:943
本文介绍了访问注册表项“HKEY_LOCAL_MACHINE \SYSTEM\currentcontrolset \services \ USBSTOR”被拒绝。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试禁用或启用端口时出现此问题。当我使用我朋友的笔记本电脑时,它运作良好,但当我尝试使用我的笔记本电脑时,它会出现此错误。为什么会发生这种情况以及如何解决?谢谢^^



I got this problem while trying to disable or enable ports. It works well when Im using my friend's laptop but when I tried using my laptop, it give this error. Why was this happen and how to solve it? Thanks ^^

Private Sub DisableBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisableBtn.Click
        Microsoft.Win32.Registry.SetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord) 'this line gives error
        MessageBox.Show("Port are disable", "USB Disable", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Me.Hide()
        Login.Show()
    End Sub

    Private Sub EnableBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnableBtn.Click
        Microsoft.Win32.Registry.SetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 3, Microsoft.Win32.RegistryValueKind.DWord) 'this line gives error
        MessageBox.Show("Port are enable", "USB Enable", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Me.Hide()
        Login.Show()
    End Sub





我的尝试:



我试过编辑注册表,因为我从谷歌找到了一些'解决方案',但它仍然没有用。



What I have tried:

I have tried edit regedit as I found some 'solution' from google but it still didnt work.

推荐答案

如果您尝试写入HKEY_LOCAL_MACHINE上的任何内容,运行您的代码的帐户必须具有管理员权限。



要做你正在谈论的事情需要管理员权限。如果你试图以普通用户的身份做到这一点,那么你就做不到,但同样糟糕的是另一个普通用户可能会再次启用它。
If you try to write to anything on HKEY_LOCAL_MACHINE the account running your code MUST have administrator permissions.

To do the thing you're talking about requires admin permissions. If you tried to do it as a normal user, well, you can't, but just as bad is another plain old user could just enable it again.


这篇关于访问注册表项“HKEY_LOCAL_MACHINE \SYSTEM\currentcontrolset \services \ USBSTOR”被拒绝。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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