音量物理驱动器 [英] Volume to physical drive

查看:176
本文介绍了音量物理驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

QueryDosDevice(L"E:", DeviceName, MAX_PATH);

(E:是SD卡)

(E: is a SD card)

设备名称是\\设备\\ HarddiskVolume3

DeviceName is "\Device\HarddiskVolume3"

我如何转换它像\\\\。\\ PHYSICALDRIVE1

推荐答案

卷是由一个或多个分区,它驻留在磁盘上。因此,E:不一定映射到一个单独的磁盘系统(思软件RAID)

Volumes are made up of one or more partitions, which reside on disks. So, E: doesn't necessarily map to a single disk in the system (think software RAID).

您卷映射到在Win32中的PhysicalDrive名的方法是首先打开音量,然后发送IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS。这会给你拥有的每分区中的一个DISK_EXTENT进入该卷跨越的结构:

The way you map volumes to the PhysicalDrive names in Win32 is to first open the volume and then send IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS. This will give you a structure that has one DISK_EXTENT entry for every partition that the volume spans:

typedef struct _VOLUME_DISK_EXTENTS {
  DWORD       NumberOfDiskExtents;
  DISK_EXTENT Extents[ANYSIZE_ARRAY];
} VOLUME_DISK_EXTENTS, *PVOLUME_DISK_EXTENTS;

的程度在他们磁盘号:

The extents have a disk number in them:

typedef struct _DISK_EXTENT {
  DWORD         DiskNumber;
  LARGE_INTEGER StartingOffset;
  LARGE_INTEGER ExtentLength;
} DISK_EXTENT, *PDISK_EXTENT;

该DiskNumber是进入PhsyicalDriveX链接,所以你可以用的sprintf这个数字\\\\。\\ PhysicalDrive%D

The DiskNumber is what goes into the PhsyicalDriveX link, so you can just sprintf that number with "\\.\PhysicalDrive%d"

斯科特

这篇关于音量物理驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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