使用 Windows 原始访问 API 直接访问 USB 驱动器
在USB物理驱动器的末尾,我想使用Windows原始访问API直接写入数据。我不想使用内核驱动程序来做到这一点。
据我所知,出于安全原因,Windows XP SP2 或 SP3(?) 阻止了 HDD 直接访问。我不确定 USB 驱动器是否如此。
请指导我如何到达那里。多谢。
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这取决于你想有多“直接”。
在大多数情况下,类似的东西
应该可以满足您的需求,尽管您可能需要
DeviceIoControl
和IOCTL_USB_USER_REQUEST
和USBUSER_PASS_THRU
IOCTL_SCSI_PASS_THROUGH_DIRECT
或
IOCTL_ATA_PASS_THROUGH_DIRECT
如果您正在做一些非常高级的事情。
PS:正如其他人提到的,这应该在 StackOverflow 上。
It depends on how "direct" you want to be.
Something like
should get you what you need in most situations, although you might need
DeviceIoControl
withIOCTL_USB_USER_REQUEST
withUSBUSER_PASS_THRU
IOCTL_SCSI_PASS_THROUGH_DIRECT
or
IOCTL_ATA_PASS_THROUGH_DIRECT
if you're doing something really advanced.
P.S.: This should be on StackOverflow, as other people have mentioned.
投票决定迁移到 Stack Overflow。我认为无论如何,使用通过 USB 连接的外部硬盘不会改变任何东西,因为它仍然显示为 Windows 的普通磁盘。
当您说“原始访问 API”时,您是指列出的 CreateFile、WriteFile 等函数 这里?因为这些函数应该能够从普通的 Win32 应用程序中调用。或者您想要直接访问磁盘本身,而不需要中间的文件系统层? (部分用户应用如HxD可以直接打开磁盘进行读取/写作-谨慎使用)
Voted to move to Stack Overflow. I think regardless, using an external HDD connected by USB won't change anything, as it still appears as a normal disk to windows.
When you say "raw access API", do you mean functions like CreateFile, WriteFile etc as listed here? Because those functions should be able to be called from normal Win32 apps. Or do you want direct access to the disk itself, with no filesystem layer in between? (Some user apps such as HxD can directly open disks for reading/writing - use with caution)