问题描述
我已经使用WPD API已有一段时间了,而且似乎遇到一个又一个问题.
一旦我解决了一个问题,就会弹出其他问题.但是,嘿,这就是生活.
我一直在尝试确定WPD设备是存储设备,电话还是其他设备.
事实证明,诸如iPhone之类的设备未设置为识别为电话,而是根据WPD_DEVICE_TYPE
识别为通用设备.
但是,它作为存储设备呈现给Windows.
在连接外部硬盘驱动器,SD存储卡读取器和其他更常规的存储设备时,它们也被WPD API识别,但是为什么在Windows中也可以获得专用的挂载点. >
如果我连接一个外部硬盘驱动器,它将有一个功能类别对象,并且该对象的值将是该驱动器的路径,例如E:
.
好.太好了!
所以我的问题是:如果WPD设备具有挂载点,我该如何读取?确定功能对象表明它有一个,但是是否有可能存在指示安装点可用的指示性值?
检查设备ID,以下是它们之间的区别的示例:
\\?\ swd#wpdbusenum #_ ?? _ usbstor#disk& ven_usb& prod_flash_disk& rev_1100#aa04012700007404& 0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}#{6ac27f878-a4915
vs.
USBSTOR \ DISK& VEN_USB& PROD_FLASH_DISK& REV_1100 \ AA04012700007404& 0
上面的是从PortableDeviceManagerClass(创建PortableDevice对象的第一步)收集的ID,下面的是我刚刚从设备管理器中读取的ID,但是使用以下解决方案之一可以很容易地检索到它:
如何我如何在Windows 10 Universal中获得设备的唯一标识符?
https://sourceforge.net/projects/sharpdevelop/files/SharpUSBLib/
I've worked with WPD API for a while now, and I seem to run in to problem after problem.
Once I fix one problem, something else pops up. But hey, that's life.
I've been trying to determine if a WPD device is a storage device or a phone or whatever.
Turns out, devices such as iPhone are not set to be recognized as a phone, but instead as a generic device in terms of WPD_DEVICE_TYPE
.
But, it is presented to Windows as a storage device.
When connecting external harddrives, SD memory card readers and other more conventional storage devices, they are recognized by the WPD API as well, but ehy that also get a dedicated mount point in Windows.
If I connect an external harddrive, it will have one functional category object, and the value of that object will be the path of that drive, say E:
.
Nice. Great!
So my question is: How can I somehow read if the WPD device has a mountpoint?Sure the functional object indicates that it has one, but is it possible that there could be an indicational value which states that a mount point is available?
Check the device Ids, here's an example how they differ:
\\?\swd#wpdbusenum#_??_usbstor#disk&ven_usb&prod_flash_disk&rev_1100#aa04012700007404&0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}#{6ac27878-a6fa-4155-ba85-f98f491d4f33
vs.
USBSTOR\DISK&VEN_USB&PROD_FLASH_DISK&REV_1100\AA04012700007404&0
The upper one is the Id gathered from PortableDeviceManagerClass (first step to create an PortableDevice object), the lower one I've just read from the Device Manager, but it should be easily retrievable with one of these solutions:
How do I get a Unique Identifier for a Device within Windows 10 Universal?
https://sourceforge.net/projects/sharpdevelop/files/SharpUSBLib/
这篇关于检索WPD设备的安装点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!