WinAPI 调用访问没有驱动器号的 USB 存储设备? [英] WinAPI calls to access USB storage which has no drive letter?

查看:34
本文介绍了WinAPI 调用访问没有驱动器号的 USB 存储设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,有些 USB 存储设备不会在 Windows 中注册为常规驱动器,因为它们甚至没有被分配驱动器号.因此,我显然无法使用标准文件操作 C API 访问它们.

I've noticed, that some USB storage devices don't register in Windows as regular drives, in that they don't even get assigned a drive letter. Therefore, I can't apparently access them using the standard file operations C API.

我可以使用哪些 WinAPI 调用在那些奇怪的设备上执行一些正常的文件操作 - 所以:

What are the WinAPI calls I can use to do some normal file operations on those strange devices - so:

  • 查找/枚举这些设备,
  • 浏览设备上的文件/目录树并获取一些文件统计信息(大小、修改日期等),
  • 读/写文件内容,
  • 创建/删除文件/目录?

此外,已知/调用这些类型的设备/协议的通用关键字是什么?

Also, what are the general keywords by which those kinds devices/protocol are known/called?

推荐答案

如果您谈论的是移动设备,它们看起来像已安装的卷但没有任何已安装的点,那么它们被称为 Windows 便携式设备并且它们不是安装卷.

If you're talking about mobile devices that appears like mounted volumes but without any mounted points, well they are called Windows Portable Devices and they are not mounted volumes.

Windows 不直接访问文件系统,它仅通过媒体传输协议(MTP) 或 图片传输协议(PTP) 并创建一个 shell 命名空间扩展 向用户呈现一个虚拟文件夹.

Windows doesn't access the file system directly, it only communicates with them through the Media Transfer Protocol (MTP) or Picture Transfert Protocol (PTP) and creates a shell namespace extension to present a virtual folder to the user.

如果您想与这些类型的设备进行通信,那么您很可能希望使用 WPD API.

If you want to communicate with these kind of devices, then you most probably want to use the WPD API.

这篇关于WinAPI 调用访问没有驱动器号的 USB 存储设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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