Retrieve mount point of WPD device

做~自己de王妃 提交于 2019-12-11 03:15:09

问题


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?


回答1:


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/

|improve this answer

来源:https://stackoverflow.com/questions/29194124/retrieve-mount-point-of-wpd-device

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!