Retrieve mount point of WPD device

2019-07-21 19:13发布

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条回答
Root(大扎)
2楼-- · 2019-07-21 19:40

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.

查看更多
登录 后发表回答
相关问题
查看全部
相关文章
查看全部
收藏的人(5)