开发者

USB storage device SerialNumber from minifilter driver (from USB device descriptor)

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}
\??\USBS开发者_如何学CTOR#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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜