如何使用 .Net 直接读取磁盘? [英] How do I read a disk directly with .Net?
问题描述
是否可以直接使用 .Net 读取磁盘?直接我的意思是通过绕过文件系统的设备.我想我会通过以某种方式打开设备来解决这个问题,例如DeviceIdeIdeDeviceP2T0L0-1".
Is is possible to read a disk directly with .Net? By directly I mean via the device bypassing the file system. I think I would go about this by opening the device some way "DeviceIdeIdeDeviceP2T0L0-1" for example.
如果我无法使用 .NET api 打开设备,那么知道使用哪个 Win32 API 会有所帮助.
If I can't open the device with a .NET api knowing which Win32 API to use would be helpful.
推荐答案
CreateFile 支持直接磁盘访问.阅读物理磁盘和卷"下的说明.您应该能够 P/Invoke 调用.
CreateFile has support for direct disk access. Read the notes under "Physical Disks and Volumes". You should be able to P/Invoke the call.
请注意,Vista 和 Server 2008 有严格限制这一点.
Note that Vista and Server 2008 have severely restricted this.
这篇关于如何使用 .Net 直接读取磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!