我是vb.net
编程的新手,正在开发一个实验性应用程序来阻止USB
个计算机中的windows
端口,可以通过编辑regedit
中的某些值来实现编程新我完全空白,任何帮助将非常感激
答案 0 :(得分:1)
Imports Microsoft.Win32
禁用/阻止
的功能Private Sub functionToBlock()
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True)
regKey.SetValue("Start", 4) //' 4(To disable the ports)
End Sub
启用/取消阻止功能
Private Sub functionToUnblock()
Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True)
regKey.SetValue("Start", 3) //' 3(To enable the ports)
End Sub
答案 1 :(得分:0)
下面的解决方案适用于32位窗口但不能正常工作64位...
//禁用USB存储......
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord);
//启用USB存储......
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 3, Microsoft.Win32.RegistryValueKind.DWord);