[英]How block USB Ports in windows using vb.net
vb.net
编程中的新功能,正在开发实验性应用程序以阻止windows
计算机中的USB
端口,可以通过在regedit
编辑一些值来实现,因为编程中的新功能完全空白,因此不胜感激
Imports Microsoft.Win32
Function to disable/Block 禁用/阻止功能
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
Function to Enable/Unblock 启用/解锁功能
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
below is the solution which is working for 32 bit windows but not working 64 bit ... 以下是适用于32位窗口但不适用64位的解决方案...
//disable USB storage... //禁用USB存储设备...
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord);
//enable USB storage... //启用USB存储设备...
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 3, Microsoft.Win32.RegistryValueKind.DWord);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.