使用 Windows 原始访问 API 直接访问 USB 驱动器 [英] Use the Windows raw access APIs to directly access the USB drive

查看:45
本文介绍了使用 Windows 原始访问 API 直接访问 USB 驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在USB物理驱动器的末尾,我想直接使用windows raw access API写入数据.我不想使用内核驱动程序来做到这一点.

At the end of USB physical drive, I want to write data directly using windows raw access API. I don't want to use kernel driver to do that.

据我所知,出于安全原因,Windows xp sp2 或 sp3(?) 阻止了 HDD 直接访问.我不确定 USB 驱动器是否如此.

As far as I know, HDD direct access is blocked from windows xp sp2 or sp3(?) for security reason. I'm not sure this is true for USB drive.

请指导我如何到达那里.非常感谢.

Please guide me how to get there. Thanks a lot.

推荐答案

这取决于你想要的直接"程度.

It depends on how "direct" you want to be.

类似的东西

HANDLE hDrive = CreateFile("\\\\.\\F:", ...);
ReadFile(hDrive, ...);

在大多数情况下应该可以满足您的需求,尽管您可能需要 DeviceIoControl

should get you what you need in most situations, although you might need DeviceIoControl with

IOCTL_SCSI_PASS_THROUGH_DIRECT

IOCTL_ATA_PASS_THROUGH_DIRECT

如果你正在做一些非常高级的事情.

if you're doing something really advanced.

P.S.:正如其他人提到的,这应该在 StackOverflow 上.

P.S.: This should be on StackOverflow, as other people have mentioned.

这篇关于使用 Windows 原始访问 API 直接访问 USB 驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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