-
-
[求助]请问我如何获得磁盘上的分区信息?
-
发表于:
2014-8-7 08:51
3695
-
请问我如何获得磁盘上的分区信息?已知:\\\\.\\PHYSICALDRIVE2
HANDLE Device2 = CreateFile(
"\\\\.\\PHYSICALDRIVE2",
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_FLAG_NO_BUFFERING,
NULL
);
DWORD returned = 0;
PARTITION_INFORMATION pi = {0};
if(!DeviceIoControl(Device2,
IOCTL_DISK_GET_PARTITION_INFO,
NULL,
0,
&pi,
sizeof(pi),
&returned,
NULL))
{
printf("failure3\n");
}else
{
printf("ok pi.PartitionNumber = %d pi.PartitionLength.QuadPart = %x pi.PartitionLength.LowPart = %x pi.PartitionLength.u.LowPart = %x\n",pi.PartitionNumber,pi.PartitionLength.QuadPart,pi.PartitionLength.LowPart,pi.PartitionLength.u.LowPart);
}
以上得到的是磁盘信息,我想获得此磁盘上的分区信息,如在WinObj中显示的 \Device\HarddiskVolume10
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)