2019-9-25-如何让-USB-设备不显示安全删除硬件弹出选项

titleauthordateCreateTimecategories
如何让 USB 设备不显示安全删除硬件弹出选项
lindexi
2019-09-25 11:58:19 +0800
2019-09-25 11:22:23 +0800

插入一个 U 盘的时候,可以在右下角找到安全删除硬件图标,点击就可以删除此硬件。如果此时插入的是一个无线网卡,也就是 USB 无线 wifi 设备,此时如果逗比点了弹出 802.11 设备那么就不能再使用无线上网了 如果我是一个硬件供应商,如何让我的设备不会显示弹出安全删除硬件弹出选项

我不是做硬件的,对硬件懂的很少,以下是我找到的文档,如果有说错的,欢迎小伙伴告诉我

Using the USB Removable Capability for Device Container Grouping

可以找到这句话

The USB Removable capability allows the operating system to create a device container for legacy devices.

Overview of the Removable Device Capability可以知道一个 USB 设备是需要声明自己支持 Removable 的才可以在右下角使用安全删除硬件弹出选项

The removable device capability is a bit (Removable) that bus drivers set in the DEVICE_CAPABILITIES

Container IDs Generated from the Removable Device Capability 可以知道,在即插即用功能将会使用到这个功能,在设备插入的时候,通过发送 IRP_MN_QUERY_CAPABILITIES 获取到设备的返回信息,就可以知道这个设备支不支持移除

The Plug and Play manager uses the removable device capability to generate a container ID for all devnodes enumerated for the physical device. The bus driver reports the removable device capability in response to an IRP_MN_QUERY_CAPABILITIES request.

那么上面说的发送信息是什么,就从IRP_MN_QUERY_CAPABILITIES 可以知道,在硬件设备被枚举时,系统的 PnP 也就是即插即用功能将会发送 IRP_MN_QUERY_CAPABILITIES 信息给到硬件,此时硬件收到时将会回复 DEVICE_CAPABILITIES 信息

When a device is enumerated, but before the function and filter drivers are loaded for the device, the PnP manager sends an IRP_MN_QUERY_CAPABILITIES request to the parent bus driver for the device. The bus driver must set any relevant values in the DEVICE_CAPABILITIES structure and return it to the PnP manager.

硬件回复的消息请看 DEVICE_CAPABILITIES (wdm.h) 在 PnP 询问USB设备,此时USB设备返回 DEVICE_CAPABILITIES 里面可以设置 Removable 项说明此设备支持移除。也就是想要自己的 USB 设备不能被移除,那么就声明不支持移除

以下是 DEVICE_CAPABILITIES 定义

typedef struct _DEVICE_CAPABILITIES {
  USHORT             Size;
  USHORT             Version;
  ULONG              DeviceD1 : 1;
  ULONG              DeviceD2 : 1;
  ULONG              LockSupported : 1;
  ULONG              EjectSupported : 1;
  ULONG              Removable : 1;
  // 忽略不相关属性
} DEVICE_CAPABILITIES, *PDEVICE_CAPABILITIES;

对 Removable 属性的官方注释是如果设置为 True 那么将会显示弹出或移除设备

Removable

Specifies whether the device can be dynamically removed from its immediate parent. If Removable is set to TRUE, the device does not belong to the same physical object as its parent.

For example, if Removable is set to TRUE for a USB composite device inside a multifunction printer, the composite device does not belong to the physical object of its immediate parent, such as a USB hub inside a notebook PC.

In most cases the bus driver, not the function driver, should determine the value of the Removable parameter of the device. For USB devices, the USB hub driver sets the Removable parameter. It should not be modified by the function driver.

If Removable is set to TRUE, the device is displayed in the Unplug or Eject Hardware program, unless SurpriseRemovalOK is also set to TRUE.

从可移动设备功能生成的容器 Id 重写

在使用Windows 7系统时,'安全删除硬件'功能允许用户安全地从计算机中断开外部设备,例如USB驱动器或打印机等。若点击此选项设备无法正确弹出,通常可能是因为系统未能安全地停止使用该设备。解决这个问题,可以考虑以下几个方面: 参考资源链接:[windows7点击安全删除硬件弹出媒体无反应解决方法](https://wenku.csdn.net/doc/6412b5b7be7fbd1778d44231) 首先,确保没有程序正在访问该设备。关闭所有可能正在使用设备的应用程序。在任务栏右下角的通知区域,点击'安全删除硬件'图标,选择'停止设备',并确保弹出提示显示设备已成功停止。 其次,利用'任务管理器'检查是否有进程正在使用该设备。按下'Ctrl+Shift+Esc'打开任务管理器,切换到'进程'标签,查找与该设备相关的进程,结束这些进程后再尝试弹出设备。 如果以上步骤无效,可能是设备驱动或系统问题。建议检查设备驱动是否为最新版本,或尝试重新安装驱动。此外,确保系统的'快速启动'功能没有被禁用,因为某些情况下,这可能会影响设备安全删除功能。 对于遇到的特定问题,可以参考《windows7点击安全删除硬件弹出媒体无反应解决方法》这份资料,其中详细介绍了多种解决方案,包括系统设置的调整、驱动程序的更新、以及高级故障排除技术,帮助用户解决点击'安全删除硬件'后设备无法弹出的问题。 通过上述步骤,通常可以解决大多数在Windows 7中点击'安全删除硬件'后设备无法正常弹出的问题。如果问题依旧存在,建议查阅更多专业资料或联系专业技术支持进行进一步的诊断和处理。 参考资源链接:[windows7点击安全删除硬件弹出媒体无反应解决方法](https://wenku.csdn.net/doc/6412b5b7be7fbd1778d44231)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值