我使用Windows Portable Device API访问某些MTP设备。我想从设备中读取供应商扩展属性,它应该是这样的:
“microsoft.com/WPDNA”或“microsoft.com/MTPZ”
看起来这应该是一项非常简单的任务,但我无法弄明白。
我能够枚举设备上的对象并传输文件等,这已包含在WpdApiSample Application中。
我还发现this article我认为是我想要做的。但我不明白如何创建这些查询。
答案 0 :(得分:0)
Without getting into code, the short answer is to scan a range of PIDs for a given FormatID to see what kinds of data are in there. This is a debugging exercise, just for discovery purposes. I basically just write a loop: for example if I want to scan for the first 16 PIDs under the basic extended properties you'd use the WPD_PROPERTIES_MTP_VENDOR_EXTENDED_DEVICE_PROPS
as FormatID and then for PID change it on each iteration and scan values 0xD101
through 0xD10F
. You can usually tell from the output what may be contained in that PID location.
Once you know the PIDs for the pieces of data you want, you can write that into your code as part of your enumeration routine.