简体   繁体   English

如何使用vb.net阻止Windows中的USB端口

[英]How block USB Ports in windows using vb.net

vb.net编程中的新功能,正在开发实验性应用程序以阻止windows计算机中的USB端口,可以通过在regedit编辑一些值来实现,因为编程中的新功能完全空白,因此不胜感激

  • first import the following 首先导入以下

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.

相关问题 使用 vb.net,挂钩指定的 USB 键盘,在所需控件中接收字符并将接收到的字符阻止到窗口的其余部分 - Using vb.net, Hooking specified usb keyboard, receive chars in desired control and block received chars to rest of windows 使用 Windows 服务和 Vb.Net 检测 USB 驱动器的插入和移除 - Detecting USB drive insertion and removal using windows service and Vb.Net 什么是VB.NET相当于C#的'using'块 - What is the VB.NET equivalent to C#'s 'using' block 如何使用VB.NET读取站点地图 - How to read a sitemap using VB.NET 范围以及如何使用VB.Net缩小范围 - Scope and how to narrow it using VB.Net 如何使用 vb.net 计算时间 - how to calculate time using vb.net 如何使用C#/ Vb.Net在Windows Server 2003及更高版本上“删除-保护”文件或文件夹? - How to **delete-protect** a file or folder on Windows Server 2003 and onwards using C#/Vb.Net? 如何在VB.Net中使用Windows窗体应用程序实现计划程序 - How to implement scheduler with Windows Form Application in VB.Net 如何在 vb.net windows 应用程序中打印 html 页 - How to Print html page in vb.net windows application VB.NET Windows窗体中的AppSettings如何工作? - How does AppSettings in VB.NET windows Forms work?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM