如何找到文件/目录所在的物理驱动器。我想比较 2 个文件,如果它们位于两个不同的驱动器上,那么我可以通过同时读取两个文件来加快比较速度。
问候
最佳答案
这可能需要 P/Invoke。
Way to know if two partitions are in one physical hard disk without WMI?
来自上面的链接:
The Win32 function you'll need is called DeviceIoControl(). The API documentation can be found at http://msdn.microsoft.com/en-us/library/aa363216(VS.85).aspx. Call DeviceIoControl() with the control code IOCTL_STORAGE_GET_DEVICE_NUMBER and you'll get the physical disk drive for the given partition device handle. The device handle for the partition can be retrieved using CreateFile() API.
关于c# - 确定文件在哪个物理硬盘上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5207641/