检索 WPD 设备的挂载点 [英] Retrieve mount point of WPD device

查看:24
本文介绍了检索 WPD 设备的挂载点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 WPD API 一段时间了,我似乎遇到了一个又一个问题.

一旦我解决了一个问题,就会出现其他问题.但是,嘿,这就是生活.

我一直在尝试确定 WPD 设备是存储设备还是手机或其他设备.

事实证明,iPhone 等设备并未设置为被识别为手机,而是根据 WPD_DEVICE_TYPE 设置为通用设备.

但是,它作为存储设备呈现给 Windows.

在连接外部硬盘驱动器、SD 存储卡读卡器和其他更传统的存储设备时,它们也会被 WPD API 识别,但它们也会在 Windows 中获得一个专用的挂载点.>

如果我连接一个外部硬盘驱动器,它将有一个功能类别对象,该对象的值将是该驱动器的路径,例如 E:.

不错.太棒了!

所以我的问题是:如果 WPD 设备有安装点,我该如何读取?确定功能对象表明它有一个,但是否可能有一个指示值表明安装点可用?

解决方案

检查设备 ID,以下是它们之间的区别示例:

\\?\ SWD#wpdbusenum #_ ?? _ USBSTOR#磁盘&安培; ven_usb&安培; prod_flash_disk&安培; rev_1100#aa04012700007404&安培; 0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}#{6ac27878-a6fa-4155-BA85-f98f491d4f33

对比

USBSTOR\DISK&VEN_USB&PROD_FLASH_DISK&REV_1100\AA04012700007404&0

上部是从 PortableDeviceManagerClass 收集的 Id(创建 PortableDevice 对象的第一步),下部是我刚刚从设备管理器中读取的,但应该可以使用以下解决方案之一轻松检索:

如何如何获得 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 设备的挂载点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆