来自微型过滤器驱动程序的 USB 存储设备序列号(来自 USB 设备描述符)
我想使用 此处唯一的区别是我在内核模式下执行此操作。
我使用:
status = IoGetDeviceInterfaces(
&GUID_DEVINTERFACE_DISK,
NULL,
0,
&SymbolicLinkList
);
枚举可能的接口(示例结果):
\??\SCSI#Disk&Ven_VMware_&Prod_VMware_Virtual_S&Rev_1.0#4&5fcaafc&0&000#{53f56307 -b6bf-11d0-94f2-00a0c91efb8b}
\??\USBSTOR#Disk&Ven_Kingston&Prod_DataTraveler_C10&Rev_1.00#001D92AD7568F030E3CC 0AFC&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
\??\USBSTOR#Disk&Ven_USB_2.0&Prod_Flash_Disk&Rev_1100#AA04012700007777&0#{53f5630 7-b6bf-11d0-94f2-00a0c91efb8b}
我想通过 IOCTL_STORAGE_GET_DEVICE_NUMBER 找到其中哪一个是我的卷的接口。
我尝试了 ZwCreateFile & ZwDeviceIoControlFile 但 ZwCreateFile 返回 STATUS_OBJECT_NAME_INVALID。
如何将 IOCTLS 发送到这些接口?在用户模式下一切正常,但在内核模式下却失败了!
I want to extract a USB storage device serial number from inside a minifilter filesystem driver, inside the InstanceSetup callback using the technique described here the only difference is that I do it in kernel-mode.
I use:
status = IoGetDeviceInterfaces(
&GUID_DEVINTERFACE_DISK,
NULL,
0,
&SymbolicLinkList
);
to enumerate over possible interfaces (example result):
\??\SCSI#Disk&Ven_VMware_&Prod_VMware_Virtual_S&Rev_1.0#4&5fcaafc&0&000#{53f56307 -b6bf-11d0-94f2-00a0c91efb8b}
\??\USBSTOR#Disk&Ven_Kingston&Prod_DataTraveler_C10&Rev_1.00#001D92AD7568F030E3CC 0AFC&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
\??\USBSTOR#Disk&Ven_USB_2.0&Prod_Flash_Disk&Rev_1100#AA04012700007777&0#{53f5630 7-b6bf-11d0-94f2-00a0c91efb8b}
and I want to find which one of them is the interface of my volume by means of IOCTL_STORAGE_GET_DEVICE_NUMBER.
I tried ZwCreateFile & ZwDeviceIoControlFile but ZwCreateFile returns a STATUS_OBJECT_NAME_INVALID.
How can I send IOCTLS to these interfaces? In user-mode everything is OK but in kernel mode it fails!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该将设备名称中的 \??\ 更改为 \DosDevices\。它应该可以解决你的问题。
You should change \??\ to \DosDevices\ in the device names. It should solve your problem.
我通过将计算委托给用户模式服务并通过端口进行通信来解决这个棘手的问题。蹩脚但确实有用。
I solved the pesky issue by delegating the computing to a user-mode service and talking through a port. Lame but really useful.